[U-Boot] [PATCH] configs: am57xx_evm: define CONFIG_SPL_LOAD_FIT_ADDRESS for SPL-DFU

2019-02-08 Thread Bin Liu
Define CONFIG_SPL_LOAD_FIT_ADDRESS to enable SPL-DFU for am57x platform.

Signed-off-by: Bin Liu 
---
 include/configs/am57xx_evm.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index d61fdf9f7a36..70aa4250605b 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -35,11 +35,22 @@
 
 #define CONFIG_SYS_OMAP_ABE_SYSCK
 
+#ifdef CONFIG_SPL_DFU
+#ifndef CONFIG_SPL_BUILD
 #define DFUARGS \
"dfu_bufsiz=0x1\0" \
DFU_ALT_INFO_MMC \
DFU_ALT_INFO_EMMC \
DFU_ALT_INFO_RAM \
+   DFU_ALT_INFO_QSPI
+#else
+#undef CONFIG_CMD_BOOTD
+#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x8020
+#define DFUARGS \
+   "dfu_bufsiz=0x1\0" \
+   DFU_ALT_INFO_RAM
+#endif
+#endif
 
 #include 
 
-- 
2.17.1

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


Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-21 Thread Bin Liu

Hi,

On 07/19/2015 06:01 AM, Hans de Goede wrote:

Hi,

On 13-07-15 16:16, Bin Liu wrote:

Hi,

On 07/11/2015 08:04 AM, Hans de Goede wrote:

Hi,

On 10-07-15 17:31, Bin Liu wrote:

Hi,

On 07/10/2015 10:12 AM, Heiko Schocher wrote:

Hello Samuel,

Am 10.07.2015 um 16:50 schrieb Egli, Samuel:

Hi Hans,


-Original Message- From: Hans de Goede
[mailto:hdego...@redhat.com] Sent: Freitag, 10. Juli 2015 16:37
To: Egli, Samuel; ma...@denx.de Cc: u-boot@lists.denx.de;
tr...@konsulko.com; Bin Liu; Meier, Roger; Daniel Mack Subject:
Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

Hi,

On 10-07-15 16:30, Hans de Goede wrote:

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if
CONFIG_USB_GADGET_DUALSPEED is not set, in which case Ether
gadget only operates in fullspeed.

Note: This patch is necessary for devices like some siemens
boards that allow only FULL SPEED USB 1.1, e.g. DFU
download.

Signed-off-by: Bin Liu b-...@ti.com Reviewed-by: Tom Rini
tr...@konsulko.com Tested-by: Samuel Egli
samuel.e...@siemens.com CC: Marek Vasut ma...@denx.de CC:
Heiko Schocher h...@denx.de CC: Daniel Mack
zon...@gmail.com CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb in
host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.


My bad, I had a short thought about this when I was initially
working on
this patch, but did not really think about it throughly. Thanks for
bring it up.



p.s.

Given that you want to use this as a hack to work around the
broken pcb design of your board I suggest adding a new option for
this


Well, lets not discuss the broken pcb design. It seems that
wiring protection is not that common. Unfortunately, such a
protection is too expensive for USB High speed :-(.


Agreed, we have seen many cases that have nothing to do with hardware
design, but MUSB has to work in full-speed mode.




titled: CONFIG_USB_MUSB_NO_HIGHSPEED and then do:

+#ifndef CONFIG_USB_MUSB_NO_HIGHSPEED | MUSB_POWER_HSENAB
+#endif


This would be good enough. The point is indeed to limit it to full
speed.


Using CONFIG_USB_GADGET_DUALSPEED for this seems wrong, since
this has nothing to do with enabling dualspeed mode for the
gadget code really.


I agree that the name is confusing.


Yes, I vote for Hans suggestion.


*Adding* a new macro CONFIG_USB_MUSB_NO_HIGHSPEED for musb driver
causes
CONFIG_USB_GADGET_DUALSPEED redundant, because both control for
full-speed.

I suggest to *rename* CONFIG_USB_GADGET_DUALSPEED to
CONFIG_USB_FULLSPEED_ONLY. So that we can use one macro for both gadget
and musb drivers. Considering supper-speed exists and future, I think
CONFIG_USB_NO_HIGHSPEED is confusing...


Sorry I was too fast. CONFIG_USB_FULLSPEED_ONLY is IMHO not acceptable
as it is not granular enough. sunxi boards have both EHCI/OHCI usb
controller
pairs for host ports and an musb controller. One may be limited to
fullspeed
while the other is not.

Likewise I can see a case where some ports but not all ports are
fullspeed
only, so we still want to build the gadged code with dual-speed
descriptors.


Good point.



I really believe that something like:

CONFIG_MUSB_FULLSPEED_ONLY


I am not sure like the idea of using two macros in config.h to control
one thing. Please review the following patch which uses
CONFIG_USB_GADGET_DUALSPEED and musb-board_mode instead. Beware that
this patch is not tested.


The 2 macros do not control one thing, it is for example perfectly possible
to have multiple otg controllers, one which can only do fullspeed and one
which can do both high/full speed in this case one will want to build
the gadget code in dualspeed mode even though one of the usb controllers
is fullspeed only.


This case is a different problem, which requires a separate patch to 
solve, maybe CONFIG_MUSB_NO_HIGHSPEED can play here.


My original and 2nd patch were trying to solve the issue that MUSB 
controller was not set consistently with the gadget driver. Unless the 
patch breaks something else (as did the original patch), nothing else 
needs to be added in.


Regards,
-Bin.



Regards,

Hans








diff --git a/drivers/usb/musb-new/musb_core.c
b/drivers/usb/musb-new/musb_core.c
index eeaacdf..55d1c20 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -931,6 +931,7 @@ void musb_start(struct musb *musb)
  {
 void __iomem*regs = musb-mregs;
 u8  devctl = musb_readb(regs, MUSB_DEVCTL);
+   u8  power;

 dev_dbg(musb-controller, == devctl %02x\n, devctl);

@@ -942,11 +943,12 @@ void musb_start(struct musb *musb)
 musb_writeb(regs, MUSB_TESTMODE, 0);

 /* put into basic highspeed mode and start session */
-   musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
-   | MUSB_POWER_HSENAB
-   /* ENSUSPEND wedges
tusb

Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-13 Thread Bin Liu

Hi,

On 07/11/2015 08:04 AM, Hans de Goede wrote:

Hi,

On 10-07-15 17:31, Bin Liu wrote:

Hi,

On 07/10/2015 10:12 AM, Heiko Schocher wrote:

Hello Samuel,

Am 10.07.2015 um 16:50 schrieb Egli, Samuel:

Hi Hans,


-Original Message- From: Hans de Goede
[mailto:hdego...@redhat.com] Sent: Freitag, 10. Juli 2015 16:37
To: Egli, Samuel; ma...@denx.de Cc: u-boot@lists.denx.de;
tr...@konsulko.com; Bin Liu; Meier, Roger; Daniel Mack Subject:
Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

Hi,

On 10-07-15 16:30, Hans de Goede wrote:

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if
CONFIG_USB_GADGET_DUALSPEED is not set, in which case Ether
gadget only operates in fullspeed.

Note: This patch is necessary for devices like some siemens
boards that allow only FULL SPEED USB 1.1, e.g. DFU
download.

Signed-off-by: Bin Liu b-...@ti.com Reviewed-by: Tom Rini
tr...@konsulko.com Tested-by: Samuel Egli
samuel.e...@siemens.com CC: Marek Vasut ma...@denx.de CC:
Heiko Schocher h...@denx.de CC: Daniel Mack
zon...@gmail.com CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb in
host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.


My bad, I had a short thought about this when I was initially working on
this patch, but did not really think about it throughly. Thanks for
bring it up.



p.s.

Given that you want to use this as a hack to work around the
broken pcb design of your board I suggest adding a new option for
this


Well, lets not discuss the broken pcb design. It seems that
wiring protection is not that common. Unfortunately, such a
protection is too expensive for USB High speed :-(.


Agreed, we have seen many cases that have nothing to do with hardware
design, but MUSB has to work in full-speed mode.




titled: CONFIG_USB_MUSB_NO_HIGHSPEED and then do:

+#ifndef CONFIG_USB_MUSB_NO_HIGHSPEED | MUSB_POWER_HSENAB
+#endif


This would be good enough. The point is indeed to limit it to full
speed.


Using CONFIG_USB_GADGET_DUALSPEED for this seems wrong, since
this has nothing to do with enabling dualspeed mode for the
gadget code really.


I agree that the name is confusing.


Yes, I vote for Hans suggestion.


*Adding* a new macro CONFIG_USB_MUSB_NO_HIGHSPEED for musb driver causes
CONFIG_USB_GADGET_DUALSPEED redundant, because both control for
full-speed.

I suggest to *rename* CONFIG_USB_GADGET_DUALSPEED to
CONFIG_USB_FULLSPEED_ONLY. So that we can use one macro for both gadget
and musb drivers. Considering supper-speed exists and future, I think
CONFIG_USB_NO_HIGHSPEED is confusing...


Sorry I was too fast. CONFIG_USB_FULLSPEED_ONLY is IMHO not acceptable
as it is not granular enough. sunxi boards have both EHCI/OHCI usb
controller
pairs for host ports and an musb controller. One may be limited to
fullspeed
while the other is not.

Likewise I can see a case where some ports but not all ports are fullspeed
only, so we still want to build the gadged code with dual-speed
descriptors.


Good point.



I really believe that something like:

CONFIG_MUSB_FULLSPEED_ONLY


I am not sure like the idea of using two macros in config.h to control 
one thing. Please review the following patch which uses 
CONFIG_USB_GADGET_DUALSPEED and musb-board_mode instead. Beware that 
this patch is not tested.


diff --git a/drivers/usb/musb-new/musb_core.c 
b/drivers/usb/musb-new/musb_core.c

index eeaacdf..55d1c20 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -931,6 +931,7 @@ void musb_start(struct musb *musb)
 {
void __iomem*regs = musb-mregs;
u8  devctl = musb_readb(regs, MUSB_DEVCTL);
+   u8  power;

dev_dbg(musb-controller, == devctl %02x\n, devctl);

@@ -942,11 +943,12 @@ void musb_start(struct musb *musb)
musb_writeb(regs, MUSB_TESTMODE, 0);

/* put into basic highspeed mode and start session */
-   musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
-   | MUSB_POWER_HSENAB
-   /* ENSUSPEND wedges tusb */
-   /* | MUSB_POWER_ENSUSPEND */
-   );
+   power = MUSB_POWER_ISOUPDATE | MUSB_POWER_HSENAB;
+#ifndef CONFIG_USB_GADGET_DUALSPEED
+   if (musb-board_mode != MUSB_HOST)
+   power = ~MUSB_POWER_HSENAB;
+#endif
+   musb_writeb(regs, MUSB_POWER, power);

musb-is_active = 0;
devctl = musb_readb(regs, MUSB_DEVCTL);
diff --git a/drivers/usb/musb-new/musb_uboot.c 
b/drivers/usb/musb-new/musb_uboot.c

index 85d3027..c240032 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -176,7 +176,7 @@ int usb_gadget_register_driver(struct 
usb_gadget_driver *driver)

 {
int ret;

-   if (!driver || driver-speed  USB_SPEED_HIGH

Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-10 Thread Bin Liu

Hi,

On 07/10/2015 10:12 AM, Heiko Schocher wrote:

Hello Samuel,

Am 10.07.2015 um 16:50 schrieb Egli, Samuel:

Hi Hans,


-Original Message- From: Hans de Goede
[mailto:hdego...@redhat.com] Sent: Freitag, 10. Juli 2015 16:37
To: Egli, Samuel; ma...@denx.de Cc: u-boot@lists.denx.de;
tr...@konsulko.com; Bin Liu; Meier, Roger; Daniel Mack Subject:
Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

Hi,

On 10-07-15 16:30, Hans de Goede wrote:

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if
CONFIG_USB_GADGET_DUALSPEED is not set, in which case Ether
gadget only operates in fullspeed.

Note: This patch is necessary for devices like some siemens
boards that allow only FULL SPEED USB 1.1, e.g. DFU
download.

Signed-off-by: Bin Liu b-...@ti.com Reviewed-by: Tom Rini
tr...@konsulko.com Tested-by: Samuel Egli
samuel.e...@siemens.com CC: Marek Vasut ma...@denx.de CC:
Heiko Schocher h...@denx.de CC: Daniel Mack
zon...@gmail.com CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb in
host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.


My bad, I had a short thought about this when I was initially working on
this patch, but did not really think about it throughly. Thanks for
bring it up.



p.s.

Given that you want to use this as a hack to work around the
broken pcb design of your board I suggest adding a new option for
this


Well, lets not discuss the broken pcb design. It seems that
wiring protection is not that common. Unfortunately, such a
protection is too expensive for USB High speed :-(.


Agreed, we have seen many cases that have nothing to do with hardware
design, but MUSB has to work in full-speed mode.




titled: CONFIG_USB_MUSB_NO_HIGHSPEED and then do:

+#ifndef CONFIG_USB_MUSB_NO_HIGHSPEED | MUSB_POWER_HSENAB
+#endif


This would be good enough. The point is indeed to limit it to full
speed.


Using CONFIG_USB_GADGET_DUALSPEED for this seems wrong, since
this has nothing to do with enabling dualspeed mode for the
gadget code really.


I agree that the name is confusing.


Yes, I vote for Hans suggestion.


*Adding* a new macro CONFIG_USB_MUSB_NO_HIGHSPEED for musb driver causes
CONFIG_USB_GADGET_DUALSPEED redundant, because both control for full-speed.

I suggest to *rename* CONFIG_USB_GADGET_DUALSPEED to
CONFIG_USB_FULLSPEED_ONLY. So that we can use one macro for both gadget
and musb drivers. Considering supper-speed exists and future, I think
CONFIG_USB_NO_HIGHSPEED is confusing...

Regards,
-Bin.



bye, Heiko

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


Re: [U-Boot] [PATCH v2 1/2] usb: dfu: add fullspeed support for DFU

2014-09-10 Thread Bin Liu

Heiko,

On 09/10/2014 01:55 AM, Heiko Schocher wrote:

DFU now can use also fullspeed.

Signed-off-by: Heiko Schocher h...@denx.de
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Liu Bin b-...@ti.com


My first name is Bin.

Other than that, feel free to add

Reviewed by: Bin Liu b-...@ti.com

Regards,
-Bin.


Cc: Lukas Stockmann lukas.stockm...@siemens.com

---

- changes for v2:
   - get rid of config option CONFIG_DFU_FULLSPEED as Bin Liu
 suggested.
---
  drivers/usb/gadget/f_dfu.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 1145aab..dfa9f3b 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -238,6 +238,7 @@ static inline void to_dfu_mode(struct f_dfu *f_dfu)
  {
f_dfu-usb_function.strings = dfu_strings;
f_dfu-usb_function.hs_descriptors = f_dfu-function;
+   f_dfu-usb_function.descriptors = f_dfu-function;
f_dfu-dfu_state = DFU_STATE_dfuIDLE;
  }

@@ -245,6 +246,7 @@ static inline void to_runtime_mode(struct f_dfu *f_dfu)
  {
f_dfu-usb_function.strings = NULL;
f_dfu-usb_function.hs_descriptors = dfu_runtime_descs;
+   f_dfu-usb_function.descriptors = dfu_runtime_descs;
  }

  static int handle_upload(struct usb_request *req, u16 len)
@@ -809,6 +811,7 @@ static int dfu_bind_config(struct usb_configuration *c)
return -ENOMEM;
f_dfu-usb_function.name = dfu;
f_dfu-usb_function.hs_descriptors = dfu_runtime_descs;
+   f_dfu-usb_function.descriptors = dfu_runtime_descs;
f_dfu-usb_function.bind = dfu_bind;
f_dfu-usb_function.unbind = dfu_unbind;
f_dfu-usb_function.set_alt = dfu_set_alt;



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


Re: [U-Boot] [PATCH v1 0/2] usb: dfu: am335x: allow dfu in fullspeed mode only

2014-09-09 Thread Bin Liu

Lukasz,

On 09/09/2014 08:43 AM, Lukasz Majewski wrote:

Hi Heiko,


This patchserie adds the new config option CONFIG_DFU_FULLSPEED.


Is there any special reason to support Full Speed (12 Mbit/sec - USB
1.1) and not rely solely on the High Speed (USB 2.0) as we do now?



The drivers must support full-speed anyway based on the USB2.0 Specs.

I have seen many cases in which only full-speed is suitable due to 
either board design or specific USB use case.


One example is that to better fit to the production firmware flashing 
automation, a board does not use standard USB receptacle or plug, but a 
four touch pads on the PCB, so that the robot can grab the board and 
touch the pads to download the firmware. In this case signal integrity 
is a concern, but not download speed.


Regards,
-Bin.


If this is enabled DFU uses fullspeed only. This is used on the
siemens boards.


Is there any DFU problem with the mentioned Siemens board, that we must
use USB 1.1?

I'd also appreciate more verbose rationale for this patch series - why
this change is needed? What is the expected improvement?

Thanks in advance.



Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Liu Bin b-...@ti.com
Cc: Lukas Stockmann lukas.stockm...@siemens.com

Heiko Schocher (2):
   usb: dfu: add config option to use in dfu mode fullspeed only
   arm: am335x: siemens board use in DFU mode fullspeed only

  README | 3 +++
  drivers/usb/gadget/f_dfu.c | 3 +++
  drivers/usb/gadget/g_dnl.c | 3 +++
  include/configs/siemens-am33x-common.h | 3 ++-
  4 files changed, 11 insertions(+), 1 deletion(-)







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


Re: [U-Boot] [PATCH v1 1/2] usb: dfu: add config option to use in dfu mode fullspeed only

2014-09-09 Thread Bin Liu

Heiko,

On 09/09/2014 07:37 AM, Heiko Schocher wrote:

add the new config option CONFIG_DFU_FULLSPEED. With this
option enabled, DFU uses fullspeed only.


Can we not introduce the new config option but check the gadget driver 
speed in runtime as what the ether gadget driver does?


I don't want two config options (CONFIG_USB_GADGET_DUALSPEED and 
CONFIG_DFU_FULLSPEED) to control one feature, as in your patch 2/2.


Regards,
-Bin.



Signed-off-by: Heiko Schocher h...@denx.de
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Liu Bin b-...@ti.com
Cc: Lukas Stockmann lukas.stockm...@siemens.com
---
  README | 3 +++
  drivers/usb/gadget/f_dfu.c | 3 +++
  drivers/usb/gadget/g_dnl.c | 3 +++
  3 files changed, 9 insertions(+)

diff --git a/README b/README
index 0a0f528..1413392 100644
--- a/README
+++ b/README
@@ -1607,6 +1607,9 @@ The following options need to be configured:
entering dfuMANIFEST state. Host waits this timeout, before
sending again an USB request to the device.

+   CONFIG_DFU_FULLSPEED
+   use for the dfu functionality fullspeed only.
+
  - USB Device Android Fastboot support:
CONFIG_CMD_FASTBOOT
This enables the command fastboot which enables the Android
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 1145aab..dfa9f3b 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -238,6 +238,7 @@ static inline void to_dfu_mode(struct f_dfu *f_dfu)
  {
f_dfu-usb_function.strings = dfu_strings;
f_dfu-usb_function.hs_descriptors = f_dfu-function;
+   f_dfu-usb_function.descriptors = f_dfu-function;
f_dfu-dfu_state = DFU_STATE_dfuIDLE;
  }

@@ -245,6 +246,7 @@ static inline void to_runtime_mode(struct f_dfu *f_dfu)
  {
f_dfu-usb_function.strings = NULL;
f_dfu-usb_function.hs_descriptors = dfu_runtime_descs;
+   f_dfu-usb_function.descriptors = dfu_runtime_descs;
  }

  static int handle_upload(struct usb_request *req, u16 len)
@@ -809,6 +811,7 @@ static int dfu_bind_config(struct usb_configuration *c)
return -ENOMEM;
f_dfu-usb_function.name = dfu;
f_dfu-usb_function.hs_descriptors = dfu_runtime_descs;
+   f_dfu-usb_function.descriptors = dfu_runtime_descs;
f_dfu-usb_function.bind = dfu_bind;
f_dfu-usb_function.unbind = dfu_unbind;
f_dfu-usb_function.set_alt = dfu_set_alt;
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 58cad11..79e0c9c 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -143,6 +143,9 @@ static int g_dnl_config_register(struct usb_composite_dev 
*cdev)
config-bConfigurationValue = CONFIGURATION_NUMBER;
config-iConfiguration = STRING_USBDOWN;
config-bind = g_dnl_do_config;
+#if defined(CONFIG_DFU_FULLSPEED)
+   config-fullspeed = 1;
+#endif

return usb_add_config(cdev, config);
  }



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


Re: [U-Boot] [PATCH v1 1/2] usb: dfu: add config option to use in dfu mode fullspeed only

2014-09-09 Thread Bin Liu

Heiko,

On 09/09/2014 09:37 AM, Heiko Schocher wrote:

Hello Bin Liu,

Am 09.09.2014 16:09, schrieb Bin Liu:

Heiko,

On 09/09/2014 07:37 AM, Heiko Schocher wrote:

add the new config option CONFIG_DFU_FULLSPEED. With this
option enabled, DFU uses fullspeed only.


Can we not introduce the new config option but check the gadget driver
speed in runtime as what the ether gadget driver does?
I don't want two config options (CONFIG_USB_GADGET_DUALSPEED and
CONFIG_DFU_FULLSPEED) to control one feature, as in your patch 2/2.


Hmm.. I am not sure, if I understand you correct. I could use
CONFIG_USB_GADGET_DUALSPEED instead the new config option
for setting config-fullspeed = 1; in g_dnl_config_register()

If you mean this, yes, thats would be a good change...


No, I did not mean this build time macro, but was thinking you can check 
g-speed at the same place in runtime.


I think you can refer to ether.c, which supports full-speed but does not 
use any macro.


Regards,
-Bin.



bye,
Heiko


Regards,
-Bin.



Signed-off-by: Heiko Schocher h...@denx.de
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Liu Bin b-...@ti.com
Cc: Lukas Stockmann lukas.stockm...@siemens.com
---
README | 3 +++
drivers/usb/gadget/f_dfu.c | 3 +++
drivers/usb/gadget/g_dnl.c | 3 +++
3 files changed, 9 insertions(+)

diff --git a/README b/README
index 0a0f528..1413392 100644
--- a/README
+++ b/README
@@ -1607,6 +1607,9 @@ The following options need to be configured:
entering dfuMANIFEST state. Host waits this timeout, before
sending again an USB request to the device.

+ CONFIG_DFU_FULLSPEED
+ use for the dfu functionality fullspeed only.
+
- USB Device Android Fastboot support:
CONFIG_CMD_FASTBOOT
This enables the command fastboot which enables the Android
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 1145aab..dfa9f3b 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -238,6 +238,7 @@ static inline void to_dfu_mode(struct f_dfu *f_dfu)
{
f_dfu-usb_function.strings = dfu_strings;
f_dfu-usb_function.hs_descriptors = f_dfu-function;
+ f_dfu-usb_function.descriptors = f_dfu-function;
f_dfu-dfu_state = DFU_STATE_dfuIDLE;
}

@@ -245,6 +246,7 @@ static inline void to_runtime_mode(struct f_dfu
*f_dfu)
{
f_dfu-usb_function.strings = NULL;
f_dfu-usb_function.hs_descriptors = dfu_runtime_descs;
+ f_dfu-usb_function.descriptors = dfu_runtime_descs;
}

static int handle_upload(struct usb_request *req, u16 len)
@@ -809,6 +811,7 @@ static int dfu_bind_config(struct
usb_configuration *c)
return -ENOMEM;
f_dfu-usb_function.name = dfu;
f_dfu-usb_function.hs_descriptors = dfu_runtime_descs;
+ f_dfu-usb_function.descriptors = dfu_runtime_descs;
f_dfu-usb_function.bind = dfu_bind;
f_dfu-usb_function.unbind = dfu_unbind;
f_dfu-usb_function.set_alt = dfu_set_alt;
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 58cad11..79e0c9c 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -143,6 +143,9 @@ static int g_dnl_config_register(struct
usb_composite_dev *cdev)
config-bConfigurationValue = CONFIGURATION_NUMBER;
config-iConfiguration = STRING_USBDOWN;
config-bind = g_dnl_do_config;
+#if defined(CONFIG_DFU_FULLSPEED)
+ config-fullspeed = 1;
+#endif

return usb_add_config(cdev, config);
}









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


