From patchwork Thu Jan 25 00:16:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10183433 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 2D6CA601D5 for ; Thu, 25 Jan 2018 00:18:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2346126BE9 for ; Thu, 25 Jan 2018 00:18:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 165FF28161; Thu, 25 Jan 2018 00:18:29 +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 bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 85F4826BE9 for ; Thu, 25 Jan 2018 00:18:28 +0000 (UTC) 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=3Ig8jvao+3Ajsi91f4SYUchmoXnLtEzG4ntD3gtxVy4=; b=iTrIMjl9yKzd/fV48g15AyQfLZ AJFW6z52p9MKE7I1bUX/HNRdRI6PfDBA6R/a425rgUMkYSstYP5PkQCbYyEvbg/6tpSINF48NVgo3 Pip6wRO/k83kL6YYmKYKtyIN9IXGV4Fk3Bnpl83mkrIWu/9W6qtdJ8uVw1iveIQ1MhdS5j+tTaGVv Ga9QM3qN/84E5vku6Y21EmswvaJGeQJLBZ8vJfl+diKUuPQTaaV4kZx58VGC9B4JyPyUQ/12S8w98 UTIdbjMTy3Faht7J/4xnCfNOh2x/ISuzqeMmwVag/9dy7Xj7q7aC5IsCYFVriM8p9V8e3hoK7zQ7J PNexEAQA==; 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 1eeVFL-00027Q-9F; Thu, 25 Jan 2018 00:18:27 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eeVDz-0000n6-48; Thu, 25 Jan 2018 00:17:05 +0000 Received: by mail-wr0-x241.google.com with SMTP id s5so4508191wra.0; Wed, 24 Jan 2018 16:16:54 -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=49Uv4NrzstXVFw2mgHI+nZ6DyEO4PTjuFdNhoFSCqRo=; b=p7zc9d5QLYuhQ8aALj9W03yxf2KKXMfk/0GbWwuyrm4zscYRaZe+io9BpHDcJWC7o2 mu2H1tgHyxx4LPRAo5moxQYR80lDw3IAhdu5FkK52l3JctZReP4YwY1QFj2tdA1qJLAM PE13+H899tDpXtw8NbMfo2EE6RQoKy3SvnRWthAaF1dq67P8ivLWuIvAvExSt6TqblPs j9ROF+DqJYjgqyZw4YnHda3Brs7bdQLghuWfrvwTON/LyJ+gFkATX/CYtZGdlkhvlUIy RVe8N1DuB08wlQmBzLWEp4dqQ+t+LPF2OV6HWxgWATovaCLwdfTmOtQsVxGZEnHDHSl/ lDDg== 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=49Uv4NrzstXVFw2mgHI+nZ6DyEO4PTjuFdNhoFSCqRo=; b=h04aaIlOMDgVFIur+h2PmERnXagvmkFTncjXe3iKmisZqIMbSq2LVGsQx9Tdy1pofi WhpG4CQtQ15S+3p6+OmeMzE9K3bT57SVN25guqx/BbXaTpE/Py2AjNA211nYR3rfRQDE +zo1qHeBeNj8Hj4ptEo0ecNptE4C2oaWkoA7GM3wRDHTMYIpA9PmE+RobwQUaui6/ycL vPQ6Wk+VWOw+z/ewrj4Pi8AOSGJK7JQ5Zjhitubf2ZiIMmPpvK79Lmg2tVlpJeNQEqJo aaqHFrgE9GAUqzFilM8x9qvN2Bts7lQW0tsh6H3ltgXyKar+1drvf165BDDaitMvg9AF 03jg== X-Gm-Message-State: AKwxyte0feSw5nwMqwIhhDyjGUCxdz9WI29ojDqDGFgurJJqluCWo0IA 4z55vMj6GOQrePLSW5mbLO2dAv+/ X-Google-Smtp-Source: AH8x226wuR21j3c0DfpaTjR4oQSATMk/0ps8A8KriAJeosT1Cn/7Q5HzozTaVazGOiF6Fvtihi8RfQ== X-Received: by 10.223.169.116 with SMTP id u107mr6441443wrc.3.1516839412846; Wed, 24 Jan 2018 16:16:52 -0800 (PST) Received: from blackbox.darklights.net (p5DD9B1B3.dip0.t-ipconnect.de. [93.217.177.179]) by smtp.googlemail.com with ESMTPSA id e15sm1699159wmd.26.2018.01.24.16.16.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 16:16:52 -0800 (PST) From: Martin Blumenstingl To: linux-usb@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, chunfeng.yun@mediatek.com, matthias.bgg@gmail.com, linux@prisktech.co.nz, Peter.Chen@nxp.com Subject: [RFC/RFT usb-next v1 3/6] usb: host: ehci-platform: remove custom USB PHY handling Date: Thu, 25 Jan 2018 01:16:36 +0100 Message-Id: <20180125001639.14681-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180125001639.14681-1-martin.blumenstingl@googlemail.com> References: <20180125001639.14681-1-martin.blumenstingl@googlemail.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Blumenstingl , gregkh@linuxfoundation.org, stern@rowland.harvard.edu, mathias.nyman@intel.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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 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 b065a960adc2..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 if (!hcd->phy) { - /* Avoiding phy_get() in usb_add_hcd() */ - hcd->phy = priv->phys[phy_num]; - } - } - 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;