From patchwork Sat Mar 3 21:43:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10256205 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 100186037E for ; Sat, 3 Mar 2018 21:43:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0428D287A1 for ; Sat, 3 Mar 2018 21:43:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECEFA287A6; Sat, 3 Mar 2018 21:43:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C6F1287A1 for ; Sat, 3 Mar 2018 21:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932168AbeCCVno (ORCPT ); Sat, 3 Mar 2018 16:43:44 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51492 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932127AbeCCVnl (ORCPT ); Sat, 3 Mar 2018 16:43:41 -0500 Received: by mail-wm0-f65.google.com with SMTP id h21so9203891wmd.1; Sat, 03 Mar 2018 13:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3JrNtf6qybOVoI9HEhDIw130BLGKOYrPvk9zTKmyBE0=; b=Pyk3GTyOeIIQl/YYpJcjsajBxN4X7RbH8+MOEHNTOkoJXes8voMBfIDOdSBlcmK+ye wwX5O542vKlIJpA0/3kI8T79f/YUNL8q2BHb2uiaLy2JD78oCVBiR960+uRwXz3d2JgH ZFJsUKPDbh1+LrXwqEzbE8jcrX2xXxlDikkrejp2ShHzMIiKsD5Fs3seK4867WDh9cGn UTpi8/1UnGKo/5JLAW2bM8KjI6DD1qPWazvyqwcgC8TTIhvObgYZTmQJuZQniL2CHSzD e7lOis7VjNtavtNubbO/G6xygrLy9QVN6bGwt0kzgsnPatML9GvQ/aEvEgfVVchcyPtm FKGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3JrNtf6qybOVoI9HEhDIw130BLGKOYrPvk9zTKmyBE0=; b=d1bK8n7pqHn0s+BLJUDWI4OLJUcxTm9T/xDPWE4TYBvG8sd/q4/qEYsQM2jvCkY+M4 DeHs3/UZ1KcGTx5LWZsS+fLvzQcZK3dQSUlK9LBwU47H7gX5S/8sUGj8GiFt/vUqTbBu eGA6t/k8MZEd/4UdIpLm+bDAk7QJZmTp4OhdMBgS5sUu5PQWHSVb/jRLalsbdEXDNQ04 uBsWaodzqeWf3tesN0Ro9FefUN7s941zqPZmPbjjbdA7SRDb8S+V/krAnrSDXkmTthLU nXQ58U6a5ztaYy+h8N5yccp+8uhoKAqX/05QpxydopICyETRxuXS0LEqBPtMeLY11Xt0 I2pg== X-Gm-Message-State: AElRT7EuddGN4VvVIwkt8YD2Nbk+bzOANTDeC8xYWjhf9on1BpW1JTkT w+NUopNKoshV0eDJgdEqJ6+m1Uy6 X-Google-Smtp-Source: AG47ELsMzhwzXM/27lWL5lRYMrPLqWy0UB+qqgiw1j+TFnAvCwXteBspwz6+DCsP+x4Fuv1uJg+mkA== X-Received: by 10.28.12.14 with SMTP id 14mr4532984wmm.107.1520113419128; Sat, 03 Mar 2018 13:43:39 -0800 (PST) Received: from blackbox.darklights.net (p5DD9B279.dip0.t-ipconnect.de. [93.217.178.121]) by smtp.googlemail.com with ESMTPSA id 55sm11073171wrz.6.2018.03.03.13.43.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Mar 2018 13:43:38 -0800 (PST) From: Martin Blumenstingl To: linux-usb@vger.kernel.org, mathias.nyman@intel.com, arnd@arndb.de, gregkh@linuxfoundation.org, felipe.balbi@linux.intel.com Cc: linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, stern@rowland.harvard.edu, linux@prisktech.co.nz, Peter.Chen@nxp.com, matthias.bgg@gmail.com, mark.rutland@arm.com, robh+dt@kernel.org, narmstrong@baylibre.com, linux-amlogic@lists.infradead.org, yixun.lan@amlogic.com, Martin Blumenstingl Subject: [usb-next PATCH v11 6/8] usb: host: ehci-platform: remove custom USB PHY handling Date: Sat, 3 Mar 2018 22:43:07 +0100 Message-Id: <20180303214309.25643-7-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180303214309.25643-1-martin.blumenstingl@googlemail.com> References: <20180303214309.25643-1-martin.blumenstingl@googlemail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The new PHY wrapper is now wired up in the core HCD code. This means that PHYs are now controlled (initialized, enabled, disabled, exited) without requiring any host-driver specific code. Remove the custom USB PHY handling from the ehci-platform driver as the core HCD code now handles this. Signed-off-by: Martin Blumenstingl Acked-by: Alan Stern --- drivers/usb/host/ehci-platform.c | 55 +++------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index b91eea8c73ae..4c306fb6b069 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -44,8 +43,6 @@ struct ehci_platform_priv { struct clk *clks[EHCI_MAX_CLKS]; struct reset_control *rsts; - struct phy **phys; - int num_phys; bool reset_on_resume; }; @@ -80,7 +77,7 @@ static int ehci_platform_power_on(struct platform_device *dev) { struct usb_hcd *hcd = platform_get_drvdata(dev); struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); - int clk, ret, phy_num; + int clk, ret; for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { ret = clk_prepare_enable(priv->clks[clk]); @@ -88,24 +85,8 @@ static int ehci_platform_power_on(struct platform_device *dev) goto err_disable_clks; } - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { - ret = phy_init(priv->phys[phy_num]); - if (ret) - goto err_exit_phy; - ret = phy_power_on(priv->phys[phy_num]); - if (ret) { - phy_exit(priv->phys[phy_num]); - goto err_exit_phy; - } - } - return 0; -err_exit_phy: - while (--phy_num >= 0) { - phy_power_off(priv->phys[phy_num]); - phy_exit(priv->phys[phy_num]); - } err_disable_clks: while (--clk >= 0) clk_disable_unprepare(priv->clks[clk]); @@ -117,12 +98,7 @@ static void ehci_platform_power_off(struct platform_device *dev) { struct usb_hcd *hcd = platform_get_drvdata(dev); struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); - int clk, phy_num; - - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { - phy_power_off(priv->phys[phy_num]); - phy_exit(priv->phys[phy_num]); - } + int clk; for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) if (priv->clks[clk]) @@ -149,7 +125,7 @@ static int ehci_platform_probe(struct platform_device *dev) struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); struct ehci_platform_priv *priv; struct ehci_hcd *ehci; - int err, irq, phy_num, clk = 0; + int err, irq, clk = 0; if (usb_disabled()) return -ENODEV; @@ -202,29 +178,6 @@ static int ehci_platform_probe(struct platform_device *dev) "has-transaction-translator")) hcd->has_tt = 1; - priv->num_phys = of_count_phandle_with_args(dev->dev.of_node, - "phys", "#phy-cells"); - - if (priv->num_phys > 0) { - priv->phys = devm_kcalloc(&dev->dev, priv->num_phys, - sizeof(struct phy *), GFP_KERNEL); - if (!priv->phys) - return -ENOMEM; - } else - priv->num_phys = 0; - - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { - priv->phys[phy_num] = devm_of_phy_get_by_index( - &dev->dev, dev->dev.of_node, phy_num); - if (IS_ERR(priv->phys[phy_num])) { - err = PTR_ERR(priv->phys[phy_num]); - goto err_put_hcd; - } else { - /* Avoiding phy_get() in usb_add_hcd() */ - hcd->skip_phy_initialization = 1; - } - } - for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); if (IS_ERR(priv->clks[clk])) { @@ -306,7 +259,7 @@ static int ehci_platform_probe(struct platform_device *dev) err_put_clks: while (--clk >= 0) clk_put(priv->clks[clk]); -err_put_hcd: + if (pdata == &ehci_platform_defaults) dev->dev.platform_data = NULL;