Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755349AbcKBFiy (ORCPT ); Wed, 2 Nov 2016 01:38:54 -0400 Received: from mail-sn1nam02on0062.outbound.protection.outlook.com ([104.47.36.62]:54182 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752604AbcKBFiv (ORCPT ); Wed, 2 Nov 2016 01:38:51 -0400 Authentication-Results: spf=none (sender IP is 192.88.158.2) smtp.mailfrom=lvd5587.freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=nxp.com; From: Sriram Dash To: , CC: , , , , , , Arnd Bergmann , Sriram Dash Subject: [PATCH v2 5/6] usb: dwc3: use bus->sysdev for DMA configuration Date: Wed, 2 Nov 2016 11:08:12 +0530 Message-ID: <1478065093-6923-6-git-send-email-sriram.dash@nxp.com> X-Mailer: git-send-email 1.7.7.4 In-Reply-To: <1478065093-6923-1-git-send-email-sriram.dash@nxp.com> References: <1478065093-6923-1-git-send-email-sriram.dash@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131225387272976339;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.158.2;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(6039001)(7916002)(2980300002)(428002)(189002)(199003)(229853001)(90966002)(189998001)(2906002)(106466001)(101416001)(2950100002)(42882006)(11100500001)(626004)(33646002)(92566002)(4326007)(46386002)(960300001)(103686003)(7416002)(5003940100001)(47776003)(105586002)(50466002)(305945005)(86372001)(45336002)(19580395003)(19580405001)(7846002)(36756003)(42186005)(97736004)(5001770100001)(356003)(4720700003)(6666003)(575784001)(5660300001)(69596002)(50226002)(8666005)(76176999)(50986999)(68736007)(8676002)(52956003)(8936002)(48376002)(81156014)(586003)(87936001)(81166006)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR03MB2378;H:az84smr01.freescale.net;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:0;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD022;1:hfd7svdJHwhYMesCeBFz94DHVan+JqJxim0IvJZ6JaNIANpNOibOS3FbBdBWZveLhoKCu8a+0snkezJYpfnFhZcFSN+hUbuxO+rwSXH1toIe9fR7tkCFeshVp0wiCkvEkXsi35zDiIi6mwdWG3V8iB7SsjwCEbsHY2sN0NGJukJez3b9PCl1wr/GahY+NPEppUuFHm+Q9SgZ4WI+xSe76zwcW0b42Lb1U8vum+A4GVKzxyD9vkRHRYf4w98UUe1XYZB6tht/P2cde4Hmu73HYXDsTmbXfnjEccx5zNx2DAMBN6qPbSJtXMbwEIxuc+YCI15+ahuXV08uvIed6K1UWqfHQaRNcvyuRAyB0fp7/WauBzMhCr1ukDrXEHD11wnJ11DzORSGqnsalsmvkLVP2lg+taKffMs1v0EEvq1bwZWjp9lmvJigGqrcRwQpYoDDMnqovzLnScbQZRNjXM1rMXgkSsCHR0RPeab8WvoAbnmczN4527wnf3nLCW/ITQvgdBhUuBUl61wdbZxcGn6TUxD65p6kZhtIktAbZ4m/L+yjl04rEEawWTfD7xPl18gtEys89boIW6Cvvz0iwsOGA+NdF1I0AFPZ78nMzjZjKY0R1NKTF93SK9ToZ5V/yer3l6fpCqrc/k1/glhY2dIMlA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 04c53dfe-61ef-4791-2ccb-08d402e2844f X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2378;2:gSzgApSCZJ1gi+AeEqTrWcpDUQbIAjFYO4W4q6a2UYZ9FY12HyztQOZVBkYfZf0puf77iEAo0+GFCMqJbXKILWLNZG87NYdzL/Zfo19cR85/idSYNrkSz4vHF3Prub8/lp5Rf9Umiyjj8QAICemwasPcOXAqbwmz1ZeeQBybajCiUeWjVpHujJ4QThWQhDffXRtVLz0ogiQNoeatA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UgpyBTN1TVnyt8d4FrgqZbfmUPU3hieTg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(13017025)(13024025)(13018025)(13023025)(13015025)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:CY1PR03MB2378;BCL:0;PCL:0;RULEID:(400006);SRVR:CY1PR03MB2378; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2378;4:NIH0X+IyEwSN4nZyWo66rlJ4EfP+EjODJwhZG2FdZG+5n9uzVYPDTQf7N50eZ1s4C81hwGxXBTwaThatm1RjDurQ+d4YcYvTqObpSd5jlxkNW6VdxSj9z0xRVISFfGEn7NYuhDwh4mRyzkAkupn549H0ordfAxn7AplMr5NSHx6gbsLUKy2qKQyij1Em0pgNN7ZWidCmkifWHnZsDJ8ewGPwo0uczQeAEpQ7GJS2Or+689alKWuyEhiw6My7NyAufiRV1aDJX+ist1bhqfmh4gGoGpzqln6bj6wOa+Z0Fl9fEscCVyc17Rj+jOcI3UGFy7dqBRnYNAzhLpnjjOcDbSq/cViN1X985DygHiJHEqMZHtk0xfUKLZ+7+RLwirz/Mp5AoLY5sMsLKb9NzU3Wi0BFt5qbyva5IVwzMQkQl4GBFEveS5KhWUlLNU4M69NrzPhYAuBb7nKTNufSLakq5C2cUhHTiIyBKVhKj8WwWmQxP/DcGRKptZQBQMVIDfhb1qzJ9dW8B0RD5OiTWihqZSqiBOnaTnSaDlUXJ996wE9TO+VE5HvJ3ZD8RsDu+5bF X-Forefront-PRVS: 0114FF88F6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR03MB2378;23:ABmtlLQI68TgO/bf5+QaWKuXU9IKnmrhsehTNktn3?= =?us-ascii?Q?jkxvkISaTO3+YjqiQdLhlHC3nzx/l+ij569FWTuO6D25m91WWphDle8VT4Ik?= =?us-ascii?Q?j/pchmN3mAMHHg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lOGBIW/M/hoSlTxhptoy1Kf6o5xb9o6F41MOtGxUwkjdCJH/dJ+lvZ6Jdd8aTC5Nw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2378;7:j2esSvqSwo0vjONkbLqtaxZAAmYLn1q9qwqhG/0YlSyNuKQHsWi4joKG0onFab2efKJWAuhZpbenmRib23PZVBV5MBhwrkWDvhXYr++JQbpliSfhl/AaC7ayrBcDmCSGuLF+o4JadPfdKzH4D4KAwmrGvNaSmu2GANNixy8SolwjuXTUSrNdaJCjK1xhfxlqElKdjzKNCkYMlnNz8Hi/rPRrjWOsECgjIHzj/JP6nWC0jfEGLi5Wy42n/EPzNHb1uKRXUsXFSHCfYx3wJnNip0yqn/UvJPITrh0FO1XbiVDgEcxUxnsKe1ywjgEu5WyEz/Fz2FKKKrbSUecPZe89HG+9SV/lMdN54Hb2106u2TU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2016 05:38:47.0480 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2378 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10406 Lines: 315 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 --- Changes in v2: - integrate dwc3 driver changes together drivers/usb/dwc3/core.c | 28 +++++++++++++++------------- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/ep0.c | 8 ++++---- drivers/usb/dwc3/gadget.c | 37 +++++++++++++++++++------------------ drivers/usb/dwc3/host.c | 12 ++++-------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7287a76..0af0dc0 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -229,7 +230,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); } /** @@ -251,7 +252,7 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc, evt->dwc = dwc; evt->length = length; - 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); @@ -370,11 +371,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; } @@ -398,7 +399,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: @@ -417,7 +418,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); } @@ -943,6 +944,13 @@ static int dwc3_probe(struct platform_device *pdev) dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1); dwc->mem = mem; dwc->dev = dev; +#ifdef CONFIG_PCI + /* TODO: or some other way of detecting this? */ + if (dwc->dev->parent && dwc->dev->parent->bus == &pci_bus_type) + dwc->sysdev = dwc->dev->parent; + else +#endif + dwc->sysdev = dwc->dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -1051,12 +1059,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 6b60e42..b166b0a 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -851,6 +851,7 @@ struct dwc3 { spinlock_t lock; struct device *dev; + struct device *sysdev; struct platform_device *xhci; struct resource xhci_resources[DWC3_XHCI_RESOURCES_NUM]; diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index fe79d77..4d13723 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -974,8 +974,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) { dwc3_trace(trace_dwc3_ep0, "failed to map request"); return; @@ -1002,8 +1002,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) { dwc3_trace(trace_dwc3_ep0, "failed to map request"); return; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 1dfa56a5f..84fff5e 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -185,8 +185,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); @@ -365,7 +365,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) { @@ -381,7 +381,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; @@ -989,8 +989,8 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param) * here and stop, unmap, free and del each of the linked * requests instead of what we do now. */ - usb_gadget_unmap_request(&dwc->gadget, &req->request, - req->direction); + usb_gadget_unmap_request_by_dev(dwc->sysdev, + &req->request, req->direction); list_del(&req->list); return ret; } @@ -1063,8 +1063,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; @@ -2889,7 +2889,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"); @@ -2897,8 +2897,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; @@ -2911,7 +2912,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) { @@ -2983,18 +2984,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: @@ -3009,16 +3010,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 f6533c6..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(&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; @@ -112,9 +108,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; @@ -123,8 +119,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); } -- 2.1.0