Skip to contentSkip to conversation

powerpc/512x: add LocalPlus Bus FIFO device driver

PATCH Applied Alexander Popov 3 participants 9 messages Oct 11, 2015 – Oct 28, 2015

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

v4 cover powerpc/512x: add LocalPlus Bus FIFO device driver

This driver for Freescale MPC512x LocalPlus Bus FIFO (called SCLPC in the Reference Manual) allows Direct Memory Access transfers between RAM and peripheral devices on LocalPlus Bus.

Changes in v3:
- resource usage in probe() is fixed;
- driver methods are made safe against remove();
- dma_request_slave_channel() is used to get DMA channel number from

    the device tree;
 - chip select number concerned with the DMA transaction is determined
    from 'localbus' device tree node information;
 - register set is described as a structure;
 - symbolic names are given to shift counts to keep magic numbers
    out of the code;
 - choosing values for LPBFIFO BPT (bytes per transfer) and DMA maxburst
    is improved, so DMA transfer size has increased for some cases;

- device tree binding for LPBFIFO is documented;
- Kconfig and Makefile are improved;
- email address "[email protected]" is changed to a more pleasant alias "[email protected]".

Changes in v4:
- the race condition is fixed;
- plenty of style fixes are made;
- devm_* functions and EPROBE_DEFER are used in probe().

Alexander Popov (2):
powerpc/512x: add LocalPlus Bus FIFO device driver powerpc/512x: add a device tree binding for LocalPlus Bus FIFO

 .../bindings/powerpc/fsl/mpc512x_lpbfifo.txt       |  21 +
 arch/powerpc/boot/dts/mpc5121.dtsi                 |  11 +-
 arch/powerpc/boot/dts/mpc5125twr.dts               |  11 +-
 arch/powerpc/configs/mpc512x_defconfig             |   1 +
 arch/powerpc/include/asm/mpc5121.h                 |  59 +++
 arch/powerpc/platforms/512x/Kconfig                |   6 +
 arch/powerpc/platforms/512x/Makefile               |   1 +
 arch/powerpc/platforms/512x/mpc512x_lpbfifo.c      | 539 +++++++++++++++++++++
 8 files changed, 646 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/mpc512x_lpbfifo.txt
 create mode 100644 arch/powerpc/platforms/512x/mpc512x_lpbfifo.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/2 powerpc/512x: add LocalPlus Bus FIFO device driver

This driver for Freescale MPC512x LocalPlus Bus FIFO (called SCLPC in the Reference Manual) allows Direct Memory Access transfers between RAM and peripheral devices on LocalPlus Bus.

---
 arch/powerpc/configs/mpc512x_defconfig        |   1 +
 arch/powerpc/include/asm/mpc5121.h            |  59 +++
 arch/powerpc/platforms/512x/Kconfig           |   6 +
 arch/powerpc/platforms/512x/Makefile          |   1 +
 arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 539 ++++++++++++++++++++++++++
 5 files changed, 606 insertions(+)
 create mode 100644 arch/powerpc/platforms/512x/mpc512x_lpbfifo.c
arch/powerpc/configs/mpc512x_defconfig +1 -0
index 59b85cb..d16d6c5 100644
@@ -112,6 +112,7 @@ CONFIG_RTC_DRV_M41T80=y
 CONFIG_RTC_DRV_MPC5121=y
 CONFIG_DMADEVICES=y
 CONFIG_MPC512X_DMA=y
+CONFIG_MPC512x_LPBFIFO=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XIP=y
 CONFIG_EXT3_FS=y
arch/powerpc/include/asm/mpc5121.h +59 -0

63 lines not on this page · raw message

arch/powerpc/platforms/512x/Kconfig +6 -0
index 48bf38d..f09016f 100644
@@ -10,6 +10,12 @@ config PPC_MPC512x
 	select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
 	select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
 
+config MPC512x_LPBFIFO
+	tristate "MPC512x LocalPlus Bus FIFO driver"
+	depends on PPC_MPC512x && MPC512X_DMA
+	help
+	  Enable support for Freescale MPC512x LocalPlus Bus FIFO (SCLPC).
+
 config MPC5121_ADS
 	bool "Freescale MPC5121E ADS"
 	depends on PPC_MPC512x
arch/powerpc/platforms/512x/Makefile +1 -0
index 0169312..f47d422 100644
@@ -5,4 +5,5 @@ obj-$(CONFIG_COMMON_CLK)	+= clock-commonclk.o
 obj-y				+= mpc512x_shared.o
 obj-$(CONFIG_MPC5121_ADS)	+= mpc5121_ads.o mpc5121_ads_cpld.o
 obj-$(CONFIG_MPC512x_GENERIC)	+= mpc512x_generic.o
+obj-$(CONFIG_MPC512x_LPBFIFO)	+= mpc512x_lpbfifo.o
 obj-$(CONFIG_PDM360NG)		+= pdm360ng.o
arch/powerpc/platforms/512x/mpc512x_lpbfifo.c new file +539 -0

539 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw
Quoted 5 lines · On Mon, 12 Oct 2015 00:08:01 +0300 Alexander Popov <[email protected]> wrote:

This driver for Freescale MPC512x LocalPlus Bus FIFO (called SCLPC in the Reference Manual) allows Direct Memory Access transfers between RAM and peripheral devices on LocalPlus Bus.

Quoted 8 lines
---
 arch/powerpc/configs/mpc512x_defconfig        |   1 +
 arch/powerpc/include/asm/mpc5121.h            |  59 +++
 arch/powerpc/platforms/512x/Kconfig           |   6 +
 arch/powerpc/platforms/512x/Makefile          |   1 +
 arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 539 ++++++++++++++++++++++++++
 5 files changed, 606 insertions(+)
 create mode 100644 arch/powerpc/platforms/512x/mpc512x_lpbfifo.c

extended with MODULE_DEVICE_TABLE() for of_device_id struct and applied to mpc5xxx/next.

Thanks,

Anatolij

#3 lore raw

PATCH v4 2/2 powerpc/512x: add a device tree binding for LocalPlus Bus FIFO

In reply to Alexander Popov

Add a device tree binding for Freescale MPC512x LocalPlus Bus FIFO and introduce the document describing that binding.

---
 .../bindings/powerpc/fsl/mpc512x_lpbfifo.txt        | 21 +++++++++++++++++++++
 arch/powerpc/boot/dts/mpc5121.dtsi                  | 11 +++++++++--
 arch/powerpc/boot/dts/mpc5125twr.dts                | 11 ++++++++++-
 3 files changed, 40 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/mpc512x_lpbfifo.txt
Documentation/devicetree/bindings/powerpc/fsl/mpc512x_lpbfifo.txt new file +21 -0
new file mode 100644
index 0000000..b3b392f
@@ -0,0 +1,21 @@
+Freescale MPC512x LocalPlus Bus FIFO (called SCLPC in the Reference Manual)
+
+Required properties:
+- compatible: should be "fsl,mpc512x-lpbfifo";
+- reg: should contain the offset and length of SCLPC register set;
+- interrupts: should contain the interrupt specifier for SCLPC; syntax of an
+    interrupt client node is described in interrupt-controller/interrupts.txt;
+- dmas: should contain the DMA specifier for SCLPC as described at
+    dma/dma.txt and dma/mpc512x-dma.txt;
+- dma-names: should be "rx-tx";
+
+Example:
+
+	sclpc@10100 {
+		compatible = "fsl,mpc512x-lpbfifo";
+		reg = <0x10100 0x50>;
+		interrupts = <7 0x8>;
+		dmas = <&dma0 26>;
+		dma-names = "rx-tx";
+	};
+
arch/powerpc/boot/dts/mpc5121.dtsi +9 -2
index 7f9d14f..a015e45 100644
@@ -77,7 +77,6 @@
 		#address-cells = <2>;
 		#size-cells = <1>;
 		reg = <0x80000020 0x40>;
-		interrupts = <7 0x8>;
 		ranges = <0x0 0x0 0xfc000000 0x04000000>;
 	};
 
@@ -329,7 +328,15 @@
 		/* LocalPlus controller */
 		lpc@10000 {
 			compatible = "fsl,mpc5121-lpc";
-			reg = <0x10000 0x200>;
+			reg = <0x10000 0x100>;
+		};
+
+		sclpc@10100 {
+			compatible = "fsl,mpc512x-lpbfifo";
+			reg = <0x10100 0x50>;
+			interrupts = <7 0x8>;
+			dmas = <&dma0 26>;
+			dma-names = "rx-tx";
 		};
 
 		pata@10200 {
arch/powerpc/boot/dts/mpc5125twr.dts +10 -1
index e4f2974..898eb58 100644
@@ -246,6 +246,14 @@
 			status = "disabled";
 		};
 
+		sclpc@10100 {
+			compatible = "fsl,mpc512x-lpbfifo";
+			reg = <0x10100 0x50>;
+			interrupts = <7 0x8>;
+			dmas = <&dma0 26>;
+			dma-names = "rx-tx";
+		};
+
 		// 5125 PSCs are not 52xx or 5121 PSC compatible
 		// PSC1 uart0 aka ttyPSC0
 		serial@11100 {
@@ -279,10 +287,11 @@
 			clock-names = "ipg";
 		};
 
-		dma@14000 {
+		dma0: dma@14000 {
 			compatible = "fsl,mpc5121-dma"; // BSP name: "mpc512x-dma2"
 			reg = <0x14000 0x1800>;
 			interrupts = <65 0x8>;
+			#dma-cells = <1>;
 		};
 	};
 };
Signature · 1 line
1.9.1
maintainer Applied
#4 lore raw

Re: [PATCH v4 2/2] powerpc/512x: add a device tree binding for LocalPlus Bus FIFO

Quoted 10 lines · On Mon, 12 Oct 2015 00:08:02 +0300 Alexander Popov <[email protected]> wrote:

Add a device tree binding for Freescale MPC512x LocalPlus Bus FIFO and introduce the document describing that binding.

---
 .../bindings/powerpc/fsl/mpc512x_lpbfifo.txt        | 21 +++++++++++++++++++++
 arch/powerpc/boot/dts/mpc5121.dtsi                  | 11 +++++++++--
 arch/powerpc/boot/dts/mpc5125twr.dts                | 11 ++++++++++-
 3 files changed, 40 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/mpc512x_lpbfifo.txt

applied to mpc5xxx/next.

Thanks,

Anatolij

#5 lore raw
In reply to Alexander Popov
Quoted 8 lines · Alexander Popov

This driver for Freescale MPC512x LocalPlus Bus FIFO (called SCLPC in the Reference Manual) allows Direct Memory Access transfers between RAM and peripheral devices on LocalPlus Bus.

Changes in v4:
- the race condition is fixed;
- plenty of style fixes are made;
- devm_* functions and EPROBE_DEFER are used in probe().

Hello,

I've done my best to fix the issues pointed by Timur Tabi and Vinod Koul. Could I have a feedback please?

Best regards,
Alexander

#6 lore raw
Quoted 10 lines · Alexander Popov
Quoted 8 lines · Alexander Popov

This driver for Freescale MPC512x LocalPlus Bus FIFO (called SCLPC in the Reference Manual) allows Direct Memory Access transfers between RAM and peripheral devices on LocalPlus Bus.

Changes in v4:
- the race condition is fixed;
- plenty of style fixes are made;
- devm_* functions and EPROBE_DEFER are used in probe().

Quoted 4 lines

Hello,

I've done my best to fix the issues pointed by Timur Tabi and Vinod Koul. Could I have a feedback please?

I dont see to have v4 in my list :( Can you please repost

Signature · 5 lines
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw
Quoted 11 lines · Vinod Koul
Quoted 10 lines · Alexander Popov
Quoted 8 lines · Alexander Popov

This driver for Freescale MPC512x LocalPlus Bus FIFO (called SCLPC in the Reference Manual) allows Direct Memory Access transfers between RAM and peripheral devices on LocalPlus Bus.

Changes in v4:
- the race condition is fixed;
- plenty of style fixes are made;
- devm_* functions and EPROBE_DEFER are used in probe().

Quoted 6 lines
Quoted 4 lines

Hello,

I've done my best to fix the issues pointed by Timur Tabi and Vinod Koul. Could I have a feedback please?

I dont see to have v4 in my list :( Can you please repost

Hello, Vinod

I'm sure I haven't miss your address in the list of the recipients. Anyway I can repost.

Anatolij Gustschin wrote that he applied v4 with some fix to mpc5xxx/next some time ago.

So should I repost v4 for everybody? How should I mark the reposted patches?

Best regards,
Alexander

#8 lore raw
Quoted 7 lines · Alexander Popov
Quoted 6 lines
Quoted 4 lines

Hello,

I've done my best to fix the issues pointed by Timur Tabi and Vinod Koul. Could I have a feedback please?

I dont see to have v4 in my list :( Can you please repost

Quoted 7 lines

Hello, Vinod

I'm sure I haven't miss your address in the list of the recipients. Anyway I can repost.

Anatolij Gustschin wrote that he applied v4 with some fix to mpc5xxx/next some time ago.

Okay, I though these were dmaengine patches but looking back they seemed to be for arch code, so nothing to do here for me and then you :)

Quoted 1 line

So should I repost v4 for everybody? How should I mark the reposted patches?

Its merged so fine with me

Signature · 1 line
~Vinod