[U-Boot-Users] [PATCH] omap1510: fix usbtty support
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Sun Jul 27 02:56:16 CEST 2008
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at 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);
--
1.5.6.2
More information about the U-Boot
mailing list