mediatek: mt7622: add spi-nand support for bananapi bpi-r64
Some of bpi-r64 boards have serial NAND attached to SPI bus. Add SD card image support for installing openwrt to it. Default to nand upgrade if root device is not mmc block device. Separate preloader and uboot images for snand are generated. Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
This commit is contained in:
parent
987562bad2
commit
3c23a7c03d
@ -76,9 +76,11 @@ define Device/bananapi_bpi-r64
|
|||||||
DEVICE_DTS := mt7622-bananapi-bpi-r64
|
DEVICE_DTS := mt7622-bananapi-bpi-r64
|
||||||
DEVICE_DTS_OVERLAY := mt7622-bananapi-bpi-r64-pcie1 mt7622-bananapi-bpi-r64-sata
|
DEVICE_DTS_OVERLAY := mt7622-bananapi-bpi-r64-pcie1 mt7622-bananapi-bpi-r64-sata
|
||||||
DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 e2fsprogs mkf2fs f2fsck
|
DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 e2fsprogs mkf2fs f2fsck
|
||||||
ARTIFACTS := sdcard.img.gz
|
ARTIFACTS := sdcard.img.gz snand-preloader.bin snand-bl31-uboot.fip
|
||||||
IMAGES := sysupgrade.itb
|
IMAGES := sysupgrade.itb
|
||||||
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
||||||
|
ARTIFACT/snand-preloader.bin := bl2 snand-2ddr
|
||||||
|
ARTIFACT/snand-bl31-uboot.fip := bl31-uboot bananapi_bpi-r64-snand
|
||||||
ARTIFACT/sdcard.img.gz := mt7622-gpt sdmmc |\
|
ARTIFACT/sdcard.img.gz := mt7622-gpt sdmmc |\
|
||||||
pad-to 512k | bl2 sdmmc-2ddr |\
|
pad-to 512k | bl2 sdmmc-2ddr |\
|
||||||
pad-to 2048k | bl31-uboot bananapi_bpi-r64-sdmmc |\
|
pad-to 2048k | bl31-uboot bananapi_bpi-r64-sdmmc |\
|
||||||
@ -86,6 +88,8 @@ define Device/bananapi_bpi-r64
|
|||||||
pad-to 38912k | mt7622-gpt emmc |\
|
pad-to 38912k | mt7622-gpt emmc |\
|
||||||
pad-to 39424k | bl2 emmc-2ddr |\
|
pad-to 39424k | bl2 emmc-2ddr |\
|
||||||
pad-to 40960k | bl31-uboot bananapi_bpi-r64-emmc |\
|
pad-to 40960k | bl31-uboot bananapi_bpi-r64-emmc |\
|
||||||
|
pad-to 43008k | bl2 snand-2ddr |\
|
||||||
|
pad-to 43520k | bl31-uboot bananapi_bpi-r64-snand |\
|
||||||
pad-to 46080k | append-image squashfs-sysupgrade.itb | gzip
|
pad-to 46080k | append-image squashfs-sysupgrade.itb | gzip
|
||||||
KERNEL := kernel-bin | gzip
|
KERNEL := kernel-bin | gzip
|
||||||
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
|
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
|
||||||
|
@ -10,6 +10,8 @@ platform_do_upgrade() {
|
|||||||
bananapi,bpi-r64)
|
bananapi,bpi-r64)
|
||||||
export_bootdevice
|
export_bootdevice
|
||||||
export_partdevice rootdev 0
|
export_partdevice rootdev 0
|
||||||
|
case "$rootdev" in
|
||||||
|
mmc*)
|
||||||
local fitpart=$(get_partition_by_name $rootdev "production")
|
local fitpart=$(get_partition_by_name $rootdev "production")
|
||||||
[ "$fitpart" ] || return 1
|
[ "$fitpart" ] || return 1
|
||||||
dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null
|
dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null
|
||||||
@ -21,6 +23,12 @@ platform_do_upgrade() {
|
|||||||
dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null
|
dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null
|
||||||
echo $datapart > /tmp/sysupgrade.datapart
|
echo $datapart > /tmp/sysupgrade.datapart
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
CI_KERNPART="fit"
|
||||||
|
nand_do_upgrade "$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
buffalo,wsr-2533dhp2)
|
buffalo,wsr-2533dhp2)
|
||||||
local magic="$(get_magic_long "$1")"
|
local magic="$(get_magic_long "$1")"
|
||||||
|
|
||||||
@ -87,7 +95,11 @@ platform_copy_config_mmc() {
|
|||||||
platform_copy_config() {
|
platform_copy_config() {
|
||||||
case "$(board_name)" in
|
case "$(board_name)" in
|
||||||
bananapi,bpi-r64)
|
bananapi,bpi-r64)
|
||||||
|
export_bootdevice
|
||||||
|
export_partdevice rootdev 0
|
||||||
|
if echo $rootdev | grep -q mmc; then
|
||||||
platform_copy_config_mmc
|
platform_copy_config_mmc
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts 2021-03-13 13:46:37.057936814 +0200
|
||||||
|
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts 2021-03-13 13:49:26.957481217 +0200
|
||||||
|
@@ -114,7 +114,7 @@
|
||||||
|
};
|
||||||
|
|
||||||
|
&bch {
|
||||||
|
- status = "disabled";
|
||||||
|
+ status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&btif {
|
||||||
|
@@ -259,14 +259,40 @@
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
-&nor_flash {
|
||||||
|
+&snfi {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
- pinctrl-0 = <&spi_nor_pins>;
|
||||||
|
- status = "disabled";
|
||||||
|
+ pinctrl-0 = <&serial_nand_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
|
||||||
|
- flash@0 {
|
||||||
|
- compatible = "jedec,spi-nor";
|
||||||
|
+ snand: spi_nand@0 {
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <1>;
|
||||||
|
+ compatible = "spi-nand";
|
||||||
|
+ spi-max-frequency = <104000000>;
|
||||||
|
reg = <0>;
|
||||||
|
+
|
||||||
|
+ partitions {
|
||||||
|
+ compatible = "fixed-partitions";
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <1>;
|
||||||
|
+
|
||||||
|
+ partition@0 {
|
||||||
|
+ label = "bl2";
|
||||||
|
+ reg = <0x0 0x80000>;
|
||||||
|
+ read-only;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ partition@80000 {
|
||||||
|
+ label = "fip";
|
||||||
|
+ reg = <0x80000 0x200000>;
|
||||||
|
+ read-only;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ partition@280000 {
|
||||||
|
+ label = "ubi";
|
||||||
|
+ reg = <0x280000 0x7d80000>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts 2021-03-13 13:46:37.057936814 +0200
|
||||||
|
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts 2021-03-13 13:49:26.957481217 +0200
|
||||||
|
@@ -114,7 +114,7 @@
|
||||||
|
};
|
||||||
|
|
||||||
|
&bch {
|
||||||
|
- status = "disabled";
|
||||||
|
+ status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&btif {
|
||||||
|
@@ -259,14 +259,40 @@
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
-&nor_flash {
|
||||||
|
+&snfi {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
- pinctrl-0 = <&spi_nor_pins>;
|
||||||
|
- status = "disabled";
|
||||||
|
+ pinctrl-0 = <&serial_nand_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
|
||||||
|
- flash@0 {
|
||||||
|
- compatible = "jedec,spi-nor";
|
||||||
|
+ snand: spi_nand@0 {
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <1>;
|
||||||
|
+ compatible = "spi-nand";
|
||||||
|
+ spi-max-frequency = <104000000>;
|
||||||
|
reg = <0>;
|
||||||
|
+
|
||||||
|
+ partitions {
|
||||||
|
+ compatible = "fixed-partitions";
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <1>;
|
||||||
|
+
|
||||||
|
+ partition@0 {
|
||||||
|
+ label = "bl2";
|
||||||
|
+ reg = <0x0 0x80000>;
|
||||||
|
+ read-only;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ partition@80000 {
|
||||||
|
+ label = "fip";
|
||||||
|
+ reg = <0x80000 0x200000>;
|
||||||
|
+ read-only;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ partition@280000 {
|
||||||
|
+ label = "ubi";
|
||||||
|
+ reg = <0x280000 0x7d80000>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user