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: 10211519 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 9028A602CB for ; Sun, 11 Feb 2018 21:08:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FB2628800 for ; Sun, 11 Feb 2018 21:08:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 744E22884C; Sun, 11 Feb 2018 21:08:33 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E42128800 for ; Sun, 11 Feb 2018 21:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=B4qoapwDo3qIVegrOz8xVkeVIpqLuApgq4CZYRWyS5o=; b=i1m9VWWJLbS9JvMUipo/M3pGz8 tE1V2Zjf4sLEaXyl+fw36Nfgc75Yq1/H2MtNYfkjW5xrTcFhv7cCj+PGgDeaqkMiyf+f2e9A5L27y XPo/vzUXfmUYNsn8YMlEJX//x6k9KbgTPEZMzEccS/7c0dANDMuVlGNBAM+u9R9SgM+imRBAge3yT t6aLoCS0GlYH5IMdKXwOnTyi4ONs2G6cKDGCyj+kvcsJngSNPoAAglKBzidWudPk7vEo5zV6wroXg kmwIeXxvgdpFlhYzN2wCCarULnyX2GdJsflT4kh+Kbkcogr/lKciIWhCMQPVGbr6H84mRKusN2mcN 6/qsVjew==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ekyrO-0006WC-E4 for patchwork-linux-mediatek@patchwork.kernel.org; Sun, 11 Feb 2018 21:08:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=B4qoapwDo3qIVegrOz8xVkeVIpqLuApgq4CZYRWyS5o=; b=GOYH5olzpsblwYE9wEtmGNwCHj k5jKvNaBGjC7RFt6pjAahqY/XyF7u9oJGh6AhX/3as4sUKyCBwBYYKNYKxL+P65MoZN2n17T5f3Hm cUErrs27FQ8Abo6Qr6JJyjceINgNu3pFvui8i8/DUUel61A4T1DKJQTKY9BFR/kAR5rmYP+7nF3Ne USbEQoPdW/6yCC57yK2ZA3yLntz82twpbfOHgzjT4febts94P/eNqUKTyyuP+HCF/Gt/ZrKlCHInn BQyrTD7EvOwz2hIE5mjLGYVsmARG6xZEgAM/Wtp7erMeeoP10CdgRKS0lhG+cuQfNF1X3I08nWv6Z 4KzOCFsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ekyrK-0007zL-U4; Sun, 11 Feb 2018 21:08:26 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ekyrH-0007ym-Oh; Sun, 11 Feb 2018 21:08:25 +0000 Received: by mail-wr0-x242.google.com with SMTP id o76so10170506wrb.7; 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=Mlx0shaIbyYbAj5MFojwgFS4pboLttVDeik1CakmvZkw0K1G3qh4jx5/JjT/7jpzgl vSae65a4kBhMSkkY2XCbA1ObS4FUKOe1RwtFmCQsNCAGBFBaCA4oE22/WPDwDOnfn6q9 QFLDPnyHVQAOv0aUe6BJn8Q1g5LBGJuRiFSXwPue75j0vXARwqb7jAdZHZMKl4lTNVL8 xwHSL1h8romF/+JLE7Qfc2nDqXIs6KOVztOdcnH3KpskmGNp3tZuzh9lQl7make2kEAH oRU2kVkT8GMDO+7tF316W98k/GLbjVVIlpVu7fWaMrcSKwE+sHLpjxuBEJ6jlnLT8yJa a1Mg== X-Gm-Message-State: APf1xPCyrS/VklSY/X9EJxUivf0KZ1LeoiLk6KfDRfIAmsiRfqWwgYZD zREuL5jaYjPByML1cBcYKqQ= 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 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> X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, Peter.Chen@nxp.com, Martin Blumenstingl , narmstrong@baylibre.com, yixun.lan@amlogic.com, robh+dt@kernel.org, jonathanh@nvidia.com, linux@prisktech.co.nz, matthias.bgg@gmail.com, thierry.reding@gmail.com, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-tegra@vger.kernel.org, stern@rowland.harvard.edu, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.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;