devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 04/11] usb: usb: dsps: update device tree bindings
       [not found] <1377016553-26478-1-git-send-email-bigeasy@linutronix.de>
@ 2013-08-20 16:35 ` Sebastian Andrzej Siewior
       [not found]   ` <1377016553-26478-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
  2013-08-20 16:35 ` [PATCH 05/11] usb: usb: dsps: update code according to the binding document Sebastian Andrzej Siewior
  1 sibling, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-08-20 16:35 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb, Greg Kroah-Hartman, Sebastian Andrzej Siewior,
	Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
	Ian Campbell, devicetree

The support for both am335x-USB instances required changes to the device
tree bindings. This patch reflects these changes in the bindings
document.

v3…v4:
- remove the child node for USB. This is driver specific on won't be
  reflected in the device tree
- use the "mentor" prefix instead of "mg".
- use "dr_mode" istead of "mg,port-mode" for the port mode. The former
  is used by a few other drivers.

v2…v3:
- use proper usb-phy nodes in evm, bone and evmsk device tree.

v1…v2:
- use mg prefix for the Metor Graphics specific attributes
- use power in mA not in mA/2 as specifed in the USB2.0 specification
- use usbX-phy instead of usbX_phy
- use dma-controller instead of dma

Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 .../devicetree/bindings/usb/am33xx-usb.txt         | 222 ++++++++++++++++++---
 1 file changed, 192 insertions(+), 30 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index dc9dc8c..20c2ff2 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -1,35 +1,197 @@
-AM33XX MUSB GLUE
- - compatible : Should be "ti,musb-am33xx"
- - reg : offset and length of register sets, first usbss, then for musb instances
- - interrupts : usbss, musb instance interrupts in order
- - ti,hwmods : must be "usb_otg_hs"
- - multipoint : Should be "1" indicating the musb controller supports
-   multipoint. This is a MUSB configuration-specific setting.
- - num-eps : Specifies the number of endpoints. This is also a
-   MUSB configuration-specific setting. Should be set to "16"
- - ram-bits : Specifies the ram address size. Should be set to "12"
- - port0-mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
-   represents PERIPHERAL.
- - port1-mode : Should be "1" to represent HOST. "3" signifies OTG and "2"
-   represents PERIPHERAL.
- - power : Should be "250". This signifies the controller can supply up to
-   500mA when operating in host mode.
+  AM33xx MUSB
+~~~~~~~~~~~~~~~
+- compatible: ti,am33xx-usb
+- reg: offset and length of the usbss register sets
+- ti,hwmods : must be "usb_otg_hs"
+
+The glue layer contains multiple child nodes. It is required the have
+at least a control module node, USB node and a PHY node. The second USB
+node and its PHY node is optional. The DMA node is also optional.
+
+Reset module
+~~~~~~~~~~~~
+- compatible: ti,am335x-usb-ctrl-module
+- reg: offset and length of the "USB control registers" in the "Control
+  Module" block. A second offset and length for the USB wake up control
+  in the same memory block.
+- reg-names: "phy_ctrl" for the "USB control registers" and "wakeup" for
+  the USB wake up control register.
+
+USB PHY
+~~~~~~~
+compatible: ti,am335x-usb-phy
+reg: offset and length of the "USB PHY" register space
+ti,ctrl_mod: reference to the "reset module" node
+reg-names: phy
+The PHY should have a "phy" alias numbered properly in the alias
+node.
+
+USB
+~~~
+- compatible: ti,musb-am33xx
+- reg: offset and length of "USB Controller Registers", and offset and
+  length of "USB Core" register space.
+- reg-names: control for the ""USB Controller Registers" and "mc" for
+  "USB Core" register space
+- interrupts: USB interrupt number
+- interrupt-names: mc
+- dr_mode: Should be one of "host", "peripheral" or "otg".
+- mentor,multipoint: Should be "1" indicating the musb controller supports
+  multipoint. This is a MUSB configuration-specific setting.
+- mentor,num-eps: Specifies the number of endpoints. This is also a
+  MUSB configuration-specific setting. Should be set to "16"
+- mentor,ram-bits: Specifies the ram address size. Should be set to "12"
+- mentor,power: Should be "500". This signifies the controller can supply up to
+  500mA when operating in host mode.
+- phys: reference to the USB phy
+- dmas: specifies the dma channels
+- dma-names: specifies the names of the channels. Use "rxN" for receive
+  and "txN" for transmit endpoints. N specifies the endpoint number.
+
+The controller should have an "usb" alias numbered properly in the alias
+node.
+
+DMA
+~~~
+- compatible: ti,am3359-cppi41
+- reg: offset and length of the following register spaces: USBSS, USB
+  CPPI DMA Controller, USB CPPI DMA Scheduler, USB Queue Manager
+- reg-names: glue, controller, scheduler, queuemgr
+- #dma-cells: should be set to 2. The first number represents the
+  endpoint number (0 … 14 for endpoints 1 … 15 on instance 0 and 15 … 29
+  for endpoints 1 … 15 on instance 1). The second number is 0 for RX and
+  1 for TX transfers.
+- #dma-channels: should be set to 30 representing the 15 endpoints for
+  each USB instance.
 
 Example:
+~~~~~~~~
+The following example contains all the nodes as used on am335x-evm:
+
+aliases {
+	usb0 = &usb0;
+	usb1 = &usb1;
+	phy0 = &usb0_phy;
+	phy1 = &usb1_phy;
+};
 
-usb@47400000  {
-	compatible = "ti,musb-am33xx";
-	reg = <0x47400000 0x1000	/* usbss */
-	       0x47401000 0x800		/* musb instance 0 */
-	       0x47401800 0x800>;	/* musb instance 1 */
-	interrupts = <17		/* usbss */
-		      18		/* musb instance 0 */
-		      19>;		/* musb instance 1 */
-	multipoint = <1>;
-	num-eps = <16>;
-	ram-bits = <12>;
-	port0-mode = <3>;
-	port1-mode = <3>;
-	power = <250>;
+usb: usb@47400000 {
+	compatible = "ti,am33xx-usb";
+	reg = <0x47400000 0x1000>;
+	ranges;
+	#address-cells = <1>;
+	#size-cells = <1>;
 	ti,hwmods = "usb_otg_hs";
+
+	ctrl_mod: control@44e10000 {
+		compatible = "ti,am335x-usb-ctrl-module";
+		reg = <0x44e10620 0x10
+			0x44e10648 0x4>;
+		reg-names = "phy_ctrl", "wakeup";
+	};
+
+	usb0_phy: usb-phy@47401300 {
+		compatible = "ti,am335x-usb-phy";
+		reg = <0x47401300 0x100>;
+		reg-names = "phy";
+		ti,ctrl_mod = <&ctrl_mod>;
+	};
+
+	usb0: usb@47401000 {
+		compatible = "ti,musb-am33xx";
+		reg = <0x47401400 0x400
+			0x47401000 0x200>;
+		reg-names = "mc", "control";
+
+		interrupts = <18>;
+		interrupt-names = "mc";
+		dr_mode = "otg"
+		mentor,multipoint = <1>;
+		mentor,num-eps = <16>;
+		mentor,ram-bits = <12>;
+		mentor,power = <500>;
+		phys = <&usb0_phy>;
+
+		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_phy: usb-phy@47401b00 {
+		compatible = "ti,am335x-usb-phy";
+		reg = <0x47401b00 0x100>;
+		reg-names = "phy";
+		ti,ctrl_mod = <&ctrl_mod>;
+	};
+
+	usb1: usb@47401800 {
+		compatible = "ti,musb-am33xx";
+		reg = <0x47401c00 0x400
+			0x47401800 0x200>;
+		reg-names = "mc", "control";
+		interrupts = <19>;
+		interrupt-names = "mc";
+		dr_mode = "host"
+		mentor,multipoint = <1>;
+		mentor,num-eps = <16>;
+		mentor,ram-bits = <12>;
+		mentor,power = <500>;
+		phys = <&usb1_phy>;
+
+		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@07402000 {
+		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>;
+	};
 };
-- 
1.8.4.rc2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 05/11] usb: usb: dsps: update code according to the binding document
       [not found] <1377016553-26478-1-git-send-email-bigeasy@linutronix.de>
  2013-08-20 16:35 ` [PATCH 04/11] usb: usb: dsps: update device tree bindings Sebastian Andrzej Siewior
