Skip to contentSkip to conversation

Add support for Samsung HSOTG on DT-enabled platforms

PATCH New Tomasz Figa 4 participants 12 messages Jun 25, 2013 – Jul 8, 2013

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

cover Add support for Samsung HSOTG on DT-enabled platforms

This series enables platforms booting with Device Tree to use the Samsung HSOTG IP. Since USB PHY support has been already added, it's just a matter of adding an OF match table to the driver and respective device tree nodes to dts files.

[On Samsung Trats board based on Exynos 4210]

Tomasz Figa (4):
usb: gadget: s3c-hsotg: Allow driver instantiation using device tree
ARM: dts: exynos4: Add node for hsotg
ARM: dts: exynos4: Add nodes for USB PHY block
ARM: dts: exynos4210-trats: Enable USB gadget functionality

 .../devicetree/bindings/usb/samsung-hsotg.txt      | 40 ++++++++++++++++++++++
 arch/arm/boot/dts/exynos4.dtsi                     |  9 +++++
 arch/arm/boot/dts/exynos4210-trats.dts             | 10 ++++++
 arch/arm/boot/dts/exynos4210.dtsi                  | 15 ++++++++
 arch/arm/boot/dts/exynos4x12.dtsi                  | 15 ++++++++
 drivers/usb/gadget/s3c-hsotg.c                     | 10 ++++++
 6 files changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/samsung-hsotg.txt
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH 1/4 usb: gadget: s3c-hsotg: Allow driver instantiation using device tree

This patch adds OF match table to the driver to allow instantiating it using device tree.

---
 .../devicetree/bindings/usb/samsung-hsotg.txt      | 40 ++++++++++++++++++++++
 drivers/usb/gadget/s3c-hsotg.c                     | 10 ++++++
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/samsung-hsotg.txt
Documentation/devicetree/bindings/usb/samsung-hsotg.txt new file +40 -0
new file mode 100644
index 0000000..b83d428
@@ -0,0 +1,40 @@
+Samsung High Speed USB OTG controller
+-----------------------------
+
+The Samsung HSOTG IP can be found on Samsung SoCs, from S3C6400 onwards.
+It gives functionality of OTG-compliant USB 2.0 host and device with
+support for USB 2.0 high-speed (480Mbps) and full-speed (12 Mbps)
+operation.
+
+Currently only device mode is supported.
+
+Binding details
+-----
+
+Required properties:
+- compatible: "samsung,s3c6400-hsotg" should be used for all currently
+    supported SoC,
+- interrupt-parent: phandle for the interrupt controller to which the
+    interrupt signal of the HSOTG block is routed,
+- interrupts: specifier of interrupt signal of interrupt controller,
+    according to bindings of interrupt controller,
+- clocks: contains an array of clock specifiers:
+    - first entry: OTG clock
+- clock-names: contains array of clock names:
+    - first entry: must be "otg"
+- vusb_d-supply: phandle to voltage regulator of digital section,
+- vusb_a-supply: phandle to voltage regulator of analog section.
+
+Example
+-----
+
+	hsotg at 12480000 {
+		compatible = "samsung,s3c6400-hsotg";
+		reg = <0x12480000 0x20000>;
+		interrupts = <0 71 0>;
+		clocks = <&clock 305>;
+		clock-names = "otg";
+		vusb_d-supply = <&vusb_reg>;
+		vusb_a-supply = <&vusbdac_reg>;
+	};
+
drivers/usb/gadget/s3c-hsotg.c +10 -0
index af22f24..616ed51 100644
@@ -29,6 +29,7 @@
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/regulator/consumer.h>
+#include <linux/of_platform.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
@@ -3648,10 +3649,19 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
 #define s3c_hsotg_resume NULL
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id s3c_hsotg_of_ids[] = {
+	{ .compatible = "samsung,s3c6400-hsotg", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids);
+#endif
+
 static struct platform_driver s3c_hsotg_driver = {
 	.driver		= {
 		.name	= "s3c-hsotg",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(s3c_hsotg_of_ids),
 	},
 	.probe		= s3c_hsotg_probe,
 	.remove		= s3c_hsotg_remove,
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH 1/4 usb: gadget: s3c-hsotg: Allow driver instantiation using device tree

Quoted 5 lines · Tomasz Figa

This patch adds OF match table to the driver to allow instantiating it using device tree.

when will this driver get merged into dwc2 ?

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

PATCH 1/4 usb: gadget: s3c-hsotg: Allow driver instantiation using device tree

Quoted 8 lines · On Tuesday 25 of June 2013 23:46:32 Felipe Balbi wrote:
Quoted 5 lines · Tomasz Figa

This patch adds OF match table to the driver to allow instantiating it using device tree.

when will this driver get merged into dwc2 ?

What's dwc2? I can only see dwc3 in mainline kernel tree and it doesn't seem to be compatible with s3c-hsotg.

Best regards,
Tomasz

#4 lore raw

PATCH 1/4 usb: gadget: s3c-hsotg: Allow driver instantiation using device tree

Quoted 5 lines · Tomasz Figa
Quoted 4 lines · On Tuesday 25 of June 2013 23:46:32 Felipe Balbi wrote:
Quoted 3 lines · Tomasz Figa

This patch adds OF match table to the driver to allow instantiating it using device tree.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

when will this driver get merged into dwc2 ?

What's dwc2? I can only see dwc3 in mainline kernel tree and it doesn't seem to be compatible with s3c-hsotg.

drivers/staging/dwc2/

That's the same IP you're using Paul Zimmerman (now in Cc) is working towards getting that out of staging. It currently has only host mode, so plugging your code in there shouldn't be too difficult.

OTOH, it might be better to make your code a device-only version of dwc2 (drivers/usb/dwc2) and have Paul move his host side to that instead.

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

PATCH 1/4 usb: gadget: s3c-hsotg: Allow driver instantiation using device tree

Quoted 10 lines · On Wednesday 26 of June 2013 00:00:44 Felipe Balbi wrote:
Quoted 9 lines · Tomasz Figa
Quoted 8 lines · On Tuesday 25 of June 2013 23:46:32 Felipe Balbi wrote:
Quoted 6 lines · Tomasz Figa

This patch adds OF match table to the driver to allow instantiating it
using device tree.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

when will this driver get merged into dwc2 ?

What's dwc2? I can only see dwc3 in mainline kernel tree and it doesn't
seem to be compatible with s3c-hsotg.

drivers/staging/dwc2/

Oh right, staging, I forgot to check there.

Quoted 6 lines

That's the same IP you're using Paul Zimmerman (now in Cc) is working towards getting that out of staging. It currently has only host mode, so plugging your code in there shouldn't be too difficult.

OTOH, it might be better to make your code a device-only version of dwc2 (drivers/usb/dwc2) and have Paul move his host side to that instead.

Hmm, I believe Lukasz Majewski and Marek Szyprowski (both on CC) should be able to say something more on this topic as I'm not really into USB drivers and just doing Device Tree enablement here.

Best regards,
Tomasz

#6 lore raw

PATCH 1/4 usb: gadget: s3c-hsotg: Allow driver instantiation using device tree

In reply to Tomasz Figa

Hi,

Quoted 5 lines · Tomasz Figa

This patch adds OF match table to the driver to allow instantiating it using device tree.

I will take this one only, the others have no dependency on this.

cheers

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

PATCH 2/4 ARM: dts: exynos4: Add node for hsotg

In reply to Tomasz Figa

This patch adds device tree node for USB HSOTG controller present on Exynos4 SoCs.

---
 arch/arm/boot/dts/exynos4.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/exynos4.dtsi +9 -0
index 359694c..d53b9da 100644
@@ -119,6 +119,15 @@
 		status = "disabled";
 	};
 
+	hsotg at 12480000 {
+		compatible = "samsung,s3c6400-hsotg";
+		reg = <0x12480000 0x20000>;
+		interrupts = <0 71 0>;
+		clocks = <&clock 305>;
+		clock-names = "otg";
+		status = "disabled";
+	};
+
 	sdhci at 12510000 {
 		compatible = "samsung,exynos4210-sdhci";
 		reg = <0x12510000 0x100>;
Signature · 1 line
1.8.2.1
#8 lore raw

PATCH 2/4 ARM: dts: exynos4: Add node for hsotg

Quoted 6 lines · Tomasz Figa

This patch adds device tree node for USB HSOTG controller present on Exynos4 SoCs.

It looks good.

Best regards,
Jingoo Han

Quoted 27 lines
---
 arch/arm/boot/dts/exynos4.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/exynos4.dtsi +9 -1
index 359694c..d53b9da 100644
@@ -119,6 +119,15 @@
 		status = "disabled";
 	};
 
+	hsotg at 12480000 {
+		compatible = "samsung,s3c6400-hsotg";
+		reg = <0x12480000 0x20000>;
+		interrupts = <0 71 0>;
+		clocks = <&clock 305>;
+		clock-names = "otg";
+		status = "disabled";
+	};
+
 	sdhci at 12510000 {
 		compatible = "samsung,exynos4210-sdhci";
 		reg = <0x12510000 0x100>;
--

1.8.2.1

#9 lore raw

PATCH 3/4 ARM: dts: exynos4: Add nodes for USB PHY block

In reply to Tomasz Figa

This patch adds device tree nodes for USB OTG PHYs of Exynos4210 and Exynos4x12 SoCs.

---
 arch/arm/boot/dts/exynos4210.dtsi | 15 +++++++++++++++
 arch/arm/boot/dts/exynos4x12.dtsi | 15 +++++++++++++++
 2 files changed, 30 insertions(+)
arch/arm/boot/dts/exynos4210.dtsi +15 -0
index 54710de..3c71ea5 100644
@@ -114,6 +114,21 @@
 		interrupts = <2 4>;
 	};
 
+	usbphy at 125B0000 {
+		compatible = "samsung,exynos4210-usb2phy";
+		reg = <0x125B0000 0x100>;
+		clocks = <&clock 305>;
+		clock-names = "otg";
+		status = "disabled";
+		ranges;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		usbphy-sys {
+			reg = <0x10020704 0x8>;
+		};
+	};
+
 	g2d at 12800000 {
 		compatible = "samsung,s5pv210-g2d";
 		reg = <0x12800000 0x1000>;
arch/arm/boot/dts/exynos4x12.dtsi +15 -0
index e3380a7..267ed95 100644
@@ -79,4 +79,19 @@
 		interrupts = <0 89 0>;
 		status = "disabled";
 	};
+
+	usbphy at 125B0000 {
+		compatible = "samsung,exynos4x12-usb2phy";
+		reg = <0x125B0000 0x100>;
+		clocks = <&clock 305>;
+		clock-names = "otg";
+		status = "disabled";
+		ranges;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		usbphy-sys {
+			reg = <0x10020704 0x8>;
+		};
+	};
 };
Signature · 1 line
1.8.2.1
#10 lore raw

PATCH 3/4 ARM: dts: exynos4: Add nodes for USB PHY block

Quoted 6 lines · Tomasz Figa

This patch adds device tree nodes for USB OTG PHYs of Exynos4210 and Exynos4x12 SoCs.

It looks good.

Best regards,
Jingoo Han

Quoted 62 lines
---
 arch/arm/boot/dts/exynos4210.dtsi | 15 +++++++++++++++
 arch/arm/boot/dts/exynos4x12.dtsi | 15 +++++++++++++++
 2 files changed, 30 insertions(+)
arch/arm/boot/dts/exynos4210.dtsi +15 -0
index 54710de..3c71ea5 100644
@@ -114,6 +114,21 @@
 		interrupts = <2 4>;
 	};
 
+	usbphy at 125B0000 {
+		compatible = "samsung,exynos4210-usb2phy";
+		reg = <0x125B0000 0x100>;
+		clocks = <&clock 305>;
+		clock-names = "otg";
+		status = "disabled";
+		ranges;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		usbphy-sys {
+			reg = <0x10020704 0x8>;
+		};
+	};
+
 	g2d at 12800000 {
 		compatible = "samsung,s5pv210-g2d";
 		reg = <0x12800000 0x1000>;
arch/arm/boot/dts/exynos4x12.dtsi +15 -1
index e3380a7..267ed95 100644
@@ -79,4 +79,19 @@
 		interrupts = <0 89 0>;
 		status = "disabled";
 	};
+
+	usbphy at 125B0000 {
+		compatible = "samsung,exynos4x12-usb2phy";
+		reg = <0x125B0000 0x100>;
+		clocks = <&clock 305>;
+		clock-names = "otg";
+		status = "disabled";
+		ranges;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		usbphy-sys {
+			reg = <0x10020704 0x8>;
+		};
+	};
 };
--

1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

PATCH 4/4 ARM: dts: exynos4210-trats: Enable USB gadget functionality

In reply to Tomasz Figa

This patch adds device tree nodes necessary to enable USB gadget functionality on Exynos4210-based Trats board.

---
 arch/arm/boot/dts/exynos4210-trats.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/exynos4210-trats.dts +10 -0
index 9a14484..d2ce1cf 100644
@@ -39,6 +39,12 @@
 		enable-active-high;
 	};
 
+	hsotg at 12480000 {
+		vusb_d-supply = <&vusb_reg>;
+		vusb_a-supply = <&vusbdac_reg>;
+		status = "okay";
+	};
+
 	sdhci_emmc: sdhci at 12510000 {
 		bus-width = <8>;
 		non-removable;
@@ -48,6 +54,10 @@
 		status = "okay";
 	};
 
+	usbphy at 125B0000 {
+		status = "okay";
+	};
+
 	serial at 13800000 {
 		status = "okay";
 	};
Signature · 1 line
1.8.2.1