[U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support

2012-12-03 Thread 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.vi...@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

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] EHCI: Exynos: Add fdt support

2012-12-03 Thread Marek Vasut
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.vi...@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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot