From patchwork Sun Feb 11 21:06:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10211597 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 AB64460329 for ; Sun, 11 Feb 2018 21:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B61C28715 for ; Sun, 11 Feb 2018 21:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F5BF2899D; Sun, 11 Feb 2018 21:24:21 +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 C508328715 for ; Sun, 11 Feb 2018 21:24:20 +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=BqjR50aj0mnhVWp8VY9fSp1GddeTHG14nw863CJY2/Y=; b=l9W0pqgZ3ruoWHr1q19R/vd3Wk rrtM3kd5CY6Yw69LsIaDXXYmnknScDtv53XKJ3tt05C6DajdLJZlSRJBTlXNeO2CXWOORBLm0Zmha GBdPJeHeITfgQq3XSXMnXiAtuf8g2tr1pNabaXPH/yw+iYgSY7zK1K6E+qKI7uEp7WQFSOVlvH+b1 tNfTJOgilwkcioF5qP1qlgBPiDVgVvwZ7hpBGpekxo0KumwTajeqbsTutByT4xQ/W/MOr4E7ZI2SD LJfdbOWLI1MEI0MR5C029TzFT0FyFq+Uz29ab8yPuAwofJApMyAVpdziDugAGzAx38cN+nkMjYWyn G3HxOTqQ==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ekz6a-0005Mh-Uy for patchwork-linux-mediatek@patchwork.kernel.org; Sun, 11 Feb 2018 21:24:13 +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=BqjR50aj0mnhVWp8VY9fSp1GddeTHG14nw863CJY2/Y=; b=Af8g33MdarCiF9dYrqSIdk4TkR Taa3dOgId7VxXO0X+UYqjfiQ4z3sM0QTsQMPUMs+HaUFnSdXvBA+SZGm33mfXb1yECwnrT/KqsLFR hRnXfs9iTEy/iInNGE79qXTuvxioT94/F+Iu13MqrPviXOjVlTeZQjMuHF/RfK56BbrseQAff7F0+ 2Wh4P2SgKy1qL00A3/5aRsGppIco6p60uuu2sWDvTbBLKmQB5z/BHn4QxActutuxl62N8uN8WLiqM EUq6VMyP22/RUiU9/2P7BBh4GqJtJJ/0yhPhGyvuFZyAAdoTD8shC3pjpb/DPoO2vFuAVv0tfZOgG eLOqqmgA==; 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 1ekysK-0001D5-ER; Sun, 11 Feb 2018 21:09:28 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ekyrL-0007yL-MJ; Sun, 11 Feb 2018 21:08:29 +0000 Received: by mail-wr0-x243.google.com with SMTP id m5so1228832wrg.1; Sun, 11 Feb 2018 13:08:18 -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=xghhlQk/8/okyEjYxTkoTZ8D1/iMJq5yZ0MqXeZlvhM=; b=S0b2bxsUMSzV8z136uxk7tD/ZXVfnTYF8OVhJUYW5vxfUDhYKWTYWwJ7FnzjXXCeZq LBO4I6pCjTuIqAAZtUf5H8zY0E9MGOsyRuJMsNvwS/sVe2lyIc5reJuYoSwegbNhEONr 4APs6Ftew/ySS4rQZNC4venoicm5wr8hlM5EDo4Mz9ny5QNacLk2PS7fVr3N3rcABRlP ijP004isQSDYcf4gvfeIvxnNL5c/XdPGBU8iu7hxFxx3EvKTCd4I+Cv0jOY2DVEn7py2 va5TvtxHtnWscc1mgbCfwBfvnPH/DI0NtnIxZm6GA3KvSqsTV7ywjZFqSdzSdt0fmIof Nj6w== 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=xghhlQk/8/okyEjYxTkoTZ8D1/iMJq5yZ0MqXeZlvhM=; b=QbP94j2UVNLlloVg7dQ/xFUc+m3pnLcl0V+CgOjMTUaIgLINKOLp5InwQg2h9OyXRX nfrDc96BzyXUzg5Bwa+SRxl88oS6idJUYdTHYVHwWAQTuy/mz1ddT1Ncj84cNARr8mbZ ROFuVXAdxApr9Mcjq6wMUSmvrJA1qk5IlyoC/NvU+FUBx7dbmw9p+93qScbKmpUPCImi pEuaEImlz8Qu3iGtVQgnuGzXWCV+O6gtYQ7ib8u4soqjfuIfbYwTPAwASo2OvAH68C/T FMOsHPxAXiZ3I18BNhX4i74SBFvMIADFVEdorM0hb4pU+ggxEFRzSsaciVoF7Z1XWZAa dQ5A== X-Gm-Message-State: APf1xPDgd2izU3OCe9pU4G2nbEw/K0ecJmclvpTo6M8pmoHhOD3u6OP2 QNWqO2dd4PR22gOWdL7Qh18= X-Google-Smtp-Source: AH8x226uX7tQrbN2mfjPBpnMiT/xzB+XYlHJVCcc0c0cOGN8YGMRFjCz5HHZwaXiyTHxLnoSCKdzEw== X-Received: by 10.223.209.80 with SMTP id b16mr8162293wri.86.1518383297558; Sun, 11 Feb 2018 13:08:17 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Feb 2018 13:08:16 -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 5/8] usb: host: xhci-mtk: remove custom USB PHY handling Date: Sun, 11 Feb 2018 22:06:48 +0100 Message-Id: <20180211210651.2046-6-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 xhci-mtk driver as the core HCD code now handles this. Signed-off-by: Martin Blumenstingl --- drivers/usb/host/xhci-mtk.c | 98 +-------------------------------------------- 1 file changed, 2 insertions(+), 96 deletions(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index b0ab4d5e2751..7334da9e9779 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -352,62 +351,6 @@ static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = { static struct hc_driver __read_mostly xhci_mtk_hc_driver; -static int xhci_mtk_phy_init(struct xhci_hcd_mtk *mtk) -{ - int i; - int ret; - - for (i = 0; i < mtk->num_phys; i++) { - ret = phy_init(mtk->phys[i]); - if (ret) - goto exit_phy; - } - return 0; - -exit_phy: - for (; i > 0; i--) - phy_exit(mtk->phys[i - 1]); - - return ret; -} - -static int xhci_mtk_phy_exit(struct xhci_hcd_mtk *mtk) -{ - int i; - - for (i = 0; i < mtk->num_phys; i++) - phy_exit(mtk->phys[i]); - - return 0; -} - -static int xhci_mtk_phy_power_on(struct xhci_hcd_mtk *mtk) -{ - int i; - int ret; - - for (i = 0; i < mtk->num_phys; i++) { - ret = phy_power_on(mtk->phys[i]); - if (ret) - goto power_off_phy; - } - return 0; - -power_off_phy: - for (; i > 0; i--) - phy_power_off(mtk->phys[i - 1]); - - return ret; -} - -static void xhci_mtk_phy_power_off(struct xhci_hcd_mtk *mtk) -{ - unsigned int i; - - for (i = 0; i < mtk->num_phys; i++) - phy_power_off(mtk->phys[i]); -} - static int xhci_mtk_ldos_enable(struct xhci_hcd_mtk *mtk) { int ret; @@ -488,8 +431,6 @@ static int xhci_mtk_probe(struct platform_device *pdev) struct xhci_hcd *xhci; struct resource *res; struct usb_hcd *hcd; - struct phy *phy; - int phy_num; int ret = -ENODEV; int irq; @@ -529,16 +470,6 @@ static int xhci_mtk_probe(struct platform_device *pdev) return ret; } - mtk->num_phys = of_count_phandle_with_args(node, - "phys", "#phy-cells"); - if (mtk->num_phys > 0) { - mtk->phys = devm_kcalloc(dev, mtk->num_phys, - sizeof(*mtk->phys), GFP_KERNEL); - if (!mtk->phys) - return -ENOMEM; - } else { - mtk->num_phys = 0; - } pm_runtime_enable(dev); pm_runtime_get_sync(dev); device_enable_async_suspend(dev); @@ -596,23 +527,6 @@ static int xhci_mtk_probe(struct platform_device *pdev) mtk->has_ippc = false; } - for (phy_num = 0; phy_num < mtk->num_phys; phy_num++) { - phy = devm_of_phy_get_by_index(dev, node, phy_num); - if (IS_ERR(phy)) { - ret = PTR_ERR(phy); - goto put_usb2_hcd; - } - mtk->phys[phy_num] = phy; - } - - ret = xhci_mtk_phy_init(mtk); - if (ret) - goto put_usb2_hcd; - - ret = xhci_mtk_phy_power_on(mtk); - if (ret) - goto exit_phys; - device_init_wakeup(dev, true); xhci = hcd_to_xhci(hcd); @@ -630,7 +544,7 @@ static int xhci_mtk_probe(struct platform_device *pdev) dev_name(dev), hcd); if (!xhci->shared_hcd) { ret = -ENOMEM; - goto power_off_phys; + goto disable_device_wakeup; } ret = usb_add_hcd(hcd, irq, IRQF_SHARED); @@ -653,13 +567,9 @@ static int xhci_mtk_probe(struct platform_device *pdev) xhci_mtk_sch_exit(mtk); usb_put_hcd(xhci->shared_hcd); -power_off_phys: - xhci_mtk_phy_power_off(mtk); +disable_device_wakeup: device_init_wakeup(dev, false); -exit_phys: - xhci_mtk_phy_exit(mtk); - put_usb2_hcd: usb_put_hcd(hcd); @@ -682,8 +592,6 @@ static int xhci_mtk_remove(struct platform_device *dev) struct xhci_hcd *xhci = hcd_to_xhci(hcd); usb_remove_hcd(xhci->shared_hcd); - xhci_mtk_phy_power_off(mtk); - xhci_mtk_phy_exit(mtk); device_init_wakeup(&dev->dev, false); usb_remove_hcd(hcd); @@ -718,7 +626,6 @@ static int __maybe_unused xhci_mtk_suspend(struct device *dev) del_timer_sync(&xhci->shared_hcd->rh_timer); xhci_mtk_host_disable(mtk); - xhci_mtk_phy_power_off(mtk); xhci_mtk_clks_disable(mtk); usb_wakeup_set(mtk, true); return 0; @@ -732,7 +639,6 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev) usb_wakeup_set(mtk, false); xhci_mtk_clks_enable(mtk); - xhci_mtk_phy_power_on(mtk); xhci_mtk_host_enable(mtk); xhci_dbg(xhci, "%s: restart port polling\n", __func__);