By monitoring kernel log the userspace will be able to detect improper
speed setting and warn the user or try to automatically readjust (by
disabling internal vbus and reentering the hostmode with the proper
speed).
Bump API to
20101110.
/* This is the version of forced hostmode userspace<->kernelspace API.
* Do not update to the build date, bump only on API changes */
-#define MUSB_VERSION_HOSTMODE "20101104"
+#define MUSB_VERSION_HOSTMODE "20101110"
#ifdef CONFIG_USB_MUSB_OTG
/* Connect request */
{
struct usb_hcd *hcd = musb_to_hcd(musb);
- u8 testmode;
+ u8 testmode, line;
musb->is_active = 1;
set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
musb->port1_status |= USB_PORT_STAT_CONNECTION
|(USB_PORT_STAT_C_CONNECTION << 16);
+ line = musb_ulpi_readb(mbase, ISP1704_DEBUG);
testmode = musb_readb(mbase, MUSB_TESTMODE);
+
+ switch (line) {
+ case 1: /* pullup indicates a full/high-speed device */
+ if (!(testmode & (MUSB_TEST_FORCE_FS | MUSB_TEST_FORCE_HS)))
+ pr_err("Forced hostmode error: a full/high-speed device attached but low-speed mode selected\n");
+ break;
+ case 2: /* pullup indicates a low-speed device */
+ if (testmode & (MUSB_TEST_FORCE_FS | MUSB_TEST_FORCE_HS))
+ pr_err("Forced hostmode error: a low-speed device attached but full/high-speed mode selected\n");
+ break;
+ default:
+ pr_err("Forced hostmode error: no device attached\n");
+ }
+
if (!(testmode & (MUSB_TEST_FORCE_FS | MUSB_TEST_FORCE_HS)))
musb->port1_status |= USB_PORT_STAT_LOW_SPEED;
static void musb_port_reset(struct musb *musb, bool do_reset)
{
- u8 power;
+ u8 power, testmode;
void __iomem *mbase = musb->mregs;
#ifdef CONFIG_USB_MUSB_OTG
musb->ignore_disconnect = false;
+ testmode = musb_readb(mbase, MUSB_TESTMODE);
power = musb_readb(mbase, MUSB_POWER);
if (power & MUSB_POWER_HSMODE) {
DBG(4, "high-speed device connected\n");
musb->port1_status |= USB_PORT_STAT_HIGH_SPEED;
+ if (!(testmode & MUSB_TEST_FORCE_HS))
+ pr_err("Forced hostmode error: a high-speed device attached but not high-speed mode selected\n");
+ } else {
+ if (testmode & MUSB_TEST_FORCE_HS)
+ pr_err("Forced hostmode error: a full/low-speed device attached but high-speed mode selected\n");
}
musb->port1_status &= ~USB_PORT_STAT_RESET;