Skip to contentSkip to conversation

Add support for PL172 memory-controller

PATCH New Joachim Eastwood 2 participants 6 messages Apr 28, 2015 – May 12, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add support for PL172 memory-controller

This patch set adds support for setting up static memory devices on a ARM PrimeCell MultiPort Memory Controller (PL172) from DT. Dynamic memory (SDRAM) is not supported in this patch set.

DT bindings for PL172 is based on the bindings for the TI AEMIF memory controller. PL172 can be found on a number of NXP devices like the LPC18xx family.

Tested on Embedded Artists' LPC4357 Developer's Kit with NOR Flash (SST39VF320) and 74LCV16374 (gpio-74x164) on MPMC.

Joachim Eastwood (2):
memory: add ARM PL172 MultiPort Memory Controller driver
doc: dt: add documentation for pl172 memory bindings

 .../bindings/memory-controllers/arm,pl172.txt      | 125 +++++++++
 drivers/memory/Kconfig                             |   8 +
 drivers/memory/Makefile                            |   1 +
 drivers/memory/pl172.c                             | 302 +++++++++++++++++++++
 4 files changed, 436 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/arm,pl172.txt
 create mode 100644 drivers/memory/pl172.c
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/2 memory: add ARM PL172 MultiPort Memory Controller driver

---
 drivers/memory/Kconfig  |   8 ++
 drivers/memory/Makefile |   1 +
 drivers/memory/pl172.c  | 302 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 311 insertions(+)
 create mode 100644 drivers/memory/pl172.c
drivers/memory/Kconfig +8 -0
index 868036f70f8f..f69a8842ec69 100644
@@ -7,6 +7,14 @@ menuconfig MEMORY
 
 if MEMORY
 
+config ARM_PL172_MPMC
+	tristate "ARM PL172 MPMC driver"
+	depends on ARM_AMBA && OF
+	help
+	  This selects the ARM PrimeCell PL172 MultiPort Memory Controller.
+	  If you have an embedded system with an AMBA bus and a PL172
+	  controller, say Y or M here.
+
 config ATMEL_SDRAMC
 	bool "Atmel (Multi-port DDR-)SDRAM Controller"
 	default y
drivers/memory/Makefile +1 -0
index b670441e3cdf..1c46af501610 100644
@@ -5,6 +5,7 @@
 ifeq ($(CONFIG_DDR),y)
 obj-$(CONFIG_OF)		+= of_memory.o
 endif
+obj-$(CONFIG_ARM_PL172_MPMC)	+= pl172.o
 obj-$(CONFIG_ATMEL_SDRAMC)	+= atmel-sdramc.o
 obj-$(CONFIG_TI_AEMIF)		+= ti-aemif.o
 obj-$(CONFIG_TI_EMIF)		+= emif.o
drivers/memory/pl172.c new file +302 -0

302 lines not on this page · raw message

Signature · 1 line
1.8.0
#2 lore raw

PATCH 2/2 doc: dt: add documentation for pl172 memory bindings

In reply to Joachim Eastwood
---
 .../bindings/memory-controllers/arm,pl172.txt      | 125 +++++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/arm,pl172.txt
