From patchwork Sun Feb 11 21:06:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10211517 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 07FDE602CB for ; Sun, 11 Feb 2018 21:08:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9D0228800 for ; Sun, 11 Feb 2018 21:08:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE2132884C; Sun, 11 Feb 2018 21:08:30 +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 5AF0E28800 for ; Sun, 11 Feb 2018 21:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932275AbeBKVI1 (ORCPT ); Sun, 11 Feb 2018 16:08:27 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:43398 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932270AbeBKVIX (ORCPT ); Sun, 11 Feb 2018 16:08:23 -0500 Received: by mail-wr0-f193.google.com with SMTP id b52so13263681wrd.10; Sun, 11 Feb 2018 13:08:22 -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=Hoy9tcc92vhuv4nnTIsVX5TO/j+CWJgvqz22Pp7wMSE=; b=rD502nJ0W/vdnKW5kzjeoZDvbM5IUX2sIfcvmHL7p6hz0LLJMAadpRdTD9doFYSUhe X+POPrlij4knvjy28sLW+xbAtNyURAwcV48UClRemOWH0fhD7nSlxhi9q/uGh/DiCfEe HAGRLN/68EKhCy2JSgD+IkGoD3D6lMp1YzcYdWVEr8ngqsd5AaZtBDDgPBb3ICn3TgXG dDsZyMBu/y3TC3Vc4O+SshA6ZemVqkUVuLp6Z0/UNVUra99rqQbmhz3+yGyv6hva9jyq CWiozg8HYnRvWVTA6ZG91CWqKmt5+qPkGfS1ay5641yFScjO0xy9T3myokmq98isP4MQ Dqog== 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=Hoy9tcc92vhuv4nnTIsVX5TO/j+CWJgvqz22Pp7wMSE=; b=fMHvJSYwcpqhrJe+ID27w3ywNPMobB9E2L3L26FC+S7uJ2EzdyOYYIsE139PLrLzz0 FglSIuDB8qdNYNhgvXuyUywYAWx4G5qDQRV6WyAf/pNDuQ1idWdX6IHaGTPGR2dH4bAu QPfX6iE8eTYyNPHytuug48HLOVeVDQ4jR6GR0wZnwPeCvFPKxqQ+RujXMN5zJPzsDIHk CGniTCpdSXBbIOxJWJxYzfyDEf7OdBxsR2IT4cjXFUDp/9dNqGyj3zcB88lYU7Cook7U YWPQR31BQJpSH+zSPBhD1j9eSNtRGZ97ist5x0EJDwr8BLH7EZJSgQTYahydMyQvR4U2 Q+LA== X-Gm-Message-State: APf1xPAimJSLnUq7uXds9idzAzkyPfe+goAkA8NrGyaREzyZr03BBhg5 cUgTdb1AbQvDZqJD/+6zSOcSyaI7 X-Google-Smtp-Source: AH8x227xDpndWoEuL05btVgMdXl+Df2DnPnPWpkMLvhhW2Oo38Amkor7cBhsfm/rFFo4z5tu2fB3gg== X-Received: by 10.223.186.83 with SMTP id t19mr6056012wrg.252.1518383301026; Sun, 11 Feb 2018 13:08:21 -0800 (PST) Received: from blackbox.darklights.net (p5B056154.dip0.t-ipconnect.de. [91.5.97.84]) by smtp.googlemail.com with ESMTPSA id k13sm6301773wrd.61.2018.02.11.13.08.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Feb 2018 13:08:20 -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: [PATCH usb-next v9 7/8] usb: host: ohci-platform: remove custom USB PHY handling Date: Sun, 11 Feb 2018 22:06:50 +0100 Message-Id: <20180211210651.2046-8-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180211210651.2046-1-martin.blumenstingl@googlemail.com> References: <20180211210651.2046-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 ohci-platform driver as the core HCD code now handles this. Signed-off-by: Martin Blumenstingl Acked-by: Alan Stern --- drivers/usb/host/ohci-platform.c | 56 ++++------------------------------------ 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index bd605e79ae7d..65a1c3fdc88c 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,8 +38,6 @@ struct ohci_platform_priv { struct clk *clks[OHCI_MAX_CLKS]; struct reset_control *resets; - struct phy **phys; - int num_phys; }; static const char hcd_name[] = "ohci-platform"; @@ -48,7 +46,7 @@ static int ohci_platform_power_on(struct platform_device *dev) { struct usb_hcd *hcd = platform_get_drvdata(dev); struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); - int clk, ret, phy_num; + int clk, ret; for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) { ret = clk_prepare_enable(priv->clks[clk]); @@ -56,24 +54,8 @@ static int ohci_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]); @@ -85,12 +67,7 @@ static void ohci_platform_power_off(struct platform_device *dev) { struct usb_hcd *hcd = platform_get_drvdata(dev); struct ohci_platform_priv *priv = hcd_to_ohci_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 = OHCI_MAX_CLKS - 1; clk >= 0; clk--) if (priv->clks[clk]) @@ -117,7 +94,7 @@ static int ohci_platform_probe(struct platform_device *dev) struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); struct ohci_platform_priv *priv; struct ohci_hcd *ohci; - int err, irq, phy_num, clk = 0; + int err, irq, clk = 0; if (usb_disabled()) return -ENODEV; @@ -169,29 +146,6 @@ static int ohci_platform_probe(struct platform_device *dev) of_property_read_u32(dev->dev.of_node, "num-ports", &ohci->num_ports); - 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 = true; - } - } - for (clk = 0; clk < OHCI_MAX_CLKS; clk++) { priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); if (IS_ERR(priv->clks[clk])) { @@ -277,7 +231,7 @@ static int ohci_platform_probe(struct platform_device *dev) err_put_clks: while (--clk >= 0) clk_put(priv->clks[clk]); -err_put_hcd: + if (pdata == &ohci_platform_defaults) dev->dev.platform_data = NULL;