lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130809160339.GA14829@linutronix.de>
Date:	Fri, 9 Aug 2013 18:03:39 +0200
From:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:	Bin Liu <binmlist@...il.com>
Cc:	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	balbi@...com, george.cherian@...com
Subject: [PATCH] usb: musb: am335x: Do not remove the session bin HOST-only
 mode

This is what I observe:
On the first connect, the musb starts with DEVCTL.Session set. On
disconnect, musb_core calls try_idle. That functions removes the Session
bit signalize that the session is over (something that only in OTG is
required). A new device, that is plugged, is no longer recognized.
I've setup a timer and checked the DEVCTL register and I haven't seen a
change in VBus and I saw the B-Device bit set. After setting the IDDIG
into A mode and forcing the device to behave like I didn't see a change.
Neither VBUS goes to 0b11 nor does a session start request come.
The TI-v3.2 kernel they skip to call musb_platform_try_idle() in the
OTG_STATE_A_WAIT_BCON state while not in OTG mode.
Since the second port hast a standard A plug the patch changes the port
to run in host mode only, force the id-pin to host only and skip the
timer which would remove DEVCTL.Session.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
---
 arch/arm/boot/dts/am335x-evm.dts |  3 +++
 drivers/usb/musb/musb_dsps.c     | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index c26c16c..38a821a 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -192,6 +192,9 @@
 
 			usb@...01800 {
 				status = "okay";
+				musb1: usb@...01c00 {
+					port-mode = <1>;
+				};
 			};
 
 			dma@...02000  {
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 4ffbaac..b0752fa 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -65,6 +65,9 @@ static inline void dsps_writeb(void __iomem *addr, unsigned offset, u8 data)
 static inline void dsps_writel(void __iomem *addr, unsigned offset, u32 data)
 	{ __raw_writel(data, addr + offset); }
 
+#define USBMODE_IDDIG_A		(0 << 8)
+#define USBMODE_ID_MUX_REG	(1 << 7)
+#define USBMODE_ID_MUX_PHY	(0 << 7)
 /**
  * DSPS musb wrapper register offset.
  * FIXME: This should be expanded to have all the wrapper registers from TI DSPS
@@ -230,6 +233,8 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout)
 		glue->last_timer = jiffies;
 		return;
 	}
+	if (musb->port_mode == MUSB_PORT_MODE_HOST)
+		return;
 
 	if (time_after(glue->last_timer, timeout) &&
 				timer_pending(&glue->timer)) {
@@ -388,6 +393,14 @@ static int dsps_musb_init(struct musb *musb)
 	val &= ~(1 << wrp->otg_disable);
 	dsps_writel(musb->ctrl_base, wrp->phy_utmi, val);
 
+	if (musb->port_mode == MUSB_PORT_MODE_HOST) {
+		val = USBMODE_IDDIG_A;
+		val |= USBMODE_ID_MUX_REG;
+	} else {
+		val = USBMODE_ID_MUX_PHY;
+	}
+	dsps_writel(musb->ctrl_base, wrp->mode, val);
+
 	return 0;
 }
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