Skip to content

Commit

Permalink
usb: fix musb gadget to enable OTG mode conditionally
Browse files Browse the repository at this point in the history
The musb driver is usable in host, gadget or dual role mode depending
on the kernel configuration.

However, the musb gadget part of the driver is enabling OTG mode
whether the driver is built for dual role or gadget only mode. This
induces a bug for gadget only USB device controllers where the kernel
tries to use Host Negotiation Protocol with such controllers, which
causes a panic.

This behaviour is now fixed by enabling OTG mode only when musb driver
is built for dual role mode.

Signed-off-by: Apelete Seketeli <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
apelete authored and Felipe Balbi committed Nov 25, 2013
1 parent b144e4a commit fd3923a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/musb/musb_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,11 @@ int musb_gadget_setup(struct musb *musb)

/* this "gadget" abstracts/virtualizes the controller */
musb->g.name = musb_driver_name;
#if IS_ENABLED(CONFIG_USB_MUSB_DUAL_ROLE)
musb->g.is_otg = 1;
#elif IS_ENABLED(CONFIG_USB_MUSB_GADGET)
musb->g.is_otg = 0;
#endif

musb_g_init_endpoints(musb);

Expand Down

0 comments on commit fd3923a

Please sign in to comment.