|
@@ -299,3 +299,196 @@ static inline void otg_device_init(struct omap_usb_config *pdata)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
+#endif
|
|
|
+
|
|
|
+static u32 __init omap1_usb0_init(unsigned nwires, unsigned is_device)
|
|
|
+{
|
|
|
+ u32 syscon1 = 0;
|
|
|
+
|
|
|
+ if (nwires == 0) {
|
|
|
+ if (!cpu_is_omap15xx()) {
|
|
|
+ u32 l;
|
|
|
+
|
|
|
+ /* pulldown D+/D- */
|
|
|
+ l = omap_readl(USB_TRANSCEIVER_CTRL);
|
|
|
+ l &= ~(3 << 1);
|
|
|
+ omap_writel(l, USB_TRANSCEIVER_CTRL);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (is_device) {
|
|
|
+ if (cpu_is_omap7xx()) {
|
|
|
+ omap_cfg_reg(AA17_7XX_USB_DM);
|
|
|
+ omap_cfg_reg(W16_7XX_USB_PU_EN);
|
|
|
+ omap_cfg_reg(W17_7XX_USB_VBUSI);
|
|
|
+ omap_cfg_reg(W18_7XX_USB_DMCK_OUT);
|
|
|
+ omap_cfg_reg(W19_7XX_USB_DCRST);
|
|
|
+ } else
|
|
|
+ omap_cfg_reg(W4_USB_PUEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (nwires == 2) {
|
|
|
+ u32 l;
|
|
|
+
|
|
|
+ // omap_cfg_reg(P9_USB_DP);
|
|
|
+ // omap_cfg_reg(R8_USB_DM);
|
|
|
+
|
|
|
+ if (cpu_is_omap15xx()) {
|
|
|
+ /* This works on 1510-Innovator */
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* NOTES:
|
|
|
+ * - peripheral should configure VBUS detection!
|
|
|
+ * - only peripherals may use the internal D+/D- pulldowns
|
|
|
+ * - OTG support on this port not yet written
|
|
|
+ */
|
|
|
+
|
|
|
+ /* Don't do this for omap7xx -- it causes USB to not work correctly */
|
|
|
+ if (!cpu_is_omap7xx()) {
|
|
|
+ l = omap_readl(USB_TRANSCEIVER_CTRL);
|
|
|
+ l &= ~(7 << 4);
|
|
|
+ if (!is_device)
|
|
|
+ l |= (3 << 1);
|
|
|
+ omap_writel(l, USB_TRANSCEIVER_CTRL);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 3 << 16;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* alternate pin config, external transceiver */
|
|
|
+ if (cpu_is_omap15xx()) {
|
|
|
+ printk(KERN_ERR "no usb0 alt pin config on 15xx\n");
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ omap_cfg_reg(V6_USB0_TXD);
|
|
|
+ omap_cfg_reg(W9_USB0_TXEN);
|
|
|
+ omap_cfg_reg(W5_USB0_SE0);
|
|
|
+ if (nwires != 3)
|
|
|
+ omap_cfg_reg(Y5_USB0_RCV);
|
|
|
+
|
|
|
+ /* NOTE: SPEED and SUSP aren't configured here. OTG hosts
|
|
|
+ * may be able to use I2C requests to set those bits along
|
|
|
+ * with VBUS switching and overcurrent detection.
|
|
|
+ */
|
|
|
+
|
|
|
+ if (nwires != 6) {
|
|
|
+ u32 l;
|
|
|
+
|
|
|
+ l = omap_readl(USB_TRANSCEIVER_CTRL);
|
|
|
+ l &= ~CONF_USB2_UNI_R;
|
|
|
+ omap_writel(l, USB_TRANSCEIVER_CTRL);
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (nwires) {
|
|
|
+ case 3:
|
|
|
+ syscon1 = 2;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ syscon1 = 1;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ syscon1 = 3;
|
|
|
+ {
|
|
|
+ u32 l;
|
|
|
+
|
|
|
+ omap_cfg_reg(AA9_USB0_VP);
|
|
|
+ omap_cfg_reg(R9_USB0_VM);
|
|
|
+ l = omap_readl(USB_TRANSCEIVER_CTRL);
|
|
|
+ l |= CONF_USB2_UNI_R;
|
|
|
+ omap_writel(l, USB_TRANSCEIVER_CTRL);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ printk(KERN_ERR "illegal usb%d %d-wire transceiver\n",
|
|
|
+ 0, nwires);
|
|
|
+ }
|
|
|
+
|
|
|
+ return syscon1 << 16;
|
|
|
+}
|
|
|
+
|
|
|
+static u32 __init omap1_usb1_init(unsigned nwires)
|
|
|
+{
|
|
|
+ u32 syscon1 = 0;
|
|
|
+
|
|
|
+ if (!cpu_is_omap15xx() && nwires != 6) {
|
|
|
+ u32 l;
|
|
|
+
|
|
|
+ l = omap_readl(USB_TRANSCEIVER_CTRL);
|
|
|
+ l &= ~CONF_USB1_UNI_R;
|
|
|
+ omap_writel(l, USB_TRANSCEIVER_CTRL);
|
|
|
+ }
|
|
|
+ if (nwires == 0)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ /* external transceiver */
|
|
|
+ omap_cfg_reg(USB1_TXD);
|
|
|
+ omap_cfg_reg(USB1_TXEN);
|
|
|
+ if (nwires != 3)
|
|
|
+ omap_cfg_reg(USB1_RCV);
|
|
|
+
|
|
|
+ if (cpu_is_omap15xx()) {
|
|
|
+ omap_cfg_reg(USB1_SEO);
|
|
|
+ omap_cfg_reg(USB1_SPEED);
|
|
|
+ // SUSP
|
|
|
+ } else if (cpu_is_omap1610() || cpu_is_omap5912()) {
|
|
|
+ omap_cfg_reg(W13_1610_USB1_SE0);
|
|
|
+ omap_cfg_reg(R13_1610_USB1_SPEED);
|
|
|
+ // SUSP
|
|
|
+ } else if (cpu_is_omap1710()) {
|
|
|
+ omap_cfg_reg(R13_1710_USB1_SE0);
|
|
|
+ // SUSP
|
|
|
+ } else {
|
|
|
+ pr_debug("usb%d cpu unrecognized\n", 1);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (nwires) {
|
|
|
+ case 2:
|
|
|
+ goto bad;
|
|
|
+ case 3:
|
|
|
+ syscon1 = 2;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ syscon1 = 1;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ syscon1 = 3;
|
|
|
+ omap_cfg_reg(USB1_VP);
|
|
|
+ omap_cfg_reg(USB1_VM);
|
|
|
+ if (!cpu_is_omap15xx()) {
|
|
|
+ u32 l;
|
|
|
+
|
|
|
+ l = omap_readl(USB_TRANSCEIVER_CTRL);
|
|
|
+ l |= CONF_USB1_UNI_R;
|
|
|
+ omap_writel(l, USB_TRANSCEIVER_CTRL);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+bad:
|
|
|
+ printk(KERN_ERR "illegal usb%d %d-wire transceiver\n",
|
|
|
+ 1, nwires);
|
|
|
+ }
|
|
|
+
|
|
|
+ return syscon1 << 20;
|
|
|
+}
|
|
|
+
|
|
|
+static u32 __init omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
|
|
|
+{
|
|
|
+ u32 syscon1 = 0;
|
|
|
+
|
|
|
+ /* NOTE omap1 erratum: must leave USB2_UNI_R set if usb0 in use */
|
|
|
+ if (alt_pingroup || nwires == 0)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (!cpu_is_omap15xx() && nwires != 6) {
|
|
|
+ u32 l;
|
|
|
+
|
|
|
+ l = omap_readl(USB_TRANSCEIVER_CTRL);
|
|
|
+ l &= ~CONF_USB2_UNI_R;
|
|
|
+ omap_writel(l, USB_TRANSCEIVER_CTRL);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* external transceiver */
|