Re: [PATCH 2/3] usb: musb: Add a quirk to preserve MUSB_DEVCTL during suspend

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

 



On 12/16/2016 03:36 AM, Bin Liu wrote:
> On Mon, Nov 28, 2016 at 05:26:20PM +0100, Alexandre Bailon wrote:
>> On da8xx, VBUS is not maintained during suspend when musb is in host mode.
>> On resume, all the connected devices will be disconnected and then will
>> be enumerated again.
>> This happens because MUSB_DEVCTL is cleared during suspend.
>> Add a quirk to preserve MUSB_DEVCTL during a suspend.
>>
>> Signed-off-by: Alexandre Bailon <abailon@xxxxxxxxxxxx>
>> ---
>>  drivers/usb/musb/musb_core.c | 13 +++++++------
>>  drivers/usb/musb/musb_core.h |  1 +
>>  2 files changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
>> index 9e22646..7e2cd98 100644
>> --- a/drivers/usb/musb/musb_core.c
>> +++ b/drivers/usb/musb/musb_core.c
>> @@ -1040,14 +1040,15 @@ static void musb_enable_interrupts(struct musb *musb)
>>  
>>  }
>>  
>> -static void musb_generic_disable(struct musb *musb)
>> +static void musb_generic_disable(struct musb *musb, bool suspend)
> 
> I don't think I like it, so made a change [1] to remove this function,
> since it only has two lines of code.
> 
>>  {
>>  	void __iomem	*mbase = musb->mregs;
>>  
>>  	musb_disable_interrupts(musb);
>>  
>>  	/* off */
>> -	musb_writeb(mbase, MUSB_DEVCTL, 0);
>> +	if (!suspend || !(musb->io.quirks & MUSB_PRESERVE_DEVCTL))
>> +		musb_writeb(mbase, MUSB_DEVCTL, 0);
> 
> So now you can move this quirk check into musb_suspend(),
> 
>>  }
>>  
>>  /*
>> @@ -1106,7 +1107,7 @@ void musb_stop(struct musb *musb)
>>  {
>>  	/* stop IRQs, timers, ... */
>>  	musb_platform_disable(musb);
>> -	musb_generic_disable(musb);
>> +	musb_generic_disable(musb, false);
>>  	musb_dbg(musb, "HDRC disabled");
>>  
>>  	/* FIXME
>> @@ -2310,7 +2311,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
>>  
>>  	/* be sure interrupts are disabled before connecting ISR */
>>  	musb_platform_disable(musb);
>> -	musb_generic_disable(musb);
>> +	musb_generic_disable(musb, false);
>>  
>>  	/* Init IRQ workqueue before request_irq */
>>  	INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work);
>> @@ -2486,7 +2487,7 @@ static int musb_remove(struct platform_device *pdev)
>>  	musb_gadget_cleanup(musb);
>>  	spin_lock_irqsave(&musb->lock, flags);
>>  	musb_platform_disable(musb);
>> -	musb_generic_disable(musb);
>> +	musb_generic_disable(musb, false);
>>  	spin_unlock_irqrestore(&musb->lock, flags);
>>  	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
>>  	pm_runtime_dont_use_autosuspend(musb->controller);
>> @@ -2663,7 +2664,7 @@ static int musb_suspend(struct device *dev)
>>  	unsigned long	flags;
>>  
>>  	musb_platform_disable(musb);
>> -	musb_generic_disable(musb);
>> +	musb_generic_disable(musb, true);
>>  	WARN_ON(!list_empty(&musb->pending_list));
> 
> and all the changes above are no longer needed. Can you please revise
> this patch based on [1]?
> 
>>  
>>  	spin_lock_irqsave(&musb->lock, flags);
>> diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
>> index a611e2f..22961ef 100644
>> --- a/drivers/usb/musb/musb_core.h
>> +++ b/drivers/usb/musb/musb_core.h
>> @@ -172,6 +172,7 @@ struct musb_io;
>>   */
>>  struct musb_platform_ops {
>>  
>> +#define MUSB_PRESERVE_DEVCTL	BIT(7)
> 
> Does it miss a TAB before BIT to align with follows?
I have checked and I don't think there is any missing TAB.

Regards,
Alexandre
> 
>>  #define MUSB_DMA_UX500		BIT(6)
>>  #define MUSB_DMA_CPPI41		BIT(5)
>>  #define MUSB_DMA_CPPI		BIT(4)
>> -- 
>> 2.7.3
>>
> 
> [1] http://www.spinics.net/lists/linux-usb/msg150856.html
> 
> Regards,
> -Bin.
> 

--
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