Documentation/devicetree/bindings/memory-controllers/arm,pl172.txt new file +125 -0
new file mode 100644
index 000000000000..e6df32f9986d
@@ -0,0 +1,125 @@
+* Device tree bindings for ARM PL172 MultiPort Memory Controller
+
+Required properties:
+
+- compatible:		"arm,pl172", "arm,primecell"
+
+- reg:			Must contains offset/length value for controller.
+
+- #address-cells:	Must be 2. The partition number has to be encoded in the
+			first address cell and it may accept values 0..N-1
+			(N - total number of partitions). The second cell is the
+			offset into the partition.
+
+- #size-cells:		Must be set to 1.
+
+- ranges:		Must contain one or more chip select memory regions.
+
+- clocks:		Must contain references to controller clocks.
+
+- clock-names:		Must contain "mpmcclk" and "apb_pclk".
+
+- clock-ranges:		Empty property indicating that child nodes can inherit
+			named clocks. Required only if clock tree data present
+			in device tree.
+			See clock-bindings.txt
+
+Child chip-select (cs) nodes contain the memory devices nodes connected to
+such as NOR (e.g. cfi-flash) and NAND.
+
+Required child cs node properties:
+
+- #address-cells:	Must be 2.
+
+- #size-cells:		Must be 1.
+
+- ranges:		Empty property indicating that child nodes can inherit
+			memory layout.
+
+- clock-ranges:		Empty property indicating that child nodes can inherit
+			named clocks. Required only if clock tree data present
+			in device tree.
+
+- mpmc,cs:		Chip select number. Indicates to the pl0172 driver
+			which chipselect is used for accessing the memory.
+
+- mpmc,memory-width:	Width of the chip select memory. Must be equal to
+			either 8, 16 or 32.
+
+Optional child cs node config properties:
+
+- mpmc,async-page-mode:	Enable asynchronous page mode.
+
+- mpmc,cs-active-high:	Set chip select polarity to active high.
+
+- mpmc,byte-lane-low:	Set byte lane state to low.
+
+- mpmc,extended-wait:	Enable extended wait.
+
+- mpmc,buffer-enable:	Enable write buffer.
+
+- mpmc,write-protect:	Enable write protect.
+
+Optional child cs node timing properties:
+
+- mpmc,write-enable-delay:	Delay from chip select assertion to write
+				enable (WE signal) in nano seconds.
+
+- mpmc,output-enable-delay:	Delay from chip select assertion to output
+				enable (OE signal) in nano seconds.
+
+- mpmc,write-access-delay:	Delay from chip select assertion to write
+				access in nano seconds.
+
+- mpmc,read-access-delay:	Delay from chip select assertion to read
+				access in nano seconds.
+
+- mpmc,page-mode-read-delay:	Delay for asynchronous page mode sequential
+				accesses in nano seconds.
+
+- mpmc,turn-round-delay:	Delay between access to memory banks in nano
+				seconds.
+
+If any of the above timing parameters are absent, current parameter value will
+be taken from the corresponding HW reg.
+
+Example for pl172 with nor flash on chip select 0 shown below.
+
+emc: memory-controller at 40005000 {
+	compatible = "arm,pl172", "arm,primecell";
+	reg = <0x40005000 0x1000>;
+	clocks = <&ccu1 CLK_CPU_EMCDIV>, <&ccu1 CLK_CPU_EMC>;
+	clock-names = "mpmcclk", "apb_pclk";
+	#address-cells = <2>;
+	#size-cells = <1>;
+	ranges = <0 0 0x1c000000 0x1000000
+		  1 0 0x1d000000 0x1000000
+		  2 0 0x1e000000 0x1000000
+		  3 0 0x1f000000 0x1000000>;
+
+	cs0 {
+		#address-cells = <2>;
+		#size-cells = <1>;
+		ranges;
+
+		mpmc,cs = <0>;
+		mpmc,memory-width = <16>;
+		mpmc,byte-lane-low;
+		mpmc,write-enable-delay = <0>;
+		mpmc,output-enable-delay = <0>;
+		mpmc,read-enable-delay = <70>;
+		mpmc,page-mode-read-delay = <70>;
+
+		flash at 0,0 {
+			compatible = "sst,sst39vf320", "cfi-flash";
+			reg = <0 0 0x400000>;
+			bank-width = <2>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			partition at 0 {
+				label = "data";
+				reg = <0 0x400000>;
+			};
+		};
+	};
+};
Signature · 1 line
1.8.0
#3 lore raw

PATCH 2/2 doc: dt: add documentation for pl172 memory bindings

Hi DT maintainers,

Do you have any comments on the bindings below?

These bindings are based on bindings for "ti,davinci-aemif" found under memory-controllers/ti-aemif.txt

regards,
Joachim Eastwood

Quoted 140 lines · Joachim Eastwood
---
 .../bindings/memory-controllers/arm,pl172.txt      | 125 +++++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/arm,pl172.txt
