Skip to contentSkip to conversation

rockchip_sfc: add support for Rockchip SFC

RFC Superseded Chris Morgan 3 participants 13 messages May 25, 2021 – Jun 7, 2021

Subsystems (5)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover rockchip_sfc: add support for Rockchip SFC

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

 arch/arm/dts/px30.dtsi                     |  38 ++
 arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  10 +-
 arch/arm/dts/rk3326-odroid-go2.dts         |  22 +
 arch/arm/mach-rockchip/px30/px30.c         |  64 ++
 drivers/mtd/spi/Kconfig                    |   6 +
 drivers/mtd/spi/spi-nor-ids.c              |   8 +
 drivers/spi/Kconfig                        |   8 +
 drivers/spi/Makefile                       |   1 +
 drivers/spi/rockchip_sfc.c                 | 652 +++++++++++++++++++++
 9 files changed, 926 insertions(+), 1 deletion(-)
 create mode 100644 drivers/spi/rockchip_sfc.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/5 spi: rockchip_sfc: add support for Rockchip SFC

From: Chris Morgan <[email protected]>

This patch adds support for the Rockchip serial flash controller found on the PX30 SoC. It should work the same for all SoCs which use the same serial flash controller IP (referred to as the v3).

This is adapted from the SPI subsystem driver from Rockchip's BSP U-boot package. I made a few small changes to get it working on my board.

---
 drivers/spi/Kconfig        |   8 +
 drivers/spi/Makefile       |   1 +
 drivers/spi/rockchip_sfc.c | 652 +++++++++++++++++++++++++++++++++++++
 3 files changed, 661 insertions(+)
 create mode 100644 drivers/spi/rockchip_sfc.c
drivers/spi/Kconfig +8 -0
index 1494c91763..bef36f2931 100644
@@ -312,6 +312,14 @@ config RENESAS_RPC_SPI
 	  on Renesas RCar Gen3 SoCs. This uses driver model and requires a
 	  device tree binding to operate.
 
+config ROCKCHIP_SFC
+	bool "Rockchip SFC Driver"
+	help
+	  Enable the Rockchip SFC Driver for SPI NOR flash. This device is
+	  a limited purpose SPI controller for driving NOR flash on certain
+	  Rockchip SoCs. This uses driver model and requires a device tree
+	  binding to operate.
+
 config ROCKCHIP_SPI
 	bool "Rockchip SPI driver"
 	help
drivers/spi/Makefile +1 -0
index cfe4fae1d4..f02e84b5f1 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_PIC32_SPI) += pic32_spi.o
 obj-$(CONFIG_PL022_SPI) += pl022_spi.o
 obj-$(CONFIG_SPI_QUP) += spi-qup.o
 obj-$(CONFIG_RENESAS_RPC_SPI) += renesas_rpc_spi.o
+obj-$(CONFIG_ROCKCHIP_SFC) += rockchip_sfc.o
 obj-$(CONFIG_ROCKCHIP_SPI) += rk_spi.o
 obj-$(CONFIG_SANDBOX_SPI) += sandbox_spi.o
 obj-$(CONFIG_SPI_SIFIVE) += spi-sifive.o
drivers/spi/rockchip_sfc.c new file +652 -0

652 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/5 rockchip: px30: Add support for using SFC

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

This patch adds support for setting the correct pin configuration for the Rockchip Serial Flash Controller found on the PX30.

---
 arch/arm/mach-rockchip/px30/px30.c | 64 ++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/mach-rockchip/px30/px30.c +64 -0
index 6fcef63c1b..8674e815da 100644
@@ -51,6 +51,57 @@ struct mm_region *mem_map = px30_mem_map;
 
 #define QOS_PRIORITY_LEVEL(h, l)	((((h) & 3) << 8) | ((l) & 3))
 
+/* GRF_GPIO1AL_IOMUX */
+enum {
+	GPIO1A3_SHIFT		= 12,
+	GPIO1A3_MASK		= 0xf << GPIO1A3_SHIFT,
+	GPIO1A3_GPIO		= 0,
+	GPIO1A3_FLASH_D3,
+	GPIO1A3_EMMC_D3,
+	GPIO1A3_SFC_SIO3,
+
+	GPIO1A2_SHIFT		= 8,
+	GPIO1A2_MASK		= 0xf << GPIO1A2_SHIFT,
+	GPIO1A2_GPIO		= 0,
+	GPIO1A2_FLASH_D2,
+	GPIO1A2_EMMC_D2,
+	GPIO1A2_SFC_SIO2,
+
+	GPIO1A1_SHIFT		= 4,
+	GPIO1A1_MASK		= 0xf << GPIO1A1_SHIFT,
+	GPIO1A1_GPIO		= 0,
+	GPIO1A1_FLASH_D1,
+	GPIO1A1_EMMC_D1,
+	GPIO1A1_SFC_SIO1,
+
+	GPIO1A0_SHIFT		= 0,
+	GPIO1A0_MASK		= 0xf << GPIO1A0_SHIFT,
+	GPIO1A0_GPIO		= 0,
+	GPIO1A0_FLASH_D0,
+	GPIO1A0_EMMC_D0,
+	GPIO1A0_SFC_SIO0,
+};
+
+/* GRF_GPIO1AH_IOMUX */
+enum {
+	GPIO1A4_SHIFT		= 0,
+	GPIO1A4_MASK		= 0xf << GPIO1A4_SHIFT,
+	GPIO1A4_GPIO		= 0,
+	GPIO1A4_FLASH_D4,
+	GPIO1A4_EMMC_D4,
+	GPIO1A4_SFC_CSN0,
+};
+
+/* GRF_GPIO1BL_IOMUX */
+enum {
+	GPIO1B1_SHIFT		= 4,
+	GPIO1B1_MASK		= 0xf << GPIO1B1_SHIFT,
+	GPIO1B1_GPIO		= 0,
+	GPIO1B1_FLASH_RDY,
+	GPIO1B1_EMMC_CLKOUT,
+	GPIO1B1_SFC_CLK,
+};
+
 /* GRF_GPIO1BH_IOMUX */
 enum {
 	GPIO1B7_SHIFT		= 12,
@@ -193,6 +244,19 @@ int arch_cpu_init(void)
 		     GPIO1D4_SDMMC_D2 << GPIO1D4_SHIFT);
 #endif
 
+#ifdef CONFIG_ROCKCHIP_SFC
+	rk_clrsetreg(&grf->gpio1al_iomux,
+		     GPIO1A3_MASK | GPIO1A2_MASK | GPIO1A1_MASK | GPIO1A0_MASK,
+		     GPIO1A3_SFC_SIO3 << GPIO1A3_SHIFT |
+		     GPIO1A2_SFC_SIO2 << GPIO1A2_SHIFT |
+		     GPIO1A1_SFC_SIO1 << GPIO1A1_SHIFT |
+		     GPIO1A0_SFC_SIO0 << GPIO1A0_SHIFT);
+	rk_clrsetreg(&grf->gpio1ah_iomux, GPIO1A4_MASK,
+		     GPIO1A4_SFC_CSN0 << GPIO1A4_SHIFT);
+	rk_clrsetreg(&grf->gpio1bl_iomux, GPIO1B1_MASK,
+		     GPIO1B1_SFC_CLK << GPIO1B1_SHIFT);
+#endif
+
 #endif
 
 	/* Enable PD_VO (default disable at reset) */
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/5 rockchip: px30: add the serial flash controller

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add the serial flash controller to the devicetree for the PX30.

---
 arch/arm/dts/px30.dtsi | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
arch/arm/dts/px30.dtsi +38 -0
index b6c79e7ed3..aaa8ae2235 100644
@@ -960,6 +960,18 @@
 		status = "disabled";
 	};
 
+	sfc: sfc@ff3a0000 {
+		compatible = "rockchip,sfc";
+		reg = <0x0 0xff3a0000 0x0 0x4000>;
+		interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
+		clock-names = "clk_sfc", "hclk_sfc";
+		pinctrl-names = "default";
+		pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus4>;
+		power-domains = <&power PX30_PD_MMC_NAND>;
+		status = "disabled";
+	};
+
 	gpu: gpu@ff400000 {
 		compatible = "rockchip,px30-mali", "arm,mali-bifrost";
 		reg = <0x0 0xff400000 0x0 0x4000>;
@@ -1926,6 +1938,32 @@
 			};
 		};
 
+		serial_flash {
+			sfc_bus4: sfc-bus4 {
+				rockchip,pins =
+					<1 RK_PA0 3 &pcfg_pull_none>,
+					<1 RK_PA1 3 &pcfg_pull_none>,
+					<1 RK_PA2 3 &pcfg_pull_none>,
+					<1 RK_PA3 3 &pcfg_pull_none>;
+			};
+
+			sfc_bus2: sfc-bus2 {
+				rockchip,pins =
+					<1 RK_PA0 3 &pcfg_pull_none>,
+					<1 RK_PA1 3 &pcfg_pull_none>;
+			};
+
+			sfc_cs: sfc-cs {
+				rockchip,pins =
+					<1 RK_PA4 3 &pcfg_pull_none>;
+			};
+
+			sfc_clk: sfc-clk {
+				rockchip,pins =
+					<1 RK_PB1 3 &pcfg_pull_none>;
+			};
+		};
+
 		lcdc {
 			lcdc_rgb_dclk_pin: lcdc-rgb-dclk-pin {
 				rockchip,pins =
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/5 mtd: spi-nor-ids: Add XTX XT25F128B

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Adds support for XT25F128B used on Odroid Go Advance. Unfortunately this chip uses a continuation code which I cannot seem to parse, so there are likely going to be collisions with chips that use the same manufacturer/ID.

---
 drivers/mtd/spi/Kconfig       | 6 ++++++
 drivers/mtd/spi/spi-nor-ids.c | 8 ++++++++
 2 files changed, 14 insertions(+)
drivers/mtd/spi/Kconfig +6 -0
index f8db8e5213..8c797d1e03 100644
@@ -162,6 +162,12 @@ config SPI_FLASH_XMC
 	  Add support for various XMC (Wuhan Xinxin Semiconductor
 	  Manufacturing Corp.) SPI flash chips (XM25xxx)
 
+config SPI_FLASH_XTX
+	bool "XTX SPI flash support"
+	help
+	  Add support for various XTX (XTX Technology Limited)
+	  SPI flash chips (XT25xxx).
+
 endif
 
 config SPI_FLASH_USE_4K_SECTORS
drivers/mtd/spi/spi-nor-ids.c +8 -0
index 2b57797954..78166f408e 100644
@@ -336,6 +336,14 @@ const struct flash_info spi_nor_ids[] = {
 	/* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */
 	{ INFO("XM25QH64A", 0x207017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
 	{ INFO("XM25QH128A", 0x207018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+#endif
+#ifdef CONFIG_SPI_FLASH_XTX
+	/* XTX Technology (Shenzhen) Limited */
+	{
+		INFO("xt25f128b", 0x0b4018, 0, 64 * 1024, 256,
+		     SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+		     SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+	},
 #endif
 	{ },
 };
Signature · 1 line
2.25.1
#5 lore raw

PATCH 5/5 rockchip: px30: add support for SFC for Odroid Go Advance

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

The Odroid Go Advance uses a Rockchip Serial Flash Controller with an XT25F128B SPI NOR flash chip. This adds support for both.

---
 arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  8 ++++++++
 arch/arm/dts/rk3326-odroid-go2.dts         | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi +8 -0
index 00767d2abd..7527a6ed0e 100644
@@ -57,6 +57,14 @@
 	u-boot,spl-fifo-mode;
 };
 
+&sfc {
+	u-boot,dm-pre-reloc;
+};
+
+&spi_flash {
+	u-boot,dm-pre-reloc;
+};
+
 &uart1 {
 	clock-frequency = <24000000>;
 	u-boot,dm-pre-reloc;
arch/arm/dts/rk3326-odroid-go2.dts +22 -0
index 8cd4688c49..eb8a21ce66 100644
@@ -48,6 +48,14 @@
 		};
 	};
 
+	aliases {
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
+		serial1 = &uart1;
+		serial2 = &uart2;
+		spi0 = &sfc;
+	};
+
 	gpio-keys {
 		compatible = "gpio-keys";
 		pinctrl-names = "default";
@@ -617,6 +625,20 @@
 	status = "okay";
 };
 
+&sfc {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
+	status = "okay";
+
+	spi_flash: xt25f128b@0 {
+		reg = <0>;
+		compatible = "xtx,xt25f128b","jedec,spi-nor";
+		spi-max-frequency = <108000000>;
+	};
+};
+
 &tsadc {
 	status = "okay";
 };
Signature · 1 line
2.25.1
#6 lore raw
In reply to Chris Morgan

Add Yifeng from rockchip.

Hi Chris,

    First of all, I think you should remain the origin author info in the signed-off.

Hi Yifeng,

    Please help to review this driver.

Thanks,

- Kever

Quoted 58 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

  arch/arm/dts/px30.dtsi                     |  38 ++
  arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  10 +-
  arch/arm/dts/rk3326-odroid-go2.dts         |  22 +
  arch/arm/mach-rockchip/px30/px30.c         |  64 ++
  drivers/mtd/spi/Kconfig                    |   6 +
  drivers/mtd/spi/spi-nor-ids.c              |   8 +
  drivers/spi/Kconfig                        |   8 +
  drivers/spi/Makefile                       |   1 +
  drivers/spi/rockchip_sfc.c                 | 652 +++++++++++++++++++++
  9 files changed, 926 insertions(+), 1 deletion(-)

create mode 100644 drivers/spi/rockchip_sfc.c

#7 lore raw
Quoted 6 lines · Kever Yang

Add Yifeng from rockchip.

Hi Chris,

    First of all, I think you should remain the origin author info in the signed-off.

Okay, I can do that. Please note that since I submitted this I was asked to redo the upstream linux proposed driver to use the spi-mem framework. I think for now honestly I'd like to abandon this patch and resubmit a little later with one that is more or less the same (using the spi-mem framework) as the Linux driver.

https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/

Quoted 72 lines

Hi Yifeng,

    Please help to review this driver.

Thanks,

- Kever

Quoted 58 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

  arch/arm/dts/px30.dtsi                     |  38 ++
  arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  10 +-
  arch/arm/dts/rk3326-odroid-go2.dts         |  22 +
  arch/arm/mach-rockchip/px30/px30.c         |  64 ++
  drivers/mtd/spi/Kconfig                    |   6 +
  drivers/mtd/spi/spi-nor-ids.c              |   8 +
  drivers/spi/Kconfig                        |   8 +
  drivers/spi/Makefile                       |   1 +
  drivers/spi/rockchip_sfc.c                 | 652 +++++++++++++++++++++
  9 files changed, 926 insertions(+), 1 deletion(-)

create mode 100644 drivers/spi/rockchip_sfc.c

#8 lore raw

Hi Chris,

Quoted 5 lines · Chris Morgan
Quoted 4 lines · Kever Yang

Add Yifeng from rockchip.

Hi Chris,

Quoted 7 lines
Quoted 2 lines

    First of all, I think you should remain the origin author info in the
signed-off.

Okay, I can do that. Please note that since I submitted this I was asked to redo the upstream linux proposed driver to use the spi-mem framework. I think for now honestly I'd like to abandon this patch and resubmit a little later with one that is more or less the same (using the spi-mem framework) as the Linux driver.

This sounds better, then we can wait for driver with new framework.

Thanks,

- Kever

Quoted 74 lines

https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/

Quoted 70 lines

Hi Yifeng,

    Please help to review this driver.

Thanks,

- Kever

Quoted 58 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

   arch/arm/dts/px30.dtsi                     |  38 ++
   arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  10 +-
   arch/arm/dts/rk3326-odroid-go2.dts         |  22 +
   arch/arm/mach-rockchip/px30/px30.c         |  64 ++
   drivers/mtd/spi/Kconfig                    |   6 +
   drivers/mtd/spi/spi-nor-ids.c              |   8 +
   drivers/spi/Kconfig                        |   8 +
   drivers/spi/Makefile                       |   1 +
   drivers/spi/rockchip_sfc.c                 | 652 +++++++++++++++++++++
   9 files changed, 926 insertions(+), 1 deletion(-)

create mode 100644 drivers/spi/rockchip_sfc.c

#9 lore raw

Hi Chris:

It's my honor to read about spi-rockchip-sfc driver from you, and your code has made a big difference to me.

Recently, we happen to be willing to submit the spi-mem rk sfc drivers, and we have tried some of them in the internal process. Compared with the RK internal code, I have the following thoughts on your code:
1) Only support spi-nor, not support spi-nand
2) Only support rx_dual, tx_quad, not support tx_dual, tx_quad
3) Some of the code may be further simplified, such as "rockchip_sfc_register_all"
4) Some of the logic may be further simplified, such as "rockchip_sfc_init"
5) Doesn't support SFC ver4 ver5 althought witch is compatibled with lower version

In order to support all these features, I adjust the drivers on the basis of your code witch is attach to these mail, these drivers have been test in linux 5.10 rk3568 board, and I'm still doing more strict tests.

So I suggest that we complete it together, or we may consider transferring it to me for submission If I have the honor.

I'm still unfamiliar with the community culture. I hope I didn't offend you. If I have, I'll say sorry in advance. Best wishes.

[email protected]

From: Kever Yang
Date: 2021-06-02 09:27
To: Chris Morgan
CC: u-boot; heiko.stuebner; vigneshr; jagan; sjg; Chris Morgan; 赵仪峰; 林鼎强
Subject: Re: [RFC 0/5] rockchip_sfc: add support for Rockchip SFC Hi Chris,

Quoted 5 lines · Chris Morgan
Quoted 4 lines · Kever Yang

Add Yifeng from rockchip.

Hi Chris,

Quoted 7 lines
Quoted 2 lines

First of all, I think you should remain the origin author info in the
signed-off.

Okay, I can do that. Please note that since I submitted this I was asked to redo the upstream linux proposed driver to use the spi-mem framework. I think for now honestly I'd like to abandon this patch and resubmit a little later with one that is more or less the same (using the spi-mem framework) as the Linux driver.

This sounds better, then we can wait for driver with new framework.

Thanks,

- Kever

Quoted 74 lines

https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/

Quoted 70 lines

Hi Yifeng,

Please help to review this driver.

Thanks,

- Kever

Quoted 58 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

   arch/arm/dts/px30.dtsi                     |  38 ++
   arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  10 +-
   arch/arm/dts/rk3326-odroid-go2.dts         |  22 +
   arch/arm/mach-rockchip/px30/px30.c         |  64 ++
   drivers/mtd/spi/Kconfig                    |   6 +
   drivers/mtd/spi/spi-nor-ids.c              |   8 +
   drivers/spi/Kconfig                        |   8 +
   drivers/spi/Makefile                       |   1 +
   drivers/spi/rockchip_sfc.c                 | 652 +++++++++++++++++++++
   9 files changed, 926 insertions(+), 1 deletion(-)

create mode 100644 drivers/spi/rockchip_sfc.c

#10 lore raw
Quoted 13 lines · 林鼎强

Hi Chris:

It's my honor to read about spi-rockchip-sfc driver from you, and your code has made a big difference to me.

Recently, we happen to be willing to submit the spi-mem rk sfc drivers, and we have tried some of them in the internal process. Compared with the RK internal code, I have the following thoughts on your code:
1) Only support spi-nor, not support spi-nand
2) Only support rx_dual, tx_quad, not support tx_dual, tx_quad
3) Some of the code may be further simplified, such as "rockchip_sfc_register_all"
4) Some of the logic may be further simplified, such as "rockchip_sfc_init"
5) Doesn't support SFC ver4 ver5 althought witch is compatibled with lower version

Quoted 7 lines

In order to support all these features, I adjust the drivers on the basis of your code witch is attach to these mail, these drivers have been test in linux 5.10 rk3568 board, and I'm still doing more strict tests.

So I suggest that we complete it together, or we may consider transferring it to me for submission If I have the honor.

I'm still unfamiliar with the community culture. I hope I didn't offend you. If I have, I'll say sorry in advance. Best wishes.

I am absolutely fine with you taking this on, and will be happy to help you in any way I can. I only started working on support for this because I wanted it supported in both Linux and U-Boot mainline, and didn't see any progress being made (so I thought I would do it myself). Basically, my goal all along has been to ensure the Odroid Go Advance is fully supported in mainline Linux (and U-boot), and that requires we get the audio (done), SFC (in progress), crypto, battery, charger, and everything else (done) supported.

I trust you are better able to develop/test this than I am, as I only have access to some technical documents and a single PX30 based device to test this on.

Please CC me when you are ready to submit upstream to Linux and U-boot and I will happily test it on my hardware. If you don't have a U-boot driver in progress let me know and I can start working on one.

Thank you.

Quoted 110 lines

[email protected]

From: Kever Yang
Date: 2021-06-02 09:27
To: Chris Morgan
CC: u-boot; heiko.stuebner; vigneshr; jagan; sjg; Chris Morgan; 赵仪峰; 林鼎强
Subject: Re: [RFC 0/5] rockchip_sfc: add support for Rockchip SFC Hi Chris,

Quoted 5 lines · Chris Morgan
Quoted 4 lines · Kever Yang

Add Yifeng from rockchip.

Hi Chris,

Quoted 7 lines
Quoted 2 lines

First of all, I think you should remain the origin author info in the
signed-off.

Okay, I can do that. Please note that since I submitted this I was asked to redo the upstream linux proposed driver to use the spi-mem framework. I think for now honestly I'd like to abandon this patch and resubmit a little later with one that is more or less the same (using the spi-mem framework) as the Linux driver.

This sounds better, then we can wait for driver with new framework.

Thanks,

- Kever

Quoted 74 lines

https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/

Quoted 70 lines

Hi Yifeng,

Please help to review this driver.

Thanks,

- Kever

Quoted 58 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

   arch/arm/dts/px30.dtsi                     |  38 ++
   arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  10 +-
   arch/arm/dts/rk3326-odroid-go2.dts         |  22 +
   arch/arm/mach-rockchip/px30/px30.c         |  64 ++
   drivers/mtd/spi/Kconfig                    |   6 +
   drivers/mtd/spi/spi-nor-ids.c              |   8 +
   drivers/spi/Kconfig                        |   8 +
   drivers/spi/Makefile                       |   1 +
   drivers/spi/rockchip_sfc.c                 | 652 +++++++++++++++++++++
   9 files changed, 926 insertions(+), 1 deletion(-)

create mode 100644 drivers/spi/rockchip_sfc.c

#11 lore raw
Quoted 33 lines · Chris Morgan
Quoted 12 lines · 林鼎强

Hi Chris:

It's my honor to read about spi-rockchip-sfc driver from you, and your code has made a big difference to me.

Recently, we happen to be willing to submit the spi-mem rk sfc drivers, and we have tried some of them in the internal process. Compared with the RK internal code, I have the following thoughts on your code:
1) Only support spi-nor, not support spi-nand
2) Only support rx_dual, tx_quad, not support tx_dual, tx_quad
3) Some of the code may be further simplified, such as "rockchip_sfc_register_all"
4) Some of the logic may be further simplified, such as "rockchip_sfc_init"
5) Doesn't support SFC ver4 ver5 althought witch is compatibled with lower version

Quoted 7 lines

In order to support all these features, I adjust the drivers on the basis of your code witch is attach to these mail, these drivers have been test in linux 5.10 rk3568 board, and I'm still doing more strict tests.

So I suggest that we complete it together, or we may consider transferring it to me for submission If I have the honor.

I'm still unfamiliar with the community culture. I hope I didn't offend you. If I have, I'll say sorry in advance. Best wishes.

I am absolutely fine with you taking this on, and will be happy to help you in any way I can. I only started working on support for this because I wanted it supported in both Linux and U-Boot mainline, and didn't see any progress being made (so I thought I would do it myself). Basically, my goal all along has been to ensure the Odroid Go Advance is fully supported in mainline Linux (and U-boot), and that requires we get the audio (done), SFC (in progress), crypto, battery, charger, and everything else (done) supported.

I trust you are better able to develop/test this than I am, as I only have access to some technical documents and a single PX30 based device to test this on.

Quoted 5 lines

Please CC me when you are ready to submit upstream to Linux and U-boot and I will happily test it on my hardware. If you don't have a U-boot driver in progress let me know and I can start working on one.

Thank you.

I'm glad to receive your reply and your understanding so soon. I'll talk about my plan directly. If there is no obvious objection,I'll go on with it.

Firstly, I will submit the support for the my first version of Linux drivers next week which is base on your series submission.

After browsing your submission, there will be the following changes:
1) [RFC,v4,1/8] change with the "Rob Herring" comment
2) [RFC,v4,2/8] update driver
3) All dt patches, make a little change to compatible with RK SDK

[RFC,v4,8/8] arm64: dts: rockchip: Enable SFC for Odroid Go Advance [RFC,v4,7/8] arm64: dts: rockchip: Add SFC to RK3308
[RFC,v4,6/8] arm: dts: rockchip: Add SFC to RV1108
[RFC,v4,5/8] arm: dts: rockchip: Add SFC to RK3036
[RFC,v4,4/8] clk: rockchip: Add support for hclk_sfc on rk3036 [RFC,v4,3/8] arm64: dts: rockchip: Add SFC to PX30
[RFC,v4,2/8] spi: rockchip-sfc: add rockchip serial flash controller [RFC,v4,1/8] dt-bindings: rockchip-sfc: Bindings for Rockchip serial flash controller

Secondly, Keep devolop uboot drivers base on your serieas submission https://patchwork.ozlabs.org/project/uboot/list//?series=245724
submit the code under uboot as soon as possible.

Finally I'll keep focus on the new comments about all these linux patches,then fix it until they are merged.

Best wishes.

Quoted 110 lines
Quoted 105 lines

[email protected]

From: Kever Yang
Date: 2021-06-02 09:27
To: Chris Morgan
CC: u-boot; heiko.stuebner; vigneshr; jagan; sjg; Chris Morgan; 赵仪峰; 林鼎强
Subject: Re: [RFC 0/5] rockchip_sfc: add support for Rockchip SFC Hi Chris,

Quoted 5 lines · Chris Morgan
Quoted 4 lines · Kever Yang

Add Yifeng from rockchip.

Hi Chris,

Quoted 7 lines
Quoted 2 lines

First of all, I think you should remain the origin author info in the
signed-off.

Okay, I can do that. Please note that since I submitted this I was asked to redo the upstream linux proposed driver to use the spi-mem framework. I think for now honestly I'd like to abandon this patch and resubmit a little later with one that is more or less the same (using the spi-mem framework) as the Linux driver.

This sounds better, then we can wait for driver with new framework.

Thanks,

- Kever

Quoted 70 lines

https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/

Quoted 68 lines

Hi Yifeng,

Please help to review this driver.

Thanks,

- Kever

Quoted 58 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

arch/arm/dts/px30.dtsi | 38 ++
arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi | 10 +-
arch/arm/dts/rk3326-odroid-go2.dts | 22 +
arch/arm/mach-rockchip/px30/px30.c | 64 ++
drivers/mtd/spi/Kconfig | 6 +
drivers/mtd/spi/spi-nor-ids.c | 8 +
drivers/spi/Kconfig | 8 +
drivers/spi/Makefile | 1 +
drivers/spi/rockchip_sfc.c | 652 +++++++++++++++++++++
9 files changed, 926 insertions(+), 1 deletion(-) create mode 100644 drivers/spi/rockchip_sfc.c

#12 lore raw
Quoted 63 lines · Jon Lin
Quoted 33 lines · Chris Morgan
Quoted 12 lines · 林鼎强

Hi Chris:

It's my honor to read about spi-rockchip-sfc driver from you, and your code has made a big difference to me.

Recently, we happen to be willing to submit the spi-mem rk sfc drivers, and we have tried some of them in the internal process. Compared with the RK internal code, I have the following thoughts on your code:
1) Only support spi-nor, not support spi-nand
2) Only support rx_dual, tx_quad, not support tx_dual, tx_quad
3) Some of the code may be further simplified, such as "rockchip_sfc_register_all"
4) Some of the logic may be further simplified, such as "rockchip_sfc_init"
5) Doesn't support SFC ver4 ver5 althought witch is compatibled with lower version

Quoted 7 lines

In order to support all these features, I adjust the drivers on the basis of your code witch is attach to these mail, these drivers have been test in linux 5.10 rk3568 board, and I'm still doing more strict tests.

So I suggest that we complete it together, or we may consider transferring it to me for submission If I have the honor.

I'm still unfamiliar with the community culture. I hope I didn't offend you. If I have, I'll say sorry in advance. Best wishes.

I am absolutely fine with you taking this on, and will be happy to help you in any way I can. I only started working on support for this because I wanted it supported in both Linux and U-Boot mainline, and didn't see any progress being made (so I thought I would do it myself). Basically, my goal all along has been to ensure the Odroid Go Advance is fully supported in mainline Linux (and U-boot), and that requires we get the audio (done), SFC (in progress), crypto, battery, charger, and everything else (done) supported.

I trust you are better able to develop/test this than I am, as I only have access to some technical documents and a single PX30 based device to test this on.

Quoted 5 lines

Please CC me when you are ready to submit upstream to Linux and U-boot and I will happily test it on my hardware. If you don't have a U-boot driver in progress let me know and I can start working on one.

Thank you.

I'm glad to receive your reply and your understanding so soon. I'll talk about my plan directly. If there is no obvious objection,I'll go on with it.

Firstly, I will submit the support for the my first version of Linux drivers next week which is base on your series submission.

After browsing your submission, there will be the following changes:
1) [RFC,v4,1/8] change with the "Rob Herring" comment
2) [RFC,v4,2/8] update driver
3) All dt patches, make a little change to compatible with RK SDK

[RFC,v4,8/8] arm64: dts: rockchip: Enable SFC for Odroid Go Advance [RFC,v4,7/8] arm64: dts: rockchip: Add SFC to RK3308 [RFC,v4,6/8] arm: dts: rockchip: Add SFC to RV1108 [RFC,v4,5/8] arm: dts: rockchip: Add SFC to RK3036 [RFC,v4,4/8] clk: rockchip: Add support for hclk_sfc on rk3036 [RFC,v4,3/8] arm64: dts: rockchip: Add SFC to PX30 [RFC,v4,2/8] spi: rockchip-sfc: add rockchip serial flash controller [RFC,v4,1/8] dt-bindings: rockchip-sfc: Bindings for Rockchip serial flash controller

Quoted 3 lines

Secondly, Keep devolop uboot drivers base on your serieas submission
https://patchwork.ozlabs.org/project/uboot/list//?series=245724
submit the code under uboot as soon as possible.

I'm actually abandoning that series of commits, in favor of one more closely related to the linux driver you're putting in place. I'd like to use the spi-mem framework for U-boot as well. I will pursue it instead and try to have something ready soon. I'm not entirely clear though from this message if you are planning on doing that as well or are asking me to pursue it. I'm entirely okay with you pursuing it, but until you tell me you are I will keep working on it so as to hopefully get something ready for the next pull window.

Quoted 5 lines

Finally I'll keep focus on the new comments about all these linux patches,then fix it until they are merged.

Best wishes.

Thank you. As you make changes I will test them and provide my tested-by tag. For now I only have an rk3326 to test them on, but I will do my best to be thorough.

Quoted 104 lines
Quoted 102 lines
Quoted 97 lines

[email protected]
From: Kever Yang
Date: 2021-06-02 09:27
To: Chris Morgan
CC: u-boot; heiko.stuebner; vigneshr; jagan; sjg; Chris Morgan; 赵仪峰; 林鼎强
Subject: Re: [RFC 0/5] rockchip_sfc: add support for Rockchip SFC Hi Chris,

Quoted 5 lines · Chris Morgan
Quoted 4 lines · Kever Yang

Add Yifeng from rockchip.

Hi Chris,

Quoted 7 lines
Quoted 2 lines

First of all, I think you should remain the origin author info in the
signed-off.

Okay, I can do that. Please note that since I submitted this I was asked to redo the upstream linux proposed driver to use the spi-mem framework. I think for now honestly I'd like to abandon this patch and resubmit a little later with one that is more or less the same (using the spi-mem framework) as the Linux driver.

This sounds better, then we can wait for driver with new framework. Thanks,
- Kever

Quoted 70 lines

https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/

Quoted 68 lines

Hi Yifeng,

Please help to review this driver.

Thanks,

- Kever

Quoted 58 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works).

The specific help I need with this patch is:

1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code.

2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further.

Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage.

Tested: Read (works)
Write (works if you write to an erased sector) Erase (works)
SPL Read (works if you edit the u-boot,spl-boot-order)

Chris Morgan (5):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
mtd: spi-nor-ids: Add XTX XT25F128B
rockchip: px30: add support for SFC for Odroid Go Advance

arch/arm/dts/px30.dtsi | 38 ++
arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi | 10 +-
arch/arm/dts/rk3326-odroid-go2.dts | 22 +
arch/arm/mach-rockchip/px30/px30.c | 64 ++
drivers/mtd/spi/Kconfig | 6 +
drivers/mtd/spi/spi-nor-ids.c | 8 +
drivers/spi/Kconfig | 8 +
drivers/spi/Makefile | 1 +
drivers/spi/rockchip_sfc.c | 652 +++++++++++++++++++++
9 files changed, 926 insertions(+), 1 deletion(-) create mode 100644 drivers/spi/rockchip_sfc.c