[U-Boot-Users] USB Uboot on OSK5912

Hi all,
I am working on getting USB-uboot working on OSK5912. from linux USB gadget "device controller drivers" (i.e. kernel/drivers/usb/gadget/) it looks like USB core for omap1510 and OSK5912 is same..But not sure, please confirm
I done following steps. 1)make mrproper 2)make omap5912osk_config 3)go to include/configs/omap5912osk.h and edit this file with following macros. . #define CONFIG_DOS_PARTITION 1
#define CONFIG_USB_OHCI 1 #define CONFIG_USB_OHCI_NEW 1 #define CFG_USB_OHCI_MAX_ROOT_PORTS 1 #define CFG_USB_OHCI_SLOT_NAME "osk5912" #define CFG_USB_OHCI_REGS_BASE 0xfffba000 #define CONFIG_USB_STORAGE 1
#define CFG_USB_OHCI_BOARD_INIT 1 #define CFG_USB_OHCI_CPU_INIT 1
#define CONFIG_CMD_USB 1
4)after this, I am able to see USB command enabled on Uboot console. but I am not able to see Mass-storage detected after inserting pendrive and doing "usb start"
5) from docs/README.generic_usb_ohci, It looks like usb_board_init/stop and usb_cpu_init/stop functions are missing and needs to be implemented.
for above all, I am using omap1510 code. but I am not sure will this code work or not?
also I am not sure, why "usb_board_init/stop and usb_cpu_init/stop" code is not included in git for enabling USB uboot on omap1510 or is I am missing any thing?
Please, needs help/confirmation that I can make USB-Uboot work on OSK5912.
Thanks for any help..
Thanks and Regards, Shivdas Gujare

"Shivdas Gujare" shivdas.gujare@gmail.com writes:
I am working on getting USB-uboot working on OSK5912. from linux USB gadget "device controller drivers" (i.e. kernel/drivers/usb/gadget/) it looks like USB core for omap1510 and OSK5912 is same..But not sure, please confirm
No idea. You will have to RTFM.
I done following steps. 1)make mrproper 2)make omap5912osk_config 3)go to include/configs/omap5912osk.h and edit this file with following macros. . #define CONFIG_DOS_PARTITION 1
#define CONFIG_USB_OHCI 1
Drop this. This would enable the old OHCI support.
#define CONFIG_USB_OHCI_NEW 1 #define CFG_USB_OHCI_MAX_ROOT_PORTS 1 #define CFG_USB_OHCI_SLOT_NAME "osk5912" #define CFG_USB_OHCI_REGS_BASE 0xfffba000 #define CONFIG_USB_STORAGE 1
#define CFG_USB_OHCI_BOARD_INIT 1 #define CFG_USB_OHCI_CPU_INIT 1
You *might* have to implement these in order to enable power, clocks ...
#define CONFIG_CMD_USB 1
4)after this, I am able to see USB command enabled on Uboot console. but I am not able to see Mass-storage detected after inserting pendrive and doing "usb start"
You probably missed some initialization. Carefully check the documentation of you CPU and implement it in the functions above.
- from docs/README.generic_usb_ohci, It looks like usb_board_init/stop and
usb_cpu_init/stop functions are missing and needs to be implemented.
Exactly.
Best regards
Markus Klotzbuecher
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de

Hi Markus,
Thanks for the valuable Help.
Thanks and Regards, Shivdas Gujare
On Mon, Jul 21, 2008 at 4:15 PM, Markus Klotzbücher mk@denx.de wrote:
"Shivdas Gujare" shivdas.gujare@gmail.com writes:
I am working on getting USB-uboot working on OSK5912. from linux USB gadget "device controller drivers" (i.e. kernel/drivers/usb/gadget/) it looks like USB core for omap1510 and OSK5912 is same..But not sure, please confirm
No idea. You will have to RTFM.
I done following steps. 1)make mrproper 2)make omap5912osk_config 3)go to include/configs/omap5912osk.h and edit this file with following macros. . #define CONFIG_DOS_PARTITION 1
#define CONFIG_USB_OHCI 1
Drop this. This would enable the old OHCI support.
#define CONFIG_USB_OHCI_NEW 1 #define CFG_USB_OHCI_MAX_ROOT_PORTS 1 #define CFG_USB_OHCI_SLOT_NAME "osk5912" #define CFG_USB_OHCI_REGS_BASE 0xfffba000 #define CONFIG_USB_STORAGE 1
#define CFG_USB_OHCI_BOARD_INIT 1 #define CFG_USB_OHCI_CPU_INIT 1
You *might* have to implement these in order to enable power, clocks ...
#define CONFIG_CMD_USB 1
4)after this, I am able to see USB command enabled on Uboot console. but I am not able to see Mass-storage detected after inserting pendrive and doing "usb start"
You probably missed some initialization. Carefully check the documentation of you CPU and implement it in the functions above.
- from docs/README.generic_usb_ohci, It looks like usb_board_init/stop
and
usb_cpu_init/stop functions are missing and needs to be implemented.
Exactly.
Best regards
Markus Klotzbuecher
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de

Hi All, firstly Before going to boot from USB key, I tried to make working flash "uImage to OSK5912" using USB. and after compiling drivers/usb/usbdcore_omap1510.c with adding following macros to include/configs/omap5912osk.h
#define CONFIG_CMD_USB 1 #define CONFIG_USB_DEVICE 1 #define CONFIG_USB_TTY 1 #define CFG_CONSOLE_IS_IN_ENV 1 #define CONFIG_USBD_MANUFACTURER "OSK5912" #define CONFIG_USBD_PRODUCT_NAME "Osk5912 Bootloader " U_BOOT_VERSION #define CONFIG_EXTRA_ENV_SETTINGS "usbtty=cdc_acm\0"
after this, I set "setenv stdout usbtty" and "setenv usbtty cdc_acm" from U-boot serial console.
Now, I am, able to get U-boot console over USB after connecting to Linux Host.
But I am facing following problems, 1) I am getting every typed character twice(i.e. like local echo, but I checked local echo of minicom, it is off. same is happening using kermit also.)
like following, ------------------------------------------------ Welcome to minicom 2.2
OPTIONS: I18n
Compiled on Mar 9 2007, 07:21:40.
Port /dev/ttyUSB0
Press CTRL-A Z for help on special keys
OMAP5912 OSK # OMAP5912 OSK #
OMAP5912 OSK # OMAP5912 OSK # sseeteennvv ssttddiinn uussbbtttyy
OMAP5912 OSK # OMAP5912 OSK #
OMAP5912 OSK # AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
Unknown command 'AT' - try 'help' Unknown command 'AT' - try 'help' OMAP5912 OSK # OMAP5912 OSK #
OMAP5912 OSK # OMAP5912 OSK #
----------------------------------------------------------------------------
Also, this is not stable and gets disconnected offen. Please, suggest if have any Idea to resolve this problem.
2)also to download uImage to OSK(because loadb uses kermit), I installed Kermit.
Now, if I try to send uImage to OSK5912, it continues for some time, and connection gets lost, and OSK5912 U-boot Serial console(i.e. over /dev/ttyS0) comes up, with some older flashed u-boot.bin
Not, sure why this is happening. Please, suggest if any Idea.
Thanks and Regards, Shivdas Gujare
On Mon, Jul 21, 2008 at 4:15 PM, Markus Klotzbücher mk@denx.de wrote:
"Shivdas Gujare" shivdas.gujare@gmail.com writes:
I am working on getting USB-uboot working on OSK5912. from linux USB gadget "device controller drivers" (i.e. kernel/drivers/usb/gadget/) it looks like USB core for omap1510 and OSK5912 is same..But not sure, please confirm
No idea. You will have to RTFM.
I done following steps. 1)make mrproper 2)make omap5912osk_config 3)go to include/configs/omap5912osk.h and edit this file with following macros. . #define CONFIG_DOS_PARTITION 1
#define CONFIG_USB_OHCI 1
Drop this. This would enable the old OHCI support.
#define CONFIG_USB_OHCI_NEW 1 #define CFG_USB_OHCI_MAX_ROOT_PORTS 1 #define CFG_USB_OHCI_SLOT_NAME "osk5912" #define CFG_USB_OHCI_REGS_BASE 0xfffba000 #define CONFIG_USB_STORAGE 1
#define CFG_USB_OHCI_BOARD_INIT 1 #define CFG_USB_OHCI_CPU_INIT 1
You *might* have to implement these in order to enable power, clocks ...
#define CONFIG_CMD_USB 1
4)after this, I am able to see USB command enabled on Uboot console. but I am not able to see Mass-storage detected after inserting pendrive and doing "usb start"
You probably missed some initialization. Carefully check the documentation of you CPU and implement it in the functions above.
- from docs/README.generic_usb_ohci, It looks like usb_board_init/stop
and
usb_cpu_init/stop functions are missing and needs to be implemented.
Exactly.
Best regards
Markus Klotzbuecher
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de

Hello!
I am working on getting USB-uboot working on OSK5912. from linux USB gadget "device controller drivers" (i.e. kernel/drivers/usb/gadget/) it looks like USB core for omap1510 and OSK5912 is same..But not sure, please confirm
No idea. You will have to RTFM.
RTFM indeed ;-) However, sadly TI does not always make this easy as some of the documentation for these devices is only available under NDA...boo! If you are having problem locating the "fine manual" for OMAP1510 purposes you can refer to the OMAP5910 device as this is pretty much the same device. Documentation for the OMAP5910 can be found here:
http://focus.ti.com/docs/prod/folders/print/omap5910.html
Check out the OMAP5910 USB User Guide.
The good news...I actually looked into this sometime back and the OMAP5910/1510 and OMAP5912 are very similar. In fact if you do compare the register sets for the USB function in the 5910 and 5912 you should find that they are indeed the same. So no problems on using the USB code for the 1510 on the 5912.
Now one word of caution...when looking at this I noticed that in the file "drivers/usbdcore_omap1510.c" that there is the following code at line 1112:
/* Set and check APLL */ outw (0x0008, APLL_CTRL); UDCREG (APLL_CTRL); /* Set and check DPLL */ outw (0x2210, DPLL_CTRL); UDCREG (DPLL_CTRL);
This is checking and setting the main PLL registers. This is bad for using on the 5912 as these devices do not run at the same speeds! So I would place a "#ifdef CONFIG_OMAP1510" around this code so it is not executed for the 5912. Also I don't even think that the APLL register exists for the 5912.
Finally, at line 1119 there is the following code:
outw ((1 << 4) | (1 << 3) | 1, SOFT_REQ);
The SOFT_REQ register does slightly differ between the 5910 and 5912. Essentially the 5912 has the same bits as the 5910 but it also has additional bit fields that the 5910 does not have. Therefore, I would replace the above code with the following which will perform a read modify write:
outw ((1 << 4) | (1 << 3) | 1 | (inw(SOFT_REQ)), SOFT_REQ);
I should get out my 5912osk and create an official patch for this. Looks like it could be useful.
Cheers Jon

On 16:46 Fri 25 Jul , Hunter, Jon wrote:
Hello!
I am working on getting USB-uboot working on OSK5912. from linux USB gadget "device controller drivers" (i.e. kernel/drivers/usb/gadget/) it looks like USB core for omap1510 and OSK5912 is same..But not sure, please confirm
No idea. You will have to RTFM.
RTFM indeed ;-) However, sadly TI does not always make this easy as some of the documentation for these devices is only available under NDA...boo! If you are having problem locating the "fine manual" for OMAP1510 purposes you can refer to the OMAP5910 device as this is pretty much the same device. Documentation for the OMAP5910 can be found here:
Due to the fact thath the documentation is under NDA and you have access to it. Could you send a patch for it?
Best Regards, J.

