RE: [PATCH] usb: host: xhci-plat: fix cannot work if R-Car Gen2/3 run on above 4GB phys

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

 



Hi,

Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> writes:
> [ text/plain ]
> Hi Mathias,
>
> Would you review this patch?
> This patch could be applied into the latest usb.git / usb-next branch.
>
> Best regards,
> Yoshihiro Shimoda
>
>> -----Original Message-----
>> From: Yoshihiro Shimoda
>> Sent: Tuesday, February 16, 2016 12:26 PM
>> To: mathias.nyman@xxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx
>> Cc: linux-usb@xxxxxxxxxxxxxxx; linux-renesas-soc@xxxxxxxxxxxxxxx; Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
>> Subject: [PATCH] usb: host: xhci-plat: fix cannot work if R-Car Gen2/3 run on above 4GB phys
>> 
>> On xHCI controllers of R-Car Gen2 and Gen3, the AC64 bit (bit 0) of
>> HCCPARAMS1 is set to 1. However, these SoCs don't support 64-bit address
>> memory pointers. So, this driver should call dma_set_coherent_mask(dev,
>> DMA_BIT_MASK(32)) in xhci_gen_setup(). Otherwise, the xHCI controller
>> will be died after a usb device is connected if R-Car Gen2/3 run on above
>> 4GB physical memory environment.
>> 
>> This patch adds clearing the AC64 bit of xhci->hcc_params in the
>> xhci_plat_quirks() to fix the issue.
>> 
>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
>> ---
>>  drivers/usb/host/xhci-plat.c | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>> 
>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> index d39d6bf..047fb6a 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -39,12 +39,25 @@ static const struct xhci_driver_overrides xhci_plat_overrides __initconst = {
>> 
>>  static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
>>  {
>> +	struct usb_hcd *hcd = xhci_to_hcd(xhci);
>> +
>>  	/*
>>  	 * As of now platform drivers don't provide MSI support so we ensure
>>  	 * here that the generic code does not try to make a pci_dev from our
>>  	 * dev struct in order to setup MSI
>>  	 */
>>  	xhci->quirks |= XHCI_PLAT;
>> +
>> +	/*
>> +	 * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set
>> +	 * to 1. However, these SoCs don't support 64-bit address memory
>> +	 * pointers. So, this driver clears the AC64 bit of xhci->hcc_params
>> +	 * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in
>> +	 * xhci_gen_setup().
>> +	 */
>> +	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
>> +	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3))
>> +		xhci->hcc_params &= ~BIT(0);	/* clear HCC_64BIT_ADDR
>>  */

Mathias, of course, has the final saying; but I feel that, just like any
other quirk, this should be setting a flag in xhci->quirks and xhci core
would clear hcc_params. The reason is that if we ever need this on some
PCIe card, we won't have to shuffle code around.

-- 
balbi

Attachment: signature.asc
Description: PGP 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