Re: [U-Boot] [PATCH v2 2/2] board:freescale:usb: Add device-tree fixup support for xhci controller

2016-02-26 Thread Sriram Dash
Please find my reply inline

-Original Message-
From: Marek Vasut [mailto:ma...@denx.de] 
Sent: Thursday, February 25, 2016 11:31 PM
To: Sriram Dash ; u-boot@lists.denx.de
Cc: york sun ; Ramneek Mehresh ; 
Rajesh Bhagat 
Subject: Re: [PATCH v2 2/2] board:freescale:usb: Add device-tree fixup support 
for xhci controller

On 02/24/2016 05:44 AM, Sriram Dash wrote:
> Enables usb device-tree fixup code to incorporate xhci controller
> 
> Signed-off-by: Ramneek Mehresh 
> Signed-off-by: Sriram Dash 
> ---
>  board/freescale/common/Makefile |  4 +++-
>  board/freescale/common/usb.c| 11 +--
>  include/fdt_support.h   |  4 ++--
>  3 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/board/freescale/common/Makefile 
> b/board/freescale/common/Makefile index 62de45c..8388f47 100644
> --- a/board/freescale/common/Makefile
> +++ b/board/freescale/common/Makefile
> @@ -13,7 +13,9 @@ MINIMAL=y
>  endif
>  endif
>  
> -obj-$(CONFIG_USB_EHCI_FSL) += usb.o
> +ifneq ($(filter y,$(CONFIG_USB_EHCI_FSL) $(CONFIG_USB_XHCI_FSL)),) 
> +obj-y += usb.o endif

Please just add:

obj-$(CONFIG_USB_XHCI_FSL) += usb.o

here. Kbuild takes care of duplicities.

[Sriram] 
Accepted, Will change in v3 of patch

