#if defined(CONFIG_OMAP1510) && defined(CONFIG_USB_DEVICE)
#include <asm/io.h>
+#ifdef CONFIG_OMAP_SX1
#include <i2c.h>
+#endif
#include "usbdcore.h"
#include "usbdcore_omap1510.h"
#include "usbdcore_ep0.h"
+#define UDC_INIT_MDELAY 80 /* Device settle delay */
#define UDC_MAX_ENDPOINTS 31 /* Number of endpoints on this UDC */
/* Some kind of debugging output... */
int udc_init (void)
{
u16 udc_rev;
- uchar wert;
+ uchar value;
+ ulong gpio;
+ int i;
+
+ /* Let the device settle down before we start */
+ for (i = 0; i < UDC_INIT_MDELAY; i++) udelay(1000);
udc_device = NULL;
printf ("USB: TI OMAP1510 USB function module rev %d.%d\n",
udc_rev >> 4, udc_rev & 0xf);
- /* Configure some Sofia Unit registers
- */
- i2c_read (0x32, 0x04, 1, &wert, 1); /* SOF_Control_CONT */
- wert |= 0x04; /* SOF_ContCONT_dis_usb_det */
- i2c_write (0x32, 0x04, 1, &wert, 1);
-
- i2c_read (0x32, 0x03, 1, &wert, 1); /* SOF_Control */
- wert |= 0x01; /* SOF_Cont_usb_en */
- i2c_write (0x32, 0x03, 1, &wert, 1);
+#ifdef CONFIG_OMAP_SX1
+ i2c_read (0x32, 0x04, 1, &value, 1);
+ value |= 0x04;
+ i2c_write (0x32, 0x04, 1, &value, 1);
+
+ i2c_read (0x32, 0x03, 1, &value, 1);
+ value |= 0x01;
+ i2c_write (0x32, 0x03, 1, &value, 1);
+
+ gpio = inl(GPIO_PIN_CONTROL_REG);
+ gpio |= 0x0002; /* A_IRDA_OFF */
+ gpio |= 0x0800; /* A_SWITCH */
+ gpio |= 0x8000; /* A_USB_ON */
+ outl (gpio, GPIO_PIN_CONTROL_REG);
+
+ gpio = inl(GPIO_DIR_CONTROL_REG);
+ gpio &= ~0x0002; /* A_IRDA_OFF */
+ gpio &= ~0x0800; /* A_SWITCH */
+ gpio &= ~0x8000; /* A_USB_ON */
+ outl (gpio, GPIO_DIR_CONTROL_REG);
+
+ gpio = inl(GPIO_DATA_OUTPUT_REG);
+ gpio |= 0x0002; /* A_IRDA_OFF */
+ gpio &= ~0x0800; /* A_SWITCH */
+ gpio &= ~0x8000; /* A_USB_ON */
+ outl (gpio, GPIO_DATA_OUTPUT_REG);
+#endif
/* The VBUS_MODE bit selects whether VBUS detection is done via
* software (1) or hardware (0). When software detection is