Add Rockchip SFC(serial flash controller) support
cover Add Rockchip SFC(serial flash controller) support
From: Chris Morgan <[email protected]>
I'm trying to revive an abandoned patch series for the Rockchip serial flash controller (SFC) found on the Rockchip PX30 SOC, as well as other SOCs by Rockchip. I'm picking this up from version 8 of the patch series located from here:
http://patchwork.ozlabs.org/project/linux-mtd/cover/[email protected]/
Changes 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 (3):
mtd: spi-nor: add rockchip serial flash controller driver
mtd: spi-nor: Bindings for Rockchip serial flash controller
arm64: dts: rockchip: Add SFC to PX30
.../mtd/rockchip,serialflash-controller.yaml | 100 ++ arch/arm64/boot/dts/rockchip/px30.dtsi | 38 + drivers/mtd/spi-nor/controllers/Kconfig | 7 + drivers/mtd/spi-nor/controllers/Makefile | 1 + .../mtd/spi-nor/controllers/rockchip-sfc.c | 944 ++++++++++++++++++ 5 files changed, 1090 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/rockchip,serialflash-controller.yaml create mode 100644 drivers/mtd/spi-nor/controllers/rockchip-sfc.c
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 1/3 mtd: spi-nor: add rockchip serial flash controller driver
From: Chris Morgan <[email protected]>
Add the rockchip serial flash controller (SFC) driver.
--- drivers/mtd/spi-nor/controllers/Kconfig | 7 + drivers/mtd/spi-nor/controllers/Makefile | 1 + .../mtd/spi-nor/controllers/rockchip-sfc.c | 944 ++++++++++++++++++ 3 files changed, 952 insertions(+) create mode 100644 drivers/mtd/spi-nor/controllers/rockchip-sfc.c
drivers/mtd/spi-nor/controllers/Kconfig +7 -0
@@ -62,3 +62,10 @@ config SPI_INTEL_SPI_PLATFORM To compile this driver as a module, choose M here: the module will be called intel-spi-platform. + +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.
drivers/mtd/spi-nor/controllers/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_SPI_NXP_SPIFI) += nxp-spifi.o obj-$(CONFIG_SPI_INTEL_SPI) += intel-spi.o obj-$(CONFIG_SPI_INTEL_SPI_PCI) += intel-spi-pci.o obj-$(CONFIG_SPI_INTEL_SPI_PLATFORM) += intel-spi-platform.o +obj-$(CONFIG_SPI_ROCKCHIP_SFC) += rockchip-sfc.o
drivers/mtd/spi-nor/controllers/rockchip-sfc.c new file +944 -0
944 lines not on this page · raw message
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH 1/3] mtd: spi-nor: add rockchip serial flash controller driver
Quoted 9 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add the rockchip serial flash controller (SFC) driver.
Signed-off-by Chris Morgan <[email protected]>--- drivers/mtd/spi-nor/controllers/Kconfig | 7 + drivers/mtd/spi-nor/controllers/Makefile | 1 + .../mtd/spi-nor/controllers/rockchip-sfc.c | 944 ++++++++++++++++++
NACK. Please don't add controller drivers here. Instead use the SPI MEM (drivers/spi/spi-mem.c) framework and put the drivers in drivers/spi/. See the history for drivers/spi/spi-cadence-quadspi.c for an example conversion. I recall mentioning this on IRC as well, but maybe my memory misleads me.
Signature · 8 lines
Regards, Pratyush Yadav Texas Instruments Inc. _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH 2/3 mtd: spi-nor: Bindings for Rockchip serial flash controller
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Add binding document for the Rockchip serial flash controller.
--- .../mtd/rockchip,serialflash-controller.yaml | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/rockchip,serialflash-controller.yaml
Documentation/devicetree/bindings/mtd/rockchip,serialflash-controller.yaml new file +100 -0
@@ -0,0 +1,100 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/rockchip,serialflash-controller.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoCs Serial FLASH Controller (SFC) + +maintainers: + - Andy Yan <[email protected]> + +properties: + compatible: + oneOf: + - const: rockchip,px30-sfc + - const: rockchip,rv1108-sfc + - items: + - const: rockchip,sfc + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + minItems: 2 + items: + - description: Module Clock + - description: Bus Clock + + clock-names: + minItems: 2 + items: + - const: sfc + - const: hsfc + + power-domains: + maxItems: 1 + + rockchip,sfc-no-dma: + - descrption: Boolean value for disabling DMA + +patternProperties: + "^spi-nor@[0-3]$": + type: object + properties: + reg: + minimum: 0 + maximum: 3 + + spi-max-frequency: + maxItems: 1 + - description: Maximum frequency for SPI Flash + + compatible: + oneOf: + - const: jedec,spi-nor + + spi-rx-bus-width: + maxItems: 1 + - description: RX Bus Width (1x, 2x, or 4x mode) + + + +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> + +sfc: spi@ff3a0000 { + compatible = "rockchip,px30-sfc","rockchip,sfc"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0xff3a0000 0x0 0x4000>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; + clock-names = "sfc", "hsfc"; + pinctrl-names = "default"; + pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>; + power-domains = <&power PX30_PD_MMC_NAND>; + + nor_flash: spi-nor@0 { + reg = <0>; + compatible = "xtx,xt25f128b","jedec,spi-nor"; + spi-rx-bus-width = <2>; + spi-max-frequency = <108000000>; + }; +}; + +...
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 3/3 arm64: dts: rockchip: Add SFC to PX30
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Add a devicetree entry for the Rockchip SFC for the PX30 SOC.
--- 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 @@ emmc: mmc@ff390000 { status = "disabled"; }; + sfc: spi@ff3a0000 { + compatible = "rockchip,px30-sfc","rockchip,sfc"; + reg = <0x0 0xff3a0000 0x0 0x4000>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; + clock-names = "sfc", "hsfc"; + pinctrl-names = "default"; + pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus4>; + 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 @@ flash_bus8: flash-bus8 { }; }; + 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 · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/