Skip to contentSkip to conversation

Few dm816x fixes and improvments

PATCH New Tony Lindgren 2 participants 9 messages Mar 18, 2015 Device tree bindings

lore
Share & tools
lore
#0 lore raw

cover Few dm816x fixes and improvments

Hi all,

Here are few dm816x related fixes and improvments. Mostly to get GPIO interrupts working, and add DMA for the USB.

Note that the USB still depends on the USB PHY driver posted in "[PATCH v2] phy: Add a driver for dm816x USB PHY".

Regards,

Tony

Tony Lindgren (4):
ARM: dts: Fix gpio interrupts for dm816x
ARM: dts: Fix typo for dm816x usb0_pins
ARM: dts: Add cppi41 support for dm816x MUSB
ARM: dts: Remove PIN_INPUT for dm816x McSPI

 arch/arm/boot/dts/dm8168-evm.dts | 33 +++++++++++++----
 arch/arm/boot/dts/dm816x.dtsi    | 78 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 100 insertions(+), 11 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/4 ARM: dts: Fix gpio interrupts for dm816x

Commit 7800064ba507 ("ARM: dts: Add basic dm816x device tree configuration") added basic devices for dm816x, but I was not able to test the GPIO interrupts earlier until I found some suitable pins to test with. We can mux the MMC card detect and write protect pins from SD_SDCD and SD_SDWP mode to use a normal GPIO interrupts that are also suitable for the MMC subsystem.

This turned out several issues that need to be fixed:

- I set the GPIO type wrong to be compatible with omap3 instead of omap4. The GPIO controller on dm816x has EOI interrupt register like omap4 and am335x.

- I got the GPIO interrupt numbers wrong as each bank has two and we only use one. They need to be set up the same way as on am335x.

- The gpio banks are missing interrupt controller related properties.

With these changes the GPIO interrupts can be used with the MMC card detect pin, so let's wire that up. Let's also mux all the MMC lines for completeness while at it.

For the first GPIO bank I tested using GPMC lines temporarily muxed to GPIOs on the dip switch 10.

Cc Brian Hutchinson <[email protected]>
Cc Matthijs van Duin <[email protected]>
---
 arch/arm/boot/dts/dm8168-evm.dts | 19 +++++++++++++++++++
 arch/arm/boot/dts/dm816x.dtsi    | 18 ++++++++++++++----
 2 files changed, 33 insertions(+), 4 deletions(-)
arch/arm/boot/dts/dm8168-evm.dts +19 -0
index d3a29c1..afe678f 100644
@@ -36,6 +36,20 @@
 		>;
 	};
 
+	mmc_pins: pinmux_mmc_pins {
+		pinctrl-single,pins = <
+			DM816X_IOPAD(0x0a70, MUX_MODE0)			/* SD_POW */
+			DM816X_IOPAD(0x0a74, MUX_MODE0)			/* SD_CLK */
+			DM816X_IOPAD(0x0a78, MUX_MODE0)			/* SD_CMD */
+			DM816X_IOPAD(0x0a7C, MUX_MODE0)			/* SD_DAT0 */
+			DM816X_IOPAD(0x0a80, MUX_MODE0)			/* SD_DAT1 */
+			DM816X_IOPAD(0x0a84, MUX_MODE0)			/* SD_DAT2 */
+			DM816X_IOPAD(0x0a88, MUX_MODE0)			/* SD_DAT2 */
+			DM816X_IOPAD(0x0a8c, MUX_MODE2)			/* GP1[7] */
+			DM816X_IOPAD(0x0a90, MUX_MODE2)			/* GP1[8] */
+		>;
+	};
+
 	usb0_pins: pinmux_usb0_pins {
 		pinctrl-single,pins = <
 			DM816X_IOPAD(0x0d00, MUX_MODE0)			/* USB0_DRVVBUS */
@@ -137,7 +151,12 @@
 };
 
 &mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc_pins>;
 	vmmc-supply = <&vmmcsd_fixed>;