Documentation/devicetree/bindings/memory-controllers/arm,pl172.txt new file +125 -1
new file mode 100644
index 000000000000..e6df32f9986d
@@ -0,0 +1,125 @@
+* Device tree bindings for ARM PL172 MultiPort Memory Controller
+
+Required properties:
+
+- compatible:          "arm,pl172", "arm,primecell"
+
+- reg:                 Must contains offset/length value for controller.
+
+- #address-cells:      Must be 2. The partition number has to be encoded in the
+                       first address cell and it may accept values 0..N-1
+                       (N - total number of partitions). The second cell is the
+                       offset into the partition.
+
+- #size-cells:         Must be set to 1.
+
+- ranges:              Must contain one or more chip select memory regions.
+
+- clocks:              Must contain references to controller clocks.
+
+- clock-names:         Must contain "mpmcclk" and "apb_pclk".
+
+- clock-ranges:                Empty property indicating that child nodes can inherit
+                       named clocks. Required only if clock tree data present
+                       in device tree.
+                       See clock-bindings.txt
+
+Child chip-select (cs) nodes contain the memory devices nodes connected to
+such as NOR (e.g. cfi-flash) and NAND.
+
+Required child cs node properties:
+
+- #address-cells:      Must be 2.
+
+- #size-cells:         Must be 1.
+
+- ranges:              Empty property indicating that child nodes can inherit
+                       memory layout.
+
+- clock-ranges:                Empty property indicating that child nodes can inherit
+                       named clocks. Required only if clock tree data present
+                       in device tree.
+
+- mpmc,cs:             Chip select number. Indicates to the pl0172 driver
+                       which chipselect is used for accessing the memory.
+
+- mpmc,memory-width:   Width of the chip select memory. Must be equal to
+                       either 8, 16 or 32.
+
+Optional child cs node config properties:
+
+- mpmc,async-page-mode:        Enable asynchronous page mode.
+
+- mpmc,cs-active-high: Set chip select polarity to active high.
+
+- mpmc,byte-lane-low:  Set byte lane state to low.
+
+- mpmc,extended-wait:  Enable extended wait.
+
+- mpmc,buffer-enable:  Enable write buffer.
+
+- mpmc,write-protect:  Enable write protect.
+
+Optional child cs node timing properties:
+
+- mpmc,write-enable-delay:     Delay from chip select assertion to write
+                               enable (WE signal) in nano seconds.
+
+- mpmc,output-enable-delay:    Delay from chip select assertion to output
+                               enable (OE signal) in nano seconds.
+
+- mpmc,write-access-delay:     Delay from chip select assertion to write
+                               access in nano seconds.
+
+- mpmc,read-access-delay:      Delay from chip select assertion to read
+                               access in nano seconds.
+
+- mpmc,page-mode-read-delay:   Delay for asynchronous page mode sequential
+                               accesses in nano seconds.
+
+- mpmc,turn-round-delay:       Delay between access to memory banks in nano
+                               seconds.
+
+If any of the above timing parameters are absent, current parameter value will
+be taken from the corresponding HW reg.
+
+Example for pl172 with nor flash on chip select 0 shown below.
+
+emc: memory-controller at 40005000 {
+       compatible = "arm,pl172", "arm,primecell";
+       reg = <0x40005000 0x1000>;
+       clocks = <&ccu1 CLK_CPU_EMCDIV>, <&ccu1 CLK_CPU_EMC>;
+       clock-names = "mpmcclk", "apb_pclk";
+       #address-cells = <2>;
+       #size-cells = <1>;
+       ranges = <0 0 0x1c000000 0x1000000
+                 1 0 0x1d000000 0x1000000
+                 2 0 0x1e000000 0x1000000
+                 3 0 0x1f000000 0x1000000>;
+
+       cs0 {
+               #address-cells = <2>;
+               #size-cells = <1>;
+               ranges;
+
+               mpmc,cs = <0>;
+               mpmc,memory-width = <16>;
+               mpmc,byte-lane-low;
+               mpmc,write-enable-delay = <0>;
+               mpmc,output-enable-delay = <0>;
+               mpmc,read-enable-delay = <70>;
+               mpmc,page-mode-read-delay = <70>;
+
+               flash at 0,0 {
+                       compatible = "sst,sst39vf320", "cfi-flash";
+                       reg = <0 0 0x400000>;
+                       bank-width = <2>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       partition at 0 {
+                               label = "data";
+                               reg = <0 0x400000>;
+                       };
+               };
+       };
+};
--

1.8.0

#4 lore raw

cover Add support for PL172 memory-controller

In reply to Joachim Eastwood

Hi Joachim,

Quoted 10 lines · Joachim Eastwood

This patch set adds support for setting up static memory devices on a ARM PrimeCell MultiPort Memory Controller (PL172) from DT. Dynamic memory (SDRAM) is not supported in this patch set.

DT bindings for PL172 is based on the bindings for the TI AEMIF memory controller. PL172 can be found on a number of NXP devices like the LPC18xx family.

Tested on Embedded Artists' LPC4357 Developer's Kit with NOR Flash (SST39VF320) and 74LCV16374 (gpio-74x164) on MPMC.

Please excuse my ignorance here, but is this memory controller used to manage the memory in use by the kernel? If so, how is it safe to reconfigure it dynamically at runtime? If not, then it might be worth describing some typical use-cases in the binding documentation to motivate the existence of this driver.

Cheers,

Will

#5 lore raw

cover Add support for PL172 memory-controller

Quoted 11 lines · Will Deacon

Hi Joachim,

Quoted 8 lines · Joachim Eastwood

This patch set adds support for setting up static memory devices on a ARM PrimeCell MultiPort Memory Controller (PL172) from DT. Dynamic memory (SDRAM) is not supported in this patch set.

DT bindings for PL172 is based on the bindings for the TI AEMIF memory controller. PL172 can be found on a number of NXP devices like the LPC18xx family.

Quoted 6 lines
Quoted 2 lines

Tested on Embedded Artists' LPC4357 Developer's Kit with NOR Flash (SST39VF320) and 74LCV16374 (gpio-74x164) on MPMC.

Please excuse my ignorance here, but is this memory controller used to manage the memory in use by the kernel? If so, how is it safe to reconfigure it dynamically at runtime?

The driver is used to do a one-time configuration of static chip selects on driver probe using the parameters specified in DT. The device nodes under the MPMC node is only populated and then driver probed after the parameters has been setup. This how most of drivers under drivers/memory operates.

Quoted 3 lines

If not, then it might be worth describing
some typical use-cases in the binding documentation to motivate the existence of this driver.

The typical use case is Flash memory (NAND and NOR) configuration and timing setup but you could configure any kind of static memory devices on the bus. But as described above this only happens at driver probe time.

Hope this answer your question.

regards,
Joachim Eastwood