aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorOskari Lemmela <oskari@lemmela.net>2021-04-10 20:16:08 +0300
committerDaniel Golle <daniel@makrotopia.org>2021-04-11 20:19:44 +0100
commit3c23a7c03dc9821d25f3fd2a8ab17a4c460c3584 (patch)
treec160c7a241ebb5f5fb9f1c21f78a86dc798667f6 /target
parent987562bad2d8d48297829070bfdbaf0a0a423a27 (diff)
downloadupstream-3c23a7c03dc9821d25f3fd2a8ab17a4c460c3584.tar.gz
upstream-3c23a7c03dc9821d25f3fd2a8ab17a4c460c3584.tar.bz2
upstream-3c23a7c03dc9821d25f3fd2a8ab17a4c460c3584.zip
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>
Diffstat (limited to 'target')
-rw-r--r--target/linux/mediatek/image/mt7622.mk6
-rwxr-xr-xtarget/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh34
-rw-r--r--target/linux/mediatek/patches-5.10/115-dts-bpi64-add-snand-support.patch57
-rw-r--r--target/linux/mediatek/patches-5.4/115-dts-bpi64-add-snand-support.patch57
4 files changed, 142 insertions, 12 deletions
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index 3901800bcb..58dc578d39 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -76,9 +76,11 @@ define Device/bananapi_bpi-r64
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 |\
@@ -86,6 +88,8 @@ define Device/bananapi_bpi-r64
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
diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
index 2c1460650f..cdae06e630 100755
--- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
@@ -10,16 +10,24 @@ platform_do_upgrade() {
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")"
@@ -87,7 +95,11 @@ platform_copy_config_mmc() {
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
}
diff --git a/target/linux/mediatek/patches-5.10/115-dts-bpi64-add-snand-support.patch b/target/linux/mediatek/patches-5.10/115-dts-bpi64-add-snand-support.patch
new file mode 100644
index 0000000000..aa0e347115
--- /dev/null
+++ b/target/linux/mediatek/patches-5.10/115-dts-bpi64-add-snand-support.patch
@@ -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>;
++ };
++ };
+ };
+ };
+
diff --git a/target/linux/mediatek/patches-5.4/115-dts-bpi64-add-snand-support.patch b/target/linux/mediatek/patches-5.4/115-dts-bpi64-add-snand-support.patch
new file mode 100644
index 0000000000..aa0e347115
--- /dev/null
+++ b/target/linux/mediatek/patches-5.4/115-dts-bpi64-add-snand-support.patch
@@ -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>;
++ };
++ };
+ };
+ };
+