Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1203123 > unrolled thread
| Started by | Duc Dang <dhdang@apm.com> |
|---|---|
| First post | 2015-08-08 03:10 +0200 |
| Last post | 2015-08-08 23:10 +0200 |
| Articles | 14 — 5 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform Duc Dang <dhdang@apm.com> - 2015-08-08 03:10 +0200
Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform Greg KH <gregkh@linuxfoundation.org> - 2015-08-08 03:30 +0200
Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform Duc Dang <dhdang@apm.com> - 2015-08-08 04:50 +0200
[PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA Duc Dang <dhdang@apm.com> - 2015-08-08 05:20 +0200
[PATCH v5 2/2] usb: Add support for ACPI identification to xhci-platform Duc Dang <dhdang@apm.com> - 2015-08-08 05:20 +0200
Re: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-08-08 11:30 +0200
Re: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA Duc Dang <dhdang@apm.com> - 2015-08-08 22:40 +0200
Re: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA Arnd Bergmann <arnd@arndb.de> - 2015-08-15 22:10 +0200
[PATCH v6 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA Duc Dang <dhdang@apm.com> - 2015-08-10 09:40 +0200
[PATCH v6 2/2] usb: Add support for ACPI identification to xhci-platform Duc Dang <dhdang@apm.com> - 2015-08-10 09:40 +0200
Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform Javier Martinez Canillas <javier@dowhile0.org> - 2015-08-08 07:50 +0200
Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform Greg KH <gregkh@linuxfoundation.org> - 2015-08-08 17:40 +0200
Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform Duc Dang <dhdang@apm.com> - 2015-08-08 18:50 +0200
Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform Javier Martinez Canillas <javier@dowhile0.org> - 2015-08-08 23:10 +0200
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-08 03:10 +0200 |
| Subject | [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform |
| Message-ID | <pV0O5-fI-1@gated-at.bofh.it> |
Provide the methods to let ACPI identify the need to use
xhci-platform. Change the Kconfig files so the
xhci-plat.o file is selectable during kernel config.
This has been tested on an ARM64 machine with platform XHCI, an
x86_64 machine with XHCI, and an x86_64 machine without XHCI.
There were no regressions or error messages on the machines
without platform XHCI.
[dhdang: regenerate the patch over 4.2-rc5]
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
---
Changes from v3:
Regenerate the patch over 4.2-rc5
No code change
Changes from v2
Replaced tristate with a boolean as the driver doesn't
compile as a module
Correct --help-- to ---help---
Changes from v1
Renamed from "add support for APM X-Gene to xhci-platform"
Removed changes to arm64/Kconfig
Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
drivers/usb/host/Kconfig | 7 ++++++-
drivers/usb/host/xhci-plat.c | 11 +++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 8afc3c1..96231ee 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -32,7 +32,12 @@ config USB_XHCI_PCI
default y
config USB_XHCI_PLATFORM
- tristate
+ tristate "xHCI platform driver support"
+ ---help---
+ Say 'Y' to enable the support for the xHCI host controller
+ as a platform device. Many ARM SoCs provide USB this way.
+
+ If unsure, say 'Y'.
config USB_XHCI_MVEBU
tristate "xHCI support for Marvell Armada 375/38x"
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 5d03f8b..14b40d2 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -19,6 +19,7 @@
#include <linux/usb/phy.h>
#include <linux/slab.h>
#include <linux/usb/xhci_pdriver.h>
+#include <linux/acpi.h>
#include "xhci.h"
#include "xhci-mvebu.h"
@@ -262,6 +263,15 @@ static const struct of_device_id usb_xhci_of_match[] = {
MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
#endif
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id usb_xhci_acpi_match[] = {
+ /* APM X-Gene USB Controller */
+ { "PNP0D10", },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
+#endif
+
static struct platform_driver usb_xhci_driver = {
.probe = xhci_plat_probe,
.remove = xhci_plat_remove,
@@ -269,6 +279,7 @@ static struct platform_driver usb_xhci_driver = {
.name = "xhci-hcd",
.pm = DEV_PM_OPS,
.of_match_table = of_match_ptr(usb_xhci_of_match),
+ .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match),
},
};
MODULE_ALIAS("platform:xhci-hcd");
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2015-08-08 03:30 +0200 |
| Subject | Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform |
| Message-ID | <pV17r-BU-1@gated-at.bofh.it> |
| In reply to | #1203123 |
On Fri, Aug 07, 2015 at 06:03:36PM -0700, Duc Dang wrote:
> Provide the methods to let ACPI identify the need to use
> xhci-platform. Change the Kconfig files so the
> xhci-plat.o file is selectable during kernel config.
>
> This has been tested on an ARM64 machine with platform XHCI, an
> x86_64 machine with XHCI, and an x86_64 machine without XHCI.
> There were no regressions or error messages on the machines
> without platform XHCI.
>
> [dhdang: regenerate the patch over 4.2-rc5]
> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
> Signed-off-by: Duc Dang <dhdang@apm.com>
>
> ---
> Changes from v3:
> Regenerate the patch over 4.2-rc5
> No code change
>
> Changes from v2
> Replaced tristate with a boolean as the driver doesn't
> compile as a module
> Correct --help-- to ---help---
>
> Changes from v1
> Renamed from "add support for APM X-Gene to xhci-platform"
> Removed changes to arm64/Kconfig
> Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
>
> drivers/usb/host/Kconfig | 7 ++++++-
> drivers/usb/host/xhci-plat.c | 11 +++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index 8afc3c1..96231ee 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -32,7 +32,12 @@ config USB_XHCI_PCI
> default y
>
> config USB_XHCI_PLATFORM
> - tristate
> + tristate "xHCI platform driver support"
> + ---help---
> + Say 'Y' to enable the support for the xHCI host controller
> + as a platform device. Many ARM SoCs provide USB this way.
> +
> + If unsure, say 'Y'.
>
> config USB_XHCI_MVEBU
> tristate "xHCI support for Marvell Armada 375/38x"
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 5d03f8b..14b40d2 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -19,6 +19,7 @@
> #include <linux/usb/phy.h>
> #include <linux/slab.h>
> #include <linux/usb/xhci_pdriver.h>
> +#include <linux/acpi.h>
>
> #include "xhci.h"
> #include "xhci-mvebu.h"
> @@ -262,6 +263,15 @@ static const struct of_device_id usb_xhci_of_match[] = {
> MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
> #endif
>
> +#ifdef CONFIG_ACPI
You shoudn't need this #ifdef, right?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-08 04:50 +0200 |
| Message-ID | <pV2mR-2q5-1@gated-at.bofh.it> |
| In reply to | #1203137 |
On Fri, Aug 7, 2015 at 6:29 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Aug 07, 2015 at 06:03:36PM -0700, Duc Dang wrote:
>> Provide the methods to let ACPI identify the need to use
>> xhci-platform. Change the Kconfig files so the
>> xhci-plat.o file is selectable during kernel config.
>>
>> This has been tested on an ARM64 machine with platform XHCI, an
>> x86_64 machine with XHCI, and an x86_64 machine without XHCI.
>> There were no regressions or error messages on the machines
>> without platform XHCI.
>>
>> [dhdang: regenerate the patch over 4.2-rc5]
>> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
>> Signed-off-by: Duc Dang <dhdang@apm.com>
>>
>> ---
>> Changes from v3:
>> Regenerate the patch over 4.2-rc5
>> No code change
>>
>> Changes from v2
>> Replaced tristate with a boolean as the driver doesn't
>> compile as a module
>> Correct --help-- to ---help---
>>
>> Changes from v1
>> Renamed from "add support for APM X-Gene to xhci-platform"
>> Removed changes to arm64/Kconfig
>> Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
>>
>> drivers/usb/host/Kconfig | 7 ++++++-
>> drivers/usb/host/xhci-plat.c | 11 +++++++++++
>> 2 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
>> index 8afc3c1..96231ee 100644
>> --- a/drivers/usb/host/Kconfig
>> +++ b/drivers/usb/host/Kconfig
>> @@ -32,7 +32,12 @@ config USB_XHCI_PCI
>> default y
>>
>> config USB_XHCI_PLATFORM
>> - tristate
>> + tristate "xHCI platform driver support"
>> + ---help---
>> + Say 'Y' to enable the support for the xHCI host controller
>> + as a platform device. Many ARM SoCs provide USB this way.
>> +
>> + If unsure, say 'Y'.
>>
>> config USB_XHCI_MVEBU
>> tristate "xHCI support for Marvell Armada 375/38x"
>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> index 5d03f8b..14b40d2 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -19,6 +19,7 @@
>> #include <linux/usb/phy.h>
>> #include <linux/slab.h>
>> #include <linux/usb/xhci_pdriver.h>
>> +#include <linux/acpi.h>
>>
>> #include "xhci.h"
>> #include "xhci-mvebu.h"
>> @@ -262,6 +263,15 @@ static const struct of_device_id usb_xhci_of_match[] = {
>> MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
>> #endif
>>
>> +#ifdef CONFIG_ACPI
>
> You shoudn't need this #ifdef, right?
You are correct, Greg.
I will post a new version that remove this #ifdef CONFIG_ACPI shortly
>
> thanks,
>
> greg k-h
--
Regards,
Duc Dang.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-08 05:20 +0200 |
| Subject | [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA |
| Message-ID | <pV2PT-3d1-5@gated-at.bofh.it> |
| In reply to | #1203151 |
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.
[dhdang: Regenerate the patch over 4.2-rc5]
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
---
Changes from v4:
None
Changes from v3:
Re-generate the patch over 4.2-rc5
No code change.
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 890ad9d..5d03f8b 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -93,14 +93,14 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (irq < 0)
return -ENODEV;
- /* 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.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-08 05:20 +0200 |
| Subject | [PATCH v5 2/2] usb: Add support for ACPI identification to xhci-platform |
| Message-ID | <pV2PT-3d1-7@gated-at.bofh.it> |
| In reply to | #1203153 |
Provide the methods to let ACPI identify the need to use
xhci-platform. Change the Kconfig files so the
xhci-plat.o file is selectable during kernel config.
This has been tested on an ARM64 machine with platform XHCI, an
x86_64 machine with XHCI, and an x86_64 machine without XHCI.
There were no regressions or error messages on the machines
without platform XHCI.
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
---
Changes from v4:
Remove #ifdef CONFIG_ACPI
Changes from v3:
Regenerate the patch over 4.2-rc5
No code change
Changes from v2
Replaced tristate with a boolean as the driver doesn't
compile as a module
Correct --help-- to ---help---
Changes from v1
Renamed from "add support for APM X-Gene to xhci-platform"
Removed changes to arm64/Kconfig
Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
drivers/usb/host/Kconfig | 7 ++++++-
drivers/usb/host/xhci-plat.c | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 8afc3c1..96231ee 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -32,7 +32,12 @@ config USB_XHCI_PCI
default y
config USB_XHCI_PLATFORM
- tristate
+ tristate "xHCI platform driver support"
+ ---help---
+ Say 'Y' to enable the support for the xHCI host controller
+ as a platform device. Many ARM SoCs provide USB this way.
+
+ If unsure, say 'Y'.
config USB_XHCI_MVEBU
tristate "xHCI support for Marvell Armada 375/38x"
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 5d03f8b..bd282cd 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -19,6 +19,7 @@
#include <linux/usb/phy.h>
#include <linux/slab.h>
#include <linux/usb/xhci_pdriver.h>
+#include <linux/acpi.h>
#include "xhci.h"
#include "xhci-mvebu.h"
@@ -262,6 +263,13 @@ static const struct of_device_id usb_xhci_of_match[] = {
MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
#endif
+static const struct acpi_device_id usb_xhci_acpi_match[] = {
+ /* APM X-Gene USB Controller */
+ { "PNP0D10", },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
+
static struct platform_driver usb_xhci_driver = {
.probe = xhci_plat_probe,
.remove = xhci_plat_remove,
@@ -269,6 +277,7 @@ static struct platform_driver usb_xhci_driver = {
.name = "xhci-hcd",
.pm = DEV_PM_OPS,
.of_match_table = of_match_ptr(usb_xhci_of_match),
+ .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match),
},
};
MODULE_ALIAS("platform:xhci-hcd");
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Russell King - ARM Linux <linux@arm.linux.org.uk> |
|---|---|
| Date | 2015-08-08 11:30 +0200 |
| Subject | Re: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA |
| Message-ID | <pV8BY-31i-3@gated-at.bofh.it> |
| In reply to | #1203153 |
On Fri, Aug 07, 2015 at 08:18:48PM -0700, Duc Dang wrote:
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 890ad9d..5d03f8b 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -93,14 +93,14 @@ static int xhci_plat_probe(struct platform_device *pdev)
> if (irq < 0)
> return -ENODEV;
>
> - /* 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;
> + }
Note that dma_set_mask_and_coherent() and the original code are not
equivalent because of this:
if (!pdev->dev.dma_mask)
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
If we know that pdev->dev.dma_mask will always be initialised at this
point, then the above change is fine. If not, it's introducing a
regression - dma_set_mask_and_coherent() will fail if pdev->dev.dma_mask
is NULL (depending on the architectures implementation of dma_set_mask()).
Prefixing the above change with the two lines I mention above would
ensure equivalent behaviour. Even if we do want to get rid of this,
I'd advise to do it as a separate patch after this change, which can
be independently reverted if there's problems with its removal.
--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-08 22:40 +0200 |
| Subject | Re: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA |
| Message-ID | <pVj4m-19X-3@gated-at.bofh.it> |
| In reply to | #1203234 |
On Sat, Aug 8, 2015 at 2:22 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Fri, Aug 07, 2015 at 08:18:48PM -0700, Duc Dang wrote:
>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> index 890ad9d..5d03f8b 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -93,14 +93,14 @@ static int xhci_plat_probe(struct platform_device *pdev)
>> if (irq < 0)
>> return -ENODEV;
>>
>> - /* 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;
>> + }
>
> Note that dma_set_mask_and_coherent() and the original code are not
> equivalent because of this:
>
> if (!pdev->dev.dma_mask)
> pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
>
> If we know that pdev->dev.dma_mask will always be initialised at this
> point, then the above change is fine. If not, it's introducing a
> regression - dma_set_mask_and_coherent() will fail if pdev->dev.dma_mask
> is NULL (depending on the architectures implementation of dma_set_mask()).
>
> Prefixing the above change with the two lines I mention above would
> ensure equivalent behaviour. Even if we do want to get rid of this,
> I'd advise to do it as a separate patch after this change, which can
> be independently reverted if there's problems with its removal.
>
Hi Russell,
I will add the 2 lines you mentioned back to next version of the
patch. It is safer to do it that way as I do not see
pdev->dev.dma_mask gets initialized before the call
dma_set_mask_and_coherent inside this xhci_plat.c file.
> --
> FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
> according to speedtest.net.
--
Regards,
Duc Dang.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-08-15 22:10 +0200 |
| Subject | Re: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA |
| Message-ID | <pXPWa-3m2-17@gated-at.bofh.it> |
| In reply to | #1203364 |
On Saturday 08 August 2015 13:31:02 Duc Dang wrote: > > > > If we know that pdev->dev.dma_mask will always be initialised at this > > point, then the above change is fine. If not, it's introducing a > > regression - dma_set_mask_and_coherent() will fail if pdev->dev.dma_mask > > is NULL (depending on the architectures implementation of dma_set_mask()). > > > > Prefixing the above change with the two lines I mention above would > > ensure equivalent behaviour. Even if we do want to get rid of this, > > I'd advise to do it as a separate patch after this change, which can > > be independently reverted if there's problems with its removal. > > > Hi Russell, > > I will add the 2 lines you mentioned back to next version of the > patch. It is safer to do it that way as I do not see > pdev->dev.dma_mask gets initialized before the call > dma_set_mask_and_coherent inside this xhci_plat.c file. It would be good to add a WARN_ON() to the case where dma_mask is a NULL pointer at the least. That way, we will at least find out if there are some broken platforms that do not correctly initialize the mask pointer. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-10 09:40 +0200 |
| Subject | [PATCH v6 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA |
| Message-ID | <pVPQC-7HK-21@gated-at.bofh.it> |
| In reply to | #1203234 |
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.
[dhdang: regenerate the patch over 4.2-rc5 and address new comments]
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
---
Changes from v5:
-Change comment
-Assign dma_mask to coherent_dma_mask if dma_mask is NULL
to make sure dma_set_mask_and_coherent does not fail prematurely.
Changes from v4:
-None
Changes from v3:
-Re-generate the patch over 4.2-rc5
-No code change.
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, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 890ad9d..5d1b84b 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -93,14 +93,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (irq < 0)
return -ENODEV;
- /* 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;
+ /*
+ * Try setting dma_mask and coherent_dma_mask to 64 bits,
+ * then try 32 bits
+ */
if (!pdev->dev.dma_mask)
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
- else
- dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+ 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.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-10 09:40 +0200 |
| Subject | [PATCH v6 2/2] usb: Add support for ACPI identification to xhci-platform |
| Message-ID | <pVPQD-7HK-29@gated-at.bofh.it> |
| In reply to | #1203860 |
Provide the methods to let ACPI identify the need to use
xhci-platform. Change the Kconfig files so the
xhci-plat.o file is selectable during kernel config.
This has been tested on an ARM64 machine with platform XHCI, an
x86_64 machine with XHCI, and an x86_64 machine without XHCI.
There were no regressions or error messages on the machines
without platform XHCI.
[dhdang: regenerate the patch over 4.2-rc5 and address new comments]
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
---
Change from v5:
Change comment to "XHCI-compliant USB Controller" as
"PNP0D10" ID is not X-Gene specific
Changes from v4:
Remove #ifdef CONFIG_ACPI
Changes from v3:
Regenerate the patch over 4.2-rc5
No code change
Changes from v2
Replaced tristate with a boolean as the driver doesn't
compile as a module
Correct --help-- to ---help---
Changes from v1
Renamed from "add support for APM X-Gene to xhci-platform"
Removed changes to arm64/Kconfig
Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
drivers/usb/host/Kconfig | 7 ++++++-
drivers/usb/host/xhci-plat.c | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 8afc3c1..96231ee 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -32,7 +32,12 @@ config USB_XHCI_PCI
default y
config USB_XHCI_PLATFORM
- tristate
+ tristate "xHCI platform driver support"
+ ---help---
+ Say 'Y' to enable the support for the xHCI host controller
+ as a platform device. Many ARM SoCs provide USB this way.
+
+ If unsure, say 'Y'.
config USB_XHCI_MVEBU
tristate "xHCI support for Marvell Armada 375/38x"
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 5d1b84b..7ec2d31 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -19,6 +19,7 @@
#include <linux/usb/phy.h>
#include <linux/slab.h>
#include <linux/usb/xhci_pdriver.h>
+#include <linux/acpi.h>
#include "xhci.h"
#include "xhci-mvebu.h"
@@ -266,6 +267,13 @@ static const struct of_device_id usb_xhci_of_match[] = {
MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
#endif
+static const struct acpi_device_id usb_xhci_acpi_match[] = {
+ /* XHCI-compliant USB Controller */
+ { "PNP0D10", },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
+
static struct platform_driver usb_xhci_driver = {
.probe = xhci_plat_probe,
.remove = xhci_plat_remove,
@@ -273,6 +281,7 @@ static struct platform_driver usb_xhci_driver = {
.name = "xhci-hcd",
.pm = DEV_PM_OPS,
.of_match_table = of_match_ptr(usb_xhci_of_match),
+ .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match),
},
};
MODULE_ALIAS("platform:xhci-hcd");
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@dowhile0.org> |
|---|---|
| Date | 2015-08-08 07:50 +0200 |
| Message-ID | <pV5b3-6rX-1@gated-at.bofh.it> |
| In reply to | #1203137 |
Hello Greg,
On Sat, Aug 8, 2015 at 3:29 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Aug 07, 2015 at 06:03:36PM -0700, Duc Dang wrote:
>> Provide the methods to let ACPI identify the need to use
>> xhci-platform. Change the Kconfig files so the
>> xhci-plat.o file is selectable during kernel config.
>>
>> This has been tested on an ARM64 machine with platform XHCI, an
>> x86_64 machine with XHCI, and an x86_64 machine without XHCI.
>> There were no regressions or error messages on the machines
>> without platform XHCI.
>>
>> [dhdang: regenerate the patch over 4.2-rc5]
>> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
>> Signed-off-by: Duc Dang <dhdang@apm.com>
>>
>> ---
>> Changes from v3:
>> Regenerate the patch over 4.2-rc5
>> No code change
>>
>> Changes from v2
>> Replaced tristate with a boolean as the driver doesn't
>> compile as a module
>> Correct --help-- to ---help---
>>
>> Changes from v1
>> Renamed from "add support for APM X-Gene to xhci-platform"
>> Removed changes to arm64/Kconfig
>> Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
>>
>> drivers/usb/host/Kconfig | 7 ++++++-
>> drivers/usb/host/xhci-plat.c | 11 +++++++++++
>> 2 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
>> index 8afc3c1..96231ee 100644
>> --- a/drivers/usb/host/Kconfig
>> +++ b/drivers/usb/host/Kconfig
>> @@ -32,7 +32,12 @@ config USB_XHCI_PCI
>> default y
>>
>> config USB_XHCI_PLATFORM
>> - tristate
>> + tristate "xHCI platform driver support"
>> + ---help---
>> + Say 'Y' to enable the support for the xHCI host controller
>> + as a platform device. Many ARM SoCs provide USB this way.
>> +
>> + If unsure, say 'Y'.
>>
>> config USB_XHCI_MVEBU
>> tristate "xHCI support for Marvell Armada 375/38x"
>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> index 5d03f8b..14b40d2 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -19,6 +19,7 @@
>> #include <linux/usb/phy.h>
>> #include <linux/slab.h>
>> #include <linux/usb/xhci_pdriver.h>
>> +#include <linux/acpi.h>
>>
>> #include "xhci.h"
>> #include "xhci-mvebu.h"
>> @@ -262,6 +263,15 @@ static const struct of_device_id usb_xhci_of_match[] = {
>> MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
>> #endif
>>
>> +#ifdef CONFIG_ACPI
>
> You shoudn't need this #ifdef, right?
>
Why it is not needed?
The driver does .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match) and
ACPI_PTR() is NULL if CONFIG_ACPI is not enabled. Which can happen
AFAIU since the driver also supports OF. So without the #ifdef guards,
.acpi_match_table = NULL and the struct acpi_device_id
usb_xhci_acpi_match[] will be built but not used.
Or am I missing something?
> thanks,
>
> greg k-h
>
Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2015-08-08 17:40 +0200 |
| Subject | Re: [PATCH v4 2/2] usb: Add support for ACPI identification to xhci-platform |
| Message-ID | <pVeo1-2Qw-13@gated-at.bofh.it> |
| In reply to | #1203176 |
On Sat, Aug 08, 2015 at 07:43:40AM +0200, Javier Martinez Canillas wrote:
> Hello Greg,
>
> On Sat, Aug 8, 2015 at 3:29 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Fri, Aug 07, 2015 at 06:03:36PM -0700, Duc Dang wrote:
> >> Provide the methods to let ACPI identify the need to use
> >> xhci-platform. Change the Kconfig files so the
> >> xhci-plat.o file is selectable during kernel config.
> >>
> >> This has been tested on an ARM64 machine with platform XHCI, an
> >> x86_64 machine with XHCI, and an x86_64 machine without XHCI.
> >> There were no regressions or error messages on the machines
> >> without platform XHCI.
> >>
> >> [dhdang: regenerate the patch over 4.2-rc5]
> >> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
> >> Signed-off-by: Duc Dang <dhdang@apm.com>
> >>
> >> ---
> >> Changes from v3:
> >> Regenerate the patch over 4.2-rc5
> >> No code change
> >>
> >> Changes from v2
> >> Replaced tristate with a boolean as the driver doesn't
> >> compile as a module
> >> Correct --help-- to ---help---
> >>
> >> Changes from v1
> >> Renamed from "add support for APM X-Gene to xhci-platform"
> >> Removed changes to arm64/Kconfig
> >> Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
> >>
> >> drivers/usb/host/Kconfig | 7 ++++++-
> >> drivers/usb/host/xhci-plat.c | 11 +++++++++++
> >> 2 files changed, 17 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> >> index 8afc3c1..96231ee 100644
> >> --- a/drivers/usb/host/Kconfig
> >> +++ b/drivers/usb/host/Kconfig
> >> @@ -32,7 +32,12 @@ config USB_XHCI_PCI
> >> default y
> >>
> >> config USB_XHCI_PLATFORM
> >> - tristate
> >> + tristate "xHCI platform driver support"
> >> + ---help---
> >> + Say 'Y' to enable the support for the xHCI host controller
> >> + as a platform device. Many ARM SoCs provide USB this way.
> >> +
> >> + If unsure, say 'Y'.
> >>
> >> config USB_XHCI_MVEBU
> >> tristate "xHCI support for Marvell Armada 375/38x"
> >> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> >> index 5d03f8b..14b40d2 100644
> >> --- a/drivers/usb/host/xhci-plat.c
> >> +++ b/drivers/usb/host/xhci-plat.c
> >> @@ -19,6 +19,7 @@
> >> #include <linux/usb/phy.h>
> >> #include <linux/slab.h>
> >> #include <linux/usb/xhci_pdriver.h>
> >> +#include <linux/acpi.h>
> >>
> >> #include "xhci.h"
> >> #include "xhci-mvebu.h"
> >> @@ -262,6 +263,15 @@ static const struct of_device_id usb_xhci_of_match[] = {
> >> MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
> >> #endif
> >>
> >> +#ifdef CONFIG_ACPI
> >
> > You shoudn't need this #ifdef, right?
> >
>
> Why it is not needed?
Why is it needed?
> The driver does .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match) and
> ACPI_PTR() is NULL if CONFIG_ACPI is not enabled. Which can happen
> AFAIU since the driver also supports OF. So without the #ifdef guards,
> .acpi_match_table = NULL and the struct acpi_device_id
> usb_xhci_acpi_match[] will be built but not used.
Which is just fine, right?
> Or am I missing something?
Don't put #ifdef in .c files if at all possible is the kernel style
rules.
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Duc Dang <dhdang@apm.com> |
|---|---|
| Date | 2015-08-08 18:50 +0200 |
| Message-ID | <pVftL-4oL-9@gated-at.bofh.it> |
| In reply to | #1203285 |
On Sat, Aug 8, 2015 at 8:37 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Sat, Aug 08, 2015 at 07:43:40AM +0200, Javier Martinez Canillas wrote:
>> Hello Greg,
>>
>> On Sat, Aug 8, 2015 at 3:29 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> > On Fri, Aug 07, 2015 at 06:03:36PM -0700, Duc Dang wrote:
>> >> Provide the methods to let ACPI identify the need to use
>> >> xhci-platform. Change the Kconfig files so the
>> >> xhci-plat.o file is selectable during kernel config.
>> >>
>> >> This has been tested on an ARM64 machine with platform XHCI, an
>> >> x86_64 machine with XHCI, and an x86_64 machine without XHCI.
>> >> There were no regressions or error messages on the machines
>> >> without platform XHCI.
>> >>
>> >> [dhdang: regenerate the patch over 4.2-rc5]
>> >> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
>> >> Signed-off-by: Duc Dang <dhdang@apm.com>
>> >>
>> >> ---
>> >> Changes from v3:
>> >> Regenerate the patch over 4.2-rc5
>> >> No code change
>> >>
>> >> Changes from v2
>> >> Replaced tristate with a boolean as the driver doesn't
>> >> compile as a module
>> >> Correct --help-- to ---help---
>> >>
>> >> Changes from v1
>> >> Renamed from "add support for APM X-Gene to xhci-platform"
>> >> Removed changes to arm64/Kconfig
>> >> Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
>> >>
>> >> drivers/usb/host/Kconfig | 7 ++++++-
>> >> drivers/usb/host/xhci-plat.c | 11 +++++++++++
>> >> 2 files changed, 17 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
>> >> index 8afc3c1..96231ee 100644
>> >> --- a/drivers/usb/host/Kconfig
>> >> +++ b/drivers/usb/host/Kconfig
>> >> @@ -32,7 +32,12 @@ config USB_XHCI_PCI
>> >> default y
>> >>
>> >> config USB_XHCI_PLATFORM
>> >> - tristate
>> >> + tristate "xHCI platform driver support"
>> >> + ---help---
>> >> + Say 'Y' to enable the support for the xHCI host controller
>> >> + as a platform device. Many ARM SoCs provide USB this way.
>> >> +
>> >> + If unsure, say 'Y'.
>> >>
>> >> config USB_XHCI_MVEBU
>> >> tristate "xHCI support for Marvell Armada 375/38x"
>> >> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> >> index 5d03f8b..14b40d2 100644
>> >> --- a/drivers/usb/host/xhci-plat.c
>> >> +++ b/drivers/usb/host/xhci-plat.c
>> >> @@ -19,6 +19,7 @@
>> >> #include <linux/usb/phy.h>
>> >> #include <linux/slab.h>
>> >> #include <linux/usb/xhci_pdriver.h>
>> >> +#include <linux/acpi.h>
>> >>
>> >> #include "xhci.h"
>> >> #include "xhci-mvebu.h"
>> >> @@ -262,6 +263,15 @@ static const struct of_device_id usb_xhci_of_match[] = {
>> >> MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
>> >> #endif
>> >>
>> >> +#ifdef CONFIG_ACPI
>> >
>> > You shoudn't need this #ifdef, right?
>> >
>>
>> Why it is not needed?
>
> Why is it needed?
>
>> The driver does .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match) and
>> ACPI_PTR() is NULL if CONFIG_ACPI is not enabled. Which can happen
>> AFAIU since the driver also supports OF. So without the #ifdef guards,
>> .acpi_match_table = NULL and the struct acpi_device_id
>> usb_xhci_acpi_match[] will be built but not used.
>
> Which is just fine, right?
>
>> Or am I missing something?
>
> Don't put #ifdef in .c files if at all possible is the kernel style
> rules.
I tested booting with both device tree and ACPI with the new code that
has #ifdef CONFIG_ACPI removed and USB works fine with my X-Gene Arm64
platform.
>
> thanks,
>
> greg k-h
--
Regards,
Duc Dang.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@dowhile0.org> |
|---|---|
| Date | 2015-08-08 23:10 +0200 |
| Message-ID | <pVjxo-1Xs-7@gated-at.bofh.it> |
| In reply to | #1203285 |
Hello Greg,
On Sat, Aug 8, 2015 at 5:37 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Sat, Aug 08, 2015 at 07:43:40AM +0200, Javier Martinez Canillas wrote:
>> Hello Greg,
>>
>> On Sat, Aug 8, 2015 at 3:29 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> > On Fri, Aug 07, 2015 at 06:03:36PM -0700, Duc Dang wrote:
>> >> Provide the methods to let ACPI identify the need to use
>> >> xhci-platform. Change the Kconfig files so the
>> >> xhci-plat.o file is selectable during kernel config.
>> >>
>> >> This has been tested on an ARM64 machine with platform XHCI, an
>> >> x86_64 machine with XHCI, and an x86_64 machine without XHCI.
>> >> There were no regressions or error messages on the machines
>> >> without platform XHCI.
>> >>
>> >> [dhdang: regenerate the patch over 4.2-rc5]
>> >> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
>> >> Signed-off-by: Duc Dang <dhdang@apm.com>
>> >>
>> >> ---
>> >> Changes from v3:
>> >> Regenerate the patch over 4.2-rc5
>> >> No code change
>> >>
>> >> Changes from v2
>> >> Replaced tristate with a boolean as the driver doesn't
>> >> compile as a module
>> >> Correct --help-- to ---help---
>> >>
>> >> Changes from v1
>> >> Renamed from "add support for APM X-Gene to xhci-platform"
>> >> Removed changes to arm64/Kconfig
>> >> Made CONFIG_USB_XHCI_PLATFORM a user selectable config option
>> >>
>> >> drivers/usb/host/Kconfig | 7 ++++++-
>> >> drivers/usb/host/xhci-plat.c | 11 +++++++++++
>> >> 2 files changed, 17 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
>> >> index 8afc3c1..96231ee 100644
>> >> --- a/drivers/usb/host/Kconfig
>> >> +++ b/drivers/usb/host/Kconfig
>> >> @@ -32,7 +32,12 @@ config USB_XHCI_PCI
>> >> default y
>> >>
>> >> config USB_XHCI_PLATFORM
>> >> - tristate
>> >> + tristate "xHCI platform driver support"
>> >> + ---help---
>> >> + Say 'Y' to enable the support for the xHCI host controller
>> >> + as a platform device. Many ARM SoCs provide USB this way.
>> >> +
>> >> + If unsure, say 'Y'.
>> >>
>> >> config USB_XHCI_MVEBU
>> >> tristate "xHCI support for Marvell Armada 375/38x"
>> >> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> >> index 5d03f8b..14b40d2 100644
>> >> --- a/drivers/usb/host/xhci-plat.c
>> >> +++ b/drivers/usb/host/xhci-plat.c
>> >> @@ -19,6 +19,7 @@
>> >> #include <linux/usb/phy.h>
>> >> #include <linux/slab.h>
>> >> #include <linux/usb/xhci_pdriver.h>
>> >> +#include <linux/acpi.h>
>> >>
>> >> #include "xhci.h"
>> >> #include "xhci-mvebu.h"
>> >> @@ -262,6 +263,15 @@ static const struct of_device_id usb_xhci_of_match[] = {
>> >> MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
>> >> #endif
>> >>
>> >> +#ifdef CONFIG_ACPI
>> >
>> > You shoudn't need this #ifdef, right?
>> >
>>
>> Why it is not needed?
>
> Why is it needed?
>
As explained, to have avoid having an unused variable.
>> The driver does .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match) and
>> ACPI_PTR() is NULL if CONFIG_ACPI is not enabled. Which can happen
>> AFAIU since the driver also supports OF. So without the #ifdef guards,
>> .acpi_match_table = NULL and the struct acpi_device_id
>> usb_xhci_acpi_match[] will be built but not used.
>
> Which is just fine, right?
>
I've seen people having different opinions about this specific case
(using #ifdef guards for ACPI, OF, etc match tables definition),
that's why I asked.
>> Or am I missing something?
>
> Don't put #ifdef in .c files if at all possible is the kernel style
> rules.
>
I know but as you said the rule is to not have #ifdef if possible. But
I understand now that for you this case doesn't justify the #ifdefery.
> thanks,
>
> greg k-h
Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web