Re: [PATCH v2 1/2] usb: musb: set the controller speed based on the config setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 09/09/2015 08:37 AM, Bin Liu wrote:
Set the Power register HSENAB bit based on musb->config->maximum_speed,
so that the glue layer can control MUSB to work in high- or full-speed.

Signed-off-by: Bin Liu <b-liu@xxxxxx>
---
  drivers/usb/musb/musb_core.c | 10 +++++-----
  include/linux/usb/musb.h     |  2 +-
  2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 6dca3d7..5d8014e 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1014,6 +1014,7 @@ void musb_start(struct musb *musb)
  {
  	void __iomem    *regs = musb->mregs;
  	u8              devctl = musb_readb(regs, MUSB_DEVCTL);
+	u8		power;

  	dev_dbg(musb->controller, "<== devctl %02x\n", devctl);

@@ -1021,11 +1022,10 @@ void musb_start(struct musb *musb)
  	musb_writeb(regs, MUSB_TESTMODE, 0);

  	/* put into basic highspeed mode and start session */
-	musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
-			| MUSB_POWER_HSENAB
-			/* ENSUSPEND wedges tusb */
-			/* | MUSB_POWER_ENSUSPEND */
-		   );
+	power = MUSB_POWER_ISOUPDATE;
+	if (musb->config->maximum_speed == USB_SPEED_HIGH)
+		power |= MUSB_POWER_HSENAB;

Well, I think this breaks other glue drivers, in which case that musb->config is not allocated, or config->maximum_speed is 0 by default if not set in dts. So, to avoid patching all other glue drivers, is the following change acceptable?

+	if (musb->config->maximum_speed != USB_SPEED_FULL &&
+			musb->config->maximum_speed != USB_SPEED_LOW)
+		power |= MUSB_POWER_HSENAB;

Thanks,
-Bin.

+	musb_writeb(regs, MUSB_POWER, power);

  	musb->is_active = 0;
  	devctl = musb_readb(regs, MUSB_DEVCTL);
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index a4ee1b5..fa6dc13 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -95,7 +95,7 @@ struct musb_hdrc_config {
  	/* musb CLKIN in Blackfin in MHZ */
  	unsigned char   clkin;
  #endif
-
+	u32		maximum_speed;
  };

  struct musb_hdrc_platform_data {

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux