rockchip_sfc: add support for Rockchip SFC
Subsystems (4)
v8 cover rockchip_sfc: add support for Rockchip SFC
Changes in v8:
- Move speed operation to set_speed logic
- Use read_poll
- Change debug to dev_dbg
- Simply exec_op dma logic
- Change to use tx single line to make a good compatible
- Change spiflash dts node
Changes in v7:
- Make sfc-use-dma configurable
- Make px30 SFC clock configurable
Changes in v6:
- Fix dma transfer logic
- Fix the error of the way to wait for dma transfer finished status
Changes in v5:
- Support dma transfer
- Add CONFIG_IS_ENABLED(CLK) limitation
- Support spinand devices
- Support SFC ver4 ver5
- Using "rockchip, sfc" as compatible id
- Get clock from the index to compatible with those case which's clock-names is not parsed
- px30 use "rockchip, sfc" as compatible id
Changes in v4:
- None
Changes in v3:
- Added "rockchip_sfc_adjust_op_work()" function from proposed Linux driver to fix potential issue on hardware. Note I never noticed this issue while testing, so I cannot test if it fixed any specific issue for me.
- Updated of-compatible string back to "rockchip,sfc" to match what is currently proposed for upstream driver. The hardware itself has multiple versions but a register is present in the hardware that is read by the driver to set version specific functionality.
- Updated px30.dtsi and rk3266-odroid-go2.dts device-trees so that sfc nodes match what is in upstream.
Changes in v2:
- Resending due to glitch with patch file truncating final two lines on patch 1/5 and incorrect patch version number on patch 5/5.
Changes in v1:
- Reworked code to utilize spi-mem framework, and based it closely off of work in progress code for mainline Linux.
- Removed DMA, as it didn't offer much performance benefit for booting (in my test cases), added complexity to the code, and interfered with A-TF.
- Updated the names of the bindings to match the work in progress Linux code.
- Moved alias to u-boot specific device-tree for Odroid Go Advance. Alias is updated with the spi0 node pointing to the SFC to help the sf command as well as facilitate booting from the SFC.
- Note 2 below no longer applies, as rebasing this off of upstream code should allow the device to work for NAND, and by utilizing the spi-mem framework it no longer has to extract the parameters
Chris Morgan (4):
spi: rockchip_sfc: add support for Rockchip SFC
rockchip: px30: Add support for using SFC
rockchip: px30: add the serial flash controller
rockchip: px30: add support for SFC for Odroid Go Advance
Jon Lin (1):
rockchip: px30: Support configure SFC
Tom Rini (1):
CI: Update to LLVM-12
.azure-pipelines.yml | 4 +- .gitlab-ci.yml | 4 +- arch/arm/dts/px30.dtsi | 38 ++ arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi | 17 + arch/arm/dts/rk3326-odroid-go2.dts | 16 + arch/arm/mach-rockchip/px30/px30.c | 64 ++ drivers/clk/rockchip/clk_px30.c | 32 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/rockchip_sfc.c | 646 +++++++++++++++++++++ tools/docker/Dockerfile | 6 +- 11 files changed, 829 insertions(+), 7 deletions(-) create mode 100644 drivers/spi/rockchip_sfc.c
Signature · 1 line
2.17.1
RFC PATCH v8 1/6 CI: Update to LLVM-12
From: Tom Rini <[email protected]>
The current stable release of LLVM is 12, update to that. While at it, fix that we had not correctly upgraded to LLVM 11 previously.
---
(no changes since v1)
.azure-pipelines.yml | 4 ++-- .gitlab-ci.yml | 4 ++-- tools/docker/Dockerfile | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
.azure-pipelines.yml +2 -2
@@ -2,7 +2,7 @@ variables: windows_vm: vs2017-win2016 ubuntu_vm: ubuntu-18.04 macos_vm: macOS-10.15 - ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20210609-06Jul2021 + ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20210723-04Aug2021 # Add '-u 0' options for Azure pipelines, otherwise we get "permission # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer", # since our $(ci_runner_image) user is not root.
@@ -183,7 +183,7 @@ jobs: TEST_PY_BD: "sandbox" sandbox_clang: TEST_PY_BD: "sandbox" - OVERRIDE: "-O clang-10" + OVERRIDE: "-O clang-12" sandbox_spl: TEST_PY_BD: "sandbox_spl" TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
.gitlab-ci.yml +2 -2
@@ -2,7 +2,7 @@ # Grab our configured image. The source for this is found at: # https://source.denx.de/u-boot/gitlab-ci-runner -image: trini/u-boot-gitlab-ci-runner:focal-20210609-06Jul2021 +image: trini/u-boot-gitlab-ci-runner:focal-20210723-04Aug2021 # We run some tests in different order, to catch some failures quicker. stages:
@@ -178,7 +178,7 @@ sandbox test.py: sandbox with clang test.py: variables: TEST_PY_BD: "sandbox" - OVERRIDE: "-O clang-10" + OVERRIDE: "-O clang-12" <<: *buildman_and_testpy_dfn sandbox_spl test.py:
tools/docker/Dockerfile +3 -3
@@ -2,7 +2,7 @@ # This Dockerfile is used to build an image containing basic stuff to be used # to build U-Boot and run our test suites. -FROM ubuntu:focal-20210609 +FROM ubuntu:focal-20210723 MAINTAINER Tom Rini <[email protected]> LABEL Description=" This image is for building U-Boot inside a container"
@@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Add LLVM repository RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/* RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main | tee /etc/apt/sources.list.d/llvm.list +RUN echo deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main | tee /etc/apt/sources.list.d/llvm.list # Manually install the kernel.org "Crosstool" based toolchains for gcc-11.1.0 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.1.0/x86_64-gcc-11.1.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ
@@ -39,7 +39,7 @@ RUN apt-get update && apt-get install -y \ binutils-dev \ bison \ build-essential \ - clang-10 \ + clang-12 \ coreutils \ cpio \ cppcheck \
Signature · 1 line
2.17.1
RFC PATCH v8 2/6 spi: rockchip_sfc: add support for Rockchip SFC
In reply to Jon LinFrom: Chris Morgan <[email protected]>
This patch adds support for the Rockchip serial flash controller found on the PX30 SoC. It should work for versions 3-5 of the SFC IP, however I am only able to test it on v3.
This is adapted from the WIP SPI-MEM driver for the SFC on mainline Linux. Note that the main difference between this and earlier versions of the driver is that this one does not support DMA. In testing the performance difference (performing a dual mode read on a 128Mb chip) is negligible. DMA, if used, must also be disabled in SPL mode when using A-TF anyway.
---
Changes in v8:
- Move speed operation to set_speed logic
- Use read_poll
- Change debug to dev_dbg
- Simply exec_op dma logic
Changes in v7:
- Make sfc-use-dma configurable
Changes in v6:
- Fix dma transfer logic
- Fix the error of the way to wait for dma transfer finished status
Changes in v5:
- Support dma transfer
- Add CONFIG_IS_ENABLED(CLK) limitation
- Support spinand devices
- Support SFC ver4 ver5
- Using "rockchip, sfc" as compatible id
- Get clock from the index to compatible with those case which's clock-names is not parsed
Changes in v4:
- None
Changes in v3:
- Added "rockchip_sfc_adjust_op_work()" function from proposed Linux driver to fix potential issue on hardware. Note I never noticed this issue while testing, so I cannot test if it fixed any specific issue for me.
- Updated of-compatible string back to "rockchip,sfc" to match what is currently proposed for upstream driver. The hardware itself has multiple versions but a register is present in the hardware that is read by the driver to set version specific functionality.
- Updated px30.dtsi and rk3266-odroid-go2.dts device-trees so that sfc nodes match what is in upstream.
Changes in v2:
- Resending due to glitch with patch file truncating final two lines on patch 1/5 and incorrect patch version number on patch 5/5.
Changes in v1:
- Reworked code to utilize spi-mem framework, and based it closely off of work in progress code for mainline Linux.
- Removed DMA, as it didn't offer much performance benefit for booting (in my test cases), added complexity to the code, and interfered with A-TF.
- Updated the names of the bindings to match the work in progress Linux code.
- Moved alias to u-boot specific device-tree for Odroid Go Advance. Alias is updated with the spi0 node pointing to the SFC to help the sf command as well as facilitate booting from the SFC.
- Note 2 below no longer applies, as rebasing this off of upstream code should allow the device to work for NAND, and by utilizing the spi-mem framework it no longer has to extract the parameters
drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/rockchip_sfc.c | 646 +++++++++++++++++++++++++++++++++++++ 3 files changed, 655 insertions(+) create mode 100644 drivers/spi/rockchip_sfc.c
drivers/spi/Kconfig +8 -0
@@ -319,6 +319,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
@@ -54,6 +54,7 @@ obj-$(CONFIG_PL022_SPI) += pl022_spi.o obj-$(CONFIG_SPI_QUP) += spi-qup.o obj-$(CONFIG_SPI_MXIC) += spi-mxic.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 +646 -0
646 lines not on this page · raw message
Signature · 1 line
2.17.1
RFC PATCH v8 3/6 rockchip: px30: Add support for using SFC
In reply to Jon LinFrom: Chris Morgan <[email protected]>
This patch adds support for setting the correct pin configuration for the Rockchip Serial Flash Controller found on the PX30.
---
(no changes since v1)
arch/arm/mach-rockchip/px30/px30.c | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
arch/arm/mach-rockchip/px30/px30.c +64 -0
@@ -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.17.1
RFC PATCH v8 4/6 rockchip: px30: add the serial flash controller
In reply to Jon LinFrom: Chris Morgan <[email protected]>
Add the serial flash controller to the devicetree for the PX30.
---
(no changes since v5)
Changes in v5:
- px30 use "rockchip, sfc" as compatible id
arch/arm/dts/px30.dtsi | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
arch/arm/dts/px30.dtsi +38 -0
@@ -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.17.1