Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3611311imu; Sun, 11 Nov 2018 19:23:45 -0800 (PST) X-Google-Smtp-Source: AJdET5dGvZCEX4EyNzytvXTiq4R4Uw2skgmaq3+KU0sDmhUpAoEPH+7DOQJZTKvEOGOLMHGbufSQ X-Received: by 2002:a17:902:684e:: with SMTP id f14-v6mr18347916pln.242.1541993025526; Sun, 11 Nov 2018 19:23:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541993025; cv=none; d=google.com; s=arc-20160816; b=uOy3/VmTPYcaZUItma5v8QcD/RnKfhiN/eUa6FEIyr8rbOJitVqATKo6PnY35316zU C7ub0N5rzbDcU+ZsLh4MnzqM1bmTuGU7+wF++oBVIiR50lvJPBoVhH87IGoinSCCBb57 QHq4FKKbaKrWVOxrI7/cCZWaLeX+bBR7IfVYJtNK2kTCSHxG0cALe0RTaeqR7LEyQanp awNR16bsVX5Zd7vn6z+RmLr+uSYzYDNasgQZYpjceKQDg9yNVvnwbEQfkE4VK17bvist BGWkCNBcUlNYN9/yOqd5N6bnOCnkjHaZjSrhPozCCn6ST3gGszBLkkIuY9z68EN/QXVJ ZdyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wJ81DmizkmFCgIF586PwwfqhXxXdqXVECrOBs1pa2bE=; b=YhbhEuP2nddQoaG6QGQtmRoD9QI5/FPMEcuE4BwwzA5GQIzVaQXbbUeYZ5IhIbjjDE LClLbHwsBmSYyMUDs838k9A032zLq86AdmOk62xoIYw1RvfVjwHLDtdlREqHu4inSfx7 JiqksqUpEwPOO2BW8HRq/q8e5Parn34How0tYlmB98bjqL1Ui21H51jn1KevuCTghISI z/rlgaJaa7FmJiQpQibGuqP6qtdOPZqVdCSSU+KF7DnWVfIjdOwP9DC/xNN3IZGLTKLf dueowd/c1EvK+JNTaySpNyAiWpIQAPafSQVn7EQiCz83Z2hc7nFbrk91jERdlW0ihfe+ XE2A== 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 f3-v6si16520312pld.186.2018.11.11.19.23.30; Sun, 11 Nov 2018 19:23:45 -0800 (PST) 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 S1731083AbeKLNMv (ORCPT + 99 others); Mon, 12 Nov 2018 08:12:51 -0500 Received: from shell.v3.sk ([90.176.6.54]:59717 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730912AbeKLNMu (ORCPT ); Mon, 12 Nov 2018 08:12:50 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 3E7E0C6A2B; Mon, 12 Nov 2018 04:21:38 +0100 (CET) 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 PVXWGAwv_t7r; Mon, 12 Nov 2018 04:21:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 6B1E5C6A2F; Mon, 12 Nov 2018 04:20:50 +0100 (CET) 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 yB4Oi2-F2oTk; Mon, 12 Nov 2018 04:20:48 +0100 (CET) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id AD298C6A39; Mon, 12 Nov 2018 04:20:40 +0100 (CET) From: Lubomir Rintel To: Eric Miao , Haojian Zhuang Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Russell King , Robert Jarzmik , Lubomir Rintel Subject: [PATCH v3 18/18] USB: gadget: mv-udc: use phy-pxa-usb Date: Mon, 12 Nov 2018 04:20:27 +0100 Message-Id: <20181112032027.653931-19-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181112032027.653931-1-lkundrak@v3.sk> References: <20181112032027.653931-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 =3D { =20 #if IS_ENABLED(CONFIG_USB_MV_UDC) struct resource pxa168_u2o_resources[] =3D { - /* regbase */ [0] =3D { - .start =3D PXA168_U2O_REGBASE + U2x_CAPREGS_OFFSET, + .start =3D PXA168_U2O_REGBASE, .end =3D PXA168_U2O_REGBASE + USB_REG_RANGE, .flags =3D IORESOURCE_MEM, - .name =3D "capregs", }, - /* phybase */ [1] =3D { - .start =3D PXA168_U2O_PHYBASE, - .end =3D PXA168_U2O_PHYBASE + USB_PHY_RANGE, - .flags =3D IORESOURCE_MEM, - .name =3D "phyregs", - }, - [2] =3D { .start =3D IRQ_PXA168_USB1, .end =3D IRQ_PXA168_USB1, .flags =3D 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 =20 +/* registers */ +#define U2x_CAPREGS_OFFSET 0x100 + #define VUSBHS_MAX_PORTS 8 =20 #define DQH_ALIGNMENT 2048 @@ -174,9 +177,9 @@ struct mv_udc { struct platform_device *dev; int irq; =20 + 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 { =20 /* some SOC has mutiple clock sources for USB*/ struct clk *clk; + + struct phy *phy; }; =20 /* endpoint data structure */ diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/ud= c/mv_udc_core.c index cafde053788b..35b0bde2d46f 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; =20 - if (udc->pdata->phy_init) { - retval =3D 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 =3D 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 =3D 1; =20 @@ -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 =3D 0; } @@ -2147,30 +2143,16 @@ static int mv_udc_probe(struct platform_device *p= dev) if (IS_ERR(udc->clk)) return PTR_ERR(udc->clk); =20 - r =3D platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "capregs")= ; + r =3D platform_get_resource(udc->dev, IORESOURCE_MEM, 0); if (r =3D=3D NULL) { dev_err(&pdev->dev, "no I/O memory resource defined\n"); return -ENODEV; } =20 - udc->cap_regs =3D (struct mv_cap_regs __iomem *) - devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (udc->cap_regs =3D=3D NULL) { - dev_err(&pdev->dev, "failed to map I/O memory\n"); - return -EBUSY; - } - - r =3D platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "phyregs")= ; - if (r =3D=3D NULL) { - dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); - return -ENODEV; - } + udc->base =3D devm_ioremap(&pdev->dev, r->start, resource_size(r)); =20 - udc->phy_regs =3D devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (udc->phy_regs =3D=3D NULL) { - dev_err(&pdev->dev, "failed to map phy I/O memory\n"); - return -EBUSY; - } + udc->cap_regs =3D + (void __iomem *) ((unsigned long)udc->base + U2x_CAPREGS_OFFSET); =20 /* we will acces controller register, so enable the clk */ retval =3D mv_udc_enable_internal(udc); --=20 2.19.1