* [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode @ 2014-01-07 14:08 Przemyslaw Marczak 2014-01-13 9:18 ` Przemyslaw Marczak 2014-01-13 11:29 ` Marek Vasut 0 siblings, 2 replies; 6+ messages in thread From: Przemyslaw Marczak @ 2014-01-07 14:08 UTC (permalink / raw) To: u-boot Before this change ums mode can not be entered when device was using the same usb port for usb/uart communication. Switching USB cable from UART to USB always causes ums exit. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> --- common/cmd_usb_mass_storage.c | 24 ++++++++++++++++++++++++ include/usb_mass_storage.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c index 99487f4..5f557d5 100644 --- a/common/cmd_usb_mass_storage.c +++ b/common/cmd_usb_mass_storage.c @@ -42,6 +42,30 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, g_dnl_register("ums"); + /* Timeout unit: seconds */ + int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; + + if (!usb_cable_connected()) { + puts("Please connect USB cable.\n"); + + while (!usb_cable_connected()) { + if (ctrlc()) { + puts("\rCTRL+C - Operation aborted.\n"); + goto exit; + } + if (!cable_ready_timeout) { + puts("\rUSB cable not detected.\n" \ + "Command exit.\n"); + goto exit; + } + + printf("\rAuto exit in: %.2d s.", cable_ready_timeout); + mdelay(1000); + cable_ready_timeout--; + } + puts("\r\n"); + } + while (1) { usb_gadget_handle_interrupts(); diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index 9df3adc..058dcf1 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -20,6 +20,9 @@ #define UMS_NUM_SECTORS 0 #endif +/* Wait at maximum 60 seconds for cable connection */ +#define UMS_CABLE_READY_TIMEOUT 60 + struct ums { int (*read_sector)(struct ums *ums_dev, ulong start, lbaint_t blkcnt, void *buf); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode 2014-01-07 14:08 [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode Przemyslaw Marczak @ 2014-01-13 9:18 ` Przemyslaw Marczak 2014-01-13 11:14 ` Marek Vasut 2014-01-13 11:29 ` Marek Vasut 1 sibling, 1 reply; 6+ messages in thread From: Przemyslaw Marczak @ 2014-01-13 9:18 UTC (permalink / raw) To: u-boot Hello everyone, On 01/07/2014 03:08 PM, Przemyslaw Marczak wrote: > Before this change ums mode can not be entered when device > was using the same usb port for usb/uart communication. > Switching USB cable from UART to USB always causes ums exit. > > Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> > > --- > common/cmd_usb_mass_storage.c | 24 ++++++++++++++++++++++++ > include/usb_mass_storage.h | 3 +++ > 2 files changed, 27 insertions(+) > > diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c > index 99487f4..5f557d5 100644 > --- a/common/cmd_usb_mass_storage.c > +++ b/common/cmd_usb_mass_storage.c > @@ -42,6 +42,30 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, > > g_dnl_register("ums"); > > + /* Timeout unit: seconds */ > + int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; > + > + if (!usb_cable_connected()) { > + puts("Please connect USB cable.\n"); > + > + while (!usb_cable_connected()) { > + if (ctrlc()) { > + puts("\rCTRL+C - Operation aborted.\n"); > + goto exit; > + } > + if (!cable_ready_timeout) { > + puts("\rUSB cable not detected.\n" \ > + "Command exit.\n"); > + goto exit; > + } > + > + printf("\rAuto exit in: %.2d s.", cable_ready_timeout); > + mdelay(1000); > + cable_ready_timeout--; > + } > + puts("\r\n"); > + } > + > while (1) { > usb_gadget_handle_interrupts(); > > diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h > index 9df3adc..058dcf1 100644 > --- a/include/usb_mass_storage.h > +++ b/include/usb_mass_storage.h > @@ -20,6 +20,9 @@ > #define UMS_NUM_SECTORS 0 > #endif > > +/* Wait at maximum 60 seconds for cable connection */ > +#define UMS_CABLE_READY_TIMEOUT 60 > + > struct ums { > int (*read_sector)(struct ums *ums_dev, > ulong start, lbaint_t blkcnt, void *buf); > I was send some very useful fix to the ums. It is required for users who are using the same usb port for USB and UART purposes. Without this fix such users just can't use ums because it will always exit to prompt when user change the cable. So I have few questions... Marek, could you review this patch? And what about the release, are you going to send pull request before the release? If not, then is it possible to apply this patch directly to u-boot/master by Tom Rini? Thank you, -- Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode 2014-01-13 9:18 ` Przemyslaw Marczak @ 2014-01-13 11:14 ` Marek Vasut 2014-01-13 13:31 ` Przemyslaw Marczak 0 siblings, 1 reply; 6+ messages in thread From: Marek Vasut @ 2014-01-13 11:14 UTC (permalink / raw) To: u-boot On Monday, January 13, 2014 at 10:18:51 AM, Przemyslaw Marczak wrote: > Hello everyone, > > On 01/07/2014 03:08 PM, Przemyslaw Marczak wrote: > > Before this change ums mode can not be entered when device > > was using the same usb port for usb/uart communication. > > Switching USB cable from UART to USB always causes ums exit. > > > > Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> > > > > --- > > > > common/cmd_usb_mass_storage.c | 24 ++++++++++++++++++++++++ > > include/usb_mass_storage.h | 3 +++ > > 2 files changed, 27 insertions(+) > > > > diff --git a/common/cmd_usb_mass_storage.c > > b/common/cmd_usb_mass_storage.c index 99487f4..5f557d5 100644 > > --- a/common/cmd_usb_mass_storage.c > > +++ b/common/cmd_usb_mass_storage.c > > @@ -42,6 +42,30 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, > > > > g_dnl_register("ums"); > > > > + /* Timeout unit: seconds */ > > + int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; > > + > > + if (!usb_cable_connected()) { > > + puts("Please connect USB cable.\n"); > > + > > + while (!usb_cable_connected()) { > > + if (ctrlc()) { > > + puts("\rCTRL+C - Operation aborted.\n"); > > + goto exit; > > + } > > + if (!cable_ready_timeout) { > > + puts("\rUSB cable not detected.\n" \ > > + "Command exit.\n"); > > + goto exit; > > + } > > + > > + printf("\rAuto exit in: %.2d s.", cable_ready_timeout); > > + mdelay(1000); > > + cable_ready_timeout--; > > + } > > + puts("\r\n"); > > + } > > + > > > > while (1) { > > > > usb_gadget_handle_interrupts(); > > > > diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h > > index 9df3adc..058dcf1 100644 > > --- a/include/usb_mass_storage.h > > +++ b/include/usb_mass_storage.h > > @@ -20,6 +20,9 @@ > > > > #define UMS_NUM_SECTORS 0 > > #endif > > > > +/* Wait at maximum 60 seconds for cable connection */ > > +#define UMS_CABLE_READY_TIMEOUT 60 > > + > > > > struct ums { > > > > int (*read_sector)(struct ums *ums_dev, > > > > ulong start, lbaint_t blkcnt, void *buf); > > I was send some very useful fix to the ums. It is required for users who > are using the same usb port for USB and UART purposes. Without this fix > such users just can't use ums because it will always exit to prompt when > user change the cable. Can you please share the schematic of such a cable in public? How does this "sharing" of USB and UART work? I am very curious here :-) > So I have few questions... > Marek, could you review this patch? On it! > And what about the release, are you going to send pull request before > the release? > If not, then is it possible to apply this patch directly to > u-boot/master by Tom Rini? PR will happen once I am through the load of patches in my mailbox. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode 2014-01-13 11:14 ` Marek Vasut @ 2014-01-13 13:31 ` Przemyslaw Marczak 2014-01-13 14:02 ` Marek Vasut 0 siblings, 1 reply; 6+ messages in thread From: Przemyslaw Marczak @ 2014-01-13 13:31 UTC (permalink / raw) To: u-boot Hello, On 01/13/2014 12:14 PM, Marek Vasut wrote: > On Monday, January 13, 2014 at 10:18:51 AM, Przemyslaw Marczak wrote: >> Hello everyone, >> >> On 01/07/2014 03:08 PM, Przemyslaw Marczak wrote: >>> Before this change ums mode can not be entered when device >>> was using the same usb port for usb/uart communication. >>> Switching USB cable from UART to USB always causes ums exit. >>> >>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> >>> >>> --- >>> >>> common/cmd_usb_mass_storage.c | 24 ++++++++++++++++++++++++ >>> include/usb_mass_storage.h | 3 +++ >>> 2 files changed, 27 insertions(+) >>> >>> diff --git a/common/cmd_usb_mass_storage.c >>> b/common/cmd_usb_mass_storage.c index 99487f4..5f557d5 100644 >>> --- a/common/cmd_usb_mass_storage.c >>> +++ b/common/cmd_usb_mass_storage.c >>> @@ -42,6 +42,30 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, >>> >>> g_dnl_register("ums"); >>> >>> + /* Timeout unit: seconds */ >>> + int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; >>> + >>> + if (!usb_cable_connected()) { >>> + puts("Please connect USB cable.\n"); >>> + >>> + while (!usb_cable_connected()) { >>> + if (ctrlc()) { >>> + puts("\rCTRL+C - Operation aborted.\n"); >>> + goto exit; >>> + } >>> + if (!cable_ready_timeout) { >>> + puts("\rUSB cable not detected.\n" \ >>> + "Command exit.\n"); >>> + goto exit; >>> + } >>> + >>> + printf("\rAuto exit in: %.2d s.", cable_ready_timeout); >>> + mdelay(1000); >>> + cable_ready_timeout--; >>> + } >>> + puts("\r\n"); >>> + } >>> + >>> >>> while (1) { >>> >>> usb_gadget_handle_interrupts(); >>> >>> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h >>> index 9df3adc..058dcf1 100644 >>> --- a/include/usb_mass_storage.h >>> +++ b/include/usb_mass_storage.h >>> @@ -20,6 +20,9 @@ >>> >>> #define UMS_NUM_SECTORS 0 >>> #endif >>> >>> +/* Wait at maximum 60 seconds for cable connection */ >>> +#define UMS_CABLE_READY_TIMEOUT 60 >>> + >>> >>> struct ums { >>> >>> int (*read_sector)(struct ums *ums_dev, >>> >>> ulong start, lbaint_t blkcnt, void *buf); >> >> I was send some very useful fix to the ums. It is required for users who >> are using the same usb port for USB and UART purposes. Without this fix >> such users just can't use ums because it will always exit to prompt when >> user change the cable. > > Can you please share the schematic of such a cable in public? Unfortunately I am not allowed to share such information. > How does this > "sharing" of USB and UART work? I am very curious here :-) Regarding the USB sharing explanation - please refer to FSA9480 data sheet. It is available on the Internet. I can also recommend looking into newest kernel code support for Trats2 device. >> So I have few questions... >> Marek, could you review this patch? > > On it! > >> And what about the release, are you going to send pull request before >> the release? >> If not, then is it possible to apply this patch directly to >> u-boot/master by Tom Rini? > > PR will happen once I am through the load of patches in my mailbox. > Thank you for patch apply. Regards, -- Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode 2014-01-13 13:31 ` Przemyslaw Marczak @ 2014-01-13 14:02 ` Marek Vasut 0 siblings, 0 replies; 6+ messages in thread From: Marek Vasut @ 2014-01-13 14:02 UTC (permalink / raw) To: u-boot On Monday, January 13, 2014 at 02:31:58 PM, Przemyslaw Marczak wrote: > Hello, > > On 01/13/2014 12:14 PM, Marek Vasut wrote: > > On Monday, January 13, 2014 at 10:18:51 AM, Przemyslaw Marczak wrote: > >> Hello everyone, > >> > >> On 01/07/2014 03:08 PM, Przemyslaw Marczak wrote: > >>> Before this change ums mode can not be entered when device > >>> was using the same usb port for usb/uart communication. > >>> Switching USB cable from UART to USB always causes ums exit. > >>> > >>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> > >>> > >>> --- > >>> > >>> common/cmd_usb_mass_storage.c | 24 ++++++++++++++++++++++++ > >>> include/usb_mass_storage.h | 3 +++ > >>> 2 files changed, 27 insertions(+) > >>> > >>> diff --git a/common/cmd_usb_mass_storage.c > >>> b/common/cmd_usb_mass_storage.c index 99487f4..5f557d5 100644 > >>> --- a/common/cmd_usb_mass_storage.c > >>> +++ b/common/cmd_usb_mass_storage.c > >>> @@ -42,6 +42,30 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, > >>> > >>> g_dnl_register("ums"); > >>> > >>> + /* Timeout unit: seconds */ > >>> + int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; > >>> + > >>> + if (!usb_cable_connected()) { > >>> + puts("Please connect USB cable.\n"); > >>> + > >>> + while (!usb_cable_connected()) { > >>> + if (ctrlc()) { > >>> + puts("\rCTRL+C - Operation aborted.\n"); > >>> + goto exit; > >>> + } > >>> + if (!cable_ready_timeout) { > >>> + puts("\rUSB cable not detected.\n" \ > >>> + "Command exit.\n"); > >>> + goto exit; > >>> + } > >>> + > >>> + printf("\rAuto exit in: %.2d s.", cable_ready_timeout); > >>> + mdelay(1000); > >>> + cable_ready_timeout--; > >>> + } > >>> + puts("\r\n"); > >>> + } > >>> + > >>> > >>> while (1) { > >>> > >>> usb_gadget_handle_interrupts(); > >>> > >>> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h > >>> index 9df3adc..058dcf1 100644 > >>> --- a/include/usb_mass_storage.h > >>> +++ b/include/usb_mass_storage.h > >>> @@ -20,6 +20,9 @@ > >>> > >>> #define UMS_NUM_SECTORS 0 > >>> #endif > >>> > >>> +/* Wait at maximum 60 seconds for cable connection */ > >>> +#define UMS_CABLE_READY_TIMEOUT 60 > >>> + > >>> > >>> struct ums { > >>> > >>> int (*read_sector)(struct ums *ums_dev, > >>> > >>> ulong start, lbaint_t blkcnt, void *buf); > >> > >> I was send some very useful fix to the ums. It is required for users who > >> are using the same usb port for USB and UART purposes. Without this fix > >> such users just can't use ums because it will always exit to prompt when > >> user change the cable. > > > > Can you please share the schematic of such a cable in public? > > Unfortunately I am not allowed to share such information. Is the trats2 so similar to galaxy SIII or what ? :) > > How does this > > "sharing" of USB and UART work? I am very curious here :-) > > Regarding the USB sharing explanation - please refer to FSA9480 data > sheet. It is available on the Internet. Thanks. > I can also recommend looking into newest kernel code support for Trats2 > device. Yes, this is helpful, thanks! > >> So I have few questions... > >> Marek, could you review this patch? > > > > On it! > > > >> And what about the release, are you going to send pull request before > >> the release? > >> If not, then is it possible to apply this patch directly to > >> u-boot/master by Tom Rini? > > > > PR will happen once I am through the load of patches in my mailbox. > > Thank you for patch apply. > > Regards, ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode 2014-01-07 14:08 [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode Przemyslaw Marczak 2014-01-13 9:18 ` Przemyslaw Marczak @ 2014-01-13 11:29 ` Marek Vasut 1 sibling, 0 replies; 6+ messages in thread From: Marek Vasut @ 2014-01-13 11:29 UTC (permalink / raw) To: u-boot On Tuesday, January 07, 2014 at 03:08:37 PM, Przemyslaw Marczak wrote: > Before this change ums mode can not be entered when device > was using the same usb port for usb/uart communication. > Switching USB cable from UART to USB always causes ums exit. > > Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Applied, thanks. Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-13 14:02 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-07 14:08 [U-Boot] [PATCH] usb: ums: wait for usb cable connection before enter ums mode Przemyslaw Marczak 2014-01-13 9:18 ` Przemyslaw Marczak 2014-01-13 11:14 ` Marek Vasut 2014-01-13 13:31 ` Przemyslaw Marczak 2014-01-13 14:02 ` Marek Vasut 2014-01-13 11:29 ` Marek Vasut
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox