From patchwork Thu Jan 25 00:16:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10183441 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 C7EEA601D5 for ; Thu, 25 Jan 2018 00:20:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDD1228161 for ; Thu, 25 Jan 2018 00:20:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1316288EA; Thu, 25 Jan 2018 00:20:43 +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 70AD728161 for ; Thu, 25 Jan 2018 00:20:29 +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=YsfxLeCwF3Q9tV3Q3lKTMXGaBgKfP6tgErFpTRhxIuQ=; b=YiuMJAk7pnTYBvm1Bfl5xx6eym 7dcnxrjSb4tWlCCNo+t6C7EyMO0fB/3NnWvedmZWOe6AVjqe0twGgY91yGHcW9n+LWh4pZcvJaFlD zeoTkDFOAikC2Tj8tSeGKDJ5vk3RE+rSZ/89bBpc+YEb2Hb/b4mZOHEYTTV36kzxNyT7rBCk91hAh WmIo5mewMhtl0BNs4WtLCgBImV2zdosi6v7Ntvc54l6TDDnPzlNLtulC5ldWHtJkdODl4ogQlIlQ7 Rz/midgnnEoU7CVhWjz7UGqEblPIoL1ifCEpzR0Vo4MxhPhWUyniBaIRzvfngFujUSDrfRHClzQIx JJyf5+Gw==; 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 1eeVHG-0004bW-M4; Thu, 25 Jan 2018 00:20:26 +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 1eeVE3-0000nC-3S; Thu, 25 Jan 2018 00:17:12 +0000 Received: by mail-wr0-x243.google.com with SMTP id w50so353621wrc.2; Wed, 24 Jan 2018 16:16:56 -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=7lkos7z05eNiIOnGjtkoRIxMsbLXQ3XxUIh1s3lypLc=; b=LsjUZYz0noH3LA0S445dLfbR62R8Kbt6yYrjx2ViqBdRYlnClX0SqiGct7IdpxfUUn XoUfHGlT49o2pPwxOuFrzlgi42R0AxUZJEjktCfs0C/SK/g/g5Vaf8J+xr9nq2ax6j1i BxwpOrq0WPHj25gPPSNVu49CK8lv7ieMJLIj03G5L2z2o8wihm+T6GyanbxHXzy9n1iP YXIvm7qqUcW3WbEmzCdanjJu/5lODOD3Iq48/deMwX6ZhNZZf7QQ4mig0OpvNfeT3EBG 3smt2IibWu4P6zwF6skU2Lbe7BThr9UwiqYCN6BfgJZJwFjFf4BLye3af7A0OHBXpsrn UAYA== 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=7lkos7z05eNiIOnGjtkoRIxMsbLXQ3XxUIh1s3lypLc=; b=CckbNdZdtGPBhRwM/4cEvRANOVNOIXWIdMnkWkkvCShppR7yXy/uIV1AorEKTXnYu7 j/wsNklNJ/m+l9ulwvh4NibgXzlobXEvYq9762V4/tI98Q/HHWn8c6FvXEFbAyudd7rM VrUvQOYIQeWy1jy7fiLjcqnjtJYdWI80GLKtgj60QdQP0gZsSvUhvCbxDK97zeyo4I3l bOP9F+CfGS6+uw2fGo6G/9Ly4DgQh3s0r1i8tzpdG0VUehG9gYoAijRP/nZcWpMhz8eF RQQoSUiEsLAG5InfGxquT/FleZSLGestm722iiU1v5igu8jDbtlP8XAgSv7lcHWW1A6Y yNAQ== X-Gm-Message-State: AKwxytcwvyBbMBxmoylMbIWahRaUNrneSGiTrFEMiaIRm01TSoB7i8/E Kuzzvf3Psc/eUUEsTSuxg4I= X-Google-Smtp-Source: AH8x226IJFORlCn2CXDKbCc5h4fA8GE3lu05Y8X9tsvdUib6KL1Lcqo6qyx9WNfpkB3UrU7+JKCZjQ== X-Received: by 10.223.130.194 with SMTP id 60mr7036675wrc.72.1516839414650; Wed, 24 Jan 2018 16:16:54 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 16:16:54 -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 4/6] usb: host: ohci-platform: remove custom USB PHY handling Date: Thu, 25 Jan 2018 01:16:37 +0100 Message-Id: <20180125001639.14681-5-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 ohci-platform driver as the core HCD code now handles this. Signed-off-by: Martin Blumenstingl --- 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 1e6c954f4b3f..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 if (!hcd->phy) { - /* Avoiding phy_get() in usb_add_hcd() */ - hcd->phy = priv->phys[phy_num]; - } - } - 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;