Skip to contentSkip to conversation

EXYNOS4: Add device tree support for USB/EHCI

PATCH Superseded Dongjin Kim 2 participants 5 messages Dec 26, 2012 – Dec 27, 2012

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

cover EXYNOS4: Add device tree support for USB/EHCI

This patch set adds device tree upport for USB/EHCI device.

Dongjin Kim (2):
ARM: dts: Add EHCI device tree node for Exynos4
USB: ehci-s5p: Add to get interrupt from DT

 arch/arm/boot/dts/exynos4.dtsi         |    7 +++++++
 arch/arm/mach-exynos/mach-exynos4-dt.c |    9 +++++++++
 drivers/usb/host/ehci-s5p.c            |    8 +++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/2 ARM: dts: Add EHCI device tree node for Exynos4

This patch adds EHCI device node on device tree for Exynos4 and defines its default platform data, s5p_usb_phy_init and s5p_usb_phy_exit, so that those function can be called from the driver.

---
 arch/arm/boot/dts/exynos4.dtsi         |    7 +++++++
 arch/arm/mach-exynos/mach-exynos4-dt.c |    9 +++++++++
 2 files changed, 16 insertions(+)
arch/arm/boot/dts/exynos4.dtsi +7 -0
index 92bca86..df1a9f0 100644
@@ -140,6 +140,13 @@
 		status = "disabled";
 	};
 
+	ehci at 12580000 {
+		compatible = "samsung,exynos-ehci";
+		reg = <0x12580000 0x100>;
+		interrupts = <0 70 0>;
+		status = "disabled";
+	};
+
 	serial at 13800000 {
 		compatible = "samsung,exynos4210-uart";
 		reg = <0x13800000 0x100>;
arch/arm/mach-exynos/mach-exynos4-dt.c +9 -0
index 92757ff..c8a23f0 100644
@@ -13,6 +13,7 @@
 
 #include <linux/of_platform.h>
 #include <linux/serial_core.h>
+#include <linux/platform_data/usb-ehci-s5p.h>
 
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
@@ -20,9 +21,15 @@
 
 #include <plat/cpu.h>
 #include <plat/regs-serial.h>
+#include <plat/usb-phy.h>
 
 #include "common.h"
 
+static struct s5p_ehci_platdata s5p_ehci_platdata = {
+	.phy_init = s5p_usb_phy_init,
+	.phy_exit = s5p_usb_phy_exit,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -80,6 +87,8 @@ static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = {
 	OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_MDMA1, "dma-pl330.2", NULL),
 	OF_DEV_AUXDATA("samsung,exynos4210-tmu", EXYNOS4_PA_TMU,
 				"exynos-tmu", NULL),
+	OF_DEV_AUXDATA("samsung,exynos-ehci", EXYNOS4_PA_EHCI,
+				"s5p-ehci", &s5p_ehci_platdata),
 	{},
 };
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 USB: ehci-s5p: Add to get interrupt from DT

In reply to Dongjin Kim

This patch support to get interrupt resource from device tree as well as platform device if ehci node is defined in device tree and it's irq is described.

---
 drivers/usb/host/ehci-s5p.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-s5p.c +7 -1
index 319dcfa..0fc5e5e 100644
@@ -16,6 +16,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/of_gpio.h>
+#include <linux/of_irq.h>
 #include <linux/platform_data/usb-ehci-s5p.h>
 #include <plat/usb-phy.h>
 
@@ -156,7 +157,12 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 		goto fail_io;
 	}
 
-	irq = platform_get_irq(pdev, 0);
+	if (pdev->dev.of_node)
+		irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+	else {
+		irq = platform_get_irq(pdev, 0);
+	}
+
 	if (!irq) {
 		dev_err(&pdev->dev, "Failed to get IRQ\n");
 		err = -ENODEV;
Signature · 1 line
1.7.10.4
#3 lore raw

Re: [PATCH 2/2] USB: ehci-s5p: Add to get interrupt from DT

Hello.

Quoted 22 lines · Dongjin Kim

This patch support to get interrupt resource from device tree as well as platform device if ehci node is defined in device tree and it's irq is described.

---
 drivers/usb/host/ehci-s5p.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-s5p.c +1 -0
index 319dcfa..0fc5e5e 100644
@@ -16,6 +16,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/of_gpio.h>
+#include <linux/of_irq.h>
 #include <linux/platform_data/usb-ehci-s5p.h>
 #include <plat/usb-phy.h>
 

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 161

Quoted 6 lines
drivers/usb/host/ehci-s5p.c +2 -1
@@ -156,7 +157,12 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 		goto fail_io;
 	}
 
-	irq = platform_get_irq(pdev, 0);
+	if (pdev->dev.of_node)
+		irq = irq_of_parse_and_map(pdev->dev.of_node, 0);

platform_get_irq() should still work for device tree based platform devices.
I don't see the point on the patch?

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 164

Quoted 3 lines
drivers/usb/host/ehci-s5p.c +3 -0
+	else {
+		irq = platform_get_irq(pdev, 0);
+	}

Hm, why {} out of the blue? Both arms of *if* are single-stratement.

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 165

Quoted 1 line
drivers/usb/host/ehci-s5p.c +1 -0
+

No need for empty line here.

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 168

Quoted 3 lines
drivers/usb/host/ehci-s5p.c +0 -0
 	if (!irq) {
 		dev_err(&pdev->dev, "Failed to get IRQ\n");
 		err = -ENODEV;

WBR, Sergei

#4 lore raw

Re: [PATCH 2/2] USB: ehci-s5p: Add to get interrupt from DT

Hi Sergei,

Yes, you are right.
I made this patch to read its interrupt number from dtb directly. But now platform_get_irq() returns correct irq since "OF_DEV_AUXDATA(...)" is added as my first patch.

This patch is useless.

Thanks and best regards,
Dongjin.

Quoted 47 lines · Sergei Shtylyov

Hello.

Quoted 22 lines · Dongjin Kim

This patch support to get interrupt resource from device tree as well as platform device if ehci node is defined in device tree and it's irq is described.

---
 drivers/usb/host/ehci-s5p.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-s5p.c +1 -0
index 319dcfa..0fc5e5e 100644
@@ -16,6 +16,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/of_gpio.h>
+#include <linux/of_irq.h>
 #include <linux/platform_data/usb-ehci-s5p.h>
 #include <plat/usb-phy.h>
 

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device · line 162

Quoted 7 lines
drivers/usb/host/ehci-s5p.c +2 -1
@@ -156,7 +157,12 @@ static int s5p_ehci_probe(struct platform_device
 *pdev)
              goto fail_io;
      }
 
-     irq = platform_get_irq(pdev, 0);
+     if (pdev->dev.of_node)
+             irq = irq_of_parse_and_map(pdev->dev.of_node, 0);

platform_get_irq() should still work for device tree based platform
devices.
I don't see the point on the patch?

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 164

Quoted 3 lines
drivers/usb/host/ehci-s5p.c +3 -0
+     else {
+             irq = platform_get_irq(pdev, 0);
+     }

Hm, why {} out of the blue? Both arms of *if* are single-stratement.

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 165

Quoted 1 line
drivers/usb/host/ehci-s5p.c +1 -0
+
Quoted 8 lines

No need for empty line here.

Quoted 3 lines
drivers/usb/host/ehci-s5p.c +0 -0
      if (!irq) {
              dev_err(&pdev->dev, "Failed to get IRQ\n");
              err = -ENODEV;

WBR, Sergei

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