From 68d5efaa10cf0689521fe05e386e3a1e11d8cb29 Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Thu, 7 Apr 2022 10:16:47 +0800 Subject: mediatek: add an upstreamed spi-nand driver This patch implements the spi-nand controller driver as an ECC-capable spi-mem controller to use the upstream SPI-NAND driver. Signed-off-by: Chuanhong Guo --- .../mediatek/dts/mt7622-elecom-wrc-2533gent.dts | 102 +++++++------- .../linux/mediatek/dts/mt7622-linksys-e8450.dtsi | 15 +- target/linux/mediatek/dts/mt7622-rfb1-ubi.dts | 92 +++++++------ .../linux/mediatek/dts/mt7622-totolink-a8000ru.dts | 116 ++++++++-------- .../dts/mt7622-xiaomi-redmi-router-ax6s.dts | 151 +++++++++++---------- 5 files changed, 260 insertions(+), 216 deletions(-) (limited to 'target/linux/mediatek/dts') diff --git a/target/linux/mediatek/dts/mt7622-elecom-wrc-2533gent.dts b/target/linux/mediatek/dts/mt7622-elecom-wrc-2533gent.dts index 867982b061..3e061ef945 100644 --- a/target/linux/mediatek/dts/mt7622-elecom-wrc-2533gent.dts +++ b/target/linux/mediatek/dts/mt7622-elecom-wrc-2533gent.dts @@ -497,55 +497,65 @@ status = "okay"; }; -&snand { - mediatek,quad-spi; +&bch { + status = "okay"; +}; + +&snfi { pinctrl-names = "default"; pinctrl-0 = <&serial_nand_pins>; status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Preloader"; - reg = <0x00000 0x0080000>; - read-only; - }; - - partition@80000 { - label = "ATF"; - reg = <0x80000 0x0040000>; - read-only; - }; - - partition@c0000 { - label = "uboot"; - reg = <0xc0000 0x0080000>; - read-only; - }; - - partition@140000 { - label = "uboot-env"; - reg = <0x140000 0x0080000>; - read-only; - }; - - factory: partition@1c0000 { - label = "factory"; - reg = <0x1c0000 0x0040000>; - read-only; - }; - - partition@200000 { - label = "firmware"; - reg = <0x200000 0x2000000>; - }; - - partition@2200000 { - label = "reserved"; - reg = <0x2200000 0x4000000>; + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + nand-ecc-engine = <&snfi>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x00000 0x0080000>; + read-only; + }; + + partition@80000 { + label = "ATF"; + reg = <0x80000 0x0040000>; + read-only; + }; + + partition@c0000 { + label = "uboot"; + reg = <0xc0000 0x0080000>; + read-only; + }; + + partition@140000 { + label = "uboot-env"; + reg = <0x140000 0x0080000>; + read-only; + }; + + factory: partition@1c0000 { + label = "factory"; + reg = <0x1c0000 0x0040000>; + read-only; + }; + + partition@200000 { + label = "firmware"; + reg = <0x200000 0x2000000>; + }; + + partition@2200000 { + label = "reserved"; + reg = <0x2200000 0x4000000>; + }; }; }; }; diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi index 047a4a59ef..9f0dabdb4e 100644 --- a/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi +++ b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi @@ -342,11 +342,22 @@ }; }; -&snand { - mediatek,quad-spi; +&bch { + status = "okay"; +}; + +&snfi { pinctrl-names = "default"; pinctrl-0 = <&serial_nand_pins>; status = "okay"; + + snand: flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + nand-ecc-engine = <&snfi>; + }; }; &spi0 { diff --git a/target/linux/mediatek/dts/mt7622-rfb1-ubi.dts b/target/linux/mediatek/dts/mt7622-rfb1-ubi.dts index 1a94446c7a..0f6d9bbc50 100644 --- a/target/linux/mediatek/dts/mt7622-rfb1-ubi.dts +++ b/target/linux/mediatek/dts/mt7622-rfb1-ubi.dts @@ -6,51 +6,53 @@ compatible = "mediatek,mt7622-rfb1-ubi"; }; -&snand { - mediatek,bmt-v2; - mediatek,bmt-remap-range = <0x0 0x6c0000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Preloader"; - reg = <0x00000 0x0080000>; - read-only; +&snfi { + flash@0 { + mediatek,bmt-v2; + mediatek,bmt-remap-range = <0x0 0x6c0000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x00000 0x0080000>; + read-only; + }; + + partition@80000 { + label = "ATF"; + reg = <0x80000 0x0040000>; + }; + + partition@c0000 { + label = "Bootloader"; + reg = <0xc0000 0x0080000>; + }; + + partition@140000 { + label = "Config"; + reg = <0x140000 0x0080000>; + }; + + factory: partition@1c0000 { + label = "Factory"; + reg = <0x1c0000 0x0100000>; + }; + + partition@200000 { + label = "kernel"; + reg = <0x2c0000 0x400000>; + }; + + partition@6c0000 { + label = "ubi"; + reg = <0x6c0000 0x6f00000>; + }; + + /delete-node/ partition@2200000; }; - - partition@80000 { - label = "ATF"; - reg = <0x80000 0x0040000>; - }; - - partition@c0000 { - label = "Bootloader"; - reg = <0xc0000 0x0080000>; - }; - - partition@140000 { - label = "Config"; - reg = <0x140000 0x0080000>; - }; - - factory: partition@1c0000 { - label = "Factory"; - reg = <0x1c0000 0x0100000>; - }; - - partition@200000 { - label = "kernel"; - reg = <0x2c0000 0x400000>; - }; - - partition@6c0000 { - label = "ubi"; - reg = <0x6c0000 0x6f00000>; - }; - - /delete-node/ partition@2200000; }; }; diff --git a/target/linux/mediatek/dts/mt7622-totolink-a8000ru.dts b/target/linux/mediatek/dts/mt7622-totolink-a8000ru.dts index 0386865cc2..d67fb4efbf 100644 --- a/target/linux/mediatek/dts/mt7622-totolink-a8000ru.dts +++ b/target/linux/mediatek/dts/mt7622-totolink-a8000ru.dts @@ -226,62 +226,72 @@ status = "okay"; }; -&snand { - mediatek,quad-spi; +&bch { + status = "okay"; +}; + +&snfi { pinctrl-names = "default"; pinctrl-0 = <&serial_nand_pins>; status = "okay"; - mediatek,bmt-v2; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Preloader"; - reg = <0x0 0x80000>; - read-only; - }; - - partition@80000 { - label = "ATF"; - reg = <0x80000 0x40000>; - read-only; - }; - - partition@c0000 { - label = "u-boot"; - reg = <0xc0000 0x80000>; - read-only; - }; - - partition@140000 { - label = "u-boot-env"; - reg = <0x140000 0x80000>; - read-only; - }; - - factory: partition@1c0000 { - label = "factory"; - reg = <0x1c0000 0x40000>; - read-only; - }; - - partition@200000 { - label = "ubi"; - reg = <0x200000 0x6400000>; - }; - - partition@6600000 { - label = "User_data"; - reg = <0x6600000 0x100000>; - }; - - /* size of this partition varies due to BMT & bad blocks. */ - partition@6700000 { - label = "reserved"; - reg = <0x6700000 0>; + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + nand-ecc-engine = <&snfi>; + mediatek,bmt-v2; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "ATF"; + reg = <0x80000 0x40000>; + read-only; + }; + + partition@c0000 { + label = "u-boot"; + reg = <0xc0000 0x80000>; + read-only; + }; + + partition@140000 { + label = "u-boot-env"; + reg = <0x140000 0x80000>; + read-only; + }; + + factory: partition@1c0000 { + label = "factory"; + reg = <0x1c0000 0x40000>; + read-only; + }; + + partition@200000 { + label = "ubi"; + reg = <0x200000 0x6400000>; + }; + + partition@6600000 { + label = "User_data"; + reg = <0x6600000 0x100000>; + }; + + /* size of this partition varies due to BMT & bad blocks. */ + partition@6700000 { + label = "reserved"; + reg = <0x6700000 0>; + }; }; }; }; diff --git a/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts b/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts index 933d2c9275..6c1208d4a8 100644 --- a/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts +++ b/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts @@ -211,94 +211,105 @@ }; }; -&snand { +&bch { + status = "okay"; +}; + +&snfi { pinctrl-names = "default"; pinctrl-0 = <&serial_nand_pins>; status = "okay"; - mediatek,bmt-v2; - mediatek,bmt-table-size = <0x1000>; - mediatek,bmt-remap-range = <0x0 0x6c0000>; + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + nand-ecc-engine = <&snfi>; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; + mediatek,bmt-v2; + mediatek,bmt-table-size = <0x1000>; + mediatek,bmt-remap-range = <0x0 0x6c0000>; - partition@0 { - label = "Preloader"; - reg = <0x0 0x80000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - partition@80000 { - label = "ATF"; - reg = <0x80000 0x40000>; - read-only; - }; + partition@0 { + label = "Preloader"; + reg = <0x0 0x80000>; + read-only; + }; - partition@c0000 { - label = "u-boot"; - reg = <0xc0000 0x80000>; - read-only; - }; + partition@80000 { + label = "ATF"; + reg = <0x80000 0x40000>; + read-only; + }; - partition@140000 { - label = "u-boot-env"; - reg = <0x140000 0x40000>; - }; + partition@c0000 { + label = "u-boot"; + reg = <0xc0000 0x80000>; + read-only; + }; - partition@180000 { - label = "bdata"; - reg = <0x180000 0x40000>; - }; + partition@140000 { + label = "u-boot-env"; + reg = <0x140000 0x40000>; + }; - factory: partition@1c0000 { - label = "factory"; - reg = <0x1c0000 0x80000>; - read-only; + partition@180000 { + label = "bdata"; + reg = <0x180000 0x40000>; + }; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + factory: partition@1c0000 { + label = "factory"; + reg = <0x1c0000 0x80000>; + read-only; - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; - }; - }; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; - partition@240000 { - label = "crash"; - reg = <0x240000 0x40000>; - read-only; - }; + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; - partition@280000 { - label = "crash_log"; - reg = <0x280000 0x40000>; - read-only; - }; + partition@240000 { + label = "crash"; + reg = <0x240000 0x40000>; + read-only; + }; - /* Shrunk and renamed from "firmware" - * as to not break luci size checks - */ - partition@2c0000 { - label = "kernel"; - compatible = "denx,fit"; - reg = <0x2c0000 0x400000>; - }; + partition@280000 { + label = "crash_log"; + reg = <0x280000 0x40000>; + read-only; + }; + /* Shrunk and renamed from "firmware" + * as to not break luci size checks + */ + partition@2c0000 { + label = "kernel"; + compatible = "denx,fit"; + reg = <0x2c0000 0x400000>; + }; - /* ubi partition is the result of squashing - * consecutive stock partitions: - * - firmware (partially) - * - firmware1 - * - overlay - * - obr - */ - partition@6c0000 { - label = "ubi"; - reg = <0x6C0000 0x6f00000>; + /* ubi partition is the result of squashing + * consecutive stock partitions: + * - firmware (partially) + * - firmware1 + * - overlay + * - obr + */ + partition@6c0000 { + label = "ubi"; + reg = <0x6C0000 0x6f00000>; + }; }; }; }; -- cgit v1.2.3