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>
DEVICE_DTS := mt7622-bananapi-bpi-r64
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
- ARTIFACTS := sdcard.img.gz
+ ARTIFACTS := sdcard.img.gz snand-preloader.bin snand-bl31-uboot.fip
IMAGES := sysupgrade.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 |\
pad-to 512k | bl2 sdmmc-2ddr |\
pad-to 2048k | bl31-uboot bananapi_bpi-r64-sdmmc |\
pad-to 38912k | mt7622-gpt emmc |\
pad-to 39424k | bl2 emmc-2ddr |\
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
KERNEL := kernel-bin | gzip
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
bananapi,bpi-r64)
export_bootdevice
export_partdevice rootdev 0
- local fitpart=$(get_partition_by_name $rootdev "production")
- [ "$fitpart" ] || return 1
- dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null
- blockdev --rereadpt /dev/$rootdev
- get_image "$1" | dd of=/dev/$fitpart
- blockdev --rereadpt /dev/$rootdev
- local datapart=$(get_partition_by_name $rootdev "rootfs_data")
- [ "$datapart" ] || return 0
- dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null
- echo $datapart > /tmp/sysupgrade.datapart
+ case "$rootdev" in
+ mmc*)
+ local fitpart=$(get_partition_by_name $rootdev "production")
+ [ "$fitpart" ] || return 1
+ dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null
+ blockdev --rereadpt /dev/$rootdev
+ get_image "$1" | dd of=/dev/$fitpart
+ blockdev --rereadpt /dev/$rootdev
+ local datapart=$(get_partition_by_name $rootdev "rootfs_data")
+ [ "$datapart" ] || return 0
+ dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null
+ echo $datapart > /tmp/sysupgrade.datapart
+ ;;
+ *)
+ CI_KERNPART="fit"
+ nand_do_upgrade "$1"
+ ;;
+ esac
;;
buffalo,wsr-2533dhp2)
local magic="$(get_magic_long "$1")"
platform_copy_config() {
case "$(board_name)" in
bananapi,bpi-r64)
- platform_copy_config_mmc
+ export_bootdevice
+ export_partdevice rootdev 0
+ if echo $rootdev | grep -q mmc; then
+ platform_copy_config_mmc
+ fi
;;
esac
}
--- /dev/null
+--- 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>;
++ };
++ };
+ };
+ };
+
--- /dev/null
+--- 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>;
++ };
++ };
+ };
+ };
+