public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support for USB
@ 2012-12-03 13:30 Rajeshwari Shinde
  2012-12-03 13:30 ` [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support Rajeshwari Shinde
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Rajeshwari Shinde @ 2012-12-03 13:30 UTC (permalink / raw)
  To: u-boot

This patch set adds FDT support for USB device.

Rajeshwari Shinde (3):
  EHCI: Exynos: Add fdt support
  EXYNOS5: Add device node for USB.
  EXYNOS5: FDT: Add compatible strings for USB

 arch/arm/dts/exynos5250.dtsi   |    6 ++++
 drivers/usb/host/ehci-exynos.c |   57 ++++++++++++++++++++++++++++++++++++---
 include/fdtdec.h               |    1 +
 lib/fdtdec.c                   |    1 +
 4 files changed, 60 insertions(+), 5 deletions(-)

-- 
1.7.4.4

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

* [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support
  2012-12-03 13:30 [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support for USB Rajeshwari Shinde
@ 2012-12-03 13:30 ` Rajeshwari Shinde
  2012-12-03 14:45   ` Marek Vasut
  2012-12-03 13:30 ` [U-Boot] [PATCH 2/3] EXYNOS5: Add device node for USB Rajeshwari Shinde
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Rajeshwari Shinde @ 2012-12-03 13:30 UTC (permalink / raw)
  To: u-boot

Adding fdt support to ehci-exynos in order to parse
register base addresses from the device node.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 drivers/usb/host/ehci-exynos.c |   57 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 9f0ed06..f4c873f 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -21,6 +21,8 @@
  */
 
 #include <common.h>
+#include <fdtdec.h>
+#include <libfdt.h>
 #include <usb.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/ehci.h>
@@ -28,6 +30,9 @@
 #include <asm/arch/power.h>
 #include "ehci.h"
 
+/* Declare global data pointer */
+DECLARE_GLOBAL_DATA_PTR;
+
 /* Setup the EHCI host controller. */
 static void setup_usb_phy(struct exynos_usb_phy *usb)
 {
@@ -86,12 +91,38 @@ static void reset_usb_phy(struct exynos_usb_phy *usb)
  */
 int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
-	struct exynos_usb_phy *usb;
+	struct exynos_usb_phy *usb = NULL;
+	unsigned int *hcd = NULL;
+	unsigned int node;
+
+	node = fdtdec_next_compatible(gd->fdt_blob, 0,
+					COMPAT_SAMSUNG_EXYNOS_EHCI);
+	if (node <= 0) {
+		debug("EHCI: Can't get device tree node for ehci\n");
+		return -1;
+	}
+
+	/*
+	 * Get the base address for usbphy from the device node
+	 */
+	usb = (struct exynos_usb_phy *)fdtdec_get_addr(gd->fdt_blob, node, "phyreg");
+	if (usb == NULL) {
+		debug("Can't get the usbphy register address\n");
+		return -1;
+	}
 
-	usb = (struct exynos_usb_phy *)samsung_get_base_usb_phy();
 	setup_usb_phy(usb);
 
-	*hccr = (struct ehci_hccr *)samsung_get_base_usb_ehci();
+	/*
+	 * Get the base address for XHCI controller from the device node
+	 */
+	hcd = (unsigned int *)fdtdec_get_addr(gd->fdt_blob, node, "reg");
+	if (hcd == NULL) {
+		debug("Can't get the XHCI registere address\n");
+		return -1;
+	}
+
+	*hccr = (struct ehci_hccr *)hcd;
 	*hcor = (struct ehci_hcor *)((uint32_t) *hccr
 				+ HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
 
@@ -108,9 +139,25 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
  */
 int ehci_hcd_stop(int index)
 {
-	struct exynos_usb_phy *usb;
+	struct exynos_usb_phy *usb = NULL;
+	unsigned int node;
+
+	node = fdtdec_next_compatible(gd->fdt_blob, 0,
+					COMPAT_SAMSUNG_EXYNOS_EHCI);
+	if (node <= 0) {
+		debug("EHCI: Can't get device tree node for ehci\n");
+		return -1;
+	}
+
+	/*
+	 * Get the base address for usbphy from the device node
+	 */
+	usb = (struct exynos_usb_phy *)fdtdec_get_addr(gd->fdt_blob, node, "phyreg");
+	if (usb == NULL) {
+		debug("Can't get the usbphy register address\n");
+		return -1;
+	}
 
-	usb = (struct exynos_usb_phy *)samsung_get_base_usb_phy();
 	reset_usb_phy(usb);
 
 	return 0;
-- 
1.7.4.4

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

* [U-Boot] [PATCH 2/3] EXYNOS5: Add device node for USB.
  2012-12-03 13:30 [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support for USB Rajeshwari Shinde
  2012-12-03 13:30 ` [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support Rajeshwari Shinde
@ 2012-12-03 13:30 ` Rajeshwari Shinde
  2012-12-12 14:38   ` Simon Glass
  2012-12-03 13:30 ` [U-Boot] [PATCH 3/3] EXYNOS5: FDT: Add compatible strings " Rajeshwari Shinde
  2012-12-03 14:46 ` [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support " Marek Vasut
  3 siblings, 1 reply; 8+ messages in thread
From: Rajeshwari Shinde @ 2012-12-03 13:30 UTC (permalink / raw)
  To: u-boot

This patch adds the device node required for USB

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 arch/arm/dts/exynos5250.dtsi |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
index e8ecf3f..dd2c6ac 100644
--- a/arch/arm/dts/exynos5250.dtsi
+++ b/arch/arm/dts/exynos5250.dtsi
@@ -127,4 +127,10 @@
 		clock-frequency = <50000000>;
 		interrupts = <0 70 0>;
         };
+
+	ehci at 12110000 {
+		compatible = "samsung,exynos-ehci";
+		reg = <0x12110000 0x100>;
+		phyreg = <0x12130000>;
+	};
 };
-- 
1.7.4.4

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

* [U-Boot] [PATCH 3/3] EXYNOS5: FDT: Add compatible strings for USB
  2012-12-03 13:30 [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support for USB Rajeshwari Shinde
  2012-12-03 13:30 ` [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support Rajeshwari Shinde
  2012-12-03 13:30 ` [U-Boot] [PATCH 2/3] EXYNOS5: Add device node for USB Rajeshwari Shinde
@ 2012-12-03 13:30 ` Rajeshwari Shinde
  2012-12-04  1:25   ` Simon Glass
  2012-12-03 14:46 ` [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support " Marek Vasut
  3 siblings, 1 reply; 8+ messages in thread
From: Rajeshwari Shinde @ 2012-12-03 13:30 UTC (permalink / raw)
  To: u-boot

Add required compatible information for USB

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 include/fdtdec.h |    1 +
 lib/fdtdec.c     |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 976e6af..09d1d38 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -74,6 +74,7 @@ enum fdt_compat_id {
 	COMPAT_WOLFSON_WM8994_CODEC,	/* Wolfson WM8994 Sound Codec */
 	COMPAT_SAMSUNG_EXYNOS_SPI,	/* Exynos SPI */
 	COMPAT_MAXIM_MAX77686_PMIC,	/* MAX77686 PMIC */ 
+	COMPAT_SAMSUNG_EXYNOS_EHCI,	/* Exynos EHCI controller */
 
 	COMPAT_COUNT,
 };
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 3a6b679..5666d89 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -51,6 +51,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(WOLFSON_WM8994_CODEC, "wolfson,wm8994-codec"),
 	COMPAT(SAMSUNG_EXYNOS_SPI, "samsung,exynos-spi"),
 	COMPAT(MAXIM_MAX77686_PMIC,"maxim,MAX77686_PMIC"),
+	COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
-- 
1.7.4.4

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

* [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support
  2012-12-03 13:30 ` [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support Rajeshwari Shinde
@ 2012-12-03 14:45   ` Marek Vasut
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2012-12-03 14:45 UTC (permalink / raw)
  To: u-boot

Dear Rajeshwari Shinde,

> Adding fdt support to ehci-exynos in order to parse
> register base addresses from the device node.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
[...]

$ ./tools/checkpatch.pl \[PATCH\ 1_3\]\ EHCI_Exynos_Add\ fdt\ support.mbox 
WARNING: line over 80 characters
#136: FILE: drivers/usb/host/ehci-exynos.c:108:
+       usb = (struct exynos_usb_phy *)fdtdec_get_addr(gd->fdt_blob, node, 
"phyreg");

WARNING: line over 80 characters
#177: FILE: drivers/usb/host/ehci-exynos.c:155:
+       usb = (struct exynos_usb_phy *)fdtdec_get_addr(gd->fdt_blob, node, 
"phyreg");

total: 0 errors, 2 warnings, 85 lines checked

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX 
MULTISTATEMENT_MACRO_USE_DO_WHILE

/tmp/[PATCH 1_3] EHCI_Exynos_Add fdt support.mbox has style problems, please 
review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support for USB
  2012-12-03 13:30 [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support for USB Rajeshwari Shinde
                   ` (2 preceding siblings ...)
  2012-12-03 13:30 ` [U-Boot] [PATCH 3/3] EXYNOS5: FDT: Add compatible strings " Rajeshwari Shinde
@ 2012-12-03 14:46 ` Marek Vasut
  3 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2012-12-03 14:46 UTC (permalink / raw)
  To: u-boot

Dear Rajeshwari Shinde,

> This patch set adds FDT support for USB device.
> 
> Rajeshwari Shinde (3):
>   EHCI: Exynos: Add fdt support
>   EXYNOS5: Add device node for USB.
>   EXYNOS5: FDT: Add compatible strings for USB
> 
>  arch/arm/dts/exynos5250.dtsi   |    6 ++++
>  drivers/usb/host/ehci-exynos.c |   57
> ++++++++++++++++++++++++++++++++++++--- include/fdtdec.h               |  
>  1 +
>  lib/fdtdec.c                   |    1 +
>  4 files changed, 60 insertions(+), 5 deletions(-)

I'll not apply this, run this all via checkpatch and repost please. Thanks!

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 3/3] EXYNOS5: FDT: Add compatible strings for USB
  2012-12-03 13:30 ` [U-Boot] [PATCH 3/3] EXYNOS5: FDT: Add compatible strings " Rajeshwari Shinde
@ 2012-12-04  1:25   ` Simon Glass
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2012-12-04  1:25 UTC (permalink / raw)
  To: u-boot

On Mon, Dec 3, 2012 at 5:30 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> Add required compatible information for USB
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

Acked-by: Simon Glass <sjg@chromium.org>

> ---
>  include/fdtdec.h |    1 +
>  lib/fdtdec.c     |    1 +
>  2 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index 976e6af..09d1d38 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -74,6 +74,7 @@ enum fdt_compat_id {
>         COMPAT_WOLFSON_WM8994_CODEC,    /* Wolfson WM8994 Sound Codec */
>         COMPAT_SAMSUNG_EXYNOS_SPI,      /* Exynos SPI */
>         COMPAT_MAXIM_MAX77686_PMIC,     /* MAX77686 PMIC */
> +       COMPAT_SAMSUNG_EXYNOS_EHCI,     /* Exynos EHCI controller */
>
>         COMPAT_COUNT,
>  };
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 3a6b679..5666d89 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -51,6 +51,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
>         COMPAT(WOLFSON_WM8994_CODEC, "wolfson,wm8994-codec"),
>         COMPAT(SAMSUNG_EXYNOS_SPI, "samsung,exynos-spi"),
>         COMPAT(MAXIM_MAX77686_PMIC,"maxim,MAX77686_PMIC"),
> +       COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"),
>  };
>
>  const char *fdtdec_get_compatible(enum fdt_compat_id id)
> --
> 1.7.4.4
>

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

* [U-Boot] [PATCH 2/3] EXYNOS5: Add device node for USB.
  2012-12-03 13:30 ` [U-Boot] [PATCH 2/3] EXYNOS5: Add device node for USB Rajeshwari Shinde
@ 2012-12-12 14:38   ` Simon Glass
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2012-12-12 14:38 UTC (permalink / raw)
  To: u-boot

Hi Rajeshwari,

On Mon, Dec 3, 2012 at 5:30 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> This patch adds the device node required for USB
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> ---
>  arch/arm/dts/exynos5250.dtsi |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
> index e8ecf3f..dd2c6ac 100644
> --- a/arch/arm/dts/exynos5250.dtsi
> +++ b/arch/arm/dts/exynos5250.dtsi
> @@ -127,4 +127,10 @@
>                 clock-frequency = <50000000>;
>                 interrupts = <0 70 0>;
>          };
> +
> +       ehci at 12110000 {
> +               compatible = "samsung,exynos-ehci";
> +               reg = <0x12110000 0x100>;
> +               phyreg = <0x12130000>;

I think this last thing is a phy, but perhaps it should be written out
as a sub-node, something like:

> +       ehci at 12110000 {
> +               compatible = "samsung,exynos-ehci";
> +               reg = <0x12110000 0x100>;
> +               phy {
                        compatible = "samsung,exynos-usb-phy";
                        reg = <0x12130000 0xsomething>;
                    }

If you copy your patch to devicetree-discuss you might get some ideas.

> +       };
>  };
> --
> 1.7.4.4
>

Regards,
Simon

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

end of thread, other threads:[~2012-12-12 14:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-03 13:30 [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support for USB Rajeshwari Shinde
2012-12-03 13:30 ` [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support Rajeshwari Shinde
2012-12-03 14:45   ` Marek Vasut
2012-12-03 13:30 ` [U-Boot] [PATCH 2/3] EXYNOS5: Add device node for USB Rajeshwari Shinde
2012-12-12 14:38   ` Simon Glass
2012-12-03 13:30 ` [U-Boot] [PATCH 3/3] EXYNOS5: FDT: Add compatible strings " Rajeshwari Shinde
2012-12-04  1:25   ` Simon Glass
2012-12-03 14:46 ` [U-Boot] [PATCH 0/3] EXYNOS5: Add FDT support " Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox