Add arm pl353 smc memory and nand driver for xilinx zynq soc
v13 cover Add arm pl353 smc memory and nand driver for xilinx zynq soc
The following patches add arm pl353 static memory controller driver and NAND driver for Xilinx Zynq SoC. The arm pl353 smc supports two interfaces i.e nand and NOR/SRAM memory interfaces. The current implementation supports only a single SMC instance and nand specific configuration.
Xilinx Zynq TRM link:
http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf
ARM pl353 smc TRM link:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0380g/DDI0380G_smc_pl350_series_r2p1_trm.pdf
Tested Micron MT29F2G08ABAEAWP (On-die capable) and AMD/Spansion S34ML01G1. This latest series make use of ->exec_op().
Naga Sureshkumar Relli (2):
dt-bindings: memory: Add pl353 smc controller devicetree binding
information
memory: pl353: Add driver for arm pl353 static memory controller
.../bindings/memory-controllers/pl353-smc.txt | 47 +++ drivers/memory/Kconfig | 9 + drivers/memory/Makefile | 1 + drivers/memory/pl353-smc.c | 464 +++++++++++++++++++++ include/linux/pl353-smc.h | 30 ++ 5 files changed, 551 insertions(+) create mode 100644 Documentation/devicetree/bindings/memory-controllers/pl353-smc.txt create mode 100644 drivers/memory/pl353-smc.c create mode 100644 include/linux/pl353-smc.h
Signature · 1 line
2.7.4
PATCH v13 1/2 dt-bindings: memory: Add pl353 smc controller devicetree binding information
Add pl353 static memory controller devicetree binding information.
---
Changes in v13:
- Added change log
Changes in v12:
- None
Changes in v11:
- Changed the subject to dt-bindings
- Restuctured dt binings to represent peripherals based on ranges property as suggested by Boris.
Now the new bindings uses cs as first address cell value similar to atmel EBI/SMC.
- Added "arm,primecell" as compatible to the existing compatible property as per Linus Walleji
- Changed "aper_clk" to "apb_pclk" as per ARM AMBA peripheral documentation as per Linus Walleji.
Changes in v10:
- Corrected the typos like "should be" to "Must be" and nand to NAND etc..
- Removed padding to describe size-cells and address-cells
- Removed timing parameters from DT, and added ->setup_data_interface() hook to the driver to read the SDR timings
- Modified label name from "pl353smcc_0: pl353smcc@e000e000" to "smcc: memory-controller@e000e000" as suggested by Miquel
Changes in v9:
- Addressed below comments given by Randy Dunlap and Miquel Raynal
- Typos
- Added extra documentation that explains the HW ECC limitation with SMC (Comments given to v8: https://lkml.org/lkml/2018/3/22/23)
Changes in v8:
- None
Changes in v7:
- Corrected clocks description
- prefixed '#' for address and size cells
Changes in v6:
- None
Changes in v5:
- Removed timing properties
Changes in v4:
- none
Changes in v3:
- none
Changes in v2:
- modified timing binding info as per onfi timing parameters
- add suffix nano second as timing unit
- modified the clock names as per the IP spec
--- .../bindings/memory-controllers/pl353-smc.txt | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/memory-controllers/pl353-smc.txt
Documentation/devicetree/bindings/memory-controllers/pl353-smc.txt new file +47 -0
@@ -0,0 +1,47 @@ +Device tree bindings for ARM PL353 static memory controller + +PL353 static memory controller supports two kinds of memory +interfaces.i.e NAND and SRAM/NOR interfaces. +The actual devices are instantiated from the child nodes of pl353 smc node. + +Required properties: +- compatible : Should be "arm,pl353-smc-r2p1", "arm,primecell". +- reg : Controller registers map and length. +- clock-names : List of input clock names - "memclk", "apb_pclk" + (See clock bindings for details). +- clocks : Clock phandles (see clock bindings for details). +- address-cells : Must be 2. +- size-cells : Must be 1. + +Child nodes: + For NAND the "arm,pl353-nand-r2p1" and for NOR the "cfi-flash" drivers are +supported as child nodes. + +for NAND partition information please refer the below file +Documentation/devicetree/bindings/mtd/partition.txt + +Example: + smcc: memory-controller@e000e000 + compatible = "arm,pl353-smc-r2p1", "arm,primecell"; + clock-names = "memclk", "apb_pclk"; + clocks = <&clkc 11>, <&clkc 44>; + reg = <0xe000e000 0x1000>; + #address-cells = <2>; + #size-cells = <1>; + ranges = <0x0 0x0 0xe1000000 0x1000000 //Nand CS Region + 0x1 0x0 0xe2000000 0x2000000 //SRAM/NOR CS Region + 0x2 0x0 0xe4000000 0x2000000>; //SRAM/NOR CS Region + nand_0: flash@e1000000 { + compatible = "arm,pl353-nand-r2p1" + reg = <0 0 0x1000000>; + (...) + }; + nor0: flash@e2000000 { + compatible = "cfi-flash"; + reg = <1 0 0x2000000>; + }; + nor1: flash@e4000000 { + compatible = "cfi-flash"; + reg = <2 0 0x2000000>; + }; + };
Signature · 1 line
2.7.4
PATCH v13 2/2 memory: pl353: Add driver for arm pl353 static memory controller
In reply to Naga Sureshkumar RelliAdd driver for arm pl353 static memory controller. This controller is used in Xilinx Zynq SoC for interfacing the NAND and NOR/SRAM memory devices.
---
Changes in v13:
- Fixed sparse warnings
- Fixed check-patch --strict warnings
- Added change log
Changes in v12:
- Sent the patch with Reviewed-by tag
Changes in v11:
- Added amba device registration and removed platform device, since it is an ARM Primecell Peripheral and it should register as an amba device as per Linus Walleji.
Changes in v10:
- Corrected typos in commit message like xilinx to Xilinx
- Added SoC specific compilation check in Kconfig as below "depends on ARCH_ZYNQ"
- Modified return type from int to bool to the function pl353_smc_ecc_is_busy
- Defined Macros for values in pl353_smc_get_ecc_val and modifed the logic to read ecc value from all 4 registers
- Assinged the timeout value in pl353_smc_init_nand_interface() after declaration
- Added compatibles on another line and aligned the data with them
- Removed pl353-smc.h from platform-data and moved it to include/linux
Changes in v9:
- Addressed the comments given by Julia Cartwright to the v8 series.
Changes in v8:
- None
Changes in v7:
- Corrected the kconfig to use tristate selection
- Corrected the GPL licence ident
- Added boundary checks for nand timing parameters
Changes in v6:
- Fixed checkpatch.pl reported warnings
Changes in v5:
- Added pl353_smc_get_clkrate function, made pl353_smc_set_cycles as public API
- Removed nand timing parameter initialization and moved it to nand driver Changes in v4:
- Modified driver to support multiple instances
- Used sleep instaed of busywait for delay
Changes in v3:
- None
Changes in v2:
- Since now the timing parameters are in nano seconds, added logic to convert them to the cycles
--- drivers/memory/Kconfig | 9 + drivers/memory/Makefile | 1 + drivers/memory/pl353-smc.c | 464 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/pl353-smc.h | 30 +++ 4 files changed, 504 insertions(+) create mode 100644 drivers/memory/pl353-smc.c create mode 100644 include/linux/pl353-smc.h
drivers/memory/Kconfig +9 -0
@@ -145,6 +145,15 @@ config DA8XX_DDRCTL Texas Instruments da8xx SoCs. It's used to tweak various memory controller configuration options. +config PL353_SMC + tristate "ARM PL35X Static Memory Controller(SMC) driver" + default y + depends on ARM + depends on ARM_AMBA + help + This driver is for the ARM PL351/PL353 Static Memory + Controller(SMC) module. + source "drivers/memory/samsung/Kconfig" source "drivers/memory/tegra/Kconfig"
drivers/memory/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_MVEBU_DEVBUS) += mvebu-devbus.o obj-$(CONFIG_JZ4780_NEMC) += jz4780-nemc.o obj-$(CONFIG_MTK_SMI) += mtk-smi.o obj-$(CONFIG_DA8XX_DDRCTL) += da8xx-ddrctl.o +obj-$(CONFIG_PL353_SMC) += pl353-smc.o obj-$(CONFIG_SAMSUNG_MC) += samsung/ obj-$(CONFIG_TEGRA_MC) += tegra/
drivers/memory/pl353-smc.c new file +464 -0
464 lines not on this page · raw message
include/linux/pl353-smc.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* ARM PL353 SMC Driver Header +* +* Copyright (C) 2012 - 2018 Xilinx, Inc +*/ + +#ifndef __LINUX_PL353_SMC_H +#define __LINUX_PL353_SMC_H + +enum pl353_smc_ecc_mode { +PL353_SMC_ECCMODE_BYPASS =0 , +PL353_SMC_ECCMODE_APB =1 , +PL353_SMC_ECCMODE_MEM =2 +}; + +enum pl353_smc_mem_width { +PL353_SMC_MEM_WIDTH_8 =0 , +PL353_SMC_MEM_WIDTH_16 =1 +}; + +u32 pl353_smc_get_ecc_val (int ecc_reg); +bool pl353_smc_ecc_is_busy (void ); +int pl353_smc_get_nand_int_status_raw (void ); +void pl353_smc_clr_nand_int (void ); +int pl353_smc_set_ecc_mode (enum pl353_smc_ecc_mode mode); +int pl353_smc_set_ecc_pg_size (unsigned int pg_sz); +int pl353_smc_set_buswidth (unsigned int bw); +void pl353_smc_set_cycles (u32 timings[]); +#endif
Signature · 1 line
2.7.4
Michal Simek
AppliedQuoted 19 lines · Naga Sureshkumar Relli
The following patches add arm pl353 static memory controller driver and NAND driver for Xilinx Zynq SoC. The arm pl353 smc supports two interfaces i.e nand and NOR/SRAM memory interfaces. The current implementation supports only a single SMC instance and nand specific configuration.
Xilinx Zynq TRM link:
http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdfARM pl353 smc TRM link:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0380g/DDI0380G_smc_pl350_series_r2p1_trm.pdfTested Micron MT29F2G08ABAEAWP (On-die capable) and AMD/Spansion S34ML01G1. This latest series make use of ->exec_op().
Naga Sureshkumar Relli (2):
dt-bindings: memory: Add pl353 smc controller devicetree binding
information
memory: pl353: Add driver for arm pl353 static memory controller
Quoted 10 lines
.../bindings/memory-controllers/pl353-smc.txt | 47 +++ drivers/memory/Kconfig | 9 + drivers/memory/Makefile | 1 + drivers/memory/pl353-smc.c | 464 +++++++++++++++++++++ include/linux/pl353-smc.h | 30 ++ 5 files changed, 551 insertions(+) create mode 100644 Documentation/devicetree/bindings/memory-controllers/pl353-smc.txt create mode 100644 drivers/memory/pl353-smc.c create mode 100644 include/linux/pl353-smc.h
Applied both to zynq/soc branch.
Thanks,
Michal