RE: [PATCH 2/3] usb: dwc3: host: Do not use dma_set_coherent_mask

2016-10-26 Thread Sriram Dash
>From: Arnd Bergmann [mailto:a...@arndb.de]
>On Tuesday, October 25, 2016 4:26:27 PM CEST Sriram Dash wrote:
>> Do not require dma_set_coherent_mask for hcd
>>
>> Signed-off-by: Arnd Bergmann 
>
>Aside from the comments I had for patch 3, you are doing two different things
>here:
>
>> diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
>> index 89a2f71..4d7439c 100644
>> --- a/drivers/usb/dwc3/dwc3-st.c
>> +++ b/drivers/usb/dwc3/dwc3-st.c
>> @@ -218,7 +218,6 @@ 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);
>>  dwc3_data->dev = dev;
>>  dwc3_data->regmap = regmap;
>>
>
>This one was setting the mask for the device itself (incorrectly), so it can be
>removed along with the dma_coerce_mask_and_coherent() call in
>dwc3_exynos_probe, or as a separate patch. It is an independent cleanup.
>
>> --- a/drivers/usb/chipidea/core.c
>> +++ b/drivers/usb/chipidea/core.c
>> @@ -833,9 +833,6 @@ struct platform_device *ci_hdrc_add_device(struct
>> device *dev,
>>
>> -dma_set_coherent_mask(>dev, dev->coherent_dma_mask);
>>
>>  ret = platform_device_add_resources(pdev, res, nres);
>>  if (ret)
>
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -1059,12 +1059,6 @@ static int dwc3_probe(struct platform_device
>> *pdev)
>>
>>  spin_lock_init(>lock);
>>
>> -dma_set_coherent_mask(dev, dev->parent-
>>coherent_dma_mask);
>
>> --- a/drivers/usb/dwc3/host.c
>> +++ b/drivers/usb/dwc3/host.c
>> @@ -72,11 +72,7 @@ int dwc3_host_init(struct dwc3 *dwc)
>>  return -ENOMEM;
>>  }
>>
>> -dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
>> -
>
>These three all set the mask for the *child* devices, as that is no longer 
>needed
>after the change in patch 1/3.
>I'd suggest leaving those changes together with the rest of that patch.
>
>However, it's probably better to split up that patch along the boundaries of 
>the
>drivers, starting with the USB core:
>

Ok. Will do the needful in the next version.

>1/4 usb: separate out sysdev pointer from usb_bus
>2/4 usb: chipidea: use bus->sysdev for DMA configuration
>3/4 usb: xhci: use bus->sysdev for DMA configuration
>4/4 usb: dwc3: use bus->sysdev for DMA configuration
>
>   Arnd


RE: [PATCH 2/3] usb: dwc3: host: Do not use dma_set_coherent_mask

2016-10-26 Thread Sriram Dash
>From: Arnd Bergmann [mailto:a...@arndb.de]
>On Tuesday, October 25, 2016 4:26:27 PM CEST Sriram Dash wrote:
>> Do not require dma_set_coherent_mask for hcd
>>
>> Signed-off-by: Arnd Bergmann 
>
>Aside from the comments I had for patch 3, you are doing two different things
>here:
>
>> diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
>> index 89a2f71..4d7439c 100644
>> --- a/drivers/usb/dwc3/dwc3-st.c
>> +++ b/drivers/usb/dwc3/dwc3-st.c
>> @@ -218,7 +218,6 @@ 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);
>>  dwc3_data->dev = dev;
>>  dwc3_data->regmap = regmap;
>>
>
>This one was setting the mask for the device itself (incorrectly), so it can be
>removed along with the dma_coerce_mask_and_coherent() call in
>dwc3_exynos_probe, or as a separate patch. It is an independent cleanup.
>
>> --- a/drivers/usb/chipidea/core.c
>> +++ b/drivers/usb/chipidea/core.c
>> @@ -833,9 +833,6 @@ struct platform_device *ci_hdrc_add_device(struct
>> device *dev,
>>
>> -dma_set_coherent_mask(>dev, dev->coherent_dma_mask);
>>
>>  ret = platform_device_add_resources(pdev, res, nres);
>>  if (ret)
>
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -1059,12 +1059,6 @@ static int dwc3_probe(struct platform_device
>> *pdev)
>>
>>  spin_lock_init(>lock);
>>
>> -dma_set_coherent_mask(dev, dev->parent-
>>coherent_dma_mask);
>
>> --- a/drivers/usb/dwc3/host.c
>> +++ b/drivers/usb/dwc3/host.c
>> @@ -72,11 +72,7 @@ int dwc3_host_init(struct dwc3 *dwc)
>>  return -ENOMEM;
>>  }
>>
>> -dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
>> -
>
>These three all set the mask for the *child* devices, as that is no longer 
>needed
>after the change in patch 1/3.
>I'd suggest leaving those changes together with the rest of that patch.
>
>However, it's probably better to split up that patch along the boundaries of 
>the
>drivers, starting with the USB core:
>

Ok. Will do the needful in the next version.

>1/4 usb: separate out sysdev pointer from usb_bus
>2/4 usb: chipidea: use bus->sysdev for DMA configuration
>3/4 usb: xhci: use bus->sysdev for DMA configuration
>4/4 usb: dwc3: use bus->sysdev for DMA configuration
>
>   Arnd


Re: [PATCH 2/3] usb: dwc3: host: Do not use dma_set_coherent_mask

2016-10-25 Thread Arnd Bergmann
On Tuesday, October 25, 2016 4:26:27 PM CEST Sriram Dash wrote:
> Do not require dma_set_coherent_mask for hcd
> 
> Signed-off-by: Arnd Bergmann 

Aside from the comments I had for patch 3, you are doing two
different things here:

> diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
> index 89a2f71..4d7439c 100644
> --- a/drivers/usb/dwc3/dwc3-st.c
> +++ b/drivers/usb/dwc3/dwc3-st.c
> @@ -218,7 +218,6 @@ 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);
>   dwc3_data->dev = dev;
>   dwc3_data->regmap = regmap;
>  

This one was setting the mask for the device itself (incorrectly),
so it can be removed along with the dma_coerce_mask_and_coherent()
call in dwc3_exynos_probe, or as a separate patch. It is an
independent cleanup.

> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -833,9 +833,6 @@ struct platform_device *ci_hdrc_add_device(struct device 
> *dev,
>
> - dma_set_coherent_mask(>dev, dev->coherent_dma_mask);
>  
>   ret = platform_device_add_resources(pdev, res, nres);
>   if (ret)

> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1059,12 +1059,6 @@ static int dwc3_probe(struct platform_device *pdev)
>  
>   spin_lock_init(>lock);
>  
> - dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);

> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -72,11 +72,7 @@ int dwc3_host_init(struct dwc3 *dwc)
>   return -ENOMEM;
>   }
>  
> - dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
> -

These three all set the mask for the *child* devices, as
that is no longer needed after the change in patch 1/3.
I'd suggest leaving those changes together with the rest of
that patch.

However, it's probably better to split up that patch along the
boundaries of the drivers, starting with the USB core:

1/4 usb: separate out sysdev pointer from usb_bus
2/4 usb: chipidea: use bus->sysdev for DMA configuration
3/4 usb: xhci: use bus->sysdev for DMA configuration
4/4 usb: dwc3: use bus->sysdev for DMA configuration

Arnd


Re: [PATCH 2/3] usb: dwc3: host: Do not use dma_set_coherent_mask

2016-10-25 Thread Arnd Bergmann
On Tuesday, October 25, 2016 4:26:27 PM CEST Sriram Dash wrote:
> Do not require dma_set_coherent_mask for hcd
> 
> Signed-off-by: Arnd Bergmann 

Aside from the comments I had for patch 3, you are doing two
different things here:

> diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
> index 89a2f71..4d7439c 100644
> --- a/drivers/usb/dwc3/dwc3-st.c
> +++ b/drivers/usb/dwc3/dwc3-st.c
> @@ -218,7 +218,6 @@ 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);
>   dwc3_data->dev = dev;
>   dwc3_data->regmap = regmap;
>  

This one was setting the mask for the device itself (incorrectly),
so it can be removed along with the dma_coerce_mask_and_coherent()
call in dwc3_exynos_probe, or as a separate patch. It is an
independent cleanup.

> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -833,9 +833,6 @@ struct platform_device *ci_hdrc_add_device(struct device 
> *dev,
>
> - dma_set_coherent_mask(>dev, dev->coherent_dma_mask);
>  
>   ret = platform_device_add_resources(pdev, res, nres);
>   if (ret)

> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1059,12 +1059,6 @@ static int dwc3_probe(struct platform_device *pdev)
>  
>   spin_lock_init(>lock);
>  
> - dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);

> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -72,11 +72,7 @@ int dwc3_host_init(struct dwc3 *dwc)
>   return -ENOMEM;
>   }
>  
> - dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
> -

