* [PATCH 0/6] usb: dwc3: DMA API usage
@ 2016-04-02 8:28 Felipe Balbi
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2016-04-02 8:28 UTC (permalink / raw)
To: Linux USB Mailing List
Cc: Santosh Shilimkar, Grygorii Strashko, Tony Lindgren,
Linux OMAP Mailing List, Srinivas Kandagatla, Maxime Coquelin,
Patrice Chotard, Andy Gross, Ivan T . Ivanov, Felipe Balbi
Hi,
this should make dwc3's DMA API usage more
compliant. This is still *UNTESTED* patches but I'd
like people to give it a round of review to make
sure I didn't miss anything.
I have questions about dev->dma_parms, what should
be done with that ?
If there's anything I missed, please _do_ let me
know. Also, I think Keystone's DMA mask could be
more than 32 bits. IIRC, Keystone's DMA can address
more than 32-bits, right Santosh ?
patches are also available in my k.org tree on
branch dwc3-dma-mask for those of you willing to
give it a go on real HW.
Felipe Balbi (6):
usb: dwc3: st: fix dma initialization
usb: dwc3: omap: don't access DMA bits directly
usb: dwc3: keystone: initialize dma_mask and coherent
usb: dwc3: of-simple: initialize dma_mask and coherent
usb: dwc3: core: don't access DMA bits directly
usb: dwc3: host: don't access DMA bits directly
drivers/usb/dwc3/core.c | 6 +-----
drivers/usb/dwc3/dwc3-keystone.c | 5 +----
drivers/usb/dwc3/dwc3-of-simple.c | 1 +
drivers/usb/dwc3/dwc3-omap.c | 4 +---
drivers/usb/dwc3/dwc3-st.c | 3 ++-
drivers/usb/dwc3/host.c | 5 +----
6 files changed, 7 insertions(+), 17 deletions(-)
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/6] usb: dwc3: st: fix dma initialization
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-04-02 8:28 ` Felipe Balbi
2016-04-02 8:28 ` [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly Felipe Balbi
` (4 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2016-04-02 8:28 UTC (permalink / raw)
To: Linux USB Mailing List
Cc: Santosh Shilimkar, Grygorii Strashko, Tony Lindgren,
Linux OMAP Mailing List, Srinivas Kandagatla, Maxime Coquelin,
Patrice Chotard, Andy Gross, Ivan T . Ivanov, Felipe Balbi
Current code was basically a no-op. As it was
initializing dev->coherent_dma_mask with
dev->coherent_dma_mask. Due to lack of more
information, just initialize it to a 32-bit mask.
Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/usb/dwc3/dwc3-st.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
index 5c0adb9c6fb2..33b85ae4e698 100644
--- a/drivers/usb/dwc3/dwc3-st.c
+++ b/drivers/usb/dwc3/dwc3-st.c
@@ -212,7 +212,8 @@ static int st_dwc3_probe(struct platform_device *pdev)
if (IS_ERR(regmap))
return PTR_ERR(regmap);
- dma_set_coherent_mask(dev, dev->coherent_dma_mask);
+ dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
+
dwc3_data->dev = dev;
dwc3_data->regmap = regmap;
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-02 8:28 ` [PATCH 1/6] usb: dwc3: st: fix dma initialization Felipe Balbi
@ 2016-04-02 8:28 ` Felipe Balbi
[not found] ` <1459585739-21204-3-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-02 8:28 ` [PATCH 3/6] usb: dwc3: keystone: initialize dma_mask and coherent Felipe Balbi
` (3 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2016-04-02 8:28 UTC (permalink / raw)
To: Linux USB Mailing List
Cc: Santosh Shilimkar, Grygorii Strashko, Tony Lindgren,
Linux OMAP Mailing List, Srinivas Kandagatla, Maxime Coquelin,
Patrice Chotard, Andy Gross, Ivan T . Ivanov, Felipe Balbi
Instead of having a static global just for
initializing dma_mask directly, let's use
dma_coerce_mask_and_coherent() for that.
Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/usb/dwc3/dwc3-omap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 22e9606d8e08..c219118bfda0 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -331,8 +331,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
dwc3_omap_write_irqmisc_clr(omap, reg);
}
-static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/6] usb: dwc3: keystone: initialize dma_mask and coherent
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-02 8:28 ` [PATCH 1/6] usb: dwc3: st: fix dma initialization Felipe Balbi
2016-04-02 8:28 ` [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly Felipe Balbi
@ 2016-04-02 8:28 ` Felipe Balbi
2016-04-02 8:28 ` [PATCH 4/6] usb: dwc3: of-simple: " Felipe Balbi
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2016-04-02 8:28 UTC (permalink / raw)
To: Linux USB Mailing List
Cc: Santosh Shilimkar, Grygorii Strashko, Tony Lindgren,
Linux OMAP Mailing List, Srinivas Kandagatla, Maxime Coquelin,
Patrice Chotard, Andy Gross, Ivan T . Ivanov, Felipe Balbi
dma_get_mask(dev) just returns
dev->dma_mask. Current code was using dma_get_mask()
return to initialize dev->dma_mask. That's
essentially a no-op. Instead, let's default to a
32-bit DMA mask passed to
dma_coerce_mask_and_coherent().
Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/usb/dwc3/dwc3-keystone.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index 2be268d2423d..53bbc9dccf7e 100644
--- a/drivers/usb/dwc3/dwc3-keystone.c
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -39,8 +39,6 @@
#define USBSS_IRQ_COREIRQ_EN BIT(0)
#define USBSS_IRQ_COREIRQ_CLR BIT(0)
-static u64 kdwc3_dma_mask;
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/6] usb: dwc3: of-simple: initialize dma_mask and coherent
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
` (2 preceding siblings ...)
2016-04-02 8:28 ` [PATCH 3/6] usb: dwc3: keystone: initialize dma_mask and coherent Felipe Balbi
@ 2016-04-02 8:28 ` Felipe Balbi
2016-04-02 8:28 ` [PATCH 5/6] usb: dwc3: core: don't access DMA bits directly Felipe Balbi
2016-04-02 8:28 ` [PATCH 6/6] usb: dwc3: host: " Felipe Balbi
5 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2016-04-02 8:28 UTC (permalink / raw)
To: Linux USB Mailing List
Cc: Santosh Shilimkar, Grygorii Strashko, Tony Lindgren,
Linux OMAP Mailing List, Srinivas Kandagatla, Maxime Coquelin,
Patrice Chotard, Andy Gross, Ivan T . Ivanov, Felipe Balbi
This will make sure users of dwc3-of-simple will
have proper DMA bits initialized for dwc3 core.
Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/usb/dwc3/dwc3-of-simple.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index 974335377d9f..b33c145a7e29 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -62,6 +62,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
return -ENOMEM;
simple->dev = dev;
+ dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
for (i = 0; i < simple->num_clocks; i++) {
struct clk *clk;
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/6] usb: dwc3: core: don't access DMA bits directly
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
` (3 preceding siblings ...)
2016-04-02 8:28 ` [PATCH 4/6] usb: dwc3: of-simple: " Felipe Balbi
@ 2016-04-02 8:28 ` Felipe Balbi
[not found] ` <1459585739-21204-6-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-02 8:28 ` [PATCH 6/6] usb: dwc3: host: " Felipe Balbi
5 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2016-04-02 8:28 UTC (permalink / raw)
To: Linux USB Mailing List
Cc: Santosh Shilimkar, Grygorii Strashko, Tony Lindgren,
Linux OMAP Mailing List, Srinivas Kandagatla, Maxime Coquelin,
Patrice Chotard, Andy Gross, Ivan T . Ivanov, Felipe Balbi
instead of manually copying DMA bits from parent
device, we should let DMA API do its job.
Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/usb/dwc3/core.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 17fd81447c9f..d601de20e1cd 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -981,11 +981,7 @@ static int dwc3_probe(struct platform_device *pdev)
spin_lock_init(&dwc->lock);
- if (!dev->dma_mask) {
- dev->dma_mask = dev->parent->dma_mask;
- dev->dma_parms = dev->parent->dma_parms;
- dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
- }
+ dma_coerce_mask_and_coherent(dev, dma_get_mask(dev->parent));
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/6] usb: dwc3: host: don't access DMA bits directly
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
` (4 preceding siblings ...)
2016-04-02 8:28 ` [PATCH 5/6] usb: dwc3: core: don't access DMA bits directly Felipe Balbi
@ 2016-04-02 8:28 ` Felipe Balbi
5 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2016-04-02 8:28 UTC (permalink / raw)
To: Linux USB Mailing List
Cc: Santosh Shilimkar, Grygorii Strashko, Tony Lindgren,
Linux OMAP Mailing List, Srinivas Kandagatla, Maxime Coquelin,
Patrice Chotard, Andy Gross, Ivan T . Ivanov, Felipe Balbi
instead of manually copying DMA bits from parent
device, we should let DMA API do its job.
Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/usb/dwc3/host.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index c679f63783ae..186f1704a16b 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -32,11 +32,8 @@ int dwc3_host_init(struct dwc3 *dwc)
return -ENOMEM;
}
- dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask);
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly
[not found] ` <1459585739-21204-3-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-04-04 13:53 ` Grygorii Strashko
[not found] ` <570271BF.9040902-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 15+ messages in thread
From: Grygorii Strashko @ 2016-04-04 13:53 UTC (permalink / raw)
To: Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov, Felipe Balbi
On 04/02/2016 11:28 AM, Felipe Balbi wrote:
> Instead of having a static global just for
> initializing dma_mask directly, let's use
> dma_coerce_mask_and_coherent() for that.
>
> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
> drivers/usb/dwc3/dwc3-omap.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
> index 22e9606d8e08..c219118bfda0 100644
> --- a/drivers/usb/dwc3/dwc3-omap.c
> +++ b/drivers/usb/dwc3/dwc3-omap.c
> @@ -331,8 +331,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
> dwc3_omap_write_irqmisc_clr(omap, reg);
> }
>
> -static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
> -
> static int dwc3_omap_id_notifier(struct notifier_block *nb,
> unsigned long event, void *ptr)
> {
> @@ -490,7 +488,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
> omap->irq = irq;
> omap->base = base;
> omap->vbus_reg = vbus_reg;
> - dev->dma_mask = &dwc3_omap_dma_mask;
> + dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
I think, It'll be better to just remove DMA configuration code
from this driver and other drivers which support DT-boot mode only.
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/6] usb: dwc3: core: don't access DMA bits directly
[not found] ` <1459585739-21204-6-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-04-04 13:53 ` Grygorii Strashko
[not found] ` <570271C3.9030707-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 15+ messages in thread
From: Grygorii Strashko @ 2016-04-04 13:53 UTC (permalink / raw)
To: Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov, Felipe Balbi
On 04/02/2016 11:28 AM, Felipe Balbi wrote:
> instead of manually copying DMA bits from parent
> device, we should let DMA API do its job.
>
> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
> drivers/usb/dwc3/core.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 17fd81447c9f..d601de20e1cd 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -981,11 +981,7 @@ static int dwc3_probe(struct platform_device *pdev)
>
> spin_lock_init(&dwc->lock);
>
> - if (!dev->dma_mask) {
> - dev->dma_mask = dev->parent->dma_mask;
> - dev->dma_parms = dev->parent->dma_parms;
Here, and in most of other patches you've dropped dma_parms copying -
Is it expected?
> - dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
> - }
> + dma_coerce_mask_and_coherent(dev, dma_get_mask(dev->parent));
No. Above if case should stay, otherwise, already valid, DMA configuration
might be overwritten:
commit 19bacdc925055f020ad36da04bd72dc8b28637b8
Author: Heikki Krogerus <heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Date: Wed Sep 24 11:00:38 2014 +0300
usb: dwc3: core: only setting the dma_mask when needed
If the probe drivers have already set the dma_mask, not
replacing the value.
Signed-off-by: Heikki Krogerus <heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly
[not found] ` <570271BF.9040902-l0cyMroinI0@public.gmane.org>
@ 2016-04-05 5:51 ` Felipe Balbi
[not found] ` <87y48s4n7y.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2016-04-05 5:51 UTC (permalink / raw)
To: Grygorii Strashko, Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov
[-- Attachment #1: Type: text/plain, Size: 1465 bytes --]
Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
> On 04/02/2016 11:28 AM, Felipe Balbi wrote:
>> Instead of having a static global just for
>> initializing dma_mask directly, let's use
>> dma_coerce_mask_and_coherent() for that.
>>
>> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>> ---
>> drivers/usb/dwc3/dwc3-omap.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
>> index 22e9606d8e08..c219118bfda0 100644
>> --- a/drivers/usb/dwc3/dwc3-omap.c
>> +++ b/drivers/usb/dwc3/dwc3-omap.c
>> @@ -331,8 +331,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
>> dwc3_omap_write_irqmisc_clr(omap, reg);
>> }
>>
>> -static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
>> -
>> static int dwc3_omap_id_notifier(struct notifier_block *nb,
>> unsigned long event, void *ptr)
>> {
>> @@ -490,7 +488,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
>> omap->irq = irq;
>> omap->base = base;
>> omap->vbus_reg = vbus_reg;
>> - dev->dma_mask = &dwc3_omap_dma_mask;
>> + dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
>
> I think, It'll be better to just remove DMA configuration code
> from this driver and other drivers which support DT-boot mode only.
I don't have HW, can you test that on AM57x and/or AM437x ?
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/6] usb: dwc3: core: don't access DMA bits directly
[not found] ` <570271C3.9030707-l0cyMroinI0@public.gmane.org>
@ 2016-04-05 5:52 ` Felipe Balbi
0 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2016-04-05 5:52 UTC (permalink / raw)
To: Grygorii Strashko, Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov
[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]
Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
> On 04/02/2016 11:28 AM, Felipe Balbi wrote:
>> instead of manually copying DMA bits from parent
>> device, we should let DMA API do its job.
>>
>> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>> ---
>> drivers/usb/dwc3/core.c | 6 +-----
>> 1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index 17fd81447c9f..d601de20e1cd 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -981,11 +981,7 @@ static int dwc3_probe(struct platform_device *pdev)
>>
>> spin_lock_init(&dwc->lock);
>>
>> - if (!dev->dma_mask) {
>> - dev->dma_mask = dev->parent->dma_mask;
>> - dev->dma_parms = dev->parent->dma_parms;
>
> Here, and in most of other patches you've dropped dma_parms copying -
> Is it expected?
I mentioned in cover letter that I don't know exactly what's the proper
way of dealing with dma_parms.
>> - dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
>> - }
>> + dma_coerce_mask_and_coherent(dev, dma_get_mask(dev->parent));
>
>
> No. Above if case should stay, otherwise, already valid, DMA configuration
> might be overwritten:
okay.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly
[not found] ` <87y48s4n7y.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-04-05 9:30 ` Grygorii Strashko
[not found] ` <570385AB.8060507-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 15+ messages in thread
From: Grygorii Strashko @ 2016-04-05 9:30 UTC (permalink / raw)
To: Felipe Balbi, Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov
On 04/05/2016 08:51 AM, Felipe Balbi wrote:
> Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
>> On 04/02/2016 11:28 AM, Felipe Balbi wrote:
>>> Instead of having a static global just for
>>> initializing dma_mask directly, let's use
>>> dma_coerce_mask_and_coherent() for that.
>>>
>>> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>>> ---
>>> drivers/usb/dwc3/dwc3-omap.c | 4 +---
>>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
>>> index 22e9606d8e08..c219118bfda0 100644
>>> --- a/drivers/usb/dwc3/dwc3-omap.c
>>> +++ b/drivers/usb/dwc3/dwc3-omap.c
>>> @@ -331,8 +331,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
>>> dwc3_omap_write_irqmisc_clr(omap, reg);
>>> }
>>>
>>> -static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
>>> -
>>> static int dwc3_omap_id_notifier(struct notifier_block *nb,
>>> unsigned long event, void *ptr)
>>> {
>>> @@ -490,7 +488,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
>>> omap->irq = irq;
>>> omap->base = base;
>>> omap->vbus_reg = vbus_reg;
>>> - dev->dma_mask = &dwc3_omap_dma_mask;
>>> + dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
>>
>> I think, It'll be better to just remove DMA configuration code
>> from this driver and other drivers which support DT-boot mode only.
>
> I don't have HW, can you test that on AM57x and/or AM437x ?
>
Yes. I can. With below change I see no issues with USB in Host mode
on my AM57x board:
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 16cb14f..d5feaf9 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -367,8 +367,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
dwc3_omap_write_irqmisc_clr(omap, reg);
}
-static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly
[not found] ` <570385AB.8060507-l0cyMroinI0@public.gmane.org>
@ 2016-04-05 10:29 ` Felipe Balbi
[not found] ` <87egak4adi.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2016-04-05 10:29 UTC (permalink / raw)
To: Grygorii Strashko, Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov
[-- Attachment #1: Type: text/plain, Size: 1894 bytes --]
Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
> On 04/05/2016 08:51 AM, Felipe Balbi wrote:
>> Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
>>> On 04/02/2016 11:28 AM, Felipe Balbi wrote:
>>>> Instead of having a static global just for
>>>> initializing dma_mask directly, let's use
>>>> dma_coerce_mask_and_coherent() for that.
>>>>
>>>> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>>>> ---
>>>> drivers/usb/dwc3/dwc3-omap.c | 4 +---
>>>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
>>>> index 22e9606d8e08..c219118bfda0 100644
>>>> --- a/drivers/usb/dwc3/dwc3-omap.c
>>>> +++ b/drivers/usb/dwc3/dwc3-omap.c
>>>> @@ -331,8 +331,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
>>>> dwc3_omap_write_irqmisc_clr(omap, reg);
>>>> }
>>>>
>>>> -static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
>>>> -
>>>> static int dwc3_omap_id_notifier(struct notifier_block *nb,
>>>> unsigned long event, void *ptr)
>>>> {
>>>> @@ -490,7 +488,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
>>>> omap->irq = irq;
>>>> omap->base = base;
>>>> omap->vbus_reg = vbus_reg;
>>>> - dev->dma_mask = &dwc3_omap_dma_mask;
>>>> + dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
>>>
>>> I think, It'll be better to just remove DMA configuration code
>>> from this driver and other drivers which support DT-boot mode only.
>>
>> I don't have HW, can you test that on AM57x and/or AM437x ?
>>
>
> Yes. I can. With below change I see no issues with USB in Host mode
> on my AM57x board:
what about peripheral side ? Host mode worked fine on K2 devices, only
peripheral suffered from the bad DMA API usage.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly
[not found] ` <87egak4adi.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-04-05 11:42 ` Grygorii Strashko
[not found] ` <5703A4AE.1090301-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 15+ messages in thread
From: Grygorii Strashko @ 2016-04-05 11:42 UTC (permalink / raw)
To: Felipe Balbi, Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov
On 04/05/2016 01:29 PM, Felipe Balbi wrote:
> Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
>> On 04/05/2016 08:51 AM, Felipe Balbi wrote:
>>> Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
>>>> On 04/02/2016 11:28 AM, Felipe Balbi wrote:
>>>>> Instead of having a static global just for
>>>>> initializing dma_mask directly, let's use
>>>>> dma_coerce_mask_and_coherent() for that.
>>>>>
>>>>> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>>>>> ---
>>>>> drivers/usb/dwc3/dwc3-omap.c | 4 +---
>>>>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
>>>>> index 22e9606d8e08..c219118bfda0 100644
>>>>> --- a/drivers/usb/dwc3/dwc3-omap.c
>>>>> +++ b/drivers/usb/dwc3/dwc3-omap.c
>>>>> @@ -331,8 +331,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
>>>>> dwc3_omap_write_irqmisc_clr(omap, reg);
>>>>> }
>>>>>
>>>>> -static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
>>>>> -
>>>>> static int dwc3_omap_id_notifier(struct notifier_block *nb,
>>>>> unsigned long event, void *ptr)
>>>>> {
>>>>> @@ -490,7 +488,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
>>>>> omap->irq = irq;
>>>>> omap->base = base;
>>>>> omap->vbus_reg = vbus_reg;
>>>>> - dev->dma_mask = &dwc3_omap_dma_mask;
>>>>> + dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
>>>>
>>>> I think, It'll be better to just remove DMA configuration code
>>>> from this driver and other drivers which support DT-boot mode only.
>>>
>>> I don't have HW, can you test that on AM57x and/or AM437x ?
>>>
>>
>> Yes. I can. With below change I see no issues with USB in Host mode
>> on my AM57x board:
>
> what about peripheral side ? Host mode worked fine on K2 devices, only
> peripheral suffered from the bad DMA API usage.
>
As I've mentioned before (and we verified that) on newer kernels
peripheral mode has been fixed by commit:
7ace8fc usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU
Also, on OMAP devices dwc3 core device is created from DT now (dwc3-omap calls
of_platform_populate()), so it's safe to drop manual DMA configuration code
from this driver (and if statement should be kept unchanged in dwc3/core.c
- as per my comment on your patch 5).
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly
[not found] ` <5703A4AE.1090301-l0cyMroinI0@public.gmane.org>
@ 2016-04-05 11:44 ` Felipe Balbi
0 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2016-04-05 11:44 UTC (permalink / raw)
To: Grygorii Strashko, Felipe Balbi, Linux USB Mailing List
Cc: Santosh Shilimkar, Tony Lindgren, Linux OMAP Mailing List,
Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard, Andy Gross,
Ivan T . Ivanov
[-- Attachment #1: Type: text/plain, Size: 2671 bytes --]
Hi,
Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
> On 04/05/2016 01:29 PM, Felipe Balbi wrote:
>> Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
>>> On 04/05/2016 08:51 AM, Felipe Balbi wrote:
>>>> Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> writes:
>>>>> On 04/02/2016 11:28 AM, Felipe Balbi wrote:
>>>>>> Instead of having a static global just for
>>>>>> initializing dma_mask directly, let's use
>>>>>> dma_coerce_mask_and_coherent() for that.
>>>>>>
>>>>>> Signed-off-by: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>>>>>> ---
>>>>>> drivers/usb/dwc3/dwc3-omap.c | 4 +---
>>>>>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
>>>>>> index 22e9606d8e08..c219118bfda0 100644
>>>>>> --- a/drivers/usb/dwc3/dwc3-omap.c
>>>>>> +++ b/drivers/usb/dwc3/dwc3-omap.c
>>>>>> @@ -331,8 +331,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
>>>>>> dwc3_omap_write_irqmisc_clr(omap, reg);
>>>>>> }
>>>>>>
>>>>>> -static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
>>>>>> -
>>>>>> static int dwc3_omap_id_notifier(struct notifier_block *nb,
>>>>>> unsigned long event, void *ptr)
>>>>>> {
>>>>>> @@ -490,7 +488,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
>>>>>> omap->irq = irq;
>>>>>> omap->base = base;
>>>>>> omap->vbus_reg = vbus_reg;
>>>>>> - dev->dma_mask = &dwc3_omap_dma_mask;
>>>>>> + dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
>>>>>
>>>>> I think, It'll be better to just remove DMA configuration code
>>>>> from this driver and other drivers which support DT-boot mode only.
>>>>
>>>> I don't have HW, can you test that on AM57x and/or AM437x ?
>>>>
>>>
>>> Yes. I can. With below change I see no issues with USB in Host mode
>>> on my AM57x board:
>>
>> what about peripheral side ? Host mode worked fine on K2 devices, only
>> peripheral suffered from the bad DMA API usage.
>>
>
> As I've mentioned before (and we verified that) on newer kernels
> peripheral mode has been fixed by commit:
>
> 7ace8fc usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU
>
> Also, on OMAP devices dwc3 core device is created from DT now (dwc3-omap calls
> of_platform_populate()), so it's safe to drop manual DMA configuration code
> from this driver (and if statement should be kept unchanged in dwc3/core.c
> - as per my comment on your patch 5).
fair enough, all I'm missing now is a proper patch ;-)
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-04-05 11:44 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-02 8:28 [PATCH 0/6] usb: dwc3: DMA API usage Felipe Balbi
[not found] ` <1459585739-21204-1-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-02 8:28 ` [PATCH 1/6] usb: dwc3: st: fix dma initialization Felipe Balbi
2016-04-02 8:28 ` [PATCH 2/6] usb: dwc3: omap: don't access DMA bits directly Felipe Balbi
[not found] ` <1459585739-21204-3-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-04 13:53 ` Grygorii Strashko
[not found] ` <570271BF.9040902-l0cyMroinI0@public.gmane.org>
2016-04-05 5:51 ` Felipe Balbi
[not found] ` <87y48s4n7y.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-05 9:30 ` Grygorii Strashko
[not found] ` <570385AB.8060507-l0cyMroinI0@public.gmane.org>
2016-04-05 10:29 ` Felipe Balbi
[not found] ` <87egak4adi.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-05 11:42 ` Grygorii Strashko
[not found] ` <5703A4AE.1090301-l0cyMroinI0@public.gmane.org>
2016-04-05 11:44 ` Felipe Balbi
2016-04-02 8:28 ` [PATCH 3/6] usb: dwc3: keystone: initialize dma_mask and coherent Felipe Balbi
2016-04-02 8:28 ` [PATCH 4/6] usb: dwc3: of-simple: " Felipe Balbi
2016-04-02 8:28 ` [PATCH 5/6] usb: dwc3: core: don't access DMA bits directly Felipe Balbi
[not found] ` <1459585739-21204-6-git-send-email-felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-04 13:53 ` Grygorii Strashko
[not found] ` <570271C3.9030707-l0cyMroinI0@public.gmane.org>
2016-04-05 5:52 ` Felipe Balbi
2016-04-02 8:28 ` [PATCH 6/6] usb: dwc3: host: " Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).