Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752549AbcLMX7J (ORCPT ); Tue, 13 Dec 2016 18:59:09 -0500 Received: from mail-db5eur01on0122.outbound.protection.outlook.com ([104.47.2.122]:3136 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750910AbcLMX7H (ORCPT ); Tue, 13 Dec 2016 18:59:07 -0500 X-Greylist: delayed 15348 seconds by postgrey-1.27 at vger.kernel.org; Tue, 13 Dec 2016 18:59:06 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=alexander.sverdlin@nokia.com; Subject: Re: [v5,5/6] usb: dwc3: use bus->sysdev for DMA configuration To: Sriram Dash , , References: <1479383028-27701-6-git-send-email-sriram.dash@nxp.com> CC: , , , , , , Arnd Bergmann From: Alexander Sverdlin Message-ID: <1d82b3a0-ae13-ed2a-77e2-8faeec2c5f9f@nokia.com> Date: Tue, 13 Dec 2016 17:09:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <1479383028-27701-6-git-send-email-sriram.dash@nxp.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [131.228.32.185] X-ClientProxiedBy: DB6PR1001CA0021.EURPRD10.PROD.OUTLOOK.COM (10.171.79.31) To HE1PR07MB1322.eurprd07.prod.outlook.com (10.164.52.12) X-MS-Office365-Filtering-Correlation-Id: 7084da07-c919-498a-69bb-08d42372760f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:HE1PR07MB1322; X-Microsoft-Exchange-Diagnostics: 1;HE1PR07MB1322;3:ZpnDUYxChcmqY/QPSP85obTRha/EGr9F1Ows7QiICrwUgwVgBggb0eepKy81/Qh3SUlFkELFmCTmyz1AevpfeN8vv+zhssMic7NV3bb40bcn80v/Vg7Uuju7uaFgL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31:d/Vbj0850DcYCARF176gI9qfwZ+gfnYTvTo1TT40RlhQ1iYPs1Jd2cqrtg4tR9QGchDPDiaG/Ad+3PQXk1IKbojuCmN2UBdq411HA6ZnczvCs/3/3HYsZvpp8BOfjTVcQ8UMJk/0GUWLQykAx7PJRf5GqY5b3Is4Xns7A3iWL2J6a0bh5DXcLPGM1vuG2DkJtXL3+svJocnVUMmTGOJD2SQ33Zgb7TdUXUlZ75AK3RxI2GpUJQIa2KxQW9GWzFCXnVKUng34Qr7rqj6d8CH2SQ==;20:wPNaTG2wx/i04Gg8Q8B81rar8XZrFd1ambRihcT40t1jM92VVp6TlVP3PXK1scPfN+zDMD4Q19u6IZu0VgbLiDMD5HAP4HL3kM3AOTezBlSw9u+l1hOxtphlOZOcy1umuRsXWnozsj+SWdhu95K5NzaJQ0m00fw0cnVchF4gZIjIhtQm1vPQ3uKTDR9CnWcbgLdt7+Iw7Q8HIt9JFHTJmtNLkQzY4mEW/dSO1B0S09TAFYB7SD70wicyPxHteaxvV5e8tvxGpt+PSE4tIdmsqmdJ766emkVIamGzxPAW6hxWubxUpJbtYIYgfmbEEj0TS7d4TwsqFO0dDvfbAy8JQ4KBoqFm4/jDTObRePOUMAVw4l2jJbj7Mf6o+kIOfb62zEb4oWlCn92imOHGRnK5TlopGMa7//vdLcXOIut30I1pwvvwksfxMTHngud0EjUH3JV8MtED+OuMavUGvNiy4deZXllTxMC4uFK72pkC5W4J6ZH/iNLTXP5Cdo6VTN/Z X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(6072148);SRVR:HE1PR07MB1322;BCL:0;PCL:0;RULEID:;SRVR:HE1PR07MB1322; X-Microsoft-Exchange-Diagnostics: 1;HE1PR07MB1322;4:V3oa+NMCCV1X3Qd5MCRLnZsWyIimsbPKJ7inxzhZHxxvkAgQKcsERI8ZQ83en04SVuL5krypawJg7hkL0775gzH25NCIaQAKTqLnObMIzyqoF/od3Lg+3x1yoroNHo4aw+wiVz5f7CIp3Lj6UctIvOoM/egzqQlaSSDTYL5LTTjiGJPtjwrEZgDsCwZMnLPy/hv1PgcrnbwS3FGB0X2OuR4zGqKNi2bnJ0lNUKk1/QCOBW6UrmLyenqL5qLGaAbql/fc3bgNgvzpVBkOsDEn2+hr2Q5IZMoialwe3xLlQwjvAFOACIYFTBuBeCOqcVzb8Fpo68mv4qQr943Gf60NEXFUhfmKnUr4sdyEfaVulVDhMm9YWHIGHcpoHqVCVVCGAV3hcsSVDXL5ihM9H/qbbNrqd5O0IfHiKucc9CG2eRF/kfn8sp+uhJBWsDjv60WsnNGl9ZM3bnPEr+B8RCX5VmqT7YDo8kA6lJm2qnsGHeXh25ulVMy0jGgQt6MGhlmwymi+Iz57DZfjGDkoNdppuomn3CzkpRshUKI43+tPX6um45GdO4eTl7gtQrXpuvAR2yzP4p55Hh/LiB1old0JMmLkhxXJWTNudEpowA694o3eg4/CJ9Idl6z+QkZ9NJxGjSqOzCALr7t3CAPFtnWuSHoEDROGle5FYUZ+gteXwS4= X-Forefront-PRVS: 01559F388D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(39840400002)(39410400002)(39450400003)(39860400002)(39850400002)(189002)(24454002)(199003)(36756003)(54356999)(81166006)(86362001)(2906002)(50986999)(4326007)(5660300001)(76176999)(83506001)(2950100002)(77096006)(90366009)(8676002)(65956001)(6486002)(47776003)(81156014)(230700001)(68736007)(6666003)(66066001)(39060400001)(65806001)(38730400001)(65826007)(229853002)(31696002)(189998001)(575784001)(31686004)(101416001)(8666005)(7416002)(305945005)(7736002)(6116002)(42186005)(64126003)(33646002)(92566002)(97736004)(2201001)(4001350100001)(105586002)(5001770100001)(106356001)(50466002)(23676002)(3846002)(7059030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M6dE1+wXclB8xty5zkCm2p2VyOHs4x6RRPw98UPZ7JQ7GZoRrCZGDZehzA+GIP0R3qf+Yw==;24:05ZLIozAL/IG90jryDpqVGIa/jzL3TrdW0rGQFRwh9EoJo65SkVIHU/Fo2M3n0hCl6c7utTN8LfAiGp82IuwMTKAhxI8+70faFeV172DXpA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR07MB1322;7:J/N8amhwXuP9N7CCfOXPdeXZrkphOTwQ12yGIKhJWfvfUMbqzKUd2f/SPLaCFm2EoUUWsu82GGIHIMKCMyQpDh46ee+DwesAysmF6q/qUxG37rRRpzZXf1vc/HwLOBaahujIN5LuAFXGhGdoZmI1Vza3ikDtHJ3YV7vgPSI+keqIgT+zceucIncWtxbTO8AhXV6IBZxUGDB1b0jPcmaG3W3FPohhdk37e4JaQ0V/S3YgDEDC6P8rJSg9U0yqAxaAksPRdSf8qORl26LMqG8DyclUlR3Y3HRbrg+vVs3pdjtFs3QTmr7LUCdh0xy0/3Atv20WitZ71qXV2ZeH6/9hZ72xuQxKAM7n9PyiynW7fW36C1vBQ4E2L0KWrKlJsxsxl/iZ/Ivz8W4tzh68Kx42WzxFUVKBtH345IR8tWJ3kKHsSLCGNphLWTDk1GEzatPUcuj6+pP30D9mtACPtxx+9g==;23:ouyLYr3qkPzpo0X2KXRbszA66yNMlL6DdHz9xJ99028pdDPaGtdTJd3j+IzD7EXTMumcRXii63KuwyGfjNtaqJoJZ9rsh/MpuxrhKm2dEjX4xwWL52ofgNK3obMfXduRBsLfGH0Gw8z//FEd6xisLA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 16:09:46.8198 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB1322 X-OriginatorOrg: nokia.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 12705 Lines: 370 Hi! On 17/11/16 12:43, Sriram Dash wrote: > From: Arnd Bergmann > > The dma ops for dwc3 devices are not set properly. So, use a > physical device sysdev, which will be inherited from parent, > to set the hardware / firmware parameters like dma. > > Signed-off-by: Arnd Bergmann > Signed-off-by: Sriram Dash > Tested-by: Baolin Wang Successfully tested on arm64/axxia with DWC3 USB host, XHCIs properly inherit DMA configuration. Therefore: Tested-by: Alexander Sverdlin > --- > Changes in v5: > - rebase to usb testing/next > > Changes in v4: > - removed the ifdefs for pci > - made the sysdev as a device property > - phy create lookup take up the correct device. > > Changes in v3: > - No update > > Changes in v2: > - integrate dwc3 driver changes together > > drivers/usb/dwc3/core.c | 27 ++++++++++++++------------- > drivers/usb/dwc3/core.h | 3 +++ > drivers/usb/dwc3/dwc3-pci.c | 10 ++++++++++ > drivers/usb/dwc3/ep0.c | 8 ++++---- > drivers/usb/dwc3/gadget.c | 33 +++++++++++++++++---------------- > drivers/usb/dwc3/host.c | 16 ++++++---------- > 6 files changed, 54 insertions(+), 43 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index e951448..e5fbab2 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -202,7 +202,7 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc) > static void dwc3_free_one_event_buffer(struct dwc3 *dwc, > struct dwc3_event_buffer *evt) > { > - dma_free_coherent(dwc->dev, evt->length, evt->buf, evt->dma); > + dma_free_coherent(dwc->sysdev, evt->length, evt->buf, evt->dma); > } > > /** > @@ -228,7 +228,7 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc, > if (!evt->cache) > return ERR_PTR(-ENOMEM); > > - evt->buf = dma_alloc_coherent(dwc->dev, length, > + evt->buf = dma_alloc_coherent(dwc->sysdev, length, > &evt->dma, GFP_KERNEL); > if (!evt->buf) > return ERR_PTR(-ENOMEM); > @@ -341,11 +341,11 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) > if (!WARN_ON(dwc->scratchbuf)) > return 0; > > - scratch_addr = dma_map_single(dwc->dev, dwc->scratchbuf, > + scratch_addr = dma_map_single(dwc->sysdev, dwc->scratchbuf, > dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE, > DMA_BIDIRECTIONAL); > - if (dma_mapping_error(dwc->dev, scratch_addr)) { > - dev_err(dwc->dev, "failed to map scratch buffer\n"); > + if (dma_mapping_error(dwc->sysdev, scratch_addr)) { > + dev_err(dwc->sysdev, "failed to map scratch buffer\n"); > ret = -EFAULT; > goto err0; > } > @@ -369,7 +369,7 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) > return 0; > > err1: > - dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch * > + dma_unmap_single(dwc->sysdev, dwc->scratch_addr, dwc->nr_scratch * > DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); > > err0: > @@ -388,7 +388,7 @@ static void dwc3_free_scratch_buffers(struct dwc3 *dwc) > if (!WARN_ON(dwc->scratchbuf)) > return; > > - dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch * > + dma_unmap_single(dwc->sysdev, dwc->scratch_addr, dwc->nr_scratch * > DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); > kfree(dwc->scratchbuf); > } > @@ -927,6 +927,13 @@ static void dwc3_get_properties(struct dwc3 *dwc) > dwc->dr_mode = usb_get_dr_mode(dev); > dwc->hsphy_mode = of_usb_get_phy_mode(dev->of_node); > > + dwc->sysdev_is_parent = device_property_read_bool(dev, > + "linux,sysdev_is_parent"); > + if (dwc->sysdev_is_parent) > + dwc->sysdev = dwc->dev->parent; > + else > + dwc->sysdev = dwc->dev; > + > dwc->has_lpm_erratum = device_property_read_bool(dev, > "snps,has-lpm-erratum"); > device_property_read_u8(dev, "snps,lpm-nyet-threshold", > @@ -1097,12 +1104,6 @@ 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); > - } > - > 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/core.h b/drivers/usb/dwc3/core.h > index ef81fa5..de5a857 100644 > --- a/drivers/usb/dwc3/core.h > +++ b/drivers/usb/dwc3/core.h > @@ -819,6 +819,7 @@ struct dwc3_scratchpad_array { > * @ep0_bounced: true when we used bounce buffer > * @ep0_expect_in: true when we expect a DATA IN transfer > * @has_hibernation: true when dwc3 was configured with Hibernation > + * @sysdev_is_parent: true when dwc3 device has a parent driver > * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that > * there's now way for software to detect this in runtime. > * @is_utmi_l1_suspend: the core asserts output signal > @@ -875,6 +876,7 @@ struct dwc3 { > spinlock_t lock; > > struct device *dev; > + struct device *sysdev; > > struct platform_device *xhci; > struct resource xhci_resources[DWC3_XHCI_RESOURCES_NUM]; > @@ -976,6 +978,7 @@ struct dwc3 { > unsigned ep0_bounced:1; > unsigned ep0_expect_in:1; > unsigned has_hibernation:1; > + unsigned sysdev_is_parent:1; > unsigned has_lpm_erratum:1; > unsigned is_utmi_l1_suspend:1; > unsigned is_fpga:1; > diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c > index 2b0e34d..2b73339 100644 > --- a/drivers/usb/dwc3/dwc3-pci.c > +++ b/drivers/usb/dwc3/dwc3-pci.c > @@ -73,6 +73,16 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) > { > struct platform_device *dwc3 = dwc->dwc3; > struct pci_dev *pdev = dwc->pci; > + int ret; > + > + struct property_entry sysdev_property[] = { > + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), > + { }, > + }; > + > + ret = platform_device_add_properties(dwc3, sysdev_property); > + if (ret) > + return ret; > > if (pdev->vendor == PCI_VENDOR_ID_AMD && > pdev->device == PCI_DEVICE_ID_AMD_NL_USB) { > diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c > index 2b22ea7..2d7fb2d 100644 > --- a/drivers/usb/dwc3/ep0.c > +++ b/drivers/usb/dwc3/ep0.c > @@ -1000,8 +1000,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, > u32 transfer_size = 0; > u32 maxpacket; > > - ret = usb_gadget_map_request(&dwc->gadget, &req->request, > - dep->number); > + ret = usb_gadget_map_request_by_dev(dwc->sysdev, > + &req->request, dep->number); > if (ret) > return; > > @@ -1026,8 +1026,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, > dwc->ep0_bounce_addr, transfer_size, > DWC3_TRBCTL_CONTROL_DATA, false); > } else { > - ret = usb_gadget_map_request(&dwc->gadget, &req->request, > - dep->number); > + ret = usb_gadget_map_request_by_dev(dwc->sysdev, > + &req->request, dep->number); > if (ret) > return; > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index e2416de..6785595 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -183,8 +183,8 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, > if (dwc->ep0_bounced && dep->number == 0) > dwc->ep0_bounced = false; > else > - usb_gadget_unmap_request(&dwc->gadget, &req->request, > - req->direction); > + usb_gadget_unmap_request_by_dev(dwc->sysdev, > + &req->request, req->direction); > > trace_dwc3_gadget_giveback(req); > > @@ -399,7 +399,7 @@ static int dwc3_alloc_trb_pool(struct dwc3_ep *dep) > if (dep->trb_pool) > return 0; > > - dep->trb_pool = dma_alloc_coherent(dwc->dev, > + dep->trb_pool = dma_alloc_coherent(dwc->sysdev, > sizeof(struct dwc3_trb) * DWC3_TRB_NUM, > &dep->trb_pool_dma, GFP_KERNEL); > if (!dep->trb_pool) { > @@ -415,7 +415,7 @@ static void dwc3_free_trb_pool(struct dwc3_ep *dep) > { > struct dwc3 *dwc = dep->dwc; > > - dma_free_coherent(dwc->dev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM, > + dma_free_coherent(dwc->sysdev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM, > dep->trb_pool, dep->trb_pool_dma); > > dep->trb_pool = NULL; > @@ -1171,8 +1171,8 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) > > trace_dwc3_ep_queue(req); > > - ret = usb_gadget_map_request(&dwc->gadget, &req->request, > - dep->direction); > + ret = usb_gadget_map_request_by_dev(dwc->sysdev, &req->request, > + dep->direction); > if (ret) > return ret; > > @@ -2977,7 +2977,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) > > dwc->irq_gadget = irq; > > - dwc->ctrl_req = dma_alloc_coherent(dwc->dev, sizeof(*dwc->ctrl_req), > + dwc->ctrl_req = dma_alloc_coherent(dwc->sysdev, sizeof(*dwc->ctrl_req), > &dwc->ctrl_req_addr, GFP_KERNEL); > if (!dwc->ctrl_req) { > dev_err(dwc->dev, "failed to allocate ctrl request\n"); > @@ -2985,8 +2985,9 @@ int dwc3_gadget_init(struct dwc3 *dwc) > goto err0; > } > > - dwc->ep0_trb = dma_alloc_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, > - &dwc->ep0_trb_addr, GFP_KERNEL); > + dwc->ep0_trb = dma_alloc_coherent(dwc->sysdev, > + sizeof(*dwc->ep0_trb) * 2, > + &dwc->ep0_trb_addr, GFP_KERNEL); > if (!dwc->ep0_trb) { > dev_err(dwc->dev, "failed to allocate ep0 trb\n"); > ret = -ENOMEM; > @@ -2999,7 +3000,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) > goto err2; > } > > - dwc->ep0_bounce = dma_alloc_coherent(dwc->dev, > + dwc->ep0_bounce = dma_alloc_coherent(dwc->sysdev, > DWC3_EP0_BOUNCE_SIZE, &dwc->ep0_bounce_addr, > GFP_KERNEL); > if (!dwc->ep0_bounce) { > @@ -3072,18 +3073,18 @@ int dwc3_gadget_init(struct dwc3 *dwc) > > err4: > dwc3_gadget_free_endpoints(dwc); > - dma_free_coherent(dwc->dev, DWC3_EP0_BOUNCE_SIZE, > + dma_free_coherent(dwc->sysdev, DWC3_EP0_BOUNCE_SIZE, > dwc->ep0_bounce, dwc->ep0_bounce_addr); > > err3: > kfree(dwc->setup_buf); > > err2: > - dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, > + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ep0_trb) * 2, > dwc->ep0_trb, dwc->ep0_trb_addr); > > err1: > - dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req), > + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ctrl_req), > dwc->ctrl_req, dwc->ctrl_req_addr); > > err0: > @@ -3098,16 +3099,16 @@ void dwc3_gadget_exit(struct dwc3 *dwc) > > dwc3_gadget_free_endpoints(dwc); > > - dma_free_coherent(dwc->dev, DWC3_EP0_BOUNCE_SIZE, > + dma_free_coherent(dwc->sysdev, DWC3_EP0_BOUNCE_SIZE, > dwc->ep0_bounce, dwc->ep0_bounce_addr); > > kfree(dwc->setup_buf); > kfree(dwc->zlp_buf); > > - dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, > + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ep0_trb) * 2, > dwc->ep0_trb, dwc->ep0_trb_addr); > > - dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req), > + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ctrl_req), > dwc->ctrl_req, dwc->ctrl_req_addr); > } > > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c > index 8c2679e..487f0ff 100644 > --- a/drivers/usb/dwc3/host.c > +++ b/drivers/usb/dwc3/host.c > @@ -84,11 +84,7 @@ 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; > > @@ -111,9 +107,9 @@ int dwc3_host_init(struct dwc3 *dwc) > } > > phy_create_lookup(dwc->usb2_generic_phy, "usb2-phy", > - dev_name(&xhci->dev)); > + dev_name(dwc->dev)); > phy_create_lookup(dwc->usb3_generic_phy, "usb3-phy", > - dev_name(&xhci->dev)); > + dev_name(dwc->dev)); > > ret = platform_device_add(xhci); > if (ret) { > @@ -124,9 +120,9 @@ int dwc3_host_init(struct dwc3 *dwc) > return 0; > err2: > phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", > - dev_name(&xhci->dev)); > + dev_name(dwc->dev)); > phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", > - dev_name(&xhci->dev)); > + dev_name(dwc->dev)); > err1: > platform_device_put(xhci); > return ret; > @@ -135,8 +131,8 @@ int dwc3_host_init(struct dwc3 *dwc) > void dwc3_host_exit(struct dwc3 *dwc) > { > phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", > - dev_name(&dwc->xhci->dev)); > + dev_name(dwc->dev)); > phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", > - dev_name(&dwc->xhci->dev)); > + dev_name(dwc->dev)); > platform_device_unregister(dwc->xhci); > } > -- Best regards, Alexander Sverdlin.