These three all set the mask for the *child* devices, as
that is no longer needed after the change in patch 1/3.
I'd suggest leaving those changes together with the rest of
that patch.

However, it's probably better to split up that patch along the
boundaries of the drivers, starting with the USB core:

1/4 usb: separate out sysdev pointer from usb_bus
2/4 usb: chipidea: use bus->sysdev for DMA configuration
3/4 usb: xhci: use bus->sysdev for DMA configuration
4/4 usb: dwc3: use bus->sysdev for DMA configuration

Arnd


[PATCH 2/3] usb: dwc3: host: Do not use dma_set_coherent_mask

2016-10-25 Thread Sriram Dash
Do not require dma_set_coherent_mask for hcd

Signed-off-by: Arnd Bergmann 
---
 drivers/usb/chipidea/core.c | 3 ---
 drivers/usb/dwc3/core.c | 6 --
 drivers/usb/dwc3/dwc3-st.c  | 1 -
 drivers/usb/dwc3/host.c | 4 
 4 files changed, 14 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 69426e6..8917a03 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -833,9 +833,6 @@ struct platform_device *ci_hdrc_add_device(struct device 
*dev,
}
 
pdev->dev.parent = dev;
-   pdev->dev.dma_mask = dev->dma_mask;
-   pdev->dev.dma_parms = dev->dma_parms;
-   dma_set_coherent_mask(>dev, dev->coherent_dma_mask);
 
ret = platform_device_add_resources(pdev, res, nres);
if (ret)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index e0f64ef..0af0dc0 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1059,12 +1059,6 @@ static int dwc3_probe(struct platform_device *pdev)
 
spin_lock_init(>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);
-   }
-
pm_runtime_set_active(dev);
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY);
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
index 89a2f71..4d7439c 100644
--- a/drivers/usb/dwc3/dwc3-st.c
+++ b/drivers/usb/dwc3/dwc3-st.c
@@ -218,7 +218,6 @@ 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);
dwc3_data->dev = dev;
dwc3_data->regmap = regmap;
 
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index bb83eee..045ec27 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -72,11 +72,7 @@ int dwc3_host_init(struct dwc3 *dwc)
return -ENOMEM;
}
 
-   dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
-
xhci->dev.parent= dwc->dev;
-   xhci->dev.dma_mask  = dwc->dev->dma_mask;
-   xhci->dev.dma_parms = dwc->dev->dma_parms;
 
dwc->xhci = xhci;
 
-- 
2.1.0



[PATCH 2/3] usb: dwc3: host: Do not use dma_set_coherent_mask

2016-10-25 Thread Sriram Dash
Do not require dma_set_coherent_mask for hcd

Signed-off-by: Arnd Bergmann 
---
 drivers/usb/chipidea/core.c | 3 ---
 drivers/usb/dwc3/core.c | 6 --
 drivers/usb/dwc3/dwc3-st.c  | 1 -
 drivers/usb/dwc3/host.c | 4 
 4 files changed, 14 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 69426e6..8917a03 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -833,9 +833,6 @@ struct platform_device *ci_hdrc_add_device(struct device 
*dev,
}
 
pdev->dev.parent = dev;
-   pdev->dev.dma_mask = dev->dma_mask;
-   pdev->dev.dma_parms = dev->dma_parms;
-   dma_set_coherent_mask(>dev, dev->coherent_dma_mask);
 
ret = platform_device_add_resources(pdev, res, nres);
if (ret)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index e0f64ef..0af0dc0 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1059,12 +1059,6 @@ static int dwc3_probe(struct platform_device *pdev)
 
spin_lock_init(>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);
-   }
-
pm_runtime_set_active(dev);
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY);
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
index 89a2f71..4d7439c 100644
--- a/drivers/usb/dwc3/dwc3-st.c
+++ b/drivers/usb/dwc3/dwc3-st.c
@@ -218,7 +218,6 @@ 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);
dwc3_data->dev = dev;
dwc3_data->regmap = regmap;
 
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index bb83eee..045ec27 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -72,11 +72,7 @@ int dwc3_host_init(struct dwc3 *dwc)
return -ENOMEM;
}
 
-   dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
-
xhci->dev.parent= dwc->dev;
-   xhci->dev.dma_mask  = dwc->dev->dma_mask;
-   xhci->dev.dma_parms = dwc->dev->dma_parms;
 
dwc->xhci = xhci;
 
-- 
2.1.0