All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add DT support for DA8xx
@ 2016-10-25 14:39 ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman, robh+dt, b-liu
  Cc: linux-kernel, linux-usb, devicetree, linux-arm-kernel, Alexandre Bailon

The purpose of this series is to add DT support to the da8xx USB OTG.
This series should apply and build without any issues but it has
some dependencies on "Add DT support for ohci-da8xx" series.
Without it, the phy init will fail and then the da8xx driver will also fail.

Alexandre Bailon (1):
  ARM: dts: da850: Add the usb otg device node

Petr Kulhavy (3):
  dt/bindings: Add binding for the DA8xx MUSB driver
  usb: musb: core: added helper function for parsing DT
  usb: musb: da8xx: Add DT support for the DA8xx driver

 .../devicetree/bindings/usb/da8xx-usb.txt          | 33 ++++++++++
 arch/arm/boot/dts/da850-lcdk.dts                   |  8 +++
 arch/arm/boot/dts/da850.dtsi                       | 15 +++++
 drivers/usb/musb/da8xx.c                           | 76 +++++++++++++++++++---
 drivers/usb/musb/musb_core.c                       | 19 ++++++
 drivers/usb/musb/musb_core.h                       |  5 ++
 6 files changed, 147 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

-- 
2.7.3

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

* [PATCH 0/4] Add DT support for DA8xx
@ 2016-10-25 14:39 ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman-rdvid1DuHRBWk0Htik3J/w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	b-liu-l0cyMroinI0
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Alexandre Bailon

The purpose of this series is to add DT support to the da8xx USB OTG.
This series should apply and build without any issues but it has
some dependencies on "Add DT support for ohci-da8xx" series.
Without it, the phy init will fail and then the da8xx driver will also fail.

Alexandre Bailon (1):
  ARM: dts: da850: Add the usb otg device node

Petr Kulhavy (3):
  dt/bindings: Add binding for the DA8xx MUSB driver
  usb: musb: core: added helper function for parsing DT
  usb: musb: da8xx: Add DT support for the DA8xx driver

 .../devicetree/bindings/usb/da8xx-usb.txt          | 33 ++++++++++
 arch/arm/boot/dts/da850-lcdk.dts                   |  8 +++
 arch/arm/boot/dts/da850.dtsi                       | 15 +++++
 drivers/usb/musb/da8xx.c                           | 76 +++++++++++++++++++---
 drivers/usb/musb/musb_core.c                       | 19 ++++++
 drivers/usb/musb/musb_core.h                       |  5 ++
 6 files changed, 147 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

-- 
2.7.3

--
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] 21+ messages in thread

* [PATCH 0/4] Add DT support for DA8xx
@ 2016-10-25 14:39 ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

The purpose of this series is to add DT support to the da8xx USB OTG.
This series should apply and build without any issues but it has
some dependencies on "Add DT support for ohci-da8xx" series.
Without it, the phy init will fail and then the da8xx driver will also fail.

Alexandre Bailon (1):
  ARM: dts: da850: Add the usb otg device node

Petr Kulhavy (3):
  dt/bindings: Add binding for the DA8xx MUSB driver
  usb: musb: core: added helper function for parsing DT
  usb: musb: da8xx: Add DT support for the DA8xx driver

 .../devicetree/bindings/usb/da8xx-usb.txt          | 33 ++++++++++
 arch/arm/boot/dts/da850-lcdk.dts                   |  8 +++
 arch/arm/boot/dts/da850.dtsi                       | 15 +++++
 drivers/usb/musb/da8xx.c                           | 76 +++++++++++++++++++---
 drivers/usb/musb/musb_core.c                       | 19 ++++++
 drivers/usb/musb/musb_core.h                       |  5 ++
 6 files changed, 147 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

-- 
2.7.3

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

* [PATCH 1/4] dt/bindings: Add binding for the DA8xx MUSB driver
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman, robh+dt, b-liu
  Cc: linux-kernel, linux-usb, devicetree, linux-arm-kernel,
	Petr Kulhavy, Alexandre Bailon

From: Petr Kulhavy <petr@barix.com>

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

Signed-off-by: Petr Kulhavy <petr@barix.com>
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 .../devicetree/bindings/usb/da8xx-usb.txt          | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/da8xx-usb.txt b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
new file mode 100644
index 0000000..5663d79
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
@@ -0,0 +1,43 @@
+TI DA8xx MUSB
+~~~~~~~~~~~~~
+For DA8xx/OMAP-L1x/AM17xx/AM18xx platforms.
+
+Required properties:
+~~~~~~~~~~~~~~~~~~~~
+ - compatible : Should be set to "ti,da830-musb".
+
+ - reg: Offset and length of the USB controller register set.
+
+ - interrupts: The USB interrupt number.
+
+ - interrupt-names: Should be set to "mc".
+
+ - dr_mode: The USB operation mode. Should be one of "host", "peripheral" or "otg".
+
+ - phys: Phandle for the PHY device
+
+ - phy-names: Should be "usb-phy"
+
+Optional properties:
+~~~~~~~~~~~~~~~~~~~~
+ - vbus-supply: Phandle to a regulator providing the USB bus power.
+
+Example:
+	usb_phy: usb-phy {
+		compatible = "ti,da830-usb-phy";
+		#phy-cells = <0>;
+		status = "okay";
+	};
+	usb20: usb@1e00000 {
+		compatible = "ti,da830-musb";
+		reg =   <0x00200000 0x10000>;
+		interrupts = <58>;
+		interrupt-names = "mc";
+
+		dr_mode = "host";
+		vbus-supply = <&usb_vbus>;
+		phys = <&usb_phy 0>;
+		phy-names = "usb-phy";
+
+		status = "okay";
+	};
-- 
2.7.3

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

* [PATCH 1/4] dt/bindings: Add binding for the DA8xx MUSB driver
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman-rdvid1DuHRBWk0Htik3J/w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	b-liu-l0cyMroinI0
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Petr Kulhavy,
	Alexandre Bailon

From: Petr Kulhavy <petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

Signed-off-by: Petr Kulhavy <petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Alexandre Bailon <abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
---
 .../devicetree/bindings/usb/da8xx-usb.txt          | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/da8xx-usb.txt b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
new file mode 100644
index 0000000..5663d79
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
@@ -0,0 +1,43 @@
+TI DA8xx MUSB
+~~~~~~~~~~~~~
+For DA8xx/OMAP-L1x/AM17xx/AM18xx platforms.
+
+Required properties:
+~~~~~~~~~~~~~~~~~~~~
+ - compatible : Should be set to "ti,da830-musb".
+
+ - reg: Offset and length of the USB controller register set.
+
+ - interrupts: The USB interrupt number.
+
+ - interrupt-names: Should be set to "mc".
+
+ - dr_mode: The USB operation mode. Should be one of "host", "peripheral" or "otg".
+
+ - phys: Phandle for the PHY device
+
+ - phy-names: Should be "usb-phy"
+
+Optional properties:
+~~~~~~~~~~~~~~~~~~~~
+ - vbus-supply: Phandle to a regulator providing the USB bus power.
+
+Example:
+	usb_phy: usb-phy {
+		compatible = "ti,da830-usb-phy";
+		#phy-cells = <0>;
+		status = "okay";
+	};
+	usb20: usb@1e00000 {
+		compatible = "ti,da830-musb";
+		reg =   <0x00200000 0x10000>;
+		interrupts = <58>;
+		interrupt-names = "mc";
+
+		dr_mode = "host";
+		vbus-supply = <&usb_vbus>;
+		phys = <&usb_phy 0>;
+		phy-names = "usb-phy";
+
+		status = "okay";
+	};
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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 related	[flat|nested] 21+ messages in thread

* [PATCH 1/4] dt/bindings: Add binding for the DA8xx MUSB driver
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

From: Petr Kulhavy <petr@barix.com>

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

Signed-off-by: Petr Kulhavy <petr@barix.com>
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 .../devicetree/bindings/usb/da8xx-usb.txt          | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/da8xx-usb.txt b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
new file mode 100644
index 0000000..5663d79
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
@@ -0,0 +1,43 @@
+TI DA8xx MUSB
+~~~~~~~~~~~~~
+For DA8xx/OMAP-L1x/AM17xx/AM18xx platforms.
+
+Required properties:
+~~~~~~~~~~~~~~~~~~~~
+ - compatible : Should be set to "ti,da830-musb".
+
+ - reg: Offset and length of the USB controller register set.
+
+ - interrupts: The USB interrupt number.
+
+ - interrupt-names: Should be set to "mc".
+
+ - dr_mode: The USB operation mode. Should be one of "host", "peripheral" or "otg".
+
+ - phys: Phandle for the PHY device
+
+ - phy-names: Should be "usb-phy"
+
+Optional properties:
+~~~~~~~~~~~~~~~~~~~~
+ - vbus-supply: Phandle to a regulator providing the USB bus power.
+
+Example:
+	usb_phy: usb-phy {
+		compatible = "ti,da830-usb-phy";
+		#phy-cells = <0>;
+		status = "okay";
+	};
+	usb20: usb at 1e00000 {
+		compatible = "ti,da830-musb";
+		reg =   <0x00200000 0x10000>;
+		interrupts = <58>;
+		interrupt-names = "mc";
+
+		dr_mode = "host";
+		vbus-supply = <&usb_vbus>;
+		phys = <&usb_phy 0>;
+		phy-names = "usb-phy";
+
+		status = "okay";
+	};
-- 
2.7.3

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

* [PATCH 2/4] usb: musb: core: added helper function for parsing DT
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman, robh+dt, b-liu
  Cc: linux-kernel, linux-usb, devicetree, linux-arm-kernel,
	Petr Kulhavy, Alexandre Bailon

From: Petr Kulhavy <petr@barix.com>

This adds the function musb_get_mode() to get the DT property "dr_mode"

Signed-off-by: Petr Kulhavy <petr@barix.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 drivers/usb/musb/musb_core.c | 19 +++++++++++++++++++
 drivers/usb/musb/musb_core.h |  5 +++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 27dadc0..bba07e7 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,6 +100,7 @@
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb.h>
+#include <linux/usb/of.h>
 
 #include "musb_core.h"
 #include "musb_trace.h"
@@ -130,6 +131,24 @@ static inline struct musb *dev_to_musb(struct device *dev)
 	return dev_get_drvdata(dev);
 }
 
+enum musb_mode musb_get_mode(struct device *dev)
+{
+	enum usb_dr_mode mode;
+
+	mode = usb_get_dr_mode(dev);
+	switch (mode) {
+	case USB_DR_MODE_HOST:
+		return MUSB_HOST;
+	case USB_DR_MODE_PERIPHERAL:
+		return MUSB_PERIPHERAL;
+	case USB_DR_MODE_OTG:
+	case USB_DR_MODE_UNKNOWN:
+	default:
+		return MUSB_OTG;
+	}
+}
+EXPORT_SYMBOL_GPL(musb_get_mode);
+
 /*-------------------------------------------------------------------------*/
 
 #ifndef CONFIG_BLACKFIN
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 2cb88a49..a406468 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -617,4 +617,9 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb)
 		musb->ops->post_root_reset_end(musb);
 }
 
+/* gets the "dr_mode" property from DT and converts it into musb_mode
+ * if the property is not found or not recognized returns MUSB_OTG
+ */
+extern enum musb_mode musb_get_mode(struct device *dev);
+
 #endif	/* __MUSB_CORE_H__ */
-- 
2.7.3

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

* [PATCH 2/4] usb: musb: core: added helper function for parsing DT
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman-rdvid1DuHRBWk0Htik3J/w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	b-liu-l0cyMroinI0
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Petr Kulhavy,
	Alexandre Bailon

From: Petr Kulhavy <petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>

This adds the function musb_get_mode() to get the DT property "dr_mode"

Signed-off-by: Petr Kulhavy <petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
Acked-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Signed-off-by: Alexandre Bailon <abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
---
 drivers/usb/musb/musb_core.c | 19 +++++++++++++++++++
 drivers/usb/musb/musb_core.h |  5 +++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 27dadc0..bba07e7 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,6 +100,7 @@
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb.h>
+#include <linux/usb/of.h>
 
 #include "musb_core.h"
 #include "musb_trace.h"
@@ -130,6 +131,24 @@ static inline struct musb *dev_to_musb(struct device *dev)
 	return dev_get_drvdata(dev);
 }
 
+enum musb_mode musb_get_mode(struct device *dev)
+{
+	enum usb_dr_mode mode;
+
+	mode = usb_get_dr_mode(dev);
+	switch (mode) {
+	case USB_DR_MODE_HOST:
+		return MUSB_HOST;
+	case USB_DR_MODE_PERIPHERAL:
+		return MUSB_PERIPHERAL;
+	case USB_DR_MODE_OTG:
+	case USB_DR_MODE_UNKNOWN:
+	default:
+		return MUSB_OTG;
+	}
+}
+EXPORT_SYMBOL_GPL(musb_get_mode);
+
 /*-------------------------------------------------------------------------*/
 
 #ifndef CONFIG_BLACKFIN
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 2cb88a49..a406468 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -617,4 +617,9 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb)
 		musb->ops->post_root_reset_end(musb);
 }
 
+/* gets the "dr_mode" property from DT and converts it into musb_mode
+ * if the property is not found or not recognized returns MUSB_OTG
+ */
+extern enum musb_mode musb_get_mode(struct device *dev);
+
 #endif	/* __MUSB_CORE_H__ */
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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 related	[flat|nested] 21+ messages in thread

* [PATCH 2/4] usb: musb: core: added helper function for parsing DT
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

From: Petr Kulhavy <petr@barix.com>

This adds the function musb_get_mode() to get the DT property "dr_mode"

Signed-off-by: Petr Kulhavy <petr@barix.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 drivers/usb/musb/musb_core.c | 19 +++++++++++++++++++
 drivers/usb/musb/musb_core.h |  5 +++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 27dadc0..bba07e7 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,6 +100,7 @@
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb.h>
+#include <linux/usb/of.h>
 
 #include "musb_core.h"
 #include "musb_trace.h"
@@ -130,6 +131,24 @@ static inline struct musb *dev_to_musb(struct device *dev)
 	return dev_get_drvdata(dev);
 }
 
+enum musb_mode musb_get_mode(struct device *dev)
+{
+	enum usb_dr_mode mode;
+
+	mode = usb_get_dr_mode(dev);
+	switch (mode) {
+	case USB_DR_MODE_HOST:
+		return MUSB_HOST;
+	case USB_DR_MODE_PERIPHERAL:
+		return MUSB_PERIPHERAL;
+	case USB_DR_MODE_OTG:
+	case USB_DR_MODE_UNKNOWN:
+	default:
+		return MUSB_OTG;
+	}
+}
+EXPORT_SYMBOL_GPL(musb_get_mode);
+
 /*-------------------------------------------------------------------------*/
 
 #ifndef CONFIG_BLACKFIN
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 2cb88a49..a406468 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -617,4 +617,9 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb)
 		musb->ops->post_root_reset_end(musb);
 }
 
+/* gets the "dr_mode" property from DT and converts it into musb_mode
+ * if the property is not found or not recognized returns MUSB_OTG
+ */
+extern enum musb_mode musb_get_mode(struct device *dev);
+
 #endif	/* __MUSB_CORE_H__ */
-- 
2.7.3

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

* [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver
  2016-10-25 14:39 ` Alexandre Bailon
@ 2016-10-25 14:39   ` Alexandre Bailon
  -1 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman, robh+dt, b-liu
  Cc: linux-kernel, linux-usb, devicetree, linux-arm-kernel,
	Petr Kulhavy, Alexandre Bailon

From: Petr Kulhavy <petr@barix.com>

This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver

Signed-off-by: Petr Kulhavy <petr@barix.com>
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 drivers/usb/musb/da8xx.c | 76 ++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 67 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 210b7e4..d465087 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -6,6 +6,9 @@
  * Based on the DaVinci "glue layer" code.
  * Copyright (C) 2005-2006 by Texas Instruments
  *
+ * DT support
+ * Copyright (c) 2016 Petr Kulhavy <petr@barix.com>
+ *
  * This file is part of the Inventra Controller Driver for Linux.
  *
  * The Inventra Controller Driver for Linux is free software; you
@@ -433,6 +436,21 @@ static int da8xx_musb_exit(struct musb *musb)
 	return 0;
 }
 
+static inline u8 get_vbus_power(struct device *dev)
+{
+	struct regulator *vbus_supply;
+	int current_uA;
+
+	vbus_supply = regulator_get_optional(dev, "vbus");
+	if (IS_ERR(vbus_supply))
+		return 255;
+	current_uA = regulator_get_current_limit(vbus_supply);
+	regulator_put(vbus_supply);
+	if (current_uA <= 0 || current_uA > 510000)
+		return 255;
+	return current_uA / 1000 / 2;
+}
+
 static const struct musb_platform_ops da8xx_ops = {
 	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP,
 	.init		= da8xx_musb_init,
@@ -458,6 +476,12 @@ static const struct platform_device_info da8xx_dev_info = {
 	.dma_mask	= DMA_BIT_MASK(32),
 };
 
+static const struct musb_hdrc_config da8xx_config = {
+	.ram_bits = 10,
+	.num_eps = 5,
+	.multipoint = 1,
+};
+
 static int da8xx_probe(struct platform_device *pdev)
 {
 	struct resource musb_resources[2];
@@ -465,7 +489,9 @@ static int da8xx_probe(struct platform_device *pdev)
 	struct da8xx_glue		*glue;
 	struct platform_device_info	pinfo;
 	struct clk			*clk;
+	struct device_node		*np = pdev->dev.of_node;
 	int				ret;
+	struct resource *res;
 
 	glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
 	if (!glue)
@@ -486,6 +512,18 @@ static int da8xx_probe(struct platform_device *pdev)
 	glue->dev			= &pdev->dev;
 	glue->clk			= clk;
 
+	if (IS_ENABLED(CONFIG_OF) && np) {
+		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata) {
+			/* FIXME */
+			return -ENOMEM;
+		}
+
+		pdata->config	= &da8xx_config;
+		pdata->mode	= musb_get_mode(&pdev->dev);
+		pdata->power	= get_vbus_power(&pdev->dev);
+	}
+
 	pdata->platform_ops		= &da8xx_ops;
 
 	glue->usb_phy = usb_phy_generic_register();
@@ -499,15 +537,21 @@ static int da8xx_probe(struct platform_device *pdev)
 	memset(musb_resources, 0x00, sizeof(*musb_resources) *
 			ARRAY_SIZE(musb_resources));
 
-	musb_resources[0].name = pdev->resource[0].name;
-	musb_resources[0].start = pdev->resource[0].start;
-	musb_resources[0].end = pdev->resource[0].end;
-	musb_resources[0].flags = pdev->resource[0].flags;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "failed to get memory.\n");
+		ret = -EINVAL;
+		goto err_unregister_usb_phy;
+	}
+	musb_resources[0] = *res;
 
-	musb_resources[1].name = pdev->resource[1].name;
-	musb_resources[1].start = pdev->resource[1].start;
-	musb_resources[1].end = pdev->resource[1].end;
-	musb_resources[1].flags = pdev->resource[1].flags;
+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "failed to get irq.\n");
+		ret = -EINVAL;
+		goto err_unregister_usb_phy;
+	}
+	musb_resources[1] = *res;
 
 	pinfo = da8xx_dev_info;
 	pinfo.parent = &pdev->dev;
@@ -520,9 +564,14 @@ static int da8xx_probe(struct platform_device *pdev)
 	ret = PTR_ERR_OR_ZERO(glue->musb);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register musb device: %d\n", ret);
-		usb_phy_generic_unregister(glue->usb_phy);
+		goto err_unregister_usb_phy;
 	}
 
+	return 0;
+
+err_unregister_usb_phy:
+	usb_phy_generic_unregister(glue->usb_phy);
+
 	return ret;
 }
 
@@ -536,11 +585,20 @@ static int da8xx_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id da8xx_id_table[] = {
+	{
+		.compatible = "ti,da830-musb",
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, da8xx_id_table);
+
 static struct platform_driver da8xx_driver = {
 	.probe		= da8xx_probe,
 	.remove		= da8xx_remove,
 	.driver		= {
 		.name	= "musb-da8xx",
+		.of_match_table = of_match_ptr(da8xx_id_table),
 	},
 };
 
-- 
2.7.3

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

* [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

From: Petr Kulhavy <petr@barix.com>

This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver

Signed-off-by: Petr Kulhavy <petr@barix.com>
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 drivers/usb/musb/da8xx.c | 76 ++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 67 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 210b7e4..d465087 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -6,6 +6,9 @@
  * Based on the DaVinci "glue layer" code.
  * Copyright (C) 2005-2006 by Texas Instruments
  *
+ * DT support
+ * Copyright (c) 2016 Petr Kulhavy <petr@barix.com>
+ *
  * This file is part of the Inventra Controller Driver for Linux.
  *
  * The Inventra Controller Driver for Linux is free software; you
@@ -433,6 +436,21 @@ static int da8xx_musb_exit(struct musb *musb)
 	return 0;
 }
 
+static inline u8 get_vbus_power(struct device *dev)
+{
+	struct regulator *vbus_supply;
+	int current_uA;
+
+	vbus_supply = regulator_get_optional(dev, "vbus");
+	if (IS_ERR(vbus_supply))
+		return 255;
+	current_uA = regulator_get_current_limit(vbus_supply);
+	regulator_put(vbus_supply);
+	if (current_uA <= 0 || current_uA > 510000)
+		return 255;
+	return current_uA / 1000 / 2;
+}
+
 static const struct musb_platform_ops da8xx_ops = {
 	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP,
 	.init		= da8xx_musb_init,
@@ -458,6 +476,12 @@ static const struct platform_device_info da8xx_dev_info = {
 	.dma_mask	= DMA_BIT_MASK(32),
 };
 
+static const struct musb_hdrc_config da8xx_config = {
+	.ram_bits = 10,
+	.num_eps = 5,
+	.multipoint = 1,
+};
+
 static int da8xx_probe(struct platform_device *pdev)
 {
 	struct resource musb_resources[2];
@@ -465,7 +489,9 @@ static int da8xx_probe(struct platform_device *pdev)
 	struct da8xx_glue		*glue;
 	struct platform_device_info	pinfo;
 	struct clk			*clk;
+	struct device_node		*np = pdev->dev.of_node;
 	int				ret;
+	struct resource *res;
 
 	glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
 	if (!glue)
@@ -486,6 +512,18 @@ static int da8xx_probe(struct platform_device *pdev)
 	glue->dev			= &pdev->dev;
 	glue->clk			= clk;
 
+	if (IS_ENABLED(CONFIG_OF) && np) {
+		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata) {
+			/* FIXME */
+			return -ENOMEM;
+		}
+
+		pdata->config	= &da8xx_config;
+		pdata->mode	= musb_get_mode(&pdev->dev);
+		pdata->power	= get_vbus_power(&pdev->dev);
+	}
+
 	pdata->platform_ops		= &da8xx_ops;
 
 	glue->usb_phy = usb_phy_generic_register();
@@ -499,15 +537,21 @@ static int da8xx_probe(struct platform_device *pdev)
 	memset(musb_resources, 0x00, sizeof(*musb_resources) *
 			ARRAY_SIZE(musb_resources));
 
-	musb_resources[0].name = pdev->resource[0].name;
-	musb_resources[0].start = pdev->resource[0].start;
-	musb_resources[0].end = pdev->resource[0].end;
-	musb_resources[0].flags = pdev->resource[0].flags;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "failed to get memory.\n");
+		ret = -EINVAL;
+		goto err_unregister_usb_phy;
+	}
+	musb_resources[0] = *res;
 
-	musb_resources[1].name = pdev->resource[1].name;
-	musb_resources[1].start = pdev->resource[1].start;
-	musb_resources[1].end = pdev->resource[1].end;
-	musb_resources[1].flags = pdev->resource[1].flags;
+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "failed to get irq.\n");
+		ret = -EINVAL;
+		goto err_unregister_usb_phy;
+	}
+	musb_resources[1] = *res;
 
 	pinfo = da8xx_dev_info;
 	pinfo.parent = &pdev->dev;
@@ -520,9 +564,14 @@ static int da8xx_probe(struct platform_device *pdev)
 	ret = PTR_ERR_OR_ZERO(glue->musb);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register musb device: %d\n", ret);
-		usb_phy_generic_unregister(glue->usb_phy);
+		goto err_unregister_usb_phy;
 	}
 
+	return 0;
+
+err_unregister_usb_phy:
+	usb_phy_generic_unregister(glue->usb_phy);
+
 	return ret;
 }
 
@@ -536,11 +585,20 @@ static int da8xx_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id da8xx_id_table[] = {
+	{
+		.compatible = "ti,da830-musb",
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, da8xx_id_table);
+
 static struct platform_driver da8xx_driver = {
 	.probe		= da8xx_probe,
 	.remove		= da8xx_remove,
 	.driver		= {
 		.name	= "musb-da8xx",
+		.of_match_table = of_match_ptr(da8xx_id_table),
 	},
 };
 
-- 
2.7.3

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

* [PATCH 4/4] ARM: dts: da850: Add the usb otg device node
  2016-10-25 14:39 ` Alexandre Bailon
@ 2016-10-25 14:39   ` Alexandre Bailon
  -1 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: khilman, robh+dt, b-liu
  Cc: linux-kernel, linux-usb, devicetree, linux-arm-kernel, Alexandre Bailon

This adds the device tree node for the usb otg
controller present in the da850 family of SoC's.
This also enables the otg usb controller for the lcdk board.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 arch/arm/boot/dts/da850-lcdk.dts |  8 ++++++++
 arch/arm/boot/dts/da850.dtsi     | 15 +++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts
index 7b8ab21..dca9735 100644
--- a/arch/arm/boot/dts/da850-lcdk.dts
+++ b/arch/arm/boot/dts/da850-lcdk.dts
@@ -158,6 +158,14 @@
 	rx-num-evt = <32>;
 };
 
+&usb_phy {
+	status = "okay";
+	};
+
+&usb20 {
+	status = "okay";
+};
+
 &aemif {
 	pinctrl-names = "default";
 	pinctrl-0 = <&nand_pins>;
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index f79e1b9..b11d395 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -372,6 +372,21 @@
 					>;
 			status = "disabled";
 		};
+		usb_phy: usb-phy {
+			compatible = "ti,da830-usb-phy";
+			#phy-cells = <1>;
+			status = "disabled";
+		};
+		usb20: usb20@200000 {
+			compatible = "ti,da830-musb";
+			reg = <0x200000 0x10000>;
+			interrupts = <58>;
+			interrupt-names = "mc";
+			dr_mode = "otg";
+			phys = <&usb_phy 0>;
+			phy-names = "usb-phy";
+			status = "disabled";
+		};
 		gpio: gpio@226000 {
 			compatible = "ti,dm6441-gpio";
 			gpio-controller;
-- 
2.7.3

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

* [PATCH 4/4] ARM: dts: da850: Add the usb otg device node
@ 2016-10-25 14:39   ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-25 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the device tree node for the usb otg
controller present in the da850 family of SoC's.
This also enables the otg usb controller for the lcdk board.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 arch/arm/boot/dts/da850-lcdk.dts |  8 ++++++++
 arch/arm/boot/dts/da850.dtsi     | 15 +++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts
index 7b8ab21..dca9735 100644
--- a/arch/arm/boot/dts/da850-lcdk.dts
+++ b/arch/arm/boot/dts/da850-lcdk.dts
@@ -158,6 +158,14 @@
 	rx-num-evt = <32>;
 };
 
+&usb_phy {
+	status = "okay";
+	};
+
+&usb20 {
+	status = "okay";
+};
+
 &aemif {
 	pinctrl-names = "default";
 	pinctrl-0 = <&nand_pins>;
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index f79e1b9..b11d395 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -372,6 +372,21 @@
 					>;
 			status = "disabled";
 		};
+		usb_phy: usb-phy {
+			compatible = "ti,da830-usb-phy";
+			#phy-cells = <1>;
+			status = "disabled";
+		};
+		usb20: usb20 at 200000 {
+			compatible = "ti,da830-musb";
+			reg = <0x200000 0x10000>;
+			interrupts = <58>;
+			interrupt-names = "mc";
+			dr_mode = "otg";
+			phys = <&usb_phy 0>;
+			phy-names = "usb-phy";
+			status = "disabled";
+		};
 		gpio: gpio at 226000 {
 			compatible = "ti,dm6441-gpio";
 			gpio-controller;
-- 
2.7.3

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

* Re: [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver
  2016-10-25 14:39   ` Alexandre Bailon
  (?)
@ 2016-10-25 17:38     ` Sergei Shtylyov
  -1 siblings, 0 replies; 21+ messages in thread
From: Sergei Shtylyov @ 2016-10-25 17:38 UTC (permalink / raw)
  To: Alexandre Bailon, khilman, robh+dt, b-liu
  Cc: linux-kernel, linux-usb, devicetree, linux-arm-kernel, Petr Kulhavy

Hello.

On 10/25/2016 05:39 PM, Alexandre Bailon wrote:

> From: Petr Kulhavy <petr@barix.com>
>
> This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver
>
> Signed-off-by: Petr Kulhavy <petr@barix.com>
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> ---
>  drivers/usb/musb/da8xx.c | 76 ++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 67 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
> index 210b7e4..d465087 100644
> --- a/drivers/usb/musb/da8xx.c
> +++ b/drivers/usb/musb/da8xx.c
> @@ -6,6 +6,9 @@
>   * Based on the DaVinci "glue layer" code.
>   * Copyright (C) 2005-2006 by Texas Instruments
>   *
> + * DT support
> + * Copyright (c) 2016 Petr Kulhavy <petr@barix.com>
> + *
>   * This file is part of the Inventra Controller Driver for Linux.
>   *
>   * The Inventra Controller Driver for Linux is free software; you
[...]
> @@ -499,15 +537,21 @@ static int da8xx_probe(struct platform_device *pdev)
>  	memset(musb_resources, 0x00, sizeof(*musb_resources) *
>  			ARRAY_SIZE(musb_resources));
>
> -	musb_resources[0].name = pdev->resource[0].name;
> -	musb_resources[0].start = pdev->resource[0].start;
> -	musb_resources[0].end = pdev->resource[0].end;
> -	musb_resources[0].flags = pdev->resource[0].flags;
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to get memory.\n");
> +		ret = -EINVAL;
> +		goto err_unregister_usb_phy;
> +	}
> +	musb_resources[0] = *res;

    What does this change have to do with the DT conversion?

>
> -	musb_resources[1].name = pdev->resource[1].name;
> -	musb_resources[1].start = pdev->resource[1].start;
> -	musb_resources[1].end = pdev->resource[1].end;
> -	musb_resources[1].flags = pdev->resource[1].flags;
> +	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to get irq.\n");
> +		ret = -EINVAL;
> +		goto err_unregister_usb_phy;
> +	}
> +	musb_resources[1] = *res;

    And this?
    I'm also concerned that you'd copy the resource linkage fields which the 
existing code avoids...

[...]

MBR, Sergei

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

