From patchwork Thu Jan 25 00:16:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10183419 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 C686C601D5 for ; Thu, 25 Jan 2018 00:17:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB0E126BE9 for ; Thu, 25 Jan 2018 00:17:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF73D28161; Thu, 25 Jan 2018 00:17:22 +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 2AF4626BE9 for ; Thu, 25 Jan 2018 00:17:22 +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=3GJ6VxHGpSQjz28j/XbANrmsQ8XEjXRcAgb++IgC2+k=; b=j/ch4mkkkLRb2O0TsfS2lx0znD DsFo2RG5PIc0VzQf93Flu1DEXYi1b8ih/dzGYOSDBD6+iEj82AZJ1ZImnbcAsRGBZrf/uGUEllCHf vVpquEZDFWqzOKsT61YFJcsnHmweI1MGKnCt6Urv7k2ke3+qcZoppDpwbGtlDLoHApiKI7TzfX9U+ RLy1VzXaO4ULUCBlYJaDWwT11Hrm5QYHSDaVtIKO2GYHP84yinKl2Tn2w8MbANHshy2aUBVt9IpJD TyiMecHg5axAq2MRHPHh1c00rzbTMZMl5AerB7xqyxAjglWdCDcgW+LtFczwU7A+XiKny1qHgKq/2 kf+/+itA==; 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 1eeVEF-00014J-24; Thu, 25 Jan 2018 00:17:19 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eeVDw-0000mv-20; Thu, 25 Jan 2018 00:17:01 +0000 Received: by mail-wm0-x241.google.com with SMTP id v71so11860923wmv.2; Wed, 24 Jan 2018 16:16:50 -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=TUUJoibjURNko7hqZniN+t5MTwpMl3zfKfzRvdoenPg=; b=E/kHCH5f7O6RTbZe0ExqfdxBN0g+UkCkqdwAXNyu8w3MdA+kbV9fuf4U4oDOfOy8lG 3OTT6ROwYUQzKdWkRJthw47mNVefKsSGon3RlMRnBnxh8P27Bq4JB16K7HsRzxSmv+HY eyk70ehLD0G5kUrUfDFbgtUkLt2wUzWWZCprHDUB5Q1Gg1Hro4kS38e8iQm4hdfdqJ4e lrww+85d/EhnDUpeVT6qzTfwI3xIK+JEcgUEYE0Vu2ZJWvjCML1RAB5csDM9x0RC8kgB IZ8cTc4O0R2LXVw+K9aa5EPO0IFc4piHy1SPcQvB2IE5TXoYJXEs4+dJ6MaFtXV2NNZN MjJw== 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=TUUJoibjURNko7hqZniN+t5MTwpMl3zfKfzRvdoenPg=; b=afCt+mCfpguVoRRaS2XyuNi8nTJUclAtDvOSjA1V5Ulpdw+KdHINCoy4k7m8Uje/52 CmLutclx1qwdbAoX/sX+TUeKPF4F4xtmZ7ihjkaIK40gElS4OtsLIGgjq5H1HQz33OgV mD1GeR7PvKfXiauJGLI+nGtMmWNgLORODF+h60CiuVuGgUY365zD2dQ4TXsafwtfpcOq Dd1M9Gde0YHHSyKMWeDP8Z5x+9hkhJf9NGAT2dvZaMOtiFKHKo88sKQNTqyF+P8TvUtM T+0N1+QTF3Ct2uhSpQTI9HpfjLS7ddhieg3wYnA24lXGtE/Q5hIlnoVPuw7F8vBT3al5 GYwg== X-Gm-Message-State: AKwxytfI3YDZis7f0bDHQGAEM0SoR6ZBaD/25IFNQtGeg0zYP4aMFLrd 05U4cPuDaiace86QCOAYO9I= X-Google-Smtp-Source: AH8x227+DF8+vvAz+Op5KWVj+kB2QmEnZ/1+EVuQUz4hAJJqx0Ff9C6NYQGBsy/zH2s3xpjS3GudAA== X-Received: by 10.28.212.70 with SMTP id l67mr6615671wmg.0.1516839409642; Wed, 24 Jan 2018 16:16:49 -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.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 16:16:49 -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 1/6] usb: mtu3: remove custom USB PHY handling Date: Thu, 25 Jan 2018 01:16:34 +0100 Message-Id: <20180125001639.14681-2-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 mtu3 driver as the core HCD code now handles this. Signed-off-by: Martin Blumenstingl --- drivers/usb/mtu3/mtu3_plat.c | 101 ------------------------------------------- 1 file changed, 101 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c index 628d5ce356ca..a894ddf25bcd 100644 --- a/drivers/usb/mtu3/mtu3_plat.c +++ b/drivers/usb/mtu3/mtu3_plat.c @@ -44,62 +44,6 @@ int ssusb_check_clocks(struct ssusb_mtk *ssusb, u32 ex_clks) return 0; } -static int ssusb_phy_init(struct ssusb_mtk *ssusb) -{ - int i; - int ret; - - for (i = 0; i < ssusb->num_phys; i++) { - ret = phy_init(ssusb->phys[i]); - if (ret) - goto exit_phy; - } - return 0; - -exit_phy: - for (; i > 0; i--) - phy_exit(ssusb->phys[i - 1]); - - return ret; -} - -static int ssusb_phy_exit(struct ssusb_mtk *ssusb) -{ - int i; - - for (i = 0; i < ssusb->num_phys; i++) - phy_exit(ssusb->phys[i]); - - return 0; -} - -static int ssusb_phy_power_on(struct ssusb_mtk *ssusb) -{ - int i; - int ret; - - for (i = 0; i < ssusb->num_phys; i++) { - ret = phy_power_on(ssusb->phys[i]); - if (ret) - goto power_off_phy; - } - return 0; - -power_off_phy: - for (; i > 0; i--) - phy_power_off(ssusb->phys[i - 1]); - - return ret; -} - -static void ssusb_phy_power_off(struct ssusb_mtk *ssusb) -{ - unsigned int i; - - for (i = 0; i < ssusb->num_phys; i++) - phy_power_off(ssusb->phys[i]); -} - static int ssusb_clks_enable(struct ssusb_mtk *ssusb) { int ret; @@ -162,24 +106,8 @@ static int ssusb_rscs_init(struct ssusb_mtk *ssusb) if (ret) goto clks_err; - ret = ssusb_phy_init(ssusb); - if (ret) { - dev_err(ssusb->dev, "failed to init phy\n"); - goto phy_init_err; - } - - ret = ssusb_phy_power_on(ssusb); - if (ret) { - dev_err(ssusb->dev, "failed to power on phy\n"); - goto phy_err; - } - return 0; -phy_err: - ssusb_phy_exit(ssusb); -phy_init_err: - ssusb_clks_disable(ssusb); clks_err: regulator_disable(ssusb->vusb33); vusb33_err: @@ -190,8 +118,6 @@ static void ssusb_rscs_exit(struct ssusb_mtk *ssusb) { ssusb_clks_disable(ssusb); regulator_disable(ssusb->vusb33); - ssusb_phy_power_off(ssusb); - ssusb_phy_exit(ssusb); } static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb) @@ -222,7 +148,6 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb) struct device *dev = &pdev->dev; struct regulator *vbus; struct resource *res; - int i; int ret; ssusb->vusb33 = devm_regulator_get(&pdev->dev, "vusb33"); @@ -249,25 +174,6 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb) if (IS_ERR(ssusb->dma_clk)) return PTR_ERR(ssusb->dma_clk); - ssusb->num_phys = of_count_phandle_with_args(node, - "phys", "#phy-cells"); - if (ssusb->num_phys > 0) { - ssusb->phys = devm_kcalloc(dev, ssusb->num_phys, - sizeof(*ssusb->phys), GFP_KERNEL); - if (!ssusb->phys) - return -ENOMEM; - } else { - ssusb->num_phys = 0; - } - - for (i = 0; i < ssusb->num_phys; i++) { - ssusb->phys[i] = devm_of_phy_get_by_index(dev, node, i); - if (IS_ERR(ssusb->phys[i])) { - dev_err(dev, "failed to get phy-%d\n", i); - return PTR_ERR(ssusb->phys[i]); - } - } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ippc"); ssusb->ippc_base = devm_ioremap_resource(dev, res); if (IS_ERR(ssusb->ippc_base)) @@ -457,7 +363,6 @@ static int __maybe_unused mtu3_suspend(struct device *dev) return 0; ssusb_host_disable(ssusb, true); - ssusb_phy_power_off(ssusb); ssusb_clks_disable(ssusb); ssusb_wakeup_set(ssusb, true); @@ -480,16 +385,10 @@ static int __maybe_unused mtu3_resume(struct device *dev) if (ret) goto clks_err; - ret = ssusb_phy_power_on(ssusb); - if (ret) - goto phy_err; - ssusb_host_enable(ssusb); return 0; -phy_err: - ssusb_clks_disable(ssusb); clks_err: return ret; }