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]

 



On Wed, Sep 09, 2015 at 12:18:27PM -0500, Bin Liu wrote:
> 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;

	/*
	 * treating UNKNONW as unspecified maximum speed, in which case
	 * we will default to HIGH speed.
	 */
	if (musb->config->maximum_speed == HIGH ||
			musb->config->maximum_speed == UNKNOWN)
		power |= HSENAB;

how about that ?

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux