Re: [U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

2017-09-05 Thread Fabio Estevam
On Tue, Sep 5, 2017 at 6:18 PM, Stefan Agner  wrote:

> Note that 0xfff was a rather randomly picked offset, not sure if we want that 
> in common code.

Yes, I noticed that. I am inclined to go with 0xfff and then later we
can even introduce a CONFIG option for the offset if needed.

>> -#ifdef CONFIG_USB_GADGET_DOWNLOAD
>> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
>> -{
>> - unsigned short usb_pid;
>> -
>> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid;
>> - put_unaligned(usb_pid, >idProduct);
>> -
>> - return 0;
>> -}
>> -#endif
>
> Nack to this part, this is U-Boot only (not used in SPL) and reads the 
> product ID from eMMC to generate the officially assigned Toradex USB Product 
> ID.

Ok, will prepare another version that keeps the non-SPL code then.

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


Re: [U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

2017-09-05 Thread Stefan Agner


On 03.09.2017 07:56, Fabio Estevam wrote:
> From: Fabio Estevam 
>
> Instead of having every board file to add its own g_dnl_bind_fixup()
> implementation, move it to the common imx6 SPL code.
>
> Signed-off-by: Fabio Estevam 
> ---
> Stefan,
>
> I don't have access to Toradex board to test it, hence marking it
> as RFC.
>
> I have tested it with imx6q-sabresd and it works fine on this board.
>
>  arch/arm/mach-imx/spl.c   | 10 ++
>  board/toradex/apalis_imx6/apalis_imx6.c   | 13 -
>  board/toradex/colibri_imx6/colibri_imx6.c | 13 -
>  board/toradex/common/tdx-common.c | 13 -
>  4 files changed, 10 insertions(+), 39 deletions(-)
>
> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> index 8e8e2f7..e350bc9 100644
> --- a/arch/arm/mach-imx/spl.c
> +++ b/arch/arm/mach-imx/spl.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -86,6 +87,15 @@ u32 spl_boot_device(void)
>   }
>   return BOOT_DEVICE_NONE;
>  }
> +
> +#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
> +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> +{
> + put_unaligned(CONFIG_G_DNL_PRODUCT_NUM + 0xfff, >idProduct);

Note that 0xfff was a rather randomly picked offset, not sure if we want that 
in common code.



> +
> + return 0;
> +}
> +#endif
>  #endif
>  
>  #if defined(CONFIG_SPL_MMC_SUPPORT)
> diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
> b/board/toradex/apalis_imx6/apalis_imx6.c
> index ebc6c12..628a61d 100644
> --- a/board/toradex/apalis_imx6/apalis_imx6.c
> +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> @@ -29,7 +29,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -1224,18 +1223,6 @@ void reset_cpu(ulong addr)
>  {
>  }
>  
> -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> -{
> - unsigned short usb_pid;
> -
> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
> - put_unaligned(usb_pid, >idProduct);
> -
> - return 0;
> -}
> -#endif
> -
>  #endif
>  
>  static struct mxc_serial_platdata mxc_serial_plat = {
> diff --git a/board/toradex/colibri_imx6/colibri_imx6.c 
> b/board/toradex/colibri_imx6/colibri_imx6.c
> index 669d912..756e3f3 100644
> --- a/board/toradex/colibri_imx6/colibri_imx6.c
> +++ b/board/toradex/colibri_imx6/colibri_imx6.c
> @@ -28,7 +28,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -1108,18 +1107,6 @@ void reset_cpu(ulong addr)
>  {
>  }
>  
> -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> -{
> - unsigned short usb_pid;
> -
> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
> - put_unaligned(usb_pid, >idProduct);
> -
> - return 0;
> -}
> -#endif
> -
>  #endif
>  
>  static struct mxc_serial_platdata mxc_serial_plat = {
> diff --git a/board/toradex/common/tdx-common.c 
> b/board/toradex/common/tdx-common.c
> index b4e4727..a7efeb8 100644
> --- a/board/toradex/common/tdx-common.c
> +++ b/board/toradex/common/tdx-common.c
> @@ -5,7 +5,6 @@
>   */
>  
>  #include 
> -#include 
>  #include 
>  
>  #include "tdx-cfg-block.h"
> @@ -109,18 +108,6 @@ int show_board_info(void)
>   return 0;
>  }
>  
> -#ifdef CONFIG_USB_GADGET_DOWNLOAD
> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> -{
> - unsigned short usb_pid;
> -
> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid;
> - put_unaligned(usb_pid, >idProduct);
> -
> - return 0;
> -}
> -#endif

Nack to this part, this is U-Boot only (not used in SPL) and reads the product 
ID from eMMC to generate the officially assigned Toradex USB Product ID.

--
Stefan

> -
>  #if defined(CONFIG_OF_LIBFDT)
>  int ft_common_board_setup(void *blob, bd_t *bd)
>  {

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


Re: [U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

2017-09-03 Thread Łukasz Majewski

On 09/03/2017 04:56 PM, Fabio Estevam wrote:

From: Fabio Estevam 

Instead of having every board file to add its own g_dnl_bind_fixup()
implementation, move it to the common imx6 SPL code.



Reviewed-by: Łukasz Majewski 


Signed-off-by: Fabio Estevam 
---
Stefan,

I don't have access to Toradex board to test it, hence marking it
as RFC.

I have tested it with imx6q-sabresd and it works fine on this board.

  arch/arm/mach-imx/spl.c   | 10 ++
  board/toradex/apalis_imx6/apalis_imx6.c   | 13 -
  board/toradex/colibri_imx6/colibri_imx6.c | 13 -
  board/toradex/common/tdx-common.c | 13 -
  4 files changed, 10 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 8e8e2f7..e350bc9 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -14,6 +14,7 @@
  #include 
  #include 
  #include 
+#include 
  
  DECLARE_GLOBAL_DATA_PTR;
  
@@ -86,6 +87,15 @@ u32 spl_boot_device(void)

}
return BOOT_DEVICE_NONE;
  }
+
+#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+   put_unaligned(CONFIG_G_DNL_PRODUCT_NUM + 0xfff, >idProduct);
+
+   return 0;
+}
+#endif
  #endif
  
  #if defined(CONFIG_SPL_MMC_SUPPORT)

diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index ebc6c12..628a61d 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -29,7 +29,6 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
  #include 
@@ -1224,18 +1223,6 @@ void reset_cpu(ulong addr)
  {
  }
  
-#ifdef CONFIG_SPL_USB_GADGET_SUPPORT

-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
  #endif
  
  static struct mxc_serial_platdata mxc_serial_plat = {

diff --git a/board/toradex/colibri_imx6/colibri_imx6.c 
b/board/toradex/colibri_imx6/colibri_imx6.c
index 669d912..756e3f3 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -28,7 +28,6 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
  #include 
@@ -1108,18 +1107,6 @@ void reset_cpu(ulong addr)
  {
  }
  
-#ifdef CONFIG_SPL_USB_GADGET_SUPPORT

-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
  #endif
  
  static struct mxc_serial_platdata mxc_serial_plat = {

diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index b4e4727..a7efeb8 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -5,7 +5,6 @@
   */
  
  #include 

-#include 
  #include 
  
  #include "tdx-cfg-block.h"

@@ -109,18 +108,6 @@ int show_board_info(void)
return 0;
  }
  
-#ifdef CONFIG_USB_GADGET_DOWNLOAD

-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
  #if defined(CONFIG_OF_LIBFDT)
  int ft_common_board_setup(void *blob, bd_t *bd)
  {




--
Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

2017-09-03 Thread Fabio Estevam
From: Fabio Estevam 

Instead of having every board file to add its own g_dnl_bind_fixup()
implementation, move it to the common imx6 SPL code.

Signed-off-by: Fabio Estevam 
---
Stefan,

I don't have access to Toradex board to test it, hence marking it
as RFC.

I have tested it with imx6q-sabresd and it works fine on this board.

 arch/arm/mach-imx/spl.c   | 10 ++
 board/toradex/apalis_imx6/apalis_imx6.c   | 13 -
 board/toradex/colibri_imx6/colibri_imx6.c | 13 -
 board/toradex/common/tdx-common.c | 13 -
 4 files changed, 10 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 8e8e2f7..e350bc9 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -86,6 +87,15 @@ u32 spl_boot_device(void)
}
return BOOT_DEVICE_NONE;
 }
+
+#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+   put_unaligned(CONFIG_G_DNL_PRODUCT_NUM + 0xfff, >idProduct);
+
+   return 0;
+}
+#endif
 #endif
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index ebc6c12..628a61d 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -29,7 +29,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1224,18 +1223,6 @@ void reset_cpu(ulong addr)
 {
 }
 
-#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
 #endif
 
 static struct mxc_serial_platdata mxc_serial_plat = {
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c 
b/board/toradex/colibri_imx6/colibri_imx6.c
index 669d912..756e3f3 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1108,18 +1107,6 @@ void reset_cpu(ulong addr)
 {
 }
 
-#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
 #endif
 
 static struct mxc_serial_platdata mxc_serial_plat = {
diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index b4e4727..a7efeb8 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 
 #include "tdx-cfg-block.h"
@@ -109,18 +108,6 @@ int show_board_info(void)
return 0;
 }
 
-#ifdef CONFIG_USB_GADGET_DOWNLOAD
-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
 #if defined(CONFIG_OF_LIBFDT)
 int ft_common_board_setup(void *blob, bd_t *bd)
 {
-- 
2.7.4

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