>  ifdef MINIMAL
>  # necessary to create built-in.o
> diff --git a/board/freescale/common/usb.c 
> b/board/freescale/common/usb.c index 7a35e92..b06daa0 100644
> --- a/board/freescale/common/usb.c
> +++ b/board/freescale/common/usb.c
> @@ -23,6 +23,7 @@ static const char *fdt_usb_get_node_type(void *blob, 
> int start_offset,  {
>   const char *compat_dr = "fsl-usb2-dr";
>   const char *compat_mph = "fsl-usb2-mph";
> + const char *compat_snps = "snps,dwc3";

Will you add more random variables here once you add another DT compat string 
for another controller? You might want to learn about C arrays :)

[Sriram] Accepted, Will change in v3 of patch


>   const char *node_type = NULL;
>  
>   *node_offset = fdt_node_offset_by_compatible(blob, start_offset, @@ 
> -32,8 +33,14 @@ static const char *fdt_usb_get_node_type(void *blob, int 
> start_offset,
>start_offset,
>compat_dr);
>   if (*node_offset < 0) {
> - printf("ERROR: could not find compatible node: %s\n",
> -fdt_strerror(*node_offset));
> + *node_offset = fdt_node_offset_by_compatible
> +(blob, start_offset, compat_snps);
> + if (*node_offset < 0) {
> + printf("ERROR:could not find node:%s",
> +fdt_strerror(*node_offset));
> + } else {
> + node_type = compat_snps;
> + }
>   } else {
>   node_type = compat_dr;
>   }
> diff --git a/include/fdt_support.h b/include/fdt_support.h index 
> 296add0..d34e959 100644
> --- a/include/fdt_support.h
> +++ b/include/fdt_support.h
> @@ -113,11 +113,11 @@ void fdt_fixup_qe_firmware(void *fdt);
>   */
>  int fdt_fixup_display(void *blob, const char *path, const char 
> *display);
>  
> -#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
> +#if defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL)

This change looks unrelated.

[Sriram] fdt_fixup_dr_usb is currently for fixing device tree for EHCI. We are 
planning to use this 
for XHCI also. 

>  void fdt_fixup_dr_usb(void *blob, bd_t *bd);  #else  static inline 
> void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} -#endif /* 
> defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */
> +#endif /* defined(CONFIG_USB_EHCI_FSL) || 
> +defined(CONFIG_USB_XHCI_FSL) */
>  
>  #if defined(CONFIG_SYS_FSL_SEC_COMPAT)
>  void fdt_fixup_crypto_node(void *blob, int sec_rev);
> 

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


Re: [U-Boot] [PATCH v2 2/2] board:freescale:usb: Add device-tree fixup support for xhci controller

2016-02-25 Thread Marek Vasut
On 02/24/2016 05:44 AM, Sriram Dash wrote:
> Enables usb device-tree fixup code to incorporate xhci controller
> 
> Signed-off-by: Ramneek Mehresh 
> Signed-off-by: Sriram Dash 
> ---
>  board/freescale/common/Makefile |  4 +++-
>  board/freescale/common/usb.c| 11 +--
>  include/fdt_support.h   |  4 ++--
>  3 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
> index 62de45c..8388f47 100644
> --- a/board/freescale/common/Makefile
> +++ b/board/freescale/common/Makefile
> @@ -13,7 +13,9 @@ MINIMAL=y
>  endif
>  endif
>  
> -obj-$(CONFIG_USB_EHCI_FSL) += usb.o
> +ifneq ($(filter y,$(CONFIG_USB_EHCI_FSL) $(CONFIG_USB_XHCI_FSL)),)
> +obj-y += usb.o
> +endif

Please just add:

obj-$(CONFIG_USB_XHCI_FSL) += usb.o

here. Kbuild takes care of duplicities.

>  ifdef MINIMAL
>  # necessary to create built-in.o
> diff --git a/board/freescale/common/usb.c b/board/freescale/common/usb.c
> index 7a35e92..b06daa0 100644
> --- a/board/freescale/common/usb.c
> +++ b/board/freescale/common/usb.c
> @@ -23,6 +23,7 @@ static const char *fdt_usb_get_node_type(void *blob, int 
> start_offset,
>  {
>   const char *compat_dr = "fsl-usb2-dr";
>   const char *compat_mph = "fsl-usb2-mph";
> + const char *compat_snps = "snps,dwc3";

Will you add more random variables here once you add another DT compat
string for another controller? You might want to learn about C arrays :)

>   const char *node_type = NULL;
>  
>   *node_offset = fdt_node_offset_by_compatible(blob, start_offset,
> @@ -32,8 +33,14 @@ static const char *fdt_usb_get_node_type(void *blob, int 
> start_offset,
>start_offset,
>compat_dr);
>   if (*node_offset < 0) {
> - printf("ERROR: could not find compatible node: %s\n",
> -fdt_strerror(*node_offset));
> + *node_offset = fdt_node_offset_by_compatible
> +(blob, start_offset, compat_snps);
> + if (*node_offset < 0) {
> + printf("ERROR:could not find node:%s",
> +fdt_strerror(*node_offset));
> + } else {
> + node_type = compat_snps;
> + }
>   } else {
>   node_type = compat_dr;
>   }
> diff --git a/include/fdt_support.h b/include/fdt_support.h
> index 296add0..d34e959 100644
> --- a/include/fdt_support.h
> +++ b/include/fdt_support.h
> @@ -113,11 +113,11 @@ void fdt_fixup_qe_firmware(void *fdt);
>   */
>  int fdt_fixup_display(void *blob, const char *path, const char *display);
>  
> -#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
> +#if defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL)

This change looks unrelated.

>  void fdt_fixup_dr_usb(void *blob, bd_t *bd);
>  #else
>  static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {}
> -#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) 
> */
> +#endif /* defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL) */
>  
>  #if defined(CONFIG_SYS_FSL_SEC_COMPAT)
>  void fdt_fixup_crypto_node(void *blob, int sec_rev);
> 

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


[U-Boot] [PATCH v2 2/2] board:freescale:usb: Add device-tree fixup support for xhci controller

2016-02-24 Thread Sriram Dash
Enables usb device-tree fixup code to incorporate xhci controller

Signed-off-by: Ramneek Mehresh 
Signed-off-by: Sriram Dash 
---
 board/freescale/common/Makefile |  4 +++-
 board/freescale/common/usb.c| 11 +--
 include/fdt_support.h   |  4 ++--
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index 62de45c..8388f47 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -13,7 +13,9 @@ MINIMAL=y
 endif
 endif
 
-obj-$(CONFIG_USB_EHCI_FSL) += usb.o
+ifneq ($(filter y,$(CONFIG_USB_EHCI_FSL) $(CONFIG_USB_XHCI_FSL)),)
+obj-y += usb.o
+endif
 
 ifdef MINIMAL
 # necessary to create built-in.o
diff --git a/board/freescale/common/usb.c b/board/freescale/common/usb.c
index 7a35e92..b06daa0 100644
--- a/board/freescale/common/usb.c
+++ b/board/freescale/common/usb.c
@@ -23,6 +23,7 @@ static const char *fdt_usb_get_node_type(void *blob, int 
start_offset,
 {
const char *compat_dr = "fsl-usb2-dr";
const char *compat_mph = "fsl-usb2-mph";
+   const char *compat_snps = "snps,dwc3";
const char *node_type = NULL;
 
*node_offset = fdt_node_offset_by_compatible(blob, start_offset,
@@ -32,8 +33,14 @@ static const char *fdt_usb_get_node_type(void *blob, int 
start_offset,
 start_offset,
 compat_dr);
if (*node_offset < 0) {
-   printf("ERROR: could not find compatible node: %s\n",
-  fdt_strerror(*node_offset));
+   *node_offset = fdt_node_offset_by_compatible
+  (blob, start_offset, compat_snps);
+   if (*node_offset < 0) {
+   printf("ERROR:could not find node:%s",
+  fdt_strerror(*node_offset));
+   } else {
+   node_type = compat_snps;
+   }
} else {
node_type = compat_dr;
}
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 296add0..d34e959 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -113,11 +113,11 @@ void fdt_fixup_qe_firmware(void *fdt);
  */
 int fdt_fixup_display(void *blob, const char *path, const char *display);
 
-#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
+#if defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL)
 void fdt_fixup_dr_usb(void *blob, bd_t *bd);
 #else
 static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {}
-#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */
+#endif /* defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL) */
 
 #if defined(CONFIG_SYS_FSL_SEC_COMPAT)
 void fdt_fixup_crypto_node(void *blob, int sec_rev);
-- 
2.1.0

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