From b99c93689d2d857a19043d7e44d869be91329bbd Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Sun, 3 Nov 2019 09:10:22 +0800 Subject: [PATCH] ramips: mt7621: update dts and old NAND driver to use sub node Signed-off-by: DENG Qingfang --- .../ramips/dts/mt7621_asus_rt-acx5p.dtsi | 87 +++++----- .../linux/ramips/dts/mt7621_hiwifi_hc5962.dts | 141 +++++++-------- .../dts/mt7621_mediatek_mt7621-eval-board.dts | 49 +++--- .../linux/ramips/dts/mt7621_netgear_r6220.dts | 77 +++++---- .../dts/mt7621_netgear_sercomm_chj.dtsi | 89 +++++----- .../linux/ramips/dts/mt7621_netis_wf-2881.dts | 57 ++++--- .../dts/mt7621_ubiquiti_edgerouterx.dtsi | 63 +++---- .../linux/ramips/dts/mt7621_xiaomi_mir3g.dts | 161 +++++++++--------- .../linux/ramips/dts/mt7621_xiaomi_mir3p.dts | 119 ++++++------- .../0039-mtd-add-mt7621-nand-support.patch | 2 +- 10 files changed, 436 insertions(+), 409 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi index 7e433d34d6..78c8dbbd48 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi +++ b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi @@ -72,48 +72,51 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0xe0000>; - read-only; - }; - - partition@e0000 { - label = "u-boot-env"; - reg = <0xe0000 0x100000>; - read-only; - }; - - factory: partition@1e0000 { - label = "factory"; - reg = <0x1e0000 0x100000>; - read-only; - }; - - factory2: partition@2e0000 { - label = "factory2"; - reg = <0x2e0000 0x100000>; - read-only; - }; - - partition@3e0000 { - label = "kernel"; - reg = <0x3e0000 0x400000>; - }; - - partition@7e0000 { - label = "ubi"; - reg = <0x7e0000 0x2e00000>; - }; - - partition@35e0000 { - label = "firmware2"; - reg = <0x35e0000 0x3200000>; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0xe0000>; + read-only; + }; + + partition@e0000 { + label = "u-boot-env"; + reg = <0xe0000 0x100000>; + read-only; + }; + + factory: partition@1e0000 { + label = "factory"; + reg = <0x1e0000 0x100000>; + read-only; + }; + + factory2: partition@2e0000 { + label = "factory2"; + reg = <0x2e0000 0x100000>; + read-only; + }; + + partition@3e0000 { + label = "kernel"; + reg = <0x3e0000 0x400000>; + }; + + partition@7e0000 { + label = "ubi"; + reg = <0x7e0000 0x2e00000>; + }; + + partition@35e0000 { + label = "firmware2"; + reg = <0x35e0000 0x3200000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts b/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts index ae6ddda394..1ce6a649d4 100644 --- a/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts +++ b/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts @@ -52,75 +52,78 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x80000>; - read-only; - }; - - partition@80000 { - label = "debug"; - reg = <0x80000 0x80000>; - read-only; - }; - - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - read-only; - }; - - partition@140000 { - label = "kernel"; - reg = <0x140000 0x200000>; - }; - - partition@340000 { - label = "ubi"; - reg = <0x340000 0x1E00000>; - }; - - partition@2140000 { - label = "hw_panic"; - reg = <0x2140000 0x80000>; - read-only; - }; - - partition@21c0000 { - label = "bdinfo"; - reg = <0x21c0000 0x80000>; - read-only; - }; - - partition@2240000 { - label = "backup"; - reg = <0x2240000 0x80000>; - read-only; - }; - - partition@22c0000 { - label = "overly"; - reg = <0x22c0000 0x1000000>; - }; - - partition@32c0000 { - label = "firmware_backup"; - reg = <0x32c0000 0x2000000>; - }; - - partition@52c0000 { - label = "oem"; - reg = <0x52c0000 0x200000>; - }; - - partition@54c0000 { - label = "opt"; - reg = <0x54c0000 0x2ac0000>; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "debug"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "kernel"; + reg = <0x140000 0x200000>; + }; + + partition@340000 { + label = "ubi"; + reg = <0x340000 0x1E00000>; + }; + + partition@2140000 { + label = "hw_panic"; + reg = <0x2140000 0x80000>; + read-only; + }; + + partition@21c0000 { + label = "bdinfo"; + reg = <0x21c0000 0x80000>; + read-only; + }; + + partition@2240000 { + label = "backup"; + reg = <0x2240000 0x80000>; + read-only; + }; + + partition@22c0000 { + label = "overly"; + reg = <0x22c0000 0x1000000>; + }; + + partition@32c0000 { + label = "firmware_backup"; + reg = <0x32c0000 0x2000000>; + }; + + partition@52c0000 { + label = "oem"; + reg = <0x52c0000 0x200000>; + }; + + partition@54c0000 { + label = "opt"; + reg = <0x54c0000 0x2ac0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts index 59ab9ab70e..4adfae7ecb 100644 --- a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts +++ b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts @@ -18,29 +18,32 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x00000 0x80000>; /* 64 KB */ - }; - - partition@80000 { - label = "uboot_env"; - reg = <0x80000 0x80000>; /* 64 KB */ - }; - - partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - }; - - partition@140000 { - label = "rootfs"; - reg = <0x140000 0xec0000>; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x80000>; /* 64 KB */ + }; + + partition@80000 { + label = "uboot_env"; + reg = <0x80000 0x80000>; /* 64 KB */ + }; + + partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "rootfs"; + reg = <0x140000 0xec0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netgear_r6220.dts b/target/linux/ramips/dts/mt7621_netgear_r6220.dts index 3a47fca22a..3d9335fe66 100644 --- a/target/linux/ramips/dts/mt7621_netgear_r6220.dts +++ b/target/linux/ramips/dts/mt7621_netgear_r6220.dts @@ -35,43 +35,46 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x100000>; - read-only; - }; - - partition@100000 { - label = "SC PID"; - reg = <0x100000 0x100000>; - read-only; - }; - - partition@200000 { - label = "kernel"; - reg = <0x200000 0x400000>; - }; - - partition@600000 { - label = "ubi"; - reg = <0x600000 0x1c00000>; - }; - - factory: partition@2e00000 { - label = "factory"; - reg = <0x2e00000 0x100000>; - read-only; - }; - - partition@4200000 { - label = "reserved"; - reg = <0x4200000 0x3c00000>; - read-only; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "SC PID"; + reg = <0x100000 0x100000>; + read-only; + }; + + partition@200000 { + label = "kernel"; + reg = <0x200000 0x400000>; + }; + + partition@600000 { + label = "ubi"; + reg = <0x600000 0x1c00000>; + }; + + factory: partition@2e00000 { + label = "factory"; + reg = <0x2e00000 0x100000>; + read-only; + }; + + partition@4200000 { + label = "reserved"; + reg = <0x4200000 0x3c00000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi b/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi index d15bb2f804..d8f891b6a3 100644 --- a/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi +++ b/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi @@ -116,49 +116,52 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x100000>; - read-only; - }; - - partition@100000 { - label = "SC PART_MAP"; - reg = <0x100000 0x100000>; - read-only; - }; - - partition@200000 { - label = "kernel"; - reg = <0x200000 0x400000>; - }; - - partition@600000 { - label = "ubi"; - reg = <0x600000 0x2800000>; - }; - - partition@2e00000 { - label = "reserved0"; - reg = <0x2e00000 0x1800000>; - read-only; - }; - - factory: partition@4600000 { - label = "factory"; - reg = <0x4600000 0x200000>; - read-only; - }; - - partition@4800000 { - label = "reserved1"; - reg = <0x4800000 0x3800000>; - read-only; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "SC PART_MAP"; + reg = <0x100000 0x100000>; + read-only; + }; + + partition@200000 { + label = "kernel"; + reg = <0x200000 0x400000>; + }; + + partition@600000 { + label = "ubi"; + reg = <0x600000 0x2800000>; + }; + + partition@2e00000 { + label = "reserved0"; + reg = <0x2e00000 0x1800000>; + read-only; + }; + + factory: partition@4600000 { + label = "factory"; + reg = <0x4600000 0x200000>; + read-only; + }; + + partition@4800000 { + label = "reserved1"; + reg = <0x4800000 0x3800000>; + read-only; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netis_wf-2881.dts b/target/linux/ramips/dts/mt7621_netis_wf-2881.dts index 51150d3d73..c5e696547d 100644 --- a/target/linux/ramips/dts/mt7621_netis_wf-2881.dts +++ b/target/linux/ramips/dts/mt7621_netis_wf-2881.dts @@ -55,33 +55,36 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x80000>; - read-only; - }; - - partition@80000 { - label = "config"; - reg = <0x80000 0x80000>; - read-only; - }; - - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - read-only; - }; - - partition@140000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x140000 0x7e40000>; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x140000 0x7e40000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_ubiquiti_edgerouterx.dtsi b/target/linux/ramips/dts/mt7621_ubiquiti_edgerouterx.dtsi index ddbb9b46b9..76c0517bff 100644 --- a/target/linux/ramips/dts/mt7621_ubiquiti_edgerouterx.dtsi +++ b/target/linux/ramips/dts/mt7621_ubiquiti_edgerouterx.dtsi @@ -36,41 +36,44 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x80000>; - read-only; - }; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@80000 { - label = "u-boot-env"; - reg = <0x80000 0x60000>; - read-only; - }; + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; - factory: partition@e0000 { - label = "factory"; - reg = <0xe0000 0x60000>; - }; + partition@80000 { + label = "u-boot-env"; + reg = <0x80000 0x60000>; + read-only; + }; - partition@140000 { - label = "kernel1"; - reg = <0x140000 0x300000>; - }; + factory: partition@e0000 { + label = "factory"; + reg = <0xe0000 0x60000>; + }; - partition@440000 { - label = "kernel2"; - reg = <0x440000 0x300000>; - }; + partition@140000 { + label = "kernel1"; + reg = <0x140000 0x300000>; + }; + + partition@440000 { + label = "kernel2"; + reg = <0x440000 0x300000>; + }; - partition@740000 { - label = "ubi"; - reg = <0x740000 0xf7c0000>; + partition@740000 { + label = "ubi"; + reg = <0x740000 0xf7c0000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts b/target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts index b9eb011122..a567ac2bc0 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts @@ -85,85 +85,88 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Bootloader"; - reg = <0x0 0x80000>; - read-only; - }; - - partition@80000 { - label = "Config"; - reg = <0x80000 0x40000>; - }; - - partition@c0000 { - label = "Bdata"; - reg = <0xc0000 0x40000>; - read-only; - }; - - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - read-only; - }; - - partition@140000 { - label = "crash"; - reg = <0x140000 0x40000>; - }; - - partition@180000 { - label = "crash_syslog"; - reg = <0x180000 0x40000>; - }; - - partition@1c0000 { - label = "reserved0"; - reg = <0x1c0000 0x40000>; - read-only; - }; - - /* uboot expects to find kernels at 0x200000 & 0x600000 - * referred to as system 1 & system 2 respectively. - * a kernel is considered suitable for handing control over - * if its linux magic number exists & uImage CRC are correct. - * If either of those conditions fail, a matching sys'n'_fail flag - * is set in uboot env & a restart performed in the hope that the - * alternate kernel is okay. - * if neither kernel checksums ok and both are marked failed, system 2 - * is booted anyway. - * - * Note uboot's tftp flash install writes the transferred - * image to both kernel partitions. - */ - - partition@200000 { - label = "kernel_stock"; - reg = <0x200000 0x400000>; - }; - - partition@600000 { - label = "kernel"; - reg = <0x600000 0x400000>; - }; - - /* ubi partition is the result of squashing - * next consecutive stock partitions: - * - rootfs0 (rootfs partition for stock kernel0), - * - rootfs1 (rootfs partition for stock failsafe kernel1), - * - overlay (used as ubi overlay in stock fw) - * resulting 117,5MiB space for packages. - */ - - partition@a00000 { - label = "ubi"; - reg = <0xa00000 0x7580000>; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "Config"; + reg = <0x80000 0x40000>; + }; + + partition@c0000 { + label = "Bdata"; + reg = <0xc0000 0x40000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "crash"; + reg = <0x140000 0x40000>; + }; + + partition@180000 { + label = "crash_syslog"; + reg = <0x180000 0x40000>; + }; + + partition@1c0000 { + label = "reserved0"; + reg = <0x1c0000 0x40000>; + read-only; + }; + + /* uboot expects to find kernels at 0x200000 & 0x600000 + * referred to as system 1 & system 2 respectively. + * a kernel is considered suitable for handing control over + * if its linux magic number exists & uImage CRC are correct. + * If either of those conditions fail, a matching sys'n'_fail flag + * is set in uboot env & a restart performed in the hope that the + * alternate kernel is okay. + * if neither kernel checksums ok and both are marked failed, system 2 + * is booted anyway. + * + * Note uboot's tftp flash install writes the transferred + * image to both kernel partitions. + */ + + partition@200000 { + label = "kernel_stock"; + reg = <0x200000 0x400000>; + }; + + partition@600000 { + label = "kernel"; + reg = <0x600000 0x400000>; + }; + + /* ubi partition is the result of squashing + * next consecutive stock partitions: + * - rootfs0 (rootfs partition for stock kernel0), + * - rootfs1 (rootfs partition for stock failsafe kernel1), + * - overlay (used as ubi overlay in stock fw) + * resulting 117,5MiB space for packages. + */ + + partition@a00000 { + label = "ubi"; + reg = <0xa00000 0x7580000>; + }; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir3p.dts b/target/linux/ramips/dts/mt7621_xiaomi_mir3p.dts index b456e43a9e..c556200e45 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mir3p.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mir3p.dts @@ -91,64 +91,67 @@ &nand { status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Bootloader"; - reg = <0x0 0x40000>; - read-only; - }; - - partition@40000 { - label = "Config"; - reg = <0x40000 0x40000>; - }; - - partition@80000 { - label = "Bdata"; - reg = <0x80000 0x40000>; - read-only; - }; - - factory: partition@c0000 { - label = "factory"; - reg = <0x0c0000 0x40000>; - read-only; - }; - - partition@100000 { - label = "crash"; - reg = <0x100000 0x40000>; - }; - - partition@140000 { - label = "crash_syslog"; - reg = <0x140000 0x80000>; - }; - - partition@1c0000 { - label = "reserved0"; - reg = <0x1c0000 0x40000>; - read-only; - }; - - /* We keep stock xiaomi firmware (kernel0) here */ - partition@200000 { - label = "kernel_stock"; - reg = <0x200000 0x400000>; - }; - - partition@600000 { - label = "kernel"; - reg = <0x600000 0x400000>; - }; - - partition@a00000 { - label = "ubi"; - reg = <0xa00000 0xf580000>; + nand@0 { + reg = <0>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "Config"; + reg = <0x40000 0x40000>; + }; + + partition@80000 { + label = "Bdata"; + reg = <0x80000 0x40000>; + read-only; + }; + + factory: partition@c0000 { + label = "factory"; + reg = <0x0c0000 0x40000>; + read-only; + }; + + partition@100000 { + label = "crash"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "crash_syslog"; + reg = <0x140000 0x80000>; + }; + + partition@1c0000 { + label = "reserved0"; + reg = <0x1c0000 0x40000>; + read-only; + }; + + /* We keep stock xiaomi firmware (kernel0) here */ + partition@200000 { + label = "kernel_stock"; + reg = <0x200000 0x400000>; + }; + + partition@600000 { + label = "kernel"; + reg = <0x600000 0x400000>; + }; + + partition@a00000 { + label = "ubi"; + reg = <0xa00000 0xf580000>; + }; }; }; }; diff --git a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch index 0d69d2cb34..492c59cbbf 100644 --- a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch +++ b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch @@ -3572,7 +3572,7 @@ Signed-off-by: John Crispin + } +#endif + -+ nand_set_flash_node(nand_chip, pdev->dev.of_node); ++ nand_set_flash_node(nand_chip, of_get_next_available_child(pdev->dev.of_node, NULL)); + err = mtd_device_parse_register(mtd, probe_types, &ppdata, + NULL, 0); + if (!err) { -- 2.30.2