Date:2013-12-17 23:09:25 (9 years 5 months ago)
Author:Apelete Seketeli
Commit:122e6350a985fd89312a14e5d63ca945e102bc76
Message:usb: musb_gadget: use is_otg flag to set gadget peripheral mode on reset

Since jz4740 is not OTG compatible, rely on is_otg flag to set gadget
peripheral mode on reset instead of accessing devct register which
does not exists.

Signed-off-by: Apelete Seketeli <apelete@seketeli.net>
Files: drivers/usb/musb/musb_gadget.c (1 diff)

Change Details

drivers/usb/musb/musb_gadget.c
21192119    /* Normal reset, as B-Device;
21202120     * or else after HNP, as A-Device
21212121     */
2122#if defined(CONFIG_USB_MUSB_JZ4740) || defined(CONFIG_USB_MUSB_JZ4740_MODULE)
2123    /* JZ4740 UDC Controller is not OTG compatible and does not
2124     * have DEVCTL register in silicon: do not rely on devctl for
2125     * setting peripheral mode.
2126     */
2127    musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
2128    musb->g.is_a_peripheral = 0;
2129#else
2130    if (devctl & MUSB_DEVCTL_BDEVICE) {
2122    if (!musb->g.is_otg) {
2123        /* JZ4740 UDC Controller is not OTG compatible, thus
2124         * does not have DEVCTL register in silicon: do not
2125         * rely on devctl for setting peripheral mode.
2126         */
2127        musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
2128        musb->g.is_a_peripheral = 0;
2129    } else if (devctl & MUSB_DEVCTL_BDEVICE) {
21312130        musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
21322131        musb->g.is_a_peripheral = 0;
21332132    } else {
21342133        musb->xceiv->state = OTG_STATE_A_PERIPHERAL;
21352134        musb->g.is_a_peripheral = 1;
21362135    }
2137#endif
2136
21382137
21392138    /* start with default limits on VBUS power draw */
21402139    (void) musb_gadget_vbus_draw(&musb->g, 8);

Archive Download the corresponding diff file



interactive