Add Rockchip SFC(serial flash controller) support
Subsystems (5)
v11 cover Add Rockchip SFC(serial flash controller) support
Changes in v11:
- The tx is set to 1 for Odroid Go Advance device
Changes in v10:
- Fix dma transfer logic
Changes in v9:
- Separate DMA IRQ setting and wait_completion from DMA fifo transfer function to make dma_status_poll be possible(Which I will implement in u-boot)
- Add SFC Kconfig detail comment
- Separate FDT binding docs and includes from rk3036 sfc_hclk patch
- Separate FDT binding docs and includes from rk3036 sfc_hclk patch
Changes in v8:
- Fix indent 4 to 2 in yaml
Changes in v7:
- Fix up the sclk_sfc parent error in rk3036
- Unify to "rockchip,sfc" compatible id because all the feature update will have a new IP version, so the driver is used for the SFC IP in all SoCs
- Change to use node "sfc" to name the SFC pinctrl group
- Add subnode reg property check
- Add rockchip_sfc_adjust_op_size to workaround in CMD + DUMMY case
- Limit max_iosize to 32KB
Changes in v6:
- Add support in device trees for rv1126(Declared in series 5 but not submitted)
- Change to use "clk_sfc" "hclk_sfc" as clock lable, since it does not affect interpretation and has been widely used
- Support sfc tx_dual, tx_quad(Declared in series 5 but not submitted)
- Simplify the code, such as remove "rockchip_sfc_register_all"(Declared in series 5 but not submitted)
- Support SFC ver4 ver5(Declared in series 5 but not submitted)
- Add author Chris Morgan and Jon Lin to spi-rockchip-sfc.c
- Change to use devm_spi_alloc_master and spi_unregister_master
Changes in v5:
- Add support in device trees for rv1126
- Support sfc tx_dual, tx_quad
- Simplify the code, such as remove "rockchip_sfc_register_all"
- Support SFC ver4 ver5
Changes in v4:
- Changing patch back to an "RFC". An engineer from Rockchip reached out to me to let me know they are working on this patch for upstream, I am submitting this v4 for the community to see however I expect Jon Lin ([email protected]) will submit new patches soon and these are the ones we should pursue for mainlining. Jon's patch series should include support for more hardware than this series.
- Clean up documentation more and ensure it is correct per make dt_binding_check.
- Add support in device trees for rk3036, rk3308, and rv1108.
- Add ahb clock (hclk_sfc) support for rk3036.
- Change rockchip_sfc_wait_fifo_ready() to use a switch statement.
- Change IRQ code to only mark IRQ as handled if it handles the specific IRQ (DMA transfer finish) it is supposed to handle.
Changes in v3:
- Changed the name of the clocks to sfc/ahb (from clk-sfc/clk-hsfc).
- Changed the compatible string from rockchip,sfc to rockchip,rk3036-sfc. A quick glance at the datasheets suggests this driver should work for the PX30, RK180x, RK3036, RK312x, RK3308 and RV1108 SoCs, and possibly more. However, I am currently only able to test this on a PX30 (an RK3326). The technical reference manuals appear to list the same registers for each device.
- Corrected devicetree documentation for formatting and to note these changes.
- Replaced the maintainer with Heiko Stuebner and myself, as we will take ownership of this going forward.
- Noted that the device (per the reference manual) supports 4 CS, but I am only able to test a single CS (CS 0).
- Reordered patches to comply with upstream rules.
Changes in v2:
- Reimplemented driver using spi-mem subsystem.
- Removed power management code as I couldn't get it working properly.
- Added device tree bindings for Odroid Go Advance.
Changes in v1:
hanges made in this new series versus the v8 of the old series:
- Added function to read spi-rx-bus-width from device tree, in the event that the SPI chip supports 4x mode but only has 2 pins wired (such as the Odroid Go Advance).
- Changed device tree documentation from txt to yaml format.
- Made "reset" message a dev_dbg from a dev_info.
- Changed read and write fifo functions to remove redundant checks.
- Changed the write and read from relaxed to non-relaxed when starting the DMA transfer or reading the DMA IRQ.
- Changed from dma_coerce_mask_and_coherent to just dma_set_mask_and_coherent.
- Changed name of get_if_type to rockchip_sfc_get_if_type.
Chris Morgan (8):
dt-bindings: rockchip-sfc: Bindings for Rockchip serial flash
controller
spi: rockchip-sfc: add rockchip serial flash controller
arm64: dts: rockchip: Add SFC to PX30
clk: rockchip: add dt-binding for hclk_sfc on rk3036
arm: dts: rockchip: Add SFC to RK3036
arm: dts: rockchip: Add SFC to RV1108
arm64: dts: rockchip: Add SFC to RK3308
arm64: dts: rockchip: Enable SFC for Odroid Go Advance
Jon Lin (2):
clk: rockchip: rk3036: fix up the sclk_sfc parent error
clk: rockchip: Add support for hclk_sfc on rk3036
.../devicetree/bindings/spi/rockchip-sfc.yaml | 88 +++ arch/arm/boot/dts/rk3036.dtsi | 42 ++ arch/arm/boot/dts/rv1108.dtsi | 37 + arch/arm64/boot/dts/rockchip/px30.dtsi | 38 + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 37 + .../boot/dts/rockchip/rk3326-odroid-go2.dts | 16 + drivers/clk/rockchip/clk-rk3036.c | 5 +- drivers/spi/Kconfig | 12 + drivers/spi/Makefile | 1 + drivers/spi/spi-rockchip-sfc.c | 681 ++++++++++++++++++ include/dt-bindings/clock/rk3036-cru.h | 1 + 11 files changed, 956 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/rockchip-sfc.yaml create mode 100644 drivers/spi/spi-rockchip-sfc.c
Signature · 1 line
2.17.1
RFC PATCH v11 1/10 dt-bindings: rockchip-sfc: Bindings for Rockchip serial flash controller
From: Chris Morgan <[email protected]>
Add bindings for the Rockchip serial flash controller. New device specific parameter of rockchip,sfc-no-dma included in documentation.
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- Fix indent 4 to 2 in yaml
Changes in v7:
- Fix up the sclk_sfc parent error in rk3036
- Unify to "rockchip,sfc" compatible id because all the feature update will have a new IP version, so the driver is used for the SFC IP in all SoCs
- Change to use node "sfc" to name the SFC pinctrl group
- Add subnode reg property check
- Add rockchip_sfc_adjust_op_size to workaround in CMD + DUMMY case
- Limit max_iosize to 32KB
Changes in v6:
- Add support in device trees for rv1126(Declared in series 5 but not submitted)
- Change to use "clk_sfc" "hclk_sfc" as clock lable, since it does not affect interpretation and has been widely used
- Support sfc tx_dual, tx_quad(Declared in series 5 but not submitted)
- Simplify the code, such as remove "rockchip_sfc_register_all"(Declared in series 5 but not submitted)
- Support SFC ver4 ver5(Declared in series 5 but not submitted)
- Add author Chris Morgan and Jon Lin to spi-rockchip-sfc.c
- Change to use devm_spi_alloc_master and spi_unregister_master
Changes in v5:
- Add support in device trees for rv1126
- Support sfc tx_dual, tx_quad
- Simplify the code, such as remove "rockchip_sfc_register_all"
- Support SFC ver4 ver5
Changes in v4:
- Changing patch back to an "RFC". An engineer from Rockchip reached out to me to let me know they are working on this patch for upstream, I am submitting this v4 for the community to see however I expect Jon Lin ([email protected]) will submit new patches soon and these are the ones we should pursue for mainlining. Jon's patch series should include support for more hardware than this series.
- Clean up documentation more and ensure it is correct per make dt_binding_check.
- Add support in device trees for rk3036, rk3308, and rv1108.
- Add ahb clock (hclk_sfc) support for rk3036.
- Change rockchip_sfc_wait_fifo_ready() to use a switch statement.
- Change IRQ code to only mark IRQ as handled if it handles the specific IRQ (DMA transfer finish) it is supposed to handle.
Changes in v3:
- Changed the name of the clocks to sfc/ahb (from clk-sfc/clk-hsfc).
- Changed the compatible string from rockchip,sfc to rockchip,rk3036-sfc. A quick glance at the datasheets suggests this driver should work for the PX30, RK180x, RK3036, RK312x, RK3308 and RV1108 SoCs, and possibly more. However, I am currently only able to test this on a PX30 (an RK3326). The technical reference manuals appear to list the same registers for each device.
- Corrected devicetree documentation for formatting and to note these changes.
- Replaced the maintainer with Heiko Stuebner and myself, as we will take ownership of this going forward.
- Noted that the device (per the reference manual) supports 4 CS, but I am only able to test a single CS (CS 0).
- Reordered patches to comply with upstream rules.
Changes in v2:
- Reimplemented driver using spi-mem subsystem.
- Removed power management code as I couldn't get it working properly.
- Added device tree bindings for Odroid Go Advance.
Changes in v1:
hanges made in this new series versus the v8 of the old series:
- Added function to read spi-rx-bus-width from device tree, in the event that the SPI chip supports 4x mode but only has 2 pins wired (such as the Odroid Go Advance).
- Changed device tree documentation from txt to yaml format.
- Made "reset" message a dev_dbg from a dev_info.
- Changed read and write fifo functions to remove redundant checks.
- Changed the write and read from relaxed to non-relaxed when starting the DMA transfer or reading the DMA IRQ.
- Changed from dma_coerce_mask_and_coherent to just dma_set_mask_and_coherent.
- Changed name of get_if_type to rockchip_sfc_get_if_type.
.../devicetree/bindings/spi/rockchip-sfc.yaml | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/rockchip-sfc.yaml
Documentation/devicetree/bindings/spi/rockchip-sfc.yaml new file +88 -0
@@ -0,0 +1,88 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/rockchip-sfc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip Serial Flash Controller (SFC) + +maintainers: + - Heiko Stuebner <[email protected]> + - Chris Morgan <[email protected]> + +allOf: + - $ref: spi-controller.yaml# + +properties: + compatible: + oneOf: + - const: rockchip,sfc + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Bus Clock + - description: Module Clock + + clock-names: + items: + - const: clk_sfc + - const: hclk_sfc + + power-domains: + maxItems: 1 + + rockchip,sfc-no-dma: + description: Disable DMA and utilize FIFO mode only + type: boolean + +patternProperties: + "^flash@[0-3]$": + type: object + properties: + reg: + minimum: 0 + maximum: 3 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/px30-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/px30-power.h> + + sfc: spi@ff3a0000 { + compatible = "rockchip,sfc"; + reg = <0xff3a0000 0x4000>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; + clock-names = "clk_sfc", "hclk_sfc"; + pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>; + pinctrl-names = "default"; + power-domains = <&power PX30_PD_MMC_NAND>; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <108000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <2>; + }; + }; + +...
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [RFC PATCH v11 01/10] dt-bindings: rockchip-sfc: Bindings for Rockchip serial flash controller
Quoted 7 lines · Jon Lin
From: Chris Morgan <[email protected]>
Add bindings for the Rockchip serial flash controller. New device specific parameter of rockchip,sfc-no-dma included in documentation.
Signed-off-by Chris Morgan <[email protected]>Signed-off-by Jon Lin <[email protected]>
Quoted 7 lines
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- Fix indent 4 to 2 in yaml
Sigh, my comments from v7 still remain. I told you the same thing on v8.
Quoted 98 lines
Changes in v7:
- Fix up thesclk_sfcparent error in rk3036
- Unify to "rockchip,sfc" compatible id because all the feature update will have a new IP version, so the driver is used for the SFC IP in all SoCs
- Change to use node "sfc" to name the SFC pinctrl group
- Add subnode reg property check
- Addrockchip_sfc_adjust_op_sizeto workaround in CMD + DUMMY case
- Limitmax_iosizeto 32KBChanges in v6:
- Add support in device trees for rv1126(Declared in series 5 but not submitted)
- Change to use "clk_sfc" "hclk_sfc" as clock lable, since it does not affect interpretation and has been widely used
- Support sfctx_dual,tx_quad(Declared in series 5 but not submitted)
- Simplify the code, such as remove "rockchip_sfc_register_all"(Declared in series 5 but not submitted)
- Support SFC ver4 ver5(Declared in series 5 but not submitted)
- Add author Chris Morgan and Jon Lin tospi-rockchip-sfc.c
- Change to usedevm_spi_alloc_masterandspi_unregister_masterChanges in v5:
- Add support in device trees for rv1126
- Support sfctx_dual,tx_quad
- Simplify the code, such as remove "rockchip_sfc_register_all"
- Support SFC ver4 ver5Changes in v4:
- Changing patch back to an "RFC". An engineer from Rockchip reached out to me to let me know they are working on this patch for upstream, I am submitting this v4 for the community to see however I expect Jon Lin ([email protected]) will submit new patches soon and these are the ones we should pursue for mainlining. Jon's patch series should include support for more hardware than this series.
- Clean up documentation more and ensure it is correct per makedt_binding_check.
- Add support in device trees for rk3036, rk3308, and rv1108.
- Add ahb clock (hclk_sfc) support for rk3036.
- Changerockchip_sfc_wait_fifo_ready()to use a switch statement.
- Change IRQ code to only mark IRQ as handled if it handles the specific IRQ (DMA transfer finish) it is supposed to handle.Changes in v3:
- Changed the name of the clocks to sfc/ahb (from clk-sfc/clk-hsfc).
- Changed the compatible string from rockchip,sfc to rockchip,rk3036-sfc. A quick glance at the datasheets suggests this driver should work for the PX30, RK180x, RK3036, RK312x, RK3308 and RV1108 SoCs, and possibly more. However, I am currently only able to test this on a PX30 (an RK3326). The technical reference manuals appear to list the same registers for each device.
- Corrected devicetree documentation for formatting and to note these changes.
- Replaced the maintainer with Heiko Stuebner and myself, as we will take ownership of this going forward.
- Noted that the device (per the reference manual) supports 4 CS, but I am only able to test a single CS (CS 0).
- Reordered patches to comply with upstream rules.Changes in v2:
- Reimplemented driver using spi-mem subsystem.
- Removed power management code as I couldn't get it working properly.
- Added device tree bindings for Odroid Go Advance.Changes in v1:
hanges made in this new series versus the v8 of the old series:
- Added function to read spi-rx-bus-width from device tree, in the event that the SPI chip supports 4x mode but only has 2 pins wired (such as the Odroid Go Advance).
- Changed device tree documentation from txt to yaml format.
- Made "reset" message adev_dbgfrom adev_info.
- Changed read and write fifo functions to remove redundant checks.
- Changed the write and read from relaxed to non-relaxed when starting the DMA transfer or reading the DMA IRQ.
- Changed fromdma_coerce_mask_and_coherentto justdma_set_mask_and_coherent.
- Changed name ofget_if_typetorockchip_sfc_get_if_type..../devicetree/bindings/spi/rockchip-sfc.yaml | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/rockchip-sfc.yamlDocumentation/devicetree/bindings/spi/rockchip-sfc.yaml new file +8
-0@@ -0,0 +1,88 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/rockchip-sfc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip Serial Flash Controller (SFC) +
Documentation/devicetree/bindings/spi/rockchip-sfc.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/spi/rockchip-sfc.yaml new file +10
-0+maintainers: + - Heiko Stuebner <[email protected]> + - Chris Morgan <[email protected]> + +allOf: + - $ref: spi-controller.yaml# + +properties: + compatible: + oneOf:
Don't need oneOf when there is only one.
Documentation/devicetree/bindings/spi/rockchip-sfc.yaml line 19
Quoted 1 line
Documentation/devicetree/bindings/spi/rockchip-sfc.yaml new file +1
-0+ - const: rockchip,sfc
As I mentioned in v7, add a comment here why a non-specific compatible string is okay here.
Quoted 75 lines
Documentation/devicetree/bindings/spi/rockchip-sfc.yaml new file +69
-0+ + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Bus Clock + - description: Module Clock + + clock-names: + items: + - const: clk_sfc + - const: hclk_sfc + + power-domains: + maxItems: 1 + + rockchip,sfc-no-dma: + description: Disable DMA and utilize FIFO mode only + type: boolean + +patternProperties: + "^flash@[0-3]$": + type: object + properties: + reg: + minimum: 0 + maximum: 3 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/px30-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/px30-power.h> + + sfc: spi@ff3a0000 { + compatible = "rockchip,sfc"; + reg = <0xff3a0000 0x4000>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; + clock-names = "clk_sfc", "hclk_sfc"; + pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>; + pinctrl-names = "default"; + power-domains = <&power PX30_PD_MMC_NAND>; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <108000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <2>; + }; + }; + +...Signature · 1 line
2.17.1
RFC PATCH v11 2/10 spi: rockchip-sfc: add rockchip serial flash controller
In reply to Jon LinFrom: Chris Morgan <[email protected]>
Add the rockchip serial flash controller (SFC) driver.
---
Changes in v11: None
Changes in v10:
- Fix dma transfer logic
Changes in v9:
- Separate DMA IRQ setting and wait_completion from DMA fifo transfer function to make dma_status_poll be possible(Which I will implement in u-boot)
- Add SFC Kconfig detail comment
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
drivers/spi/Kconfig | 12 + drivers/spi/Makefile | 1 + drivers/spi/spi-rockchip-sfc.c | 681 +++++++++++++++++++++++++++++++++ 3 files changed, 694 insertions(+) create mode 100644 drivers/spi/spi-rockchip-sfc.c
drivers/spi/Kconfig +12 -0
@@ -658,6 +658,18 @@ config SPI_ROCKCHIP The main usecase of this controller is to use spi flash as boot device. +config SPI_ROCKCHIP_SFC + tristate "Rockchip Serial Flash Controller (SFC)" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM && HAS_DMA + help + This enables support for Rockchip serial flash controller. This + is a specialized controller used to access SPI flash on some + Rockchip SOCs. + + ROCKCHIP SFC supports DMA and PIO modes. When DMA is not available, + the driver automatically falls back to PIO mode. + config SPI_RB4XX tristate "Mikrotik RB4XX SPI master" depends on SPI_MASTER && ATH79
drivers/spi/Makefile +1 -0
@@ -95,6 +95,7 @@ obj-$(CONFIG_SPI_QCOM_GENI) += spi-geni-qcom.o obj-$(CONFIG_SPI_QCOM_QSPI) += spi-qcom-qspi.o obj-$(CONFIG_SPI_QUP) += spi-qup.o obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o +obj-$(CONFIG_SPI_ROCKCHIP_SFC) += spi-rockchip-sfc.o obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o obj-$(CONFIG_MACH_REALTEK_RTL) += spi-realtek-rtl.o obj-$(CONFIG_SPI_RPCIF) += spi-rpc-if.o
drivers/spi/spi-rockchip-sfc.c new file +681 -0
681 lines not on this page · raw message
Signature · 1 line
2.17.1
Mark Brown
maintainerRe: [RFC PATCH v11 02/10] spi: rockchip-sfc: add rockchip serial flash controller
On Wed, Jul 07, 2021 at 05:08:02PM +0800, Jon Lin wrote:
This looks pretty nice, a few small issues below but nothing major:
Quoted 4 lines
+/* Maximum clock values from datasheet suggest keeping clock value under
+ * 150MHz. No minimum or average value is suggested, but the U-boot BSP driver
+ * has a minimum of 10MHz and a default of 80MHz which seems reasonable.
+ */
It's OK to just not specify a minimum if the hardware doesn't have one, and AFAICT the driver doesn't actually use the default speed (the SPI stack will generally try to go as fast as possible by default, the board can configure the maximum speed and should be doing that if there's issues).
Quoted 5 lines
drivers/spi/spi-rockchip-sfc.c new file +5
-0+static irqreturn_t rockchip_sfc_irq_handler (int irq,void *dev_id) +{ +struct rockchip_sfc *sfc = dev_id; +u32 reg; +
drivers/spi/spi-rockchip-sfc.c line 542
Quoted 10 lines
drivers/spi/spi-rockchip-sfc.c new file +10
-0+ reg =readl (sfc->regbase +SFC_RISR ); + +/* Clear interrupt */ +writel_relaxed (reg, sfc->regbase +SFC_ICLR ); + +if (reg &SFC_RISR_DMA ) +complete (&sfc->cp); + +return IRQ_HANDLED ; +}
This will unconditionally ack any interrupt that is flagged, and doesn't verify that there were any at all. This won't work if the interrupt ever gets shared and will mean that if something goes wrong and an unexpected interrupt happens we'll at best just ignore it, at worst we'll end up with a screaming interrupt constantly firing. It'd be better to at least return IRQ_NONE if we got anything unexpected (I guess just if SFC_RISR_DMA isn't set, assuming there's nothing else we're intentionally ignoring).
drivers/spi/spi-rockchip-sfc.c line 558
Quoted 1 line
drivers/spi/spi-rockchip-sfc.c new file +1
-0+ master->mode_bits =SPI_TX_QUAD |SPI_TX_DUAL |SPI_RX_QUAD |SPI_RX_DUAL ;
Should it also do SPI_HALF_DUPLEX?
drivers/spi/spi-rockchip-sfc.c line 625
Quoted 7 lines
drivers/spi/spi-rockchip-sfc.c new file +7
-0+ ret =devm_request_irq (dev, ret, rockchip_sfc_irq_handler, +0 , pdev->name, sfc); +if (ret) { +dev_err (dev,"Failed to request irq\n" ); + +return ret; + }
Should we have a call to _irq_mask() before this to make sure that the mask is set up correctly in the hardware, just in case?
RFC PATCH v11 3/10 arm64: dts: rockchip: Add SFC to PX30
In reply to Jon LinFrom: Chris Morgan <[email protected]>
Add a devicetree entry for the Rockchip SFC for the PX30 SOC.
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
arch/arm64/boot/dts/rockchip/px30.dtsi | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
arch/arm64/boot/dts/rockchip/px30.dtsi +38 -0
@@ -966,6 +966,18 @@ status = "disabled"; }; + sfc: spi@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-0 = <&sfc_clk &sfc_cs0 &sfc_bus4>; + pinctrl-names = "default"; + power-domains = <&power PX30_PD_MMC_NAND>; + status = "disabled"; + }; + nfc: nand-controller@ff3b0000 { compatible = "rockchip,px30-nfc"; reg = <0x0 0xff3b0000 0x0 0x4000>;
@@ -1967,6 +1979,32 @@ }; }; + sfc { + 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_cs0: sfc-cs0 { + 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
RFC PATCH v11 4/10 clk: rockchip: rk3036: fix up the sclk_sfc parent error
In reply to Jon LinChoose the correct pll
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
drivers/clk/rockchip/clk-rk3036.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3036.c +2 -1
@@ -121,6 +121,7 @@ PNAME(mux_pll_src_3plls_p) = { "apll", "dpll", "gpll" };PNAME (mux_timer_p) = {"xin24m" ,"pclk_peri_src" };PNAME (mux_pll_src_apll_dpll_gpll_usb480m_p) = {"apll" ,"dpll" ,"gpll" ,"usb480m" }; +PNAME (mux_pll_src_dmyapll_dpll_gpll_xin24_p) = {"dummy_apll" ,"dpll" ,"gpll" ,"xin24m" };PNAME (mux_mmc_src_p) = {"apll" ,"dpll" ,"gpll" ,"xin24m" };PNAME (mux_i2s_pre_p) = {"i2s_src" ,"i2s_frac" ,"ext_i2s" ,"xin12m" };
@@ -340,7 +341,7 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = { RK2928_CLKSEL_CON(16), 8, 2, MFLAGS, 10, 5, DFLAGS, RK2928_CLKGATE_CON(10), 4, GFLAGS), -COMPOSITE (SCLK_SFC ,"sclk_sfc" , mux_pll_src_apll_dpll_gpll_usb480m_p,0 , +COMPOSITE (SCLK_SFC ,"sclk_sfc" , mux_pll_src_dmyapll_dpll_gpll_xin24_p,0 ,RK2928_CLKSEL_CON (16 ),0 ,2 ,MFLAGS ,2 ,5 ,DFLAGS , RK2928_CLKGATE_CON(10), 5, GFLAGS),
Signature · 1 line
2.17.1
RFC PATCH v11 5/10 clk: rockchip: add dt-binding for hclk_sfc on rk3036
In reply to Jon LinFrom: Chris Morgan <[email protected]>
Add dt-binding for hclk_sfc on rk3036
---
Changes in v11: None
Changes in v10: None
Changes in v9:
- Separate FDT binding docs and includes from rk3036 sfc_hclk patch
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
include/dt-bindings/clock/rk3036-cru.h | 1 + 1 file changed, 1 insertion(+)
include/dt-bindings/clock/rk3036-cru.h +1 -0
@@ -81,6 +81,7 @@#define HCLK_OTG0 449#define HCLK_OTG1 450#define HCLK_NANDC 453 +#define HCLK_SFC 454#define HCLK_SDMMC 456#define HCLK_SDIO 457#define HCLK_EMMC 459
Signature · 1 line
2.17.1
RFC PATCH v11 6/10 clk: rockchip: Add support for hclk_sfc on rk3036
Add support for the bus clock for the serial flash controller on the rk3036. Taken from the Rockchip BSP kernel but not tested on real hardware (as I lack a 3036 based SoC to test).
---
Changes in v11: None
Changes in v10: None
Changes in v9:
- Separate FDT binding docs and includes from rk3036 sfc_hclk patch
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
drivers/clk/rockchip/clk-rk3036.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3036.c +1 -1
@@ -404,7 +404,7 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = {GATE (HCLK_OTG0 ,"hclk_otg0" ,"hclk_peri" ,CLK_IGNORE_UNUSED ,RK2928_CLKGATE_CON (5 ),13 ,GFLAGS ),GATE (HCLK_OTG1 ,"hclk_otg1" ,"hclk_peri" ,CLK_IGNORE_UNUSED ,RK2928_CLKGATE_CON (7 ),3 ,GFLAGS ),GATE (HCLK_I2S ,"hclk_i2s" ,"hclk_peri" ,0 ,RK2928_CLKGATE_CON (7 ),2 ,GFLAGS ), -GATE (0 ,"hclk_sfc" ,"hclk_peri" ,CLK_IGNORE_UNUSED ,RK2928_CLKGATE_CON (3 ),14 ,GFLAGS ), +GATE (HCLK_SFC ,"hclk_sfc" ,"hclk_peri" ,0 ,RK2928_CLKGATE_CON (3 ),14 ,GFLAGS ), GATE(HCLK_MAC, "hclk_mac", "hclk_peri", 0, RK2928_CLKGATE_CON(3), 5, GFLAGS),/* pclk_peri gates */
Signature · 1 line
2.17.1
RFC PATCH v11 7/10 arm: dts: rockchip: Add SFC to RK3036
In reply to Jon LinFrom: Chris Morgan <[email protected]>
Add a devicetree entry for the Rockchip SFC for the RK3036 SOC.
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
arch/arm/boot/dts/rk3036.dtsi | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm/boot/dts/rk3036.dtsi +42 -0
@@ -206,6 +206,17 @@ status = "disabled"; }; + sfc: spi@10208000 { + compatible = "rockchip,sfc"; + reg = <0x10208000 0x4000>; + interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; + clock-names = "clk_sfc", "hclk_sfc"; + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus4>; + pinctrl-names = "default"; + status = "disabled"; + }; + sdmmc: mmc@10214000 { compatible = "rockchip,rk3036-dw-mshc", "rockchip,rk3288-dw-mshc"; reg = <0x10214000 0x4000>;
@@ -684,6 +695,37 @@ }; }; + sfc { + sfc_bus4: sfc-bus4 { + rockchip,pins = + <1 RK_PD0 3 &pcfg_pull_none>, + <1 RK_PD1 3 &pcfg_pull_none>, + <1 RK_PD2 3 &pcfg_pull_none>, + <1 RK_PD3 3 &pcfg_pull_none>; + }; + + sfc_bus2: sfc-bus2 { + rockchip,pins = + <1 RK_PD0 3 &pcfg_pull_none>, + <1 RK_PD1 3 &pcfg_pull_none>; + }; + + sfc_cs0: sfc-cs0 { + rockchip,pins = + <2 RK_PA2 3 &pcfg_pull_none>; + }; + + sfc_cs1: sfc-cs1 { + rockchip,pins = + <2 RK_PA3 3 &pcfg_pull_none>; + }; + + sfc_clk: sfc-clk { + rockchip,pins = + <2 RK_PA4 3 &pcfg_pull_none>; + }; + }; + emac { emac_xfer: emac-xfer { rockchip,pins = <2 RK_PB2 1 &pcfg_pull_default>, /* crs_dvalid */
Signature · 1 line
2.17.1
RFC PATCH v11 8/10 arm: dts: rockchip: Add SFC to RV1108
In reply to Jon LinFrom: Chris Morgan <[email protected]>
Add a devicetree entry for the Rockchip SFC for the RV1108 SOC.
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
arch/arm/boot/dts/rv1108.dtsi | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm/boot/dts/rv1108.dtsi +37 -0
@@ -536,6 +536,17 @@ status = "disabled"; }; + sfc: spi@301c0000 { + compatible = "rockchip,sfc"; + reg = <0x301c0000 0x4000>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; + clock-names = "clk_sfc", "hclk_sfc"; + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus4>; + pinctrl-names = "default"; + status = "disabled"; + }; + gmac: eth@30200000 { compatible = "rockchip,rv1108-gmac"; reg = <0x30200000 0x10000>;
@@ -704,6 +715,32 @@ }; }; + sfc { + sfc_bus4: sfc-bus4 { + rockchip,pins = + <2 RK_PA0 3 &pcfg_pull_none>, + <2 RK_PA1 3 &pcfg_pull_none>, + <2 RK_PA2 3 &pcfg_pull_none>, + <2 RK_PA3 3 &pcfg_pull_none>; + }; + + sfc_bus2: sfc-bus2 { + rockchip,pins = + <2 RK_PA0 3 &pcfg_pull_none>, + <2 RK_PA1 3 &pcfg_pull_none>; + }; + + sfc_cs0: sfc-cs0 { + rockchip,pins = + <2 RK_PB4 3 &pcfg_pull_none>; + }; + + sfc_clk: sfc-clk { + rockchip,pins = + <2 RK_PB7 2 &pcfg_pull_none>; + }; + }; + gmac { rmii_pins: rmii-pins { rockchip,pins = <1 RK_PC5 2 &pcfg_pull_none>,
Signature · 1 line
2.17.1
RFC PATCH v11 9/10 arm64: dts: rockchip: Add SFC to RK3308
In reply to Jon LinFrom: Chris Morgan <[email protected]>
Add a devicetree entry for the Rockchip SFC for the RK3308 SOC.
---
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
arch/arm64/boot/dts/rockchip/rk3308.dtsi | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/rockchip/rk3308.dtsi +37 -0
@@ -637,6 +637,17 @@ status = "disabled"; }; + sfc: spi@ff4c0000 { + compatible = "rockchip,sfc"; + reg = <0x0 0xff4c0000 0x0 0x4000>; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; + clock-names = "clk_sfc", "hclk_sfc"; + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus4>; + pinctrl-names = "default"; + status = "disabled"; + }; + cru: clock-controller@ff500000 { compatible = "rockchip,rk3308-cru"; reg = <0x0 0xff500000 0x0 0x1000>;
@@ -910,6 +921,32 @@ }; }; + sfc { + sfc_bus4: sfc-bus4 { + rockchip,pins = + <3 RK_PA0 3 &pcfg_pull_none>, + <3 RK_PA1 3 &pcfg_pull_none>, + <3 RK_PA2 3 &pcfg_pull_none>, + <3 RK_PA3 3 &pcfg_pull_none>; + }; + + sfc_bus2: sfc-bus2 { + rockchip,pins = + <3 RK_PA0 3 &pcfg_pull_none>, + <3 RK_PA1 3 &pcfg_pull_none>; + }; + + sfc_cs0: sfc-cs0 { + rockchip,pins = + <3 RK_PA4 3 &pcfg_pull_none>; + }; + + sfc_clk: sfc-clk { + rockchip,pins = + <3 RK_PA5 3 &pcfg_pull_none>; + }; + }; + gmac { rmii_pins: rmii-pins { rockchip,pins =
Signature · 1 line
2.17.1
RFC PATCH v11 10/10 arm64: dts: rockchip: Enable SFC for Odroid Go Advance
In reply to Jon LinFrom: Chris Morgan <[email protected]>
This enables the Rockchip Serial Flash Controller for the Odroid Go Advance. Note that while the attached SPI NOR flash and the controller both support quad read mode, only 2 of the required 4 pins are present. The rx bus width is set to 2 for this reason, and tx bus width is set to 1 for compatibility reasons.
---
Changes in v11:
- The tx is set to 1 for Odroid Go Advance device
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None
.../boot/dts/rockchip/rk3326-odroid-go2.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +16 -0
@@ -484,6 +484,22 @@ status = "okay"; }; +&sfc { + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus2>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <108000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <1>; + }; +}; + &tsadc { status = "okay"; };
Signature · 1 line
2.17.1
Re: [RFC PATCH v11 10/10] arm64: dts: rockchip: Enable SFC for Odroid Go Advance
Quoted 7 lines · Jon Lin
From: Chris Morgan <[email protected]>
This enables the Rockchip Serial Flash Controller for the Odroid Go Advance. Note that while the attached SPI NOR flash and the controller both support quad read mode, only 2 of the required 4 pins are present. The rx bus width is set to 2 for this reason, and tx bus width is set to 1 for compatibility reasons.
Thank you, I just tested this patch again and all seems to be well.
Quoted 54 lines
Signed-off-by Chris Morgan <[email protected]>Signed-off-by Jon Lin <[email protected]>---
Changes in v11:
- The tx is set to 1 for Odroid Go Advance deviceChanges in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1: None.../boot/dts/rockchip/rk3326-odroid-go2.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +16
-0@@ -484,6 +484,22 @@ status = "okay"; }; +&sfc { + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus2>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <108000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <1>; + }; +}; + &tsadc { status = "okay"; };Signature · 1 line
2.17.1
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip