#include <common.h>
+#include <console.h>
#include <watchdog.h>
-#ifdef CONFIG_ARCH_SUNXI
-#include <asm/arch/usb_phy.h>
-#endif
-#include <asm/errno.h>
+#include <linux/errno.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include "musb_gadget.h"
#include "musb_uboot.h"
-#ifdef CONFIG_MUSB_HOST
+#ifdef CONFIG_USB_MUSB_HOST
struct int_queue {
struct usb_host_endpoint hep;
struct urb urb;
power &= 0xf0;
musb_writeb(mbase, MUSB_POWER, MUSB_POWER_RESET | power);
mdelay(50);
-#ifdef CONFIG_ARCH_SUNXI
- /*
- * sunxi phy has a bug and it will wrongly detect high speed squelch
- * when clearing reset on low-speed devices, temporary disable
- * squelch detection to work around this.
- */
- sunxi_usb_phy_enable_squelch_detect(0, 0);
-#endif
+
+ if (host->host->ops->pre_root_reset_end)
+ host->host->ops->pre_root_reset_end(host->host);
+
power = musb_readb(mbase, MUSB_POWER);
musb_writeb(mbase, MUSB_POWER, ~MUSB_POWER_RESET & power);
-#ifdef CONFIG_ARCH_SUNXI
- sunxi_usb_phy_enable_squelch_detect(0, 1);
-#endif
+
+ if (host->host->ops->post_root_reset_end)
+ host->host->ops->post_root_reset_end(host->host);
+
host->host->isr(0, host->host);
host->host_speed = (musb_readb(mbase, MUSB_POWER) & MUSB_POWER_HSMODE) ?
USB_SPEED_HIGH :
if (musb_readb(mbase, MUSB_DEVCTL) & MUSB_DEVCTL_HM)
break;
} while (get_timer(0) < timeout);
- if (get_timer(0) >= timeout)
+ if (get_timer(0) >= timeout) {
+ musb_stop(host->host);
return -ENODEV;
+ }
_musb_reset_root_port(host, NULL);
host->host->is_active = 1;
.reset_root_port = musb_reset_root_port,
};
#endif /* CONFIG_DM_USB */
-#endif /* CONFIG_MUSB_HOST */
+#endif /* CONFIG_USB_MUSB_HOST */
-#ifdef CONFIG_MUSB_GADGET
+#ifdef CONFIG_USB_MUSB_GADGET
static struct musb *gadget;
int usb_gadget_handle_interrupts(int index)
driver->unbind(&gadget->g);
return 0;
}
-#endif /* CONFIG_MUSB_GADGET */
+#endif /* CONFIG_USB_MUSB_GADGET */
int musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
void *ctl_regs)
struct musb **musbp;
switch (plat->mode) {
-#if defined(CONFIG_MUSB_HOST) && !defined(CONFIG_DM_USB)
+#if defined(CONFIG_USB_MUSB_HOST) && !defined(CONFIG_DM_USB)
case MUSB_HOST:
musbp = &musb_host.host;
break;
#endif
-#ifdef CONFIG_MUSB_GADGET
+#ifdef CONFIG_USB_MUSB_GADGET
case MUSB_PERIPHERAL:
musbp = &gadget;
break;
}
*musbp = musb_init_controller(plat, (struct device *)bdata, ctl_regs);
- if (!musbp) {
+ if (!*musbp) {
printf("Failed to init the controller\n");
return -EIO;
}