[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170112002618.14207-1-shuahkh@osg.samsung.com>
Date: Wed, 11 Jan 2017 17:26:18 -0700
From: Shuah Khan <shuahkh@....samsung.com>
To: balbi@...nel.org, gregkh@...uxfoundation.org, arnd@...db.de
Cc: Shuah Khan <shuahkh@....samsung.com>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] usb: dwc3-exynos Fix dma_mask WARN_ON from xhci_plat_probe()
During dwc3_exynos_probe(), WARN_ON(!pdev->dev.dma_mask) is triggered from
xhci_plat_probe(). dwc3_host_init() doesn't configure DMA prior to adding
the platform device.
dwc3_host_init() was changed to not configure DMA with the change to use
bus->sysdev for DMA config.
sysdev_is_parent is not true for dwc3-exynos. This might be the reason why
there is a need to configure DMA in dwc3_host_init() prior to adding the
platform device for xhci in this path.
This fix adds the DMA config to dwc3_host_init() without undoing any other
changes in
commit d64ff406e51e ("usb: dwc3: use bus->sysdev for DMA configuration")
[ 3.372356] WARNING: CPU: 2 PID: 108 at drivers/usb/host/xhci-plat.c:168 xhc0
[ 3.381381] Modules linked in:
[ 3.384373] CPU: 2 PID: 108 Comm: kworker/2:1 Not tainted 4.10.0-rc2-00250-g8
[ 3.392783] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[ 3.398854] Workqueue: events deferred_probe_work_func
[ 3.403994] [<c010e19c>] (unwind_backtrace) from [<c010ae84>] (show_stack+0x)
[ 3.411696] [<c010ae84>] (show_stack) from [<c0335d50>] (dump_stack+0x78/0x8)
[ 3.418877] [<c0335d50>] (dump_stack) from [<c011aef8>] (__warn+0xe8/0x100)
[ 3.425796] [<c011aef8>] (__warn) from [<c011afc0>] (warn_slowpath_null+0x20)
[ 3.433344] [<c011afc0>] (warn_slowpath_null) from [<c04deb74>] (xhci_plat_p)
[ 3.441845] [<c04deb74>] (xhci_plat_probe) from [<c041f1dc>] (platform_drv_p)
[ 3.450157] [<c041f1dc>] (platform_drv_probe) from [<c041d848>] (driver_prob)
[ 3.458994] [<c041d848>] (driver_probe_device) from [<c041bd78>] (bus_for_ea)
[ 3.467485] [<c041bd78>] (bus_for_each_drv) from [<c041d538>] (__device_atta)
[ 3.475716] [<c041d538>] (__device_attach) from [<c041cb70>] (bus_probe_devi)
[ 3.483872] [<c041cb70>] (bus_probe_device) from [<c041af54>] (device_add+0x)
[ 3.491741] [<c041af54>] (device_add) from [<c041ef4c>] (platform_device_add)
[ 3.499892] [<c041ef4c>] (platform_device_add) from [<c04a5168>] (dwc3_host_)
[ 3.508379] [<c04a5168>] (dwc3_host_init) from [<c04a4f64>] (dwc3_probe+0x94)
[ 3.516091] [<c04a4f64>] (dwc3_probe) from [<c041f1dc>] (platform_drv_probe+)
[ 3.523975] [<c041f1dc>] (platform_drv_probe) from [<c041d848>] (driver_prob)
[ 3.532814] [<c041d848>] (driver_probe_device) from [<c041bd78>] (bus_for_ea)
[ 3.541306] [<c041bd78>] (bus_for_each_drv) from [<c041d538>] (__device_atta)
[ 3.549538] [<c041d538>] (__device_attach) from [<c041cb70>] (bus_probe_devi)
[ 3.557684] [<c041cb70>] (bus_probe_device) from [<c041af54>] (device_add+0x)
[ 3.565582] [<c041af54>] (device_add) from [<c0576334>] (of_platform_device_)
[ 3.574586] [<c0576334>] (of_platform_device_create_pdata) from [<c0576464>])
[ 3.584722] [<c0576464>] (of_platform_bus_create) from [<c05767d8>] (of_plat)
[ 3.593828] [<c05767d8>] (of_platform_populate) from [<c04ab334>] (dwc3_exyn)
[ 3.602660] [<c04ab334>] (dwc3_exynos_probe) from [<c041f1dc>] (platform_drv)
[ 3.611150] [<c041f1dc>] (platform_drv_probe) from [<c041d848>] (driver_prob)
[ 3.619988] [<c041d848>] (driver_probe_device) from [<c041bd78>] (bus_for_ea)
[ 3.628480] [<c041bd78>] (bus_for_each_drv) from [<c041d538>] (__device_atta)
[ 3.636712] [<c041d538>] (__device_attach) from [<c041cb70>] (bus_probe_devi)
[ 3.644857] [<c041cb70>] (bus_probe_device) from [<c041d04c>] (deferred_prob)
[ 3.653798] [<c041d04c>] (deferred_probe_work_func) from [<c0130c68>] (proce)
Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
Arnd! I isolated the smallest change to avoid the WARN_ON. Please let me
know if this problem could be fixed in another way.
drivers/usb/dwc3/host.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index 487f0ff..f68f71f 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -84,7 +84,10 @@ int dwc3_host_init(struct dwc3 *dwc)
return -ENOMEM;
}
+ dma_set_coherent_mask(&xhci->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.7.4
Powered by blists - more mailing lists