Re: [PATCH v3 1/2] make xhci platform driver use 64 bit or 32 bit DMA

2015-03-20 Thread Feng Kan
On Tue, Nov 25, 2014 at 1:19 PM, Mark Langsdorf mlang...@redhat.com wrote:
 The xhci platform driver needs to work on systems that either only
 support 64-bit DMA or only support 32-bit DMA. Attempt to set a
 coherent dma mask for 64-bit DMA, and attempt again with 32-bit
 DMA if that fails.

 Signed-off-by: Mark Langsdorf mlang...@redhat.com
 Tested-by: Mark Salter msal...@redhat.com
 ---
 Changes from v2:
 None
 Changes from v1:
 Consolidated to use dma_set_mask_and_coherent
 Got rid of the check against sizeof(dma_addr_t)

  drivers/usb/host/xhci-plat.c | 16 
  1 file changed, 8 insertions(+), 8 deletions(-)

 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
 index 3d78b0c..34cbf65 100644
 --- a/drivers/usb/host/xhci-plat.c
 +++ b/drivers/usb/host/xhci-plat.c
 @@ -96,14 +96,14 @@ static int xhci_plat_probe(struct platform_device *pdev)
 return ret;
 }

 -   /* Initialize dma_mask and coherent_dma_mask to 32-bits */
 -   ret = dma_set_coherent_mask(pdev-dev, DMA_BIT_MASK(32));
 -   if (ret)
 -   return ret;
 -   if (!pdev-dev.dma_mask)
 -   pdev-dev.dma_mask = pdev-dev.coherent_dma_mask;
 -   else
 -   dma_set_mask(pdev-dev, DMA_BIT_MASK(32));
 +   /* Try setting the coherent_dma_mask to 64 bits, then try 32 bits */
 +   ret = dma_set_mask_and_coherent(pdev-dev, DMA_BIT_MASK(64));
 +   if (ret) {
 +   ret = dma_set_mask_and_coherent(pdev-dev, DMA_BIT_MASK(32));
 +   if (ret)
 +   return ret;
 +   }
 +

 hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev));
 if (!hcd)
 --
 1.9.3


Tested-by: Feng Kan f...@apm.com
 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] [usb] add support for ACPI identification to xhci-platform

2014-11-18 Thread Feng Kan
On Thu, Nov 13, 2014 at 10:36 AM, Mark Langsdorf mlang...@redhat.com wrote:
 On 11/04/2014 11:12 AM, Greg KH wrote:

 On Tue, Nov 04, 2014 at 10:50:33AM -0600, Mark Langsdorf wrote:

   #endif


 +#ifdef CONFIG_ACPI
 +static const struct acpi_device_id usb_xhci_acpi_match[] = {
 +   /* APM X-Gene USB Controller */
 +   { PNP0D10, },

Mark, would it be better to use PRP0001 instead as in this patch?
https://lkml.org/lkml/2014/9/16/230

 +   { }
 +};
 +MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
 +#endif


 That looks like a very generic PNP value, are you sure it is assigned
 only to this specific device?


 Although this is a generic PNP device, the specific implementation
 I'm testing has issues with USB3. Is there a flag or function
 call that will disable the USB3 host while keeping the USB2
 host?? My naive attempts in finding one mostly hung the machine.

 --Mark Langsdorf


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


Re: [PATCH v2 2/2] [usb] add support for ACPI identification to xhci-platform

2014-11-18 Thread Feng Kan
On Tue, Nov 18, 2014 at 12:33 PM, Mark Langsdorf mlang...@redhat.com wrote:
 On 11/18/2014 02:05 PM, Feng Kan wrote:

 On Thu, Nov 13, 2014 at 10:36 AM, Mark Langsdorf mlang...@redhat.com
 wrote:

 On 11/04/2014 11:12 AM, Greg KH wrote:


 On Tue, Nov 04, 2014 at 10:50:33AM -0600, Mark Langsdorf wrote:


#endif



 +#ifdef CONFIG_ACPI
 +static const struct acpi_device_id usb_xhci_acpi_match[] = {
 +   /* APM X-Gene USB Controller */
 +   { PNP0D10, },


 Mark, would it be better to use PRP0001 instead as in this patch?
 https://lkml.org/lkml/2014/9/16/230


 Quoting Arnd,

 In this case, the device does have an official ACPI ID PNP0D10,
 so we should use that for compatibility with other operating
 systems and with BIOS versions that provide the standard IDs.

Yes, thanks. I missed that part, sorry for the spam then.
 --Mark Langsdorf
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] usb:host:xhci-plat: 64-bit dma addressing support

2014-11-13 Thread Feng Kan
Just want to ping this again to see if there is any comments, thanks.

On Tue, Nov 4, 2014 at 11:06 AM, Feng Kan f...@apm.com wrote:
 Use dma_addr_t to support 64-bit plaforms, which access beyond the default
 32 bit address range.

 Signed-off-by: Bao Truong btru...@apm.com
 Signed-off-by: Feng Kan f...@apm.com
 ---
  Changes:
 V2: fixed GKH's comment regarding not mark up the comment after
 code change.

  drivers/usb/host/xhci-plat.c | 10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
 index 3d78b0c..f75764f 100644
 --- a/drivers/usb/host/xhci-plat.c
 +++ b/drivers/usb/host/xhci-plat.c
 @@ -96,14 +96,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
 return ret;
 }

 -   /* Initialize dma_mask and coherent_dma_mask to 32-bits */
 -   ret = dma_set_coherent_mask(pdev-dev, DMA_BIT_MASK(32));
 +   /*
 +* Initialize dma_mask and coherent_dma_mask to valid DMA or bus
 +* address for the platform.
 +*/
 +   ret = dma_set_coherent_mask(pdev-dev,
 +   DMA_BIT_MASK(sizeof(dma_addr_t)*8));
 if (ret)
 return ret;
 if (!pdev-dev.dma_mask)
 pdev-dev.dma_mask = pdev-dev.coherent_dma_mask;
 else
 -   dma_set_mask(pdev-dev, DMA_BIT_MASK(32));
 +   dma_set_mask(pdev-dev, DMA_BIT_MASK(sizeof(dma_addr_t)*8));

 hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev));
 if (!hcd)
 --
 1.9.1

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


[PATCH V2] usb:host:xhci-plat: 64-bit dma addressing support

2014-11-04 Thread Feng Kan
Use dma_addr_t to support 64-bit plaforms, which access beyond the default
32 bit address range.

Signed-off-by: Bao Truong btru...@apm.com
Signed-off-by: Feng Kan f...@apm.com
---
 Changes:
V2: fixed GKH's comment regarding not mark up the comment after
code change.

 drivers/usb/host/xhci-plat.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 3d78b0c..f75764f 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -96,14 +96,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
return ret;
}
 
-   /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-   ret = dma_set_coherent_mask(pdev-dev, DMA_BIT_MASK(32));
+   /*
+* Initialize dma_mask and coherent_dma_mask to valid DMA or bus
+* address for the platform.
+*/
+   ret = dma_set_coherent_mask(pdev-dev,
+   DMA_BIT_MASK(sizeof(dma_addr_t)*8));
if (ret)
return ret;
if (!pdev-dev.dma_mask)
pdev-dev.dma_mask = pdev-dev.coherent_dma_mask;
else
-   dma_set_mask(pdev-dev, DMA_BIT_MASK(32));
+   dma_set_mask(pdev-dev, DMA_BIT_MASK(sizeof(dma_addr_t)*8));
 
hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev));
if (!hcd)
-- 
1.9.1

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


[PATCH] usb:host:xhci-plat: 64-bit dma addressing support

2014-11-03 Thread Feng Kan
Use dma_addr_t to support 64-bit plaforms, which access beyond 32 bit
address range.

Signed-off-by: Bao Truong btru...@apm.com
Signed-off-by: Feng Kan f...@apm.com
---
 drivers/usb/host/xhci-plat.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 01d1862..8cf83f0 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -97,13 +97,14 @@ static int xhci_plat_probe(struct platform_device *pdev)
}
 
/* Initialize dma_mask and coherent_dma_mask to 32-bits */
-   ret = dma_set_coherent_mask(pdev-dev, DMA_BIT_MASK(32));
+   ret = dma_set_coherent_mask(pdev-dev,
+   DMA_BIT_MASK(sizeof(dma_addr_t)*8));
if (ret)
return ret;
if (!pdev-dev.dma_mask)
pdev-dev.dma_mask = pdev-dev.coherent_dma_mask;
else
-   dma_set_mask(pdev-dev, DMA_BIT_MASK(32));
+   dma_set_mask(pdev-dev, DMA_BIT_MASK(sizeof(dma_addr_t)*8));
 
hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev));
if (!hcd)
-- 
1.9.1

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