@ 2013-08-20 16:35 ` Sebastian Andrzej Siewior
       [not found]   ` <1377016553-26478-6-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-08-20 16:35 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb, Greg Kroah-Hartman, Sebastian Andrzej Siewior,
	Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
	Ian Campbell, devicetree

This relfects the code and dts requires changes due to recent .dts
binding updates:
- use mg prefix for the Metor Graphics specific attributes
- use power in mA not in mA/2 as specifed in the USB2.0 specification
- remove the child node for USB. This is driver specific on won't be
  reflected in the device tree
- use the "mentor" prefix instead of "mg".
- use "dr_mode" istead of "mg,port-mode" for the port mode. The former
  is used by a few other drivers.

Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/arm/boot/dts/am335x-bone.dts  |  2 +-
 arch/arm/boot/dts/am335x-evm.dts   |  6 ++--
 arch/arm/boot/dts/am335x-evmsk.dts |  2 +-
 arch/arm/boot/dts/am33xx.dtsi      | 67 +++++++++++++++-----------------------
 drivers/usb/musb/musb_dsps.c       | 54 ++++++++++++++++++++----------
 5 files changed, 67 insertions(+), 64 deletions(-)

diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index a8907b5..e8447a7 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -127,7 +127,7 @@
 				status = "okay";
 			};
 
-			phy@47401300 {
+			usb-phy@47401300 {
 				status = "okay";
 			};
 
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index c26c16c..648a67e 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -178,11 +178,11 @@
 				status = "okay";
 			};
 
-			phy@47401300 {
+			usb-phy@47401300 {
 				status = "okay";
 			};
 
-			phy@47401b00 {
+			usb-phy@47401b00 {
 				status = "okay";
 			};
 
@@ -194,7 +194,7 @@
 				status = "okay";
 			};
 
-			dma@07402000  {
+			dma-controller@07402000  {
 				status = "okay";
 			};
 		};
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index e92446c..a6c5033 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -214,7 +214,7 @@
 				status = "okay";
 			};
 
-			phy@47401300 {
+			usb-phy@47401300 {
 				status = "okay";
 			};
 
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index a38f8d3..f9c5da9 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -354,7 +354,7 @@
 				status = "disabled";
 			};
 
-			usb0_phy: phy@47401300 {
+			usb0_phy: usb-phy@47401300 {
 				compatible = "ti,am335x-usb-phy";
 				reg = <0x47401300 0x100>;
 				reg-names = "phy";
@@ -364,25 +364,19 @@
 
 			usb0: usb@47401000 {
 				compatible = "ti,musb-am33xx";
-				ranges;
-				#address-cells = <1>;
-				#size-cells = <1>;
-				reg = <0x47401000 0x200>;
-				reg-names = "control";
 				status = "disabled";
-
-				musb0: usb@47401400 {
-					compatible = "mg,musbmhdrc";
-					reg = <0x47401400 0x400>;
-					reg-names = "mc";
-					interrupts = <18>;
-					interrupt-names = "mc";
-					multipoint = <1>;
-					num-eps = <16>;
-					ram-bits = <12>;
-					port-mode = <3>;
-					power = <250>;
-					phys = <&usb0_phy>;
+				reg = <0x47401400 0x400
+					0x47401000 0x200>;
+				reg-names = "mc", "control";
+
+				interrupts = <18>;
+				interrupt-names = "mc";
+				dr_mode = "otg";
+				mentor,multipoint = <1>;
+				mentor,num-eps = <16>;
+				mentor,ram-bits = <12>;
+				mentor,power = <500>;
+				phys = <&usb0_phy>;
 
 				dmas = <&cppi41dma  0 0 &cppi41dma  1 0
 					&cppi41dma  2 0 &cppi41dma  3 0
@@ -406,10 +400,9 @@
 					"tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
 					"tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
 					"tx14", "tx15";
-				};
 			};
 
-			usb1_phy: phy@47401b00 {
+			usb1_phy: usb-phy@47401b00 {
 				compatible = "ti,am335x-usb-phy";
 				reg = <0x47401b00 0x100>;
 				reg-names = "phy";
@@ -419,25 +412,18 @@
 
 			usb1: usb@47401800 {
 				compatible = "ti,musb-am33xx";
-				ranges;
-				#address-cells = <1>;
-				#size-cells = <1>;
-				reg = <0x47401800 0x200>;
-				reg-names = "control";
 				status = "disabled";
-
-				musb1: usb@47401c00 {
-					compatible = "mg,musbmhdrc";
-					reg = <0x47401c00 0x400>;
-					reg-names = "mc";
-					interrupts = <19>;
-					interrupt-names = "mc";
-					multipoint = <1>;
-					num-eps = <16>;
-					ram-bits = <12>;
-					port-mode = <3>;
-					power = <250>;
-					phys = <&usb1_phy>;
+				reg = <0x47401c00 0x400
+					0x47401800 0x200>;
+				reg-names = "mc", "control";
+				interrupts = <19>;
+				interrupt-names = "mc";
+				dr_mode = "otg";
+				mentor,multipoint = <1>;
+				mentor,num-eps = <16>;
+				mentor,ram-bits = <12>;
+				mentor,power = <500>;
+				phys = <&usb1_phy>;
 
 				dmas = <&cppi41dma 15 0 &cppi41dma 16 0
 					&cppi41dma 17 0 &cppi41dma 18 0
@@ -461,10 +447,9 @@
 					"tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
 					"tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
 					"tx14", "tx15";
-				};
 			};
 
-			cppi41dma: dma@07402000 {
+			cppi41dma: dma-controller@07402000 {
 				compatible = "ti,am3359-cppi41";
 				reg =  <0x47400000 0x1000
 					0x47402000 0x1000
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 4ffbaac..5b007d1 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -44,6 +44,7 @@
 #include <linux/of_device.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/usb/of.h>
 
 #include "musb_core.h"
 
@@ -425,35 +426,51 @@ static int get_int_prop(struct device_node *dn, const char *s)
 	return val;
 }
 
+static int get_musb_port_mode(struct device *dev)
+{
+	enum usb_dr_mode mode;
+
+	mode = of_usb_get_dr_mode(dev->of_node);
+	switch (mode) {
+	case USB_DR_MODE_HOST:
+		return MUSB_PORT_MODE_HOST;
+
+	case USB_DR_MODE_PERIPHERAL:
+		return MUSB_PORT_MODE_GADGET;
+
+	case USB_DR_MODE_UNKNOWN:
+	case USB_DR_MODE_OTG:
+	default:
+		return MUSB_PORT_MODE_DUAL_ROLE;
+	};
+}
+
 static int dsps_create_musb_pdev(struct dsps_glue *glue,
 		struct platform_device *parent)
 {
 	struct musb_hdrc_platform_data pdata;
 	struct resource	resources[2];
+	struct resource	*res;
 	struct device *dev = &parent->dev;
 	struct musb_hdrc_config	*config;
 	struct platform_device *musb;
 	struct device_node *dn = parent->dev.of_node;
-	struct device_node *child_node;
 	int ret;
 
-	child_node = of_get_child_by_name(dn, "usb");
-	if (!child_node)
-		return -EINVAL;
-
 	memset(resources, 0, sizeof(resources));
-	ret = of_address_to_resource(child_node, 0, &resources[0]);
-	if (ret) {
+	res = platform_get_resource_byname(parent, IORESOURCE_MEM, "mc");
+	if (!res) {
 		dev_err(dev, "failed to get memory.\n");
-		return ret;
+		return -EINVAL;
 	}
+	resources[0] = *res;
 
-	ret = of_irq_to_resource(child_node, 0, &resources[1]);
-	if (ret == 0) {
+	res = platform_get_resource_byname(parent, IORESOURCE_IRQ, "mc");
+	if (!res) {
 		dev_err(dev, "failed to get irq.\n");
-		ret = -EINVAL;
-		return ret;
+		return -EINVAL;
 	}
+	resources[1] = *res;
 
 	/* allocate the child platform device */
 	musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
@@ -465,7 +482,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
 	musb->dev.parent		= dev;
 	musb->dev.dma_mask		= &musb_dmamask;
 	musb->dev.coherent_dma_mask	= musb_dmamask;
-	musb->dev.of_node		= of_node_get(child_node);
+	musb->dev.of_node		= of_node_get(dn);
 
 	glue->musb = musb;
 
@@ -485,11 +502,12 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
 	pdata.config = config;
 	pdata.platform_ops = &dsps_ops;
 
-	config->num_eps = get_int_prop(child_node, "num-eps");
-	config->ram_bits = get_int_prop(child_node, "ram-bits");
-	pdata.mode = get_int_prop(child_node, "port-mode");
-	pdata.power = get_int_prop(child_node, "power");
-	config->multipoint = of_property_read_bool(child_node, "multipoint");
+	config->num_eps = get_int_prop(dn, "mentor,num-eps");
+	config->ram_bits = get_int_prop(dn, "mentor,ram-bits");
+	pdata.mode = get_musb_port_mode(dev);
+	/* DT keeps this entry in mA, musb expects it as per USB spec */
+	pdata.power = get_int_prop(dn, "mentor,power") / 2;
+	config->multipoint = of_property_read_bool(dn, "mentor,multipoint");
 
 	ret = platform_device_add_data(musb, &pdata, sizeof(pdata));
 	if (ret) {
-- 
1.8.4.rc2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 04/11] usb: usb: dsps: update device tree bindings
       [not found]   ` <1377016553-26478-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
@ 2013-09-06 14:56     ` Mark Rutland
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2013-09-06 14:56 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Greg Kroah-Hartman,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, Aug 20, 2013 at 05:35:46PM +0100, Sebastian Andrzej Siewior wrote:
> The support for both am335x-USB instances required changes to the device
> tree bindings. This patch reflects these changes in the bindings
> document.
> 
> v3…v4:
> - remove the child node for USB. This is driver specific on won't be
>   reflected in the device tree
> - use the "mentor" prefix instead of "mg".
> - use "dr_mode" istead of "mg,port-mode" for the port mode. The former
>   is used by a few other drivers.
> 
> v2…v3:
> - use proper usb-phy nodes in evm, bone and evmsk device tree.
> 
> v1…v2:
> - use mg prefix for the Metor Graphics specific attributes
> - use power in mA not in mA/2 as specifed in the USB2.0 specification
> - use usbX-phy instead of usbX_phy
> - use dma-controller instead of dma
> 
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
> Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
> Cc: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
> Cc: Ian Campbell <ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> ---
>  .../devicetree/bindings/usb/am33xx-usb.txt         | 222 ++++++++++++++++++---
>  1 file changed, 192 insertions(+), 30 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
> index dc9dc8c..20c2ff2 100644
> --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
> @@ -1,35 +1,197 @@
> -AM33XX MUSB GLUE
> - - compatible : Should be "ti,musb-am33xx"
> - - reg : offset and length of register sets, first usbss, then for musb instances
> - - interrupts : usbss, musb instance interrupts in order
> - - ti,hwmods : must be "usb_otg_hs"
> - - multipoint : Should be "1" indicating the musb controller supports
> -   multipoint. This is a MUSB configuration-specific setting.
> - - num-eps : Specifies the number of endpoints. This is also a
> -   MUSB configuration-specific setting. Should be set to "16"
> - - ram-bits : Specifies the ram address size. Should be set to "12"
> - - port0-mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
> -   represents PERIPHERAL.
> - - port1-mode : Should be "1" to represent HOST. "3" signifies OTG and "2"
> -   represents PERIPHERAL.
> - - power : Should be "250". This signifies the controller can supply up to
> -   500mA when operating in host mode.
> +  AM33xx MUSB
> +~~~~~~~~~~~~~~~
> +- compatible: ti,am33xx-usb
> +- reg: offset and length of the usbss register sets
> +- ti,hwmods : must be "usb_otg_hs"
> +
> +The glue layer contains multiple child nodes. It is required the have
> +at least a control module node, USB node and a PHY node. The second USB
> +node and its PHY node is optional. The DMA node is also optional.
> +
> +Reset module
> +~~~~~~~~~~~~
> +- compatible: ti,am335x-usb-ctrl-module
> +- reg: offset and length of the "USB control registers" in the "Control
> +  Module" block. A second offset and length for the USB wake up control
> +  in the same memory block.
> +- reg-names: "phy_ctrl" for the "USB control registers" and "wakeup" for
> +  the USB wake up control register.
> +
> +USB PHY
> +~~~~~~~
> +compatible: ti,am335x-usb-phy
> +reg: offset and length of the "USB PHY" register space
> +ti,ctrl_mod: reference to the "reset module" node
> +reg-names: phy

For consistency, these should be bullet bpoints (as with the Reset
module properties above).

Also, preferably:

- reg-names: should contain "phy".

> +The PHY should have a "phy" alias numbered properly in the alias
> +node.

Why?

> +
> +USB
> +~~~
> +- compatible: ti,musb-am33xx
> +- reg: offset and length of "USB Controller Registers", and offset and
> +  length of "USB Core" register space.
> +- reg-names: control for the ""USB Controller Registers" and "mc" for
> +  "USB Core" register space

Consistent quoting please.

> +- interrupts: USB interrupt number

- interrupts: should contain an interrupt-specifier for the USB
              interrupt.

Is this the only interrupt? Is there a particular name for it in any
data sheet?

> +- interrupt-names: mc

String property values quoted please:

- interrupt-names: should contain "mc" for the USB interrupt.

Is "mc" the name of the interrupt on the data sheet?

> +- dr_mode: Should be one of "host", "peripheral" or "otg".
> +- mentor,multipoint: Should be "1" indicating the musb controller supports
> +  multipoint. This is a MUSB configuration-specific setting.

Is this a boolean value?

Why is this not an empty property?

> +- mentor,num-eps: Specifies the number of endpoints. This is also a
> +  MUSB configuration-specific setting. Should be set to "16"
> +- mentor,ram-bits: Specifies the ram address size. Should be set to "12"

Is this to define the address space the controller can see? What if it's
offset from the CPU's view? This sounds like something better described
via another means (like dma-ranges).

> +- mentor,power: Should be "500". This signifies the controller can supply up to
> +  500mA when operating in host mode.

Why do we nee a particular value in a binding-specific property?

> +- phys: reference to the USB phy
> +- dmas: specifies the dma channels

Please refer to the bindings for these.

> +- dma-names: specifies the names of the channels. Use "rxN" for receive
> +  and "txN" for transmit endpoints. N specifies the endpoint number.
> +
> +The controller should have an "usb" alias numbered properly in the alias
> +node.

Why?

> +
> +DMA
> +~~~
> +- compatible: ti,am3359-cppi41
> +- reg: offset and length of the following register spaces: USBSS, USB
> +  CPPI DMA Controller, USB CPPI DMA Scheduler, USB Queue Manager
> +- reg-names: glue, controller, scheduler, queuemgr

Are these expected to be in the order described in reg, or in any order
and should be looked up via reg-names?

> +- #dma-cells: should be set to 2. The first number represents the
> +  endpoint number (0 … 14 for endpoints 1 … 15 on instance 0 and 15 … 29
> +  for endpoints 1 … 15 on instance 1). The second number is 0 for RX and
> +  1 for TX transfers.

Any reason for describing that one-off?

> +- #dma-channels: should be set to 30 representing the 15 endpoints for
> +  each USB instance.
>  
>  Example:
> +~~~~~~~~
> +The following example contains all the nodes as used on am335x-evm:
> +
> +aliases {
> +	usb0 = &usb0;
> +	usb1 = &usb1;
> +	phy0 = &usb0_phy;
> +	phy1 = &usb1_phy;
> +};
>  
> -usb@47400000  {
> -	compatible = "ti,musb-am33xx";
> -	reg = <0x47400000 0x1000	/* usbss */
> -	       0x47401000 0x800		/* musb instance 0 */
> -	       0x47401800 0x800>;	/* musb instance 1 */
> -	interrupts = <17		/* usbss */
> -		      18		/* musb instance 0 */
> -		      19>;		/* musb instance 1 */
> -	multipoint = <1>;
> -	num-eps = <16>;
> -	ram-bits = <12>;
> -	port0-mode = <3>;
> -	port1-mode = <3>;
> -	power = <250>;
> +usb: usb@47400000 {
> +	compatible = "ti,am33xx-usb";
> +	reg = <0x47400000 0x1000>;
> +	ranges;
> +	#address-cells = <1>;
> +	#size-cells = <1>;
>  	ti,hwmods = "usb_otg_hs";
> +
> +	ctrl_mod: control@44e10000 {
> +		compatible = "ti,am335x-usb-ctrl-module";
> +		reg = <0x44e10620 0x10
> +			0x44e10648 0x4>;

Nit: could you bracket these independently please? Like this:

		reg = <0x44e10620 0x10>,
		      <0x44e10648 0x4>;

Similarly for other composite values in lists.

Cheers,
Mark.

> +		reg-names = "phy_ctrl", "wakeup";
> +	};
> +
> +	usb0_phy: usb-phy@47401300 {
> +		compatible = "ti,am335x-usb-phy";
> +		reg = <0x47401300 0x100>;
> +		reg-names = "phy";
> +		ti,ctrl_mod = <&ctrl_mod>;
> +	};
> +
> +	usb0: usb@47401000 {
> +		compatible = "ti,musb-am33xx";
> +		reg = <0x47401400 0x400
> +			0x47401000 0x200>;
> +		reg-names = "mc", "control";
> +
> +		interrupts = <18>;
> +		interrupt-names = "mc";
> +		dr_mode = "otg"
> +		mentor,multipoint = <1>;
> +		mentor,num-eps = <16>;
> +		mentor,ram-bits = <12>;
> +		mentor,power = <500>;
> +		phys = <&usb0_phy>;
> +
> +		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_phy: usb-phy@47401b00 {
> +		compatible = "ti,am335x-usb-phy";
> +		reg = <0x47401b00 0x100>;
> +		reg-names = "phy";
> +		ti,ctrl_mod = <&ctrl_mod>;
> +	};
> +
> +	usb1: usb@47401800 {
> +		compatible = "ti,musb-am33xx";
> +		reg = <0x47401c00 0x400
> +			0x47401800 0x200>;
> +		reg-names = "mc", "control";
> +		interrupts = <19>;
> +		interrupt-names = "mc";
> +		dr_mode = "host"
> +		mentor,multipoint = <1>;
> +		mentor,num-eps = <16>;
> +		mentor,ram-bits = <12>;
> +		mentor,power = <500>;
> +		phys = <&usb1_phy>;
> +
> +		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@07402000 {
> +		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>;
> +	};
>  };
> -- 
> 1.8.4.rc2
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 05/11] usb: usb: dsps: update code according to the binding document
       [not found]   ` <1377016553-26478-6-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
@ 2013-09-06 15:01     ` Mark Rutland
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2013-09-06 15:01 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Greg Kroah-Hartman,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, Aug 20, 2013 at 05:35:47PM +0100, Sebastian Andrzej Siewior wrote:
> This relfects the code and dts requires changes due to recent .dts
> binding updates:
> - use mg prefix for the Metor Graphics specific attributes
> - use power in mA not in mA/2 as specifed in the USB2.0 specification
> - remove the child node for USB. This is driver specific on won't be
>   reflected in the device tree
> - use the "mentor" prefix instead of "mg".
> - use "dr_mode" istead of "mg,port-mode" for the port mode. The former
>   is used by a few other drivers.
> 
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
> Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
> Cc: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
> Cc: Ian Campbell <ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> ---
>  arch/arm/boot/dts/am335x-bone.dts  |  2 +-
>  arch/arm/boot/dts/am335x-evm.dts   |  6 ++--
>  arch/arm/boot/dts/am335x-evmsk.dts |  2 +-
>  arch/arm/boot/dts/am33xx.dtsi      | 67 +++++++++++++++-----------------------
>  drivers/usb/musb/musb_dsps.c       | 54 ++++++++++++++++++++----------
>  5 files changed, 67 insertions(+), 64 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
> index a8907b5..e8447a7 100644
> --- a/arch/arm/boot/dts/am335x-bone.dts
> +++ b/arch/arm/boot/dts/am335x-bone.dts
> @@ -127,7 +127,7 @@
>  				status = "okay";
>  			};
>  
> -			phy@47401300 {
> +			usb-phy@47401300 {
>  				status = "okay";
>  			};
>  
> diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
> index c26c16c..648a67e 100644
> --- a/arch/arm/boot/dts/am335x-evm.dts
> +++ b/arch/arm/boot/dts/am335x-evm.dts
> @@ -178,11 +178,11 @@
>  				status = "okay";
>  			};
>  
> -			phy@47401300 {
> +			usb-phy@47401300 {
>  				status = "okay";
>  			};
>  
> -			phy@47401b00 {
> +			usb-phy@47401b00 {
>  				status = "okay";
>  			};
>  
> @@ -194,7 +194,7 @@
>  				status = "okay";
>  			};
>  
> -			dma@07402000  {
> +			dma-controller@07402000  {
>  				status = "okay";
>  			};
>  		};
> diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
> index e92446c..a6c5033 100644
> --- a/arch/arm/boot/dts/am335x-evmsk.dts
> +++ b/arch/arm/boot/dts/am335x-evmsk.dts
> @@ -214,7 +214,7 @@
>  				status = "okay";
>  			};
>  
> -			phy@47401300 {
> +			usb-phy@47401300 {
>  				status = "okay";
>  			};
>  
> diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
> index a38f8d3..f9c5da9 100644
> --- a/arch/arm/boot/dts/am33xx.dtsi
> +++ b/arch/arm/boot/dts/am33xx.dtsi
> @@ -354,7 +354,7 @@
>  				status = "disabled";
>  			};
>  
> -			usb0_phy: phy@47401300 {
> +			usb0_phy: usb-phy@47401300 {
>  				compatible = "ti,am335x-usb-phy";
>  				reg = <0x47401300 0x100>;
>  				reg-names = "phy";
> @@ -364,25 +364,19 @@
>  
>  			usb0: usb@47401000 {
>  				compatible = "ti,musb-am33xx";
> -				ranges;
> -				#address-cells = <1>;
> -				#size-cells = <1>;
> -				reg = <0x47401000 0x200>;
> -				reg-names = "control";
>  				status = "disabled";
> -
> -				musb0: usb@47401400 {
> -					compatible = "mg,musbmhdrc";
> -					reg = <0x47401400 0x400>;
> -					reg-names = "mc";
> -					interrupts = <18>;
> -					interrupt-names = "mc";
> -					multipoint = <1>;
> -					num-eps = <16>;
> -					ram-bits = <12>;
> -					port-mode = <3>;
> -					power = <250>;
> -					phys = <&usb0_phy>;
> +				reg = <0x47401400 0x400
> +					0x47401000 0x200>;
> +				reg-names = "mc", "control";
> +
> +				interrupts = <18>;
> +				interrupt-names = "mc";
> +				dr_mode = "otg";
> +				mentor,multipoint = <1>;
> +				mentor,num-eps = <16>;
> +				mentor,ram-bits = <12>;
> +				mentor,power = <500>;
> +				phys = <&usb0_phy>;
>  
>  				dmas = <&cppi41dma  0 0 &cppi41dma  1 0
>  					&cppi41dma  2 0 &cppi41dma  3 0
> @@ -406,10 +400,9 @@
>  					"tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
>  					"tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
>  					"tx14", "tx15";
> -				};
>  			};
>  
> -			usb1_phy: phy@47401b00 {
> +			usb1_phy: usb-phy@47401b00 {
>  				compatible = "ti,am335x-usb-phy";
>  				reg = <0x47401b00 0x100>;
>  				reg-names = "phy";
> @@ -419,25 +412,18 @@
>  
>  			usb1: usb@47401800 {
>  				compatible = "ti,musb-am33xx";
> -				ranges;
> -				#address-cells = <1>;
> -				#size-cells = <1>;
> -				reg = <0x47401800 0x200>;
> -				reg-names = "control";
>  				status = "disabled";
> -
> -				musb1: usb@47401c00 {
> -					compatible = "mg,musbmhdrc";
> -					reg = <0x47401c00 0x400>;
> -					reg-names = "mc";
> -					interrupts = <19>;
> -					interrupt-names = "mc";
> -					multipoint = <1>;
> -					num-eps = <16>;
> -					ram-bits = <12>;
> -					port-mode = <3>;
> -					power = <250>;
> -					phys = <&usb1_phy>;
> +				reg = <0x47401c00 0x400
> +					0x47401800 0x200>;
> +				reg-names = "mc", "control";
> +				interrupts = <19>;
> +				interrupt-names = "mc";
> +				dr_mode = "otg";
> +				mentor,multipoint = <1>;
> +				mentor,num-eps = <16>;
> +				mentor,ram-bits = <12>;
> +				mentor,power = <500>;
> +				phys = <&usb1_phy>;
>  
>  				dmas = <&cppi41dma 15 0 &cppi41dma 16 0
>  					&cppi41dma 17 0 &cppi41dma 18 0
> @@ -461,10 +447,9 @@
>  					"tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
>  					"tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
>  					"tx14", "tx15";
> -				};
>  			};
>  
> -			cppi41dma: dma@07402000 {
> +			cppi41dma: dma-controller@07402000 {
>  				compatible = "ti,am3359-cppi41";
>  				reg =  <0x47400000 0x1000
>  					0x47402000 0x1000
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 4ffbaac..5b007d1 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -44,6 +44,7 @@
>  #include <linux/of_device.h>
>  #include <linux/of_address.h>
>  #include <linux/of_irq.h>
> +#include <linux/usb/of.h>
>  
>  #include "musb_core.h"
>  
> @@ -425,35 +426,51 @@ static int get_int_prop(struct device_node *dn, const char *s)
>  	return val;
>  }
>  
> +static int get_musb_port_mode(struct device *dev)
> +{
> +	enum usb_dr_mode mode;
> +
> +	mode = of_usb_get_dr_mode(dev->of_node);
> +	switch (mode) {
> +	case USB_DR_MODE_HOST:
> +		return MUSB_PORT_MODE_HOST;
> +
> +	case USB_DR_MODE_PERIPHERAL:
> +		return MUSB_PORT_MODE_GADGET;
> +
> +	case USB_DR_MODE_UNKNOWN:
> +	case USB_DR_MODE_OTG:
> +	default:
> +		return MUSB_PORT_MODE_DUAL_ROLE;
> +	};
> +}
> +
>  static int dsps_create_musb_pdev(struct dsps_glue *glue,
>  		struct platform_device *parent)
>  {
>  	struct musb_hdrc_platform_data pdata;
>  	struct resource	resources[2];
> +	struct resource	*res;
>  	struct device *dev = &parent->dev;
>  	struct musb_hdrc_config	*config;
>  	struct platform_device *musb;
>  	struct device_node *dn = parent->dev.of_node;
> -	struct device_node *child_node;
>  	int ret;
>  
> -	child_node = of_get_child_by_name(dn, "usb");
> -	if (!child_node)
> -		return -EINVAL;
> -
>  	memset(resources, 0, sizeof(resources));
> -	ret = of_address_to_resource(child_node, 0, &resources[0]);
> -	if (ret) {
> +	res = platform_get_resource_byname(parent, IORESOURCE_MEM, "mc");
> +	if (!res) {
>  		dev_err(dev, "failed to get memory.\n");
> -		return ret;
> +		return -EINVAL;
>  	}
> +	resources[0] = *res;
>  
> -	ret = of_irq_to_resource(child_node, 0, &resources[1]);
> -	if (ret == 0) {
> +	res = platform_get_resource_byname(parent, IORESOURCE_IRQ, "mc");
> +	if (!res) {
>  		dev_err(dev, "failed to get irq.\n");
> -		ret = -EINVAL;
> -		return ret;
> +		return -EINVAL;
>  	}
> +	resources[1] = *res;
>  
>  	/* allocate the child platform device */
>  	musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
> @@ -465,7 +482,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
>  	musb->dev.parent		= dev;
>  	musb->dev.dma_mask		= &musb_dmamask;
>  	musb->dev.coherent_dma_mask	= musb_dmamask;
> -	musb->dev.of_node		= of_node_get(child_node);
> +	musb->dev.of_node		= of_node_get(dn);
>  
>  	glue->musb = musb;
>  
> @@ -485,11 +502,12 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
>  	pdata.config = config;
>  	pdata.platform_ops = &dsps_ops;
>  
> -	config->num_eps = get_int_prop(child_node, "num-eps");
> -	config->ram_bits = get_int_prop(child_node, "ram-bits");
> -	pdata.mode = get_int_prop(child_node, "port-mode");
> -	pdata.power = get_int_prop(child_node, "power");
> -	config->multipoint = of_property_read_bool(child_node, "multipoint");
> +	config->num_eps = get_int_prop(dn, "mentor,num-eps");
> +	config->ram_bits = get_int_prop(dn, "mentor,ram-bits");
> +	pdata.mode = get_musb_port_mode(dev);
> +	/* DT keeps this entry in mA, musb expects it as per USB spec */
> +	pdata.power = get_int_prop(dn, "mentor,power") / 2;

Surely this will break existing DTs (the driver will decide they operate
at half the mA the old dt described)?

Thanks,
Mark.

> +	config->multipoint = of_property_read_bool(dn, "mentor,multipoint");

So this is a boolean property, as I asked in my last reply.

In DTs this can be:

	mentor,multipoint;

Rather than:

	mentor,multipoint = <1>;

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-06 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1377016553-26478-1-git-send-email-bigeasy@linutronix.de>
2013-08-20 16:35 ` [PATCH 04/11] usb: usb: dsps: update device tree bindings Sebastian Andrzej Siewior
     [not found]   ` <1377016553-26478-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-09-06 14:56     ` Mark Rutland
2013-08-20 16:35 ` [PATCH 05/11] usb: usb: dsps: update code according to the binding document Sebastian Andrzej Siewior
     [not found]   ` <1377016553-26478-6-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-09-06 15:01     ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).