Due to the fact thath the documentation is under NDA and you have access to it. Could you send a patch for it?
No problem. I will have a crack. Please note long-time user, first time patcher, so let me know if anything gets messed up but I have tried to follow the guidelines that you have.
By the way, whilst playing around with this, I did noticed that there have been alot of updates made to drivers/serial/usbtty.c. It appears to have broken support for usbtty on OMAP devices. The board "SX1" (a Siemens OMAP1510 board which I don't have) that originally added the usbtty support for OMAP is no longer compiling correctly with the latest version of u-boot. Back in the days of u-boot v1.1.x usbtty was working a treat for OMAP5912. Looks like more work to get usbtty back up and running on the OMAP5912 ;-(
Cheers Jon

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com --- drivers/serial/usbtty.c | 10 +++++----- drivers/serial/usbtty.h | 7 ++++++- drivers/usb/usbdcore_omap1510.c | 16 ++++++++++++---- include/usbdcore_omap1510.h | 6 +++--- 4 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c index 2bc5c3c..e6edb79 100644 --- a/drivers/serial/usbtty.c +++ b/drivers/serial/usbtty.c @@ -25,13 +25,13 @@
#ifdef CONFIG_USB_TTY
+#include <config.h> /* If defined, override Linux identifiers with + * vendor specific ones */ #include <circbuf.h> #include <devices.h> #include "usbtty.h" #include "usb_cdc_acm.h" #include "usbdescriptors.h" -#include <config.h> /* If defined, override Linux identifiers with - * vendor specific ones */
#if 0 #define TTYDBG(fmt,args...)\ @@ -155,7 +155,7 @@ struct acm_config_desc { /* Slave Interface */ struct usb_interface_descriptor data_class_interface; struct usb_endpoint_descriptor - data_endpoints[NUM_ENDPOINTS-1] __attribute__((packed)); + data_endpoints[NUM_ENDPOINTS-1]; } __attribute__((packed));
static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = { @@ -285,9 +285,9 @@ struct gserial_config_desc {
struct usb_configuration_descriptor configuration_desc; struct usb_interface_descriptor - interface_desc[NUM_GSERIAL_INTERFACES] __attribute__((packed)); + interface_desc[NUM_GSERIAL_INTERFACES]; struct usb_endpoint_descriptor - data_endpoints[NUM_ENDPOINTS] __attribute__((packed)); + data_endpoints[NUM_ENDPOINTS];
} __attribute__((packed));
diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h index 71c47bc..74098f7 100644 --- a/drivers/serial/usbtty.h +++ b/drivers/serial/usbtty.h @@ -36,12 +36,17 @@ /* If no VendorID/ProductID is defined in config.h, pretend to be Linux * DO NOT Reuse this Vendor/Product setup with protocol incompatible devices */
+#ifndef CONFIG_USBD_VENDORID #define CONFIG_USBD_VENDORID 0x0525 /* Linux/NetChip */ +#endif #define CONFIG_USBD_PRODUCTID_GSERIAL 0xa4a6 /* gserial */ #define CONFIG_USBD_PRODUCTID_CDCACM 0xa4a7 /* CDC ACM */ +#ifndef CONFIG_USBD_MANUFACTURER #define CONFIG_USBD_MANUFACTURER "Das U-Boot" +#endif +#ifndef CONFIG_USBD_PRODUCT_NAME #define CONFIG_USBD_PRODUCT_NAME U_BOOT_VERSION - +#endif
#define CONFIG_USBD_CONFIGURATION_STR "TTY via USB"
diff --git a/drivers/usb/usbdcore_omap1510.c b/drivers/usb/usbdcore_omap1510.c index 84bb936..e51e066 100644 --- a/drivers/usb/usbdcore_omap1510.c +++ b/drivers/usb/usbdcore_omap1510.c @@ -452,7 +452,7 @@ static void omap1510_prepare_for_control_write_status (struct urb *urb) outw (UDC_EP_Dir, UDC_EP_NUM); }
-/* udc_state_transition_up +/* dc_state_transition_up * udc_state_transition_down * * Helper functions to implement device state changes. The device states and @@ -1064,10 +1064,14 @@ void omap1510_udc_noniso_irq (void) */
/* Called to start packet transmission. */ -void udc_endpoint_write (struct usb_endpoint_instance *endpoint) +int udc_endpoint_write (struct usb_endpoint_instance *endpoint) { - unsigned short epnum = - endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK; + unsigned short epnum; + + if (!udc_device || !endpoint) + return -1; + + epnum = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK;
UDCDBGA ("Starting transmit on ep %x", epnum);
@@ -1080,7 +1084,11 @@ void udc_endpoint_write (struct usb_endpoint_instance *endpoint) outw (UDC_Set_FIFO_En, UDC_CTRL); /* deselect the endpoint FIFO */ outw (UDC_EP_Dir | epnum, UDC_EP_NUM); + } else { + return -1; } + + return 0; }
/* Start to initialize h/w stuff */ diff --git a/include/usbdcore_omap1510.h b/include/usbdcore_omap1510.h index 526fcd9..ecc94f7 100644 --- a/include/usbdcore_omap1510.h +++ b/include/usbdcore_omap1510.h @@ -168,8 +168,8 @@ #define UDC_IN_ENDPOINT 1 #define UDC_IN_PACKET_SIZE 64 #define UDC_INT_ENDPOINT 5 -#define UDC_INT_PKTSIZE 16 -#define UDC_BULK_PKTSIZE 16 +#define UDC_INT_PACKET_SIZE 16 +#define UDC_BULK_PACKET_SIZE 16
void udc_irq (void); /* Flow control */ @@ -177,7 +177,7 @@ void udc_set_nak(int epid); void udc_unset_nak (int epid);
/* Higher level functions for abstracting away from specific device */ -void udc_endpoint_write(struct usb_endpoint_instance *endpoint); +int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
int udc_init (void);

Hi Jon, This is what I observed, I needed to modify usbdcore_omap1510.c file to get it complied properly with usbtty.c Also, After disabling following code from usbdcore_omap1510.c,
/* Set and check APLL */ outw (0x0008, APLL_CTRL); UDCREG (APLL_CTRL); /* Set and check DPLL */ outw (0x2210, DPLL_CTRL); UDCREG (DPLL_CTRL);
I was able to get Uboot console over USB on osk5912, but is not stable.
Now, I will test this with other suggested modifications.
Thanks for your Replies.
Thanks and Regards, Shivdas Gujare
On Sun, Jul 27, 2008 at 4:51 AM, Hunter, Jon jon-hunter@ti.com wrote:
Due to the fact thath the documentation is under NDA and you have access to it. Could you send a patch for it?
No problem. I will have a crack. Please note long-time user, first time patcher, so let me know if anything gets messed up but I have tried to follow the guidelines that you have.
By the way, whilst playing around with this, I did noticed that there have been alot of updates made to drivers/serial/usbtty.c. It appears to have broken support for usbtty on OMAP devices. The board "SX1" (a Siemens OMAP1510 board which I don't have) that originally added the usbtty support for OMAP is no longer compiling correctly with the latest version of u-boot. Back in the days of u-boot v1.1.x usbtty was working a treat for OMAP5912. Looks like more work to get usbtty back up and running on the OMAP5912 ;-(
Cheers Jon

Hi, I tested the patches today, and looks like problem remained same, but I am able to get it compiled without any errors. I am able to detect OSK5912 as "low speed USB device using uhci_hcd". I think it should get detected as full speed device. but problem of getting every typed character twice remained same, and also all things are not stable enough.
Is everything works fine at your place?
Thanks for help.
Thanks and Regards, Shivdas Gujare
On Mon, Jul 28, 2008 at 11:18 AM, Shivdas Gujare shivdas.gujare@gmail.comwrote:
Hi Jon, This is what I observed, I needed to modify usbdcore_omap1510.c file to get it complied properly with usbtty.c Also, After disabling following code from usbdcore_omap1510.c,
/* Set and check APLL */ outw (0x0008, APLL_CTRL); UDCREG (APLL_CTRL); /* Set and check DPLL */ outw (0x2210, DPLL_CTRL); UDCREG (DPLL_CTRL);
I was able to get Uboot console over USB on osk5912, but is not stable.
Now, I will test this with other suggested modifications.
Thanks for your Replies.
Thanks and Regards, Shivdas Gujare
On Sun, Jul 27, 2008 at 4:51 AM, Hunter, Jon jon-hunter@ti.com wrote:
Due to the fact thath the documentation is under NDA and you have
access
to it. Could you send a patch for it?
No problem. I will have a crack. Please note long-time user, first time patcher, so let me know if anything gets messed up but I have tried to follow the guidelines that you have.
By the way, whilst playing around with this, I did noticed that there have been alot of updates made to drivers/serial/usbtty.c. It appears to have broken support for usbtty on OMAP devices. The board "SX1" (a Siemens OMAP1510 board which I don't have) that originally added the usbtty support for OMAP is no longer compiling correctly with the latest version of u-boot. Back in the days of u-boot v1.1.x usbtty was working a treat for OMAP5912. Looks like more work to get usbtty back up and running on the OMAP5912 ;-(
Cheers Jon

I tested the patches today, and looks like problem remained same, but I am able to get it compiled without any errors. I am able to detect OSK5912 as "low speed USB device using uhci_hcd". I think it should get detected as full speed device. but problem of getting every typed character twice remained same, and also all things are not stable enough.
Is everything works fine at your place?
Yes, I am also still seeing some issues. From my testing, stdin over usbtty seems to work fine, but as soon as I re-direct stdout to usbtty all hell breaks loose. Originally, when directing stdout over usbtty I did not see anything, but after I enabled some debugging statements in the usb driver, I then started to see messages printed twice.
I recall that this did work with release 1.1.6, so it could be interesting to go back to 1.1.6 and see if it does work.
Cheers Jon

I recall that this did work with release 1.1.6, so it could be interesting to go back to 1.1.6 and see if it does work.
Ok, so I did try with 1.1.6 and made the same changes to usbdcore_omap1510.c and usbtty does work fine. It would be interesting to track-down where this stopped working and fix this, but right now I don't have the time :-(
Cheers Jon

On 11:06 Mon 28 Jul , Hunter, Jon wrote:
I recall that this did work with release 1.1.6, so it could be interesting to go back to 1.1.6 and see if it does work.
Ok, so I did try with 1.1.6 and made the same changes to usbdcore_omap1510.c and usbtty does work fine. It would be interesting to track-down where this stopped working and fix this, but right now I don't have the time :-(
Do you try the patch that I send?
Best Regards, J.

Do you try the patch that I send?
Sorry, yes I did try and this patch. It does allow the code to compile, but I am having issues on the USB TX side (stdout). It appears that may be there are still some architecture changes made somewhere in the ttyusb driver that are not working with the OMAP devices.
Cheers Jon
participants (4)
-
Hunter, Jon
-
Jean-Christophe PLAGNIOL-VILLARD
-
Markus Klotzbücher
-
Shivdas Gujare