* Re: [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver
@ 2016-10-25 17:38     ` Sergei Shtylyov
  0 siblings, 0 replies; 21+ messages in thread
From: Sergei Shtylyov @ 2016-10-25 17:38 UTC (permalink / raw)
  To: Alexandre Bailon, khilman, robh+dt, b-liu
  Cc: Petr Kulhavy, devicetree, linux-usb, linux-kernel, linux-arm-kernel

Hello.

On 10/25/2016 05:39 PM, Alexandre Bailon wrote:

> From: Petr Kulhavy <petr@barix.com>
>
> This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver
>
> Signed-off-by: Petr Kulhavy <petr@barix.com>
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> ---
>  drivers/usb/musb/da8xx.c | 76 ++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 67 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
> index 210b7e4..d465087 100644
> --- a/drivers/usb/musb/da8xx.c
> +++ b/drivers/usb/musb/da8xx.c
> @@ -6,6 +6,9 @@
>   * Based on the DaVinci "glue layer" code.
>   * Copyright (C) 2005-2006 by Texas Instruments
>   *
> + * DT support
> + * Copyright (c) 2016 Petr Kulhavy <petr@barix.com>
> + *
>   * This file is part of the Inventra Controller Driver for Linux.
>   *
>   * The Inventra Controller Driver for Linux is free software; you
[...]
> @@ -499,15 +537,21 @@ static int da8xx_probe(struct platform_device *pdev)
>  	memset(musb_resources, 0x00, sizeof(*musb_resources) *
>  			ARRAY_SIZE(musb_resources));
>
> -	musb_resources[0].name = pdev->resource[0].name;
> -	musb_resources[0].start = pdev->resource[0].start;
> -	musb_resources[0].end = pdev->resource[0].end;
> -	musb_resources[0].flags = pdev->resource[0].flags;
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to get memory.\n");
> +		ret = -EINVAL;
> +		goto err_unregister_usb_phy;
> +	}
> +	musb_resources[0] = *res;

    What does this change have to do with the DT conversion?

>
> -	musb_resources[1].name = pdev->resource[1].name;
> -	musb_resources[1].start = pdev->resource[1].start;
> -	musb_resources[1].end = pdev->resource[1].end;
> -	musb_resources[1].flags = pdev->resource[1].flags;
> +	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to get irq.\n");
> +		ret = -EINVAL;
> +		goto err_unregister_usb_phy;
> +	}
> +	musb_resources[1] = *res;

    And this?
    I'm also concerned that you'd copy the resource linkage fields which the 
existing code avoids...

[...]

MBR, Sergei

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

* [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver
@ 2016-10-25 17:38     ` Sergei Shtylyov
  0 siblings, 0 replies; 21+ messages in thread
From: Sergei Shtylyov @ 2016-10-25 17:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 10/25/2016 05:39 PM, Alexandre Bailon wrote:

> From: Petr Kulhavy <petr@barix.com>
>
> This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver
>
> Signed-off-by: Petr Kulhavy <petr@barix.com>
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> ---
>  drivers/usb/musb/da8xx.c | 76 ++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 67 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
> index 210b7e4..d465087 100644
> --- a/drivers/usb/musb/da8xx.c
> +++ b/drivers/usb/musb/da8xx.c
> @@ -6,6 +6,9 @@
>   * Based on the DaVinci "glue layer" code.
>   * Copyright (C) 2005-2006 by Texas Instruments
>   *
> + * DT support
> + * Copyright (c) 2016 Petr Kulhavy <petr@barix.com>
> + *
>   * This file is part of the Inventra Controller Driver for Linux.
>   *
>   * The Inventra Controller Driver for Linux is free software; you
[...]
> @@ -499,15 +537,21 @@ static int da8xx_probe(struct platform_device *pdev)
>  	memset(musb_resources, 0x00, sizeof(*musb_resources) *
>  			ARRAY_SIZE(musb_resources));
>
> -	musb_resources[0].name = pdev->resource[0].name;
> -	musb_resources[0].start = pdev->resource[0].start;
> -	musb_resources[0].end = pdev->resource[0].end;
> -	musb_resources[0].flags = pdev->resource[0].flags;
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to get memory.\n");
> +		ret = -EINVAL;
> +		goto err_unregister_usb_phy;
> +	}
> +	musb_resources[0] = *res;

    What does this change have to do with the DT conversion?

>
> -	musb_resources[1].name = pdev->resource[1].name;
> -	musb_resources[1].start = pdev->resource[1].start;
> -	musb_resources[1].end = pdev->resource[1].end;
> -	musb_resources[1].flags = pdev->resource[1].flags;
> +	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to get irq.\n");
> +		ret = -EINVAL;
> +		goto err_unregister_usb_phy;
> +	}
> +	musb_resources[1] = *res;

    And this?
    I'm also concerned that you'd copy the resource linkage fields which the 
existing code avoids...

[...]

MBR, Sergei

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

* Re: [PATCH 4/4] ARM: dts: da850: Add the usb otg device node
@ 2016-10-25 19:29     ` David Lechner
  0 siblings, 0 replies; 21+ messages in thread
From: David Lechner @ 2016-10-25 19:29 UTC (permalink / raw)
  To: Alexandre Bailon, khilman, robh+dt, b-liu
  Cc: devicetree, linux-usb, linux-kernel, linux-arm-kernel

On 10/25/2016 09:39 AM, Alexandre Bailon wrote:
> This adds the device tree node for the usb otg
> controller present in the da850 family of SoC's.
> This also enables the otg usb controller for the lcdk board.
>
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> ---
>  arch/arm/boot/dts/da850-lcdk.dts |  8 ++++++++
>  arch/arm/boot/dts/da850.dtsi     | 15 +++++++++++++++
>  2 files changed, 23 insertions(+)
>
> diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts
> index 7b8ab21..dca9735 100644
> --- a/arch/arm/boot/dts/da850-lcdk.dts
> +++ b/arch/arm/boot/dts/da850-lcdk.dts
> @@ -158,6 +158,14 @@
>  	rx-num-evt = <32>;
>  };
>
> +&usb_phy {
> +	status = "okay";
> +	};
> +
> +&usb20 {
> +	status = "okay";
> +};
> +
>  &aemif {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&nand_pins>;
> diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
> index f79e1b9..b11d395 100644
> --- a/arch/arm/boot/dts/da850.dtsi
> +++ b/arch/arm/boot/dts/da850.dtsi
> @@ -372,6 +372,21 @@
>  					>;
>  			status = "disabled";
>  		};
> +		usb_phy: usb-phy {
> +			compatible = "ti,da830-usb-phy";
> +			#phy-cells = <1>;
> +			status = "disabled";
> +		};
> +		usb20: usb20@200000 {

This should be usb0: usb@200000

> +			compatible = "ti,da830-musb";
> +			reg = <0x200000 0x10000>;
> +			interrupts = <58>;
> +			interrupt-names = "mc";
> +			dr_mode = "otg";
> +			phys = <&usb_phy 0>;
> +			phy-names = "usb-phy";
> +			status = "disabled";
> +		};
>  		gpio: gpio@226000 {
>  			compatible = "ti,dm6441-gpio";
>  			gpio-controller;
>

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

* Re: [PATCH 4/4] ARM: dts: da850: Add the usb otg device node
@ 2016-10-25 19:29     ` David Lechner
  0 siblings, 0 replies; 21+ messages in thread
From: David Lechner @ 2016-10-25 19:29 UTC (permalink / raw)
  To: Alexandre Bailon, khilman-rdvid1DuHRBWk0Htik3J/w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, b-liu-l0cyMroinI0
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 10/25/2016 09:39 AM, Alexandre Bailon wrote:
> This adds the device tree node for the usb otg
> controller present in the da850 family of SoC's.
> This also enables the otg usb controller for the lcdk board.
>
> Signed-off-by: Alexandre Bailon <abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
> ---
>  arch/arm/boot/dts/da850-lcdk.dts |  8 ++++++++
>  arch/arm/boot/dts/da850.dtsi     | 15 +++++++++++++++
>  2 files changed, 23 insertions(+)
>
> diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts
> index 7b8ab21..dca9735 100644
> --- a/arch/arm/boot/dts/da850-lcdk.dts
> +++ b/arch/arm/boot/dts/da850-lcdk.dts
> @@ -158,6 +158,14 @@
>  	rx-num-evt = <32>;
>  };
>
> +&usb_phy {
> +	status = "okay";
> +	};
> +
> +&usb20 {
> +	status = "okay";
> +};
> +
>  &aemif {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&nand_pins>;
> diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
> index f79e1b9..b11d395 100644
> --- a/arch/arm/boot/dts/da850.dtsi
> +++ b/arch/arm/boot/dts/da850.dtsi
> @@ -372,6 +372,21 @@
>  					>;
>  			status = "disabled";
>  		};
> +		usb_phy: usb-phy {
> +			compatible = "ti,da830-usb-phy";
> +			#phy-cells = <1>;
> +			status = "disabled";
> +		};
> +		usb20: usb20@200000 {

This should be usb0: usb@200000

> +			compatible = "ti,da830-musb";
> +			reg = <0x200000 0x10000>;
> +			interrupts = <58>;
> +			interrupt-names = "mc";
> +			dr_mode = "otg";
> +			phys = <&usb_phy 0>;
> +			phy-names = "usb-phy";
> +			status = "disabled";
> +		};
>  		gpio: gpio@226000 {
>  			compatible = "ti,dm6441-gpio";
>  			gpio-controller;
>

--
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] 21+ messages in thread

* [PATCH 4/4] ARM: dts: da850: Add the usb otg device node
@ 2016-10-25 19:29     ` David Lechner
  0 siblings, 0 replies; 21+ messages in thread
From: David Lechner @ 2016-10-25 19:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/25/2016 09:39 AM, Alexandre Bailon wrote:
> This adds the device tree node for the usb otg
> controller present in the da850 family of SoC's.
> This also enables the otg usb controller for the lcdk board.
>
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> ---
>  arch/arm/boot/dts/da850-lcdk.dts |  8 ++++++++
>  arch/arm/boot/dts/da850.dtsi     | 15 +++++++++++++++
>  2 files changed, 23 insertions(+)
>
> diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts
> index 7b8ab21..dca9735 100644
> --- a/arch/arm/boot/dts/da850-lcdk.dts
> +++ b/arch/arm/boot/dts/da850-lcdk.dts
> @@ -158,6 +158,14 @@
>  	rx-num-evt = <32>;
>  };
>
> +&usb_phy {
> +	status = "okay";
> +	};
> +
> +&usb20 {
> +	status = "okay";
> +};
> +
>  &aemif {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&nand_pins>;
> diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
> index f79e1b9..b11d395 100644
> --- a/arch/arm/boot/dts/da850.dtsi
> +++ b/arch/arm/boot/dts/da850.dtsi
> @@ -372,6 +372,21 @@
>  					>;
>  			status = "disabled";
>  		};
> +		usb_phy: usb-phy {
> +			compatible = "ti,da830-usb-phy";
> +			#phy-cells = <1>;
> +			status = "disabled";
> +		};
> +		usb20: usb20 at 200000 {

This should be usb0: usb at 200000

> +			compatible = "ti,da830-musb";
> +			reg = <0x200000 0x10000>;
> +			interrupts = <58>;
> +			interrupt-names = "mc";
> +			dr_mode = "otg";
> +			phys = <&usb_phy 0>;
> +			phy-names = "usb-phy";
> +			status = "disabled";
> +		};
>  		gpio: gpio at 226000 {
>  			compatible = "ti,dm6441-gpio";
>  			gpio-controller;
>

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

* Re: [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver
  2016-10-25 17:38     ` Sergei Shtylyov
@ 2016-10-26  9:31       ` Alexandre Bailon
  -1 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-26  9:31 UTC (permalink / raw)
  To: Sergei Shtylyov, khilman, robh+dt, b-liu
  Cc: linux-kernel, linux-usb, devicetree, linux-arm-kernel, Petr Kulhavy

On 10/25/2016 07:38 PM, Sergei Shtylyov wrote:
> Hello.
> 
> On 10/25/2016 05:39 PM, Alexandre Bailon wrote:
> 
>> From: Petr Kulhavy <petr@barix.com>
>>
>> This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver
>>
>> Signed-off-by: Petr Kulhavy <petr@barix.com>
>> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
>> ---
>>  drivers/usb/musb/da8xx.c | 76
>> ++++++++++++++++++++++++++++++++++++++++++------
>>  1 file changed, 67 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
>> index 210b7e4..d465087 100644
>> --- a/drivers/usb/musb/da8xx.c
>> +++ b/drivers/usb/musb/da8xx.c
>> @@ -6,6 +6,9 @@
>>   * Based on the DaVinci "glue layer" code.
>>   * Copyright (C) 2005-2006 by Texas Instruments
>>   *
>> + * DT support
>> + * Copyright (c) 2016 Petr Kulhavy <petr@barix.com>
>> + *
>>   * This file is part of the Inventra Controller Driver for Linux.
>>   *
>>   * The Inventra Controller Driver for Linux is free software; you
> [...]
>> @@ -499,15 +537,21 @@ static int da8xx_probe(struct platform_device
>> *pdev)
>>      memset(musb_resources, 0x00, sizeof(*musb_resources) *
>>              ARRAY_SIZE(musb_resources));
>>
>> -    musb_resources[0].name = pdev->resource[0].name;
>> -    musb_resources[0].start = pdev->resource[0].start;
>> -    musb_resources[0].end = pdev->resource[0].end;
>> -    musb_resources[0].flags = pdev->resource[0].flags;
>> +    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +    if (!res) {
>> +        dev_err(&pdev->dev, "failed to get memory.\n");
>> +        ret = -EINVAL;
>> +        goto err_unregister_usb_phy;
>> +    }
>> +    musb_resources[0] = *res;
> 
>    What does this change have to do with the DT conversion?
Nothing. I will remove it.
> 
>>
>> -    musb_resources[1].name = pdev->resource[1].name;
>> -    musb_resources[1].start = pdev->resource[1].start;
>> -    musb_resources[1].end = pdev->resource[1].end;
>> -    musb_resources[1].flags = pdev->resource[1].flags;
>> +    res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>> +    if (!res) {
>> +        dev_err(&pdev->dev, "failed to get irq.\n");
>> +        ret = -EINVAL;
>> +        goto err_unregister_usb_phy;
>> +    }
>> +    musb_resources[1] = *res;
> 
>    And this?
>    I'm also concerned that you'd copy the resource linkage fields which
> the existing code avoids...
> 
> [...]
> 
> MBR, Sergei
> 

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

* [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver
@ 2016-10-26  9:31       ` Alexandre Bailon
  0 siblings, 0 replies; 21+ messages in thread
From: Alexandre Bailon @ 2016-10-26  9:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/25/2016 07:38 PM, Sergei Shtylyov wrote:
> Hello.
> 
> On 10/25/2016 05:39 PM, Alexandre Bailon wrote:
> 
>> From: Petr Kulhavy <petr@barix.com>
>>
>> This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver
>>
>> Signed-off-by: Petr Kulhavy <petr@barix.com>
>> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
>> ---
>>  drivers/usb/musb/da8xx.c | 76
>> ++++++++++++++++++++++++++++++++++++++++++------
>>  1 file changed, 67 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
>> index 210b7e4..d465087 100644
>> --- a/drivers/usb/musb/da8xx.c
>> +++ b/drivers/usb/musb/da8xx.c
>> @@ -6,6 +6,9 @@
>>   * Based on the DaVinci "glue layer" code.
>>   * Copyright (C) 2005-2006 by Texas Instruments
>>   *
>> + * DT support
>> + * Copyright (c) 2016 Petr Kulhavy <petr@barix.com>
>> + *
>>   * This file is part of the Inventra Controller Driver for Linux.
>>   *
>>   * The Inventra Controller Driver for Linux is free software; you
> [...]
>> @@ -499,15 +537,21 @@ static int da8xx_probe(struct platform_device
>> *pdev)
>>      memset(musb_resources, 0x00, sizeof(*musb_resources) *
>>              ARRAY_SIZE(musb_resources));
>>
>> -    musb_resources[0].name = pdev->resource[0].name;
>> -    musb_resources[0].start = pdev->resource[0].start;
>> -    musb_resources[0].end = pdev->resource[0].end;
>> -    musb_resources[0].flags = pdev->resource[0].flags;
>> +    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +    if (!res) {
>> +        dev_err(&pdev->dev, "failed to get memory.\n");
>> +        ret = -EINVAL;
>> +        goto err_unregister_usb_phy;
>> +    }
>> +    musb_resources[0] = *res;
> 
>    What does this change have to do with the DT conversion?
Nothing. I will remove it.
> 
>>
>> -    musb_resources[1].name = pdev->resource[1].name;
>> -    musb_resources[1].start = pdev->resource[1].start;
>> -    musb_resources[1].end = pdev->resource[1].end;
>> -    musb_resources[1].flags = pdev->resource[1].flags;
>> +    res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>> +    if (!res) {
>> +        dev_err(&pdev->dev, "failed to get irq.\n");
>> +        ret = -EINVAL;
>> +        goto err_unregister_usb_phy;
>> +    }
>> +    musb_resources[1] = *res;
> 
>    And this?
>    I'm also concerned that you'd copy the resource linkage fields which
> the existing code avoids...
> 
> [...]
> 
> MBR, Sergei
> 

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

end of thread, other threads:[~2016-10-26  9:31 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 14:39 [PATCH 0/4] Add DT support for DA8xx Alexandre Bailon
2016-10-25 14:39 ` Alexandre Bailon
2016-10-25 14:39 ` Alexandre Bailon
2016-10-25 14:39 ` [PATCH 1/4] dt/bindings: Add binding for the DA8xx MUSB driver Alexandre Bailon
2016-10-25 14:39   ` Alexandre Bailon
2016-10-25 14:39   ` Alexandre Bailon
2016-10-25 14:39 ` [PATCH 2/4] usb: musb: core: added helper function for parsing DT Alexandre Bailon
2016-10-25 14:39   ` Alexandre Bailon
2016-10-25 14:39   ` Alexandre Bailon
2016-10-25 14:39 ` [PATCH 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver Alexandre Bailon
2016-10-25 14:39   ` Alexandre Bailon
2016-10-25 17:38   ` Sergei Shtylyov
2016-10-25 17:38     ` Sergei Shtylyov
2016-10-25 17:38     ` Sergei Shtylyov
2016-10-26  9:31     ` Alexandre Bailon
2016-10-26  9:31       ` Alexandre Bailon
2016-10-25 14:39 ` [PATCH 4/4] ARM: dts: da850: Add the usb otg device node Alexandre Bailon
2016-10-25 14:39   ` Alexandre Bailon
2016-10-25 19:29   ` David Lechner
2016-10-25 19:29     ` David Lechner
2016-10-25 19:29     ` David Lechner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.