CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
CONF2_VBDTCTEN | CONF2_DATPOL);
- if (musb_register(&cm_t3517_musb_pdata, &cm_t3517_musb_board_data,
- (void *)AM35XX_IPSS_USBOTGSS_BASE))
+ if (!musb_register(&cm_t3517_musb_pdata, &cm_t3517_musb_board_data,
+ (void *)AM35XX_IPSS_USBOTGSS_BASE))
printf("Failed initializing AM35x MUSB!\n");
}
#else
}
#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;
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;
}
ret = musb_lowlevel_init(mdata);
#else
pic32_musb_plat.mode = MUSB_PERIPHERAL;
- ret = musb_register(&pic32_musb_plat, &pdata->dev, mregs);
+ mdata->host = musb_register(&pic32_musb_plat, &pdata->dev, mregs);
+ if (!mdata->host)
+ return -EIO;
#endif
- if (ret == 0)
+ if ((ret == 0) && mdata->host)
printf("PIC32 MUSB OTG\n");
return ret;
printf("Allwinner mUSB OTG (Host)\n");
#else
pdata.mode = MUSB_PERIPHERAL;
- ret = musb_register(&pdata, &glue->dev, base);
- if (!ret)
- printf("Allwinner mUSB OTG (Peripheral)\n");
+ host->host = musb_register(&pdata, &glue->dev, base);
+ if (!host->host)
+ return -EIO;
+
+ printf("Allwinner mUSB OTG (Peripheral)\n");
#endif
return ret;
/*
* U-Boot specfic stuff
*/
-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);
#endif /* __LINUX_USB_MUSB_H */