[U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2013-03-21 Thread Bin Liu
Do not config MUSB to highspeed mode if CONFIG_USB_GADGET_DUALSPEED
is not set, in which case Ether gadget only operates in fullspeed.

Reviewed-by: Tom Rini tr...@ti.com
Signed-off-by: Bin Liu b-...@ti.com
---
 drivers/usb/musb-new/musb_core.c  |2 ++
 drivers/usb/musb-new/musb_uboot.c |2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index aa647e6..da93571 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -943,7 +943,9 @@ void musb_start(struct musb *musb)
 
/* put into basic highspeed mode and start session */
musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
+#ifdef CONFIG_USB_GADGET_DUALSPEED
| MUSB_POWER_HSENAB
+#endif
/* ENSUSPEND wedges tusb */
/* | MUSB_POWER_ENSUSPEND */
);
diff --git a/drivers/usb/musb-new/musb_uboot.c 
b/drivers/usb/musb-new/musb_uboot.c
index 096c4f4..ee3e6c5 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -174,7 +174,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver 
*driver)
 {
int ret;
 
-   if (!driver || driver-speed  USB_SPEED_HIGH || !driver-bind ||
+   if (!driver || driver-speed  USB_SPEED_FULL || !driver-bind ||
!driver-setup) {
printf(bad parameter.\n);
return -EINVAL;
-- 
1.7.9.5

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


[U-Boot] [PATCH] musb: am335x: disable bulk split-combine feature

2013-03-21 Thread Bin Liu
On TI AM335x devices, MUSB has bulk split/combine feature enabled
in the ConfigData register, but the current MUSB driver does not
support it yet. Therefore, disable the feature for now, until the
driver adds the support.

One usecase which is broken because of this feature is that Ether
gadget stops working in Fullspeed mode (by un-defining
CONFIG_USB_GADGET_DUALSPEED)

After desabled this feature, MUSB driver send packets in proper size
(no more than 64 bytes) in Fullspeed mode.

This has been validated with Ether gadget in Fullspeed mode on AM335x
EVM.

Signed-off-by: Bin Liu b-...@ti.com
---
 drivers/usb/musb-new/musb_core.c |5 +
 include/configs/am335x_evm.h |1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index 040a5c0..aa647e6 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -1421,6 +1421,7 @@ static int __devinit musb_core_init(u16 musb_type, struct 
musb *musb)
strcat(aInfo, , dyn FIFOs);
musb-dyn_fifo = true;
}
+#ifndef CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT
if (reg  MUSB_CONFIGDATA_MPRXE) {
strcat(aInfo, , bulk combine);
musb-bulk_combine = true;
@@ -1429,6 +1430,10 @@ static int __devinit musb_core_init(u16 musb_type, 
struct musb *musb)
strcat(aInfo, , bulk split);
musb-bulk_split = true;
}
+#else
+   musb-bulk_combine = false;
+   musb-bulk_split = false;
+#endif
if (reg  MUSB_CONFIGDATA_HBRXE) {
strcat(aInfo, , HB-ISO Rx);
musb-hb_iso_rx = true;
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 74a70ee..faf9581 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -450,6 +450,7 @@
 #define CONFIG_ARCH_MISC_INIT
 #define CONFIG_MUSB_GADGET
 #define CONFIG_MUSB_PIO_ONLY
+#define CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW2
 #define CONFIG_MUSB_HOST
-- 
1.7.9.5

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