+	bus-width = <4>;
+	cd-gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
+	wp-gpios = <&gpio2 8 GPIO_ACTIVE_LOW>;
 };
 
 /* At least dm8168-evm rev c won't support multipoint, later may */
arch/arm/boot/dts/dm816x.dtsi +14 -4
index 3c97b5f..f35715b 100644
@@ -150,17 +150,27 @@
 		};
 
 		gpio1: gpio at 48032000 {
-			compatible = "ti,omap3-gpio";
+			compatible = "ti,omap4-gpio";
 			ti,hwmods = "gpio1";
+			ti,gpio-always-on;
 			reg = <0x48032000 0x1000>;
-			interrupts = <97>;
+			interrupts = <96>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
 		};
 
 		gpio2: gpio at 4804c000 {
-			compatible = "ti,omap3-gpio";
+			compatible = "ti,omap4-gpio";
 			ti,hwmods = "gpio2";
+			ti,gpio-always-on;
 			reg = <0x4804c000 0x1000>;
-			interrupts = <99>;
+			interrupts = <98>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
 		};
 
 		gpmc: gpmc at 50000000 {
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/4 ARM: dts: Fix typo for dm816x usb0_pins

In reply to Tony Lindgren

Commit a54879a00859 ("ARM: dts: Fix USB dts configuration for dm816x") attempted to fix the USB features introduced by commit 7800064ba507 ("ARM: dts: Add basic dm816x device tree configuration") but obviously I did not read the dmesg as more USB issues still keep trickling in.

It should be usb1_pins instead not usb0_pins for the second interface to avoid warnings from pinctrl framework.

Cc Brian Hutchinson <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Matthijs van Duin <[email protected]>
---
 arch/arm/boot/dts/dm8168-evm.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/dm8168-evm.dts +3 -3
index afe678f..b520a8b 100644
@@ -52,13 +52,13 @@
 
 	usb0_pins: pinmux_usb0_pins {
 		pinctrl-single,pins = <
-			DM816X_IOPAD(0x0d00, MUX_MODE0)			/* USB0_DRVVBUS */
+			DM816X_IOPAD(0x0d04, MUX_MODE0)			/* USB0_DRVVBUS */
 		>;
 	};
 
-	usb1_pins: pinmux_usb0_pins {
+	usb1_pins: pinmux_usb1_pins {
 		pinctrl-single,pins = <
-			DM816X_IOPAD(0x0d04, MUX_MODE0)			/* USB1_DRVVBUS */
+			DM816X_IOPAD(0x0d08, MUX_MODE0)			/* USB1_DRVVBUS */
 		>;
 	};
 };
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/4 ARM: dts: Add cppi41 support for dm816x MUSB

In reply to Tony Lindgren

Looks like we have cppi41 on dm816x just like on am335x.

Cc Bin Liu <[email protected]>
Cc Brian Hutchinson <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Matthijs van Duin <[email protected]>
---
 arch/arm/boot/dts/dm816x.dtsi | 60 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
arch/arm/boot/dts/dm816x.dtsi +60 -0
index f35715b..de8427b 100644
@@ -396,6 +396,29 @@
 				mentor,num-eps = <16>;
 				mentor,ram-bits = <12>;
 				mentor,power = <500>;
+
+				dmas = <&cppi41dma  0 0 &cppi41dma  1 0
+					&cppi41dma  2 0 &cppi41dma  3 0
+					&cppi41dma  4 0 &cppi41dma  5 0
+					&cppi41dma  6 0 &cppi41dma  7 0
+					&cppi41dma  8 0 &cppi41dma  9 0
+					&cppi41dma 10 0 &cppi41dma 11 0
+					&cppi41dma 12 0 &cppi41dma 13 0
+					&cppi41dma 14 0 &cppi41dma  0 1
+					&cppi41dma  1 1 &cppi41dma  2 1
+					&cppi41dma  3 1 &cppi41dma  4 1
+					&cppi41dma  5 1 &cppi41dma  6 1
+					&cppi41dma  7 1 &cppi41dma  8 1
+					&cppi41dma  9 1 &cppi41dma 10 1
+					&cppi41dma 11 1 &cppi41dma 12 1
+					&cppi41dma 13 1 &cppi41dma 14 1>;
+				dma-names =
+					"rx1", "rx2", "rx3", "rx4", "rx5", "rx6", "rx7",
+					"rx8", "rx9", "rx10", "rx11", "rx12", "rx13",
+					"rx14", "rx15",
+					"tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
+					"tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
+					"tx14", "tx15";
 			};
 
 			usb1: usb at 47401800 {
@@ -413,6 +436,43 @@
 				mentor,num-eps = <16>;
 				mentor,ram-bits = <12>;
 				mentor,power = <500>;
+
+				dmas = <&cppi41dma 15 0 &cppi41dma 16 0
+					&cppi41dma 17 0 &cppi41dma 18 0
+					&cppi41dma 19 0 &cppi41dma 20 0
+					&cppi41dma 21 0 &cppi41dma 22 0
+					&cppi41dma 23 0 &cppi41dma 24 0
+					&cppi41dma 25 0 &cppi41dma 26 0
+					&cppi41dma 27 0 &cppi41dma 28 0
+					&cppi41dma 29 0 &cppi41dma 15 1
+					&cppi41dma 16 1 &cppi41dma 17 1
+					&cppi41dma 18 1 &cppi41dma 19 1
+					&cppi41dma 20 1 &cppi41dma 21 1
+					&cppi41dma 22 1 &cppi41dma 23 1
+					&cppi41dma 24 1 &cppi41dma 25 1
+					&cppi41dma 26 1 &cppi41dma 27 1
+					&cppi41dma 28 1 &cppi41dma 29 1>;
+				dma-names =
+					"rx1", "rx2", "rx3", "rx4", "rx5", "rx6", "rx7",
+					"rx8", "rx9", "rx10", "rx11", "rx12", "rx13",
+					"rx14", "rx15",
+					"tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
+					"tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
+					"tx14", "tx15";
+			};
+
+			cppi41dma: dma-controller at 47402000 {
+				compatible = "ti,am3359-cppi41";
+				reg =  <0x47400000 0x1000
+					0x47402000 0x1000
+					0x47403000 0x1000
+					0x47404000 0x4000>;
+				reg-names = "glue", "controller", "scheduler", "queuemgr";
+				interrupts = <17>;
+				interrupt-names = "glue";
+				#dma-cells = <2>;
+				#dma-channels = <30>;
+				#dma-requests = <256>;
 			};
 		};
 
Signature · 1 line
2.1.4
#4 lore raw

PATCH 3/4 ARM: dts: Add cppi41 support for dm816x MUSB

Hi,

Quoted 7 lines · Tony Lindgren

Looks like we have cppi41 on dm816x just like on am335x.

Cc Bin Liu <[email protected]>
Cc Brian Hutchinson <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Matthijs van Duin <[email protected]>

Any logs available ? Any throughput improvements with DMA ?

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150317/47d68d58/attachment-0001.sig>
#5 lore raw

PATCH 3/4 ARM: dts: Add cppi41 support for dm816x MUSB

Quoted 5 lines · Felipe Balbi

Hi,

Quoted 2 lines · Tony Lindgren

Looks like we have cppi41 on dm816x just like on am335x.

Quoted 7 lines
Quoted 5 lines
Cc Bin Liu <[email protected]>
Cc Brian Hutchinson <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Matthijs van Duin <[email protected]>

Any logs available ? Any throughput improvements with DMA ?

So far I only logged with the debug option on. I can do some test runs with your for-next branch to a USB mass storage device if you prefer that, or got some other test in mind?

Regards,

Tony

#6 lore raw

PATCH 3/4 ARM: dts: Add cppi41 support for dm816x MUSB

Quoted 12 lines · Tony Lindgren
Quoted 11 lines · Felipe Balbi

Hi,

Quoted 7 lines · Tony Lindgren

Looks like we have cppi41 on dm816x just like on am335x.

Cc Bin Liu <[email protected]>
Cc Brian Hutchinson <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Matthijs van Duin <[email protected]>
Quoted 5 lines
Quoted 1 line

Any logs available ? Any throughput improvements with DMA ?

So far I only logged with the debug option on. I can do some test runs with your for-next branch to a USB mass storage device if you prefer that, or got some other test in mind?

mass storage should be fine, just wanna know if you're getting acceptable throughput.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150318/869be06b/attachment.sig>
#7 lore raw

PATCH 3/4 ARM: dts: Add cppi41 support for dm816x MUSB

Quoted 13 lines · Felipe Balbi
Quoted 12 lines · Tony Lindgren
Quoted 11 lines · Felipe Balbi

Hi,

Quoted 7 lines · Tony Lindgren

Looks like we have cppi41 on dm816x just like on am335x.

Cc Bin Liu <[email protected]>
Cc Brian Hutchinson <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Matthijs van Duin <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Any logs available ? Any throughput improvements with DMA ?

So far I only logged with the debug option on. I can do some test runs with your for-next branch to a USB mass storage device if you prefer that, or got some other test in mind?

mass storage should be fine, just wanna know if you're getting acceptable throughput.

No luck with your current merge branch with DMA right now, it's producing an error both on bbb and dm816x:

"musb-hdrc musb-hdrc.0.auto: Need DT for the DMA engine."

So here are some test results against -rc4.

CONFIG_MUSB_PIO_ONLY

Copy a 10MB file to /dev/sda right after a reboot:

# time /bin/sh -c 'cp filler /mnt/ && sync'
real    0m2.480s
user    0m0.000s
sys     0m0.320s

Run hdparm a few times:

# hdparm -t /dev/sda

/dev/sda:
Timing buffered disk reads: 34 MB in 3.16 seconds = 10.75 MB/sec

CONFIG_USB_TI_CPPI41_DMA

Copy a 10MB file to /dev/sda right after a reboot:

# time /bin/sh -c 'cp filler /mnt/ && sync'
real    0m2.095s
user    0m0.000s
sys     0m0.310s

Run hdparm a few times:

# hdparm -t /dev/sda

/dev/sda:
Timing buffered disk reads: 52 MB in 3.07 seconds = 16.94 MB/sec

Regards,

Tony

#8 lore raw

PATCH 4/4 ARM: dts: Remove PIN_INPUT for dm816x McSPI

In reply to Tony Lindgren

On dm816x we have no PIN_INPUT vs PIN_OUTPUT configuration, there are just pulls. Let's remove the bogus flags.

Cc Brian Hutchinson <[email protected]>
Cc Matthijs van Duin <[email protected]>
---
 arch/arm/boot/dts/dm8168-evm.dts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/dm8168-evm.dts +4 -4
index b520a8b..169a855 100644
@@ -29,10 +29,10 @@
 &dm816x_pinmux {
 	mcspi1_pins: pinmux_mcspi1_pins {
 		pinctrl-single,pins = <
-			DM816X_IOPAD(0x0a94, PIN_INPUT | MUX_MODE0)	/* SPI_SCLK */
-			DM816X_IOPAD(0x0a98, PIN_OUTPUT | MUX_MODE0)	/* SPI_SCS0 */
-			DM816X_IOPAD(0x0aa8, PIN_INPUT | MUX_MODE0)	/* SPI_D0 */
-			DM816X_IOPAD(0x0aac, PIN_INPUT | MUX_MODE0)	/* SPI_D1 */
+			DM816X_IOPAD(0x0a94, MUX_MODE0)			/* SPI_SCLK */
+			DM816X_IOPAD(0x0a98, MUX_MODE0)			/* SPI_SCS0 */
+			DM816X_IOPAD(0x0aa8, MUX_MODE0)			/* SPI_D0 */
+			DM816X_IOPAD(0x0aac, MUX_MODE0)			/* SPI_D1 */
 		>;
 	};
 
Signature · 1 line
2.1.4