Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp848288imm; Wed, 22 Aug 2018 13:46:00 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdavs2s8wdwzzQ2KTEywGLYj2c5VYvrKMkkAtvoCK2BkEZXn1Pk4RieozU6gOboBERcMJykS X-Received: by 2002:a63:440a:: with SMTP id r10-v6mr7443301pga.417.1534970760646; Wed, 22 Aug 2018 13:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534970760; cv=none; d=google.com; s=arc-20160816; b=qb18+3dudWL65cX177VXqrS1Agt7Dd7lHTu0YxbzbBkB2EzOG6BXGkyTP3eODmz0L/ BQb8orqJ8beM++EqeE3aYnAnODL5QszZd6J7FPBsXIdHuUXloV3p3fFGUiB2k+1+BJy7 pn1jV6XJKf7qwG7LaD/bzYPu7LzUlC7nA3A5+8S0Jj765l6yfhAkfr/8RGDO4laJ2UrV jLTa1NJQPfkvWLlWvLgzfCwF64xePA6SCBcpZLF4bRaR8EzPbsuZSL1T+Jv9stpMb4L/ BOympXZm9VS7wvGj3U4vS3pQd8EeR/dqW//qre+tEKJQ5WVDpfwTk2HBjSD2+DEn2BQT myZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=8fJ9XnSWjVpKVwWtfM+8Ec1aMkoLTpuqbj7Hm39SwSM=; b=hbU7/EoTmEFCw4au6fiDtNZomg914Mu1REkJTmPse0MeZ/hKrNt8kRBsqDyJGYrfUG KnD2p/L8MKYfa6lRDhBwruP7mZxKRtNb4rUyUjVoHwLm9X0sZLuXomnApFLi5wwe+Itv adZWZJadGe5SNlNzQ9RIf8t07/BlLR2hHzeJz7FSLHToerLdAZaKPZUeOp3pfqD7aJdk kFqwOrwqU6HGzicofvNWylEVW/z5erXP/5CO3e/SfdY1j+uu+d5/3FWgMALstJn65T0A uUhWG9FeZY0jf9Fs1M5XYr7VgEOjtg2saPXxV6nXpJa1XysDcprW5+UlAnqrhtrToZS1 taHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21-v6si2498380pgg.588.2018.08.22.13.45.27; Wed, 22 Aug 2018 13:46:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728750AbeHWAKR (ORCPT + 99 others); Wed, 22 Aug 2018 20:10:17 -0400 Received: from shell.v3.sk ([90.176.6.54]:53378 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728611AbeHWAKQ (ORCPT ); Wed, 22 Aug 2018 20:10:16 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 06FFEB5BA5; Wed, 22 Aug 2018 22:43:49 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id vYSUNHFsCMCc; Wed, 22 Aug 2018 22:43:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 866BDB5B9D; Wed, 22 Aug 2018 22:43:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id D3s7r6G-3Cjy; Wed, 22 Aug 2018 22:43:15 +0200 (CEST) Received: from odvarok.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id E60C0B5B95; Wed, 22 Aug 2018 22:43:13 +0200 (CEST) From: Lubomir Rintel To: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Herring , Mark Rutland , Greg Kroah-Hartman , Eric Miao , Haojian Zhuang , Kishon Vijay Abraham I , Alan Stern , Lubomir Rintel Subject: [PATCH 10/14] USB: gadget: mv-udc: use phy-pxa-usb Date: Wed, 22 Aug 2018 22:43:03 +0200 Message-Id: <20180822204307.13251-11-lkundrak@v3.sk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180822204307.13251-1-lkundrak@v3.sk> References: <20180822204307.13251-1-lkundrak@v3.sk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use a proper PHY driver, instead of hooks to a board support package. Signed-off-by: Lubomir Rintel --- arch/arm/mach-mmp/devices.c | 11 +------- drivers/usb/gadget/udc/mv_udc.h | 7 ++++- drivers/usb/gadget/udc/mv_udc_core.c | 38 ++++++++-------------------- 3 files changed, 17 insertions(+), 39 deletions(-) diff --git a/arch/arm/mach-mmp/devices.c b/arch/arm/mach-mmp/devices.c index eb9b3c34e90a..d925be9f14a9 100644 --- a/arch/arm/mach-mmp/devices.c +++ b/arch/arm/mach-mmp/devices.c @@ -263,21 +263,12 @@ struct platform_device pxa168_device_usb_phy = { #if IS_ENABLED(CONFIG_USB_MV_UDC) struct resource pxa168_u2o_resources[] = { - /* regbase */ [0] = { - .start = PXA168_U2O_REGBASE + U2x_CAPREGS_OFFSET, + .start = PXA168_U2O_REGBASE, .end = PXA168_U2O_REGBASE + USB_REG_RANGE, .flags = IORESOURCE_MEM, - .name = "capregs", }, - /* phybase */ [1] = { - .start = PXA168_U2O_PHYBASE, - .end = PXA168_U2O_PHYBASE + USB_PHY_RANGE, - .flags = IORESOURCE_MEM, - .name = "phyregs", - }, - [2] = { .start = IRQ_PXA168_USB1, .end = IRQ_PXA168_USB1, .flags = IORESOURCE_IRQ, diff --git a/drivers/usb/gadget/udc/mv_udc.h b/drivers/usb/gadget/udc/mv_udc.h index b3f759c0962c..6f04f432964d 100644 --- a/drivers/usb/gadget/udc/mv_udc.h +++ b/drivers/usb/gadget/udc/mv_udc.h @@ -6,6 +6,9 @@ #ifndef __MV_UDC_H #define __MV_UDC_H +/* registers */ +#define U2x_CAPREGS_OFFSET 0x100 + #define VUSBHS_MAX_PORTS 8 #define DQH_ALIGNMENT 2048 @@ -174,9 +177,9 @@ struct mv_udc { struct platform_device *dev; int irq; + void __iomem *base; struct mv_cap_regs __iomem *cap_regs; struct mv_op_regs __iomem *op_regs; - void __iomem *phy_regs; unsigned int max_eps; struct mv_dqh *ep_dqh; size_t ep_dqh_size; @@ -219,6 +222,8 @@ struct mv_udc { /* some SOC has mutiple clock sources for USB*/ struct clk *clk; + + struct phy *phy; }; /* endpoint data structure */ diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index 95f52232493b..c701c83d3af5 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c @@ -1069,14 +1069,11 @@ static int mv_udc_enable_internal(struct mv_udc *udc) if (retval) return retval; - if (udc->pdata->phy_init) { - retval = udc->pdata->phy_init(udc->phy_regs); - if (retval) { - dev_err(&udc->dev->dev, - "init phy error %d\n", retval); - udc_clock_disable(udc); - return retval; - } + retval = phy_init(udc->phy); + if (retval) { + dev_err(&udc->dev->dev, "init phy error %d\n", retval); + udc_clock_disable(udc); + return retval; } udc->active = 1; @@ -1095,8 +1092,7 @@ static void mv_udc_disable_internal(struct mv_udc *udc) { if (udc->active) { dev_dbg(&udc->dev->dev, "disable udc\n"); - if (udc->pdata->phy_deinit) - udc->pdata->phy_deinit(udc->phy_regs); + phy_exit(udc->phy); udc_clock_disable(udc); udc->active = 0; } @@ -2147,30 +2143,16 @@ static int mv_udc_probe(struct platform_device *pdev) if (IS_ERR(udc->clk)) return PTR_ERR(udc->clk); - r = platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "capregs"); + r = platform_get_resource(udc->dev, IORESOURCE_MEM, 0); if (r == NULL) { dev_err(&pdev->dev, "no I/O memory resource defined\n"); return -ENODEV; } - udc->cap_regs = (struct mv_cap_regs __iomem *) - devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (udc->cap_regs == NULL) { - dev_err(&pdev->dev, "failed to map I/O memory\n"); - return -EBUSY; - } - - r = platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "phyregs"); - if (r == NULL) { - dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); - return -ENODEV; - } + udc->base = devm_ioremap(&pdev->dev, r->start, resource_size(r)); - udc->phy_regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (udc->phy_regs == NULL) { - dev_err(&pdev->dev, "failed to map phy I/O memory\n"); - return -EBUSY; - } + udc->cap_regs = + (void __iomem *) ((unsigned long)udc->base + U2x_CAPREGS_OFFSET); /* we will acces controller register, so enable the clk */ retval = mv_udc_enable_internal(udc); -- 2.17.1