X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=drivers%2Fusb%2Fmusb-new%2Fmusb_uboot.c;h=d40772b1aa5c479c9570833cca10a44fa549c9a1;hb=9450ab2ba8d720bd9f73bccc0af2e2b5a2c2aaf1;hp=10f6b5d1cf16a11f8a5554a512a766bb2cfa548a;hpb=1a2728ae4faf12874173de156b8a7e66cfbbeae5;p=platform%2Fkernel%2Fu-boot.git diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index 10f6b5d..d40772b 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -1,9 +1,7 @@ #include +#include #include -#ifdef CONFIG_ARCH_SUNXI -#include -#endif -#include +#include #include #include @@ -21,7 +19,7 @@ struct int_queue { struct urb urb; }; -#ifndef CONFIG_DM_USB +#if !CONFIG_IS_ENABLED(DM_USB) struct musb_host_data musb_host; #endif @@ -192,19 +190,16 @@ static int _musb_reset_root_port(struct musb_host_data *host, 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 : @@ -236,8 +231,10 @@ int musb_lowlevel_init(struct musb_host_data *host) 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; @@ -246,7 +243,7 @@ int musb_lowlevel_init(struct musb_host_data *host) return 0; } -#ifndef CONFIG_DM_USB +#if !CONFIG_IS_ENABLED(DM_USB) int usb_lowlevel_stop(int index) { if (!musb_host.host) { @@ -303,9 +300,9 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) { return musb_lowlevel_init(&musb_host); } -#endif /* !CONFIG_DM_USB */ +#endif /* !CONFIG_IS_ENABLED(DM_USB) */ -#ifdef CONFIG_DM_USB +#if CONFIG_IS_ENABLED(DM_USB) static int musb_submit_control_msg(struct udevice *dev, struct usb_device *udev, unsigned long pipe, void *buffer, int length, struct devrequest *setup) @@ -367,7 +364,7 @@ struct dm_usb_ops musb_usb_ops = { .destroy_int_queue = musb_destroy_int_queue, .reset_root_port = musb_reset_root_port, }; -#endif /* CONFIG_DM_USB */ +#endif /* CONFIG_IS_ENABLED(DM_USB) */ #endif /* CONFIG_USB_MUSB_HOST */ #ifdef CONFIG_USB_MUSB_GADGET @@ -422,13 +419,13 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) } #endif /* CONFIG_USB_MUSB_GADGET */ -int musb_register(struct musb_hdrc_platform_data *plat, void *bdata, - void *ctl_regs) +struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata, + void *ctl_regs) { struct musb **musbp; switch (plat->mode) { -#if defined(CONFIG_USB_MUSB_HOST) && !defined(CONFIG_DM_USB) +#if defined(CONFIG_USB_MUSB_HOST) && !CONFIG_IS_ENABLED(DM_USB) case MUSB_HOST: musbp = &musb_host.host; break; @@ -439,14 +436,14 @@ int musb_register(struct musb_hdrc_platform_data *plat, void *bdata, break; #endif default: - return -EINVAL; + return ERR_PTR(-EINVAL); } *musbp = musb_init_controller(plat, (struct device *)bdata, ctl_regs); - if (!musbp) { + if (IS_ERR(*musbp)) { printf("Failed to init the controller\n"); - return -EIO; + return ERR_CAST(*musbp); } - return 0; + return *musbp; }