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 <gch981213@gmail.com>
This commit is contained in:
Chuanhong Guo
2022-04-07 10:16:47 +08:00
parent 2138956bdc
commit 68d5efaa10
16 changed files with 3431 additions and 336 deletions

View File

@@ -497,55 +497,65 @@
status = "okay";
};
&snand {
mediatek,quad-spi;
&bch {
status = "okay";
};
&snfi {
pinctrl-names = "default";
pinctrl-0 = <&serial_nand_pins>;
status = "okay";
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>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Preloader";
reg = <0x00000 0x0080000>;
read-only;
};
partition@0 {
label = "Preloader";
reg = <0x00000 0x0080000>;
read-only;
};
partition@80000 {
label = "ATF";
reg = <0x80000 0x0040000>;
read-only;
};
partition@80000 {
label = "ATF";
reg = <0x80000 0x0040000>;
read-only;
};
partition@c0000 {
label = "uboot";
reg = <0xc0000 0x0080000>;
read-only;
};
partition@c0000 {
label = "uboot";
reg = <0xc0000 0x0080000>;
read-only;
};
partition@140000 {
label = "uboot-env";
reg = <0x140000 0x0080000>;
read-only;
};
partition@140000 {
label = "uboot-env";
reg = <0x140000 0x0080000>;
read-only;
};
factory: partition@1c0000 {
label = "factory";
reg = <0x1c0000 0x0040000>;
read-only;
};
factory: partition@1c0000 {
label = "factory";
reg = <0x1c0000 0x0040000>;
read-only;
};
partition@200000 {
label = "firmware";
reg = <0x200000 0x2000000>;
};
partition@200000 {
label = "firmware";
reg = <0x200000 0x2000000>;
};
partition@2200000 {
label = "reserved";
reg = <0x2200000 0x4000000>;
partition@2200000 {
label = "reserved";
reg = <0x2200000 0x4000000>;
};
};
};
};

View File

@@ -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 {

View File

@@ -6,51 +6,53 @@
compatible = "mediatek,mt7622-rfb1-ubi";
};
&snand {
mediatek,bmt-v2;
mediatek,bmt-remap-range = <0x0 0x6c0000>;
&snfi {
flash@0 {
mediatek,bmt-v2;
mediatek,bmt-remap-range = <0x0 0x6c0000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Preloader";
reg = <0x00000 0x0080000>;
read-only;
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;
};
};

View File

@@ -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;
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>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Preloader";
reg = <0x0 0x80000>;
read-only;
};
partition@0 {
label = "Preloader";
reg = <0x0 0x80000>;
read-only;
};
partition@80000 {
label = "ATF";
reg = <0x80000 0x40000>;
read-only;
};
partition@80000 {
label = "ATF";
reg = <0x80000 0x40000>;
read-only;
};
partition@c0000 {
label = "u-boot";
reg = <0xc0000 0x80000>;
read-only;
};
partition@c0000 {
label = "u-boot";
reg = <0xc0000 0x80000>;
read-only;
};
partition@140000 {
label = "u-boot-env";
reg = <0x140000 0x80000>;
read-only;
};
partition@140000 {
label = "u-boot-env";
reg = <0x140000 0x80000>;
read-only;
};
factory: partition@1c0000 {
label = "factory";
reg = <0x1c0000 0x40000>;
read-only;
};
factory: partition@1c0000 {
label = "factory";
reg = <0x1c0000 0x40000>;
read-only;
};
partition@200000 {
label = "ubi";
reg = <0x200000 0x6400000>;
};
partition@200000 {
label = "ubi";
reg = <0x200000 0x6400000>;
};
partition@6600000 {
label = "User_data";
reg = <0x6600000 0x100000>;
};
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>;
/* size of this partition varies due to BMT & bad blocks. */
partition@6700000 {
label = "reserved";
reg = <0x6700000 0>;
};
};
};
};

View File

@@ -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;
};
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 0x40000>;
};
partition@180000 {
label = "bdata";
reg = <0x180000 0x40000>;
};
factory: partition@1c0000 {
label = "factory";
reg = <0x1c0000 0x80000>;
read-only;
compatible = "nvmem-cells";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_4: macaddr@4 {
reg = <0x4 0x6>;
partition@0 {
label = "Preloader";
reg = <0x0 0x80000>;
read-only;
};
};
partition@240000 {
label = "crash";
reg = <0x240000 0x40000>;
read-only;
};
partition@80000 {
label = "ATF";
reg = <0x80000 0x40000>;
read-only;
};
partition@280000 {
label = "crash_log";
reg = <0x280000 0x40000>;
read-only;
};
partition@c0000 {
label = "u-boot";
reg = <0xc0000 0x80000>;
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@140000 {
label = "u-boot-env";
reg = <0x140000 0x40000>;
};
partition@180000 {
label = "bdata";
reg = <0x180000 0x40000>;
};
/* ubi partition is the result of squashing
* consecutive stock partitions:
* - firmware (partially)
* - firmware1
* - overlay
* - obr
*/
partition@6c0000 {
label = "ubi";
reg = <0x6C0000 0x6f00000>;
factory: partition@1c0000 {
label = "factory";
reg = <0x1c0000 0x80000>;
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_4: macaddr@4 {
reg = <0x4 0x6>;
};
};
partition@240000 {
label = "crash";
reg = <0x240000 0x40000>;
read-only;
};
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>;
};
};
};
};