Received: by 10.192.165.148 with SMTP id m20csp3087428imm; Sun, 22 Apr 2018 23:44:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/5Wh1W9aKEK58wfzoGLIqSn4aapk4HV0etdWf0hLaP3fKNQEbYjlfc/J8Zr814mHhxIgYq X-Received: by 2002:a17:902:5948:: with SMTP id e8-v6mr7450182plj.121.1524465891964; Sun, 22 Apr 2018 23:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524465891; cv=none; d=google.com; s=arc-20160816; b=G6VJEdPUz/3EaluudozUxmUKDJk/6vkkOl8FBUJa46fvDpoyQEQUw6C3IlWvLbd+6M IW90XoryRxzZdRBjnXpwYvbjEgPPv1sLoTcEd+LtSQPq6cyC3Kr2O6oQpn1BZyvyUg7R uXigWF5u3t3xwuapKQoa5HlwkwayAFQMrQ/k6OWj9RFzmF0yamMOPqxxoqZr/XNrdiPx XkjBTDiu7lYRZGSjJppIVg38HzBRJRXPkBSWmqpjF32pjr93Ve0lpyi7iKhFMBbpzDBV uRjECrFbedWbXv0lI640eAO+hEwyCO8/zK3NSMv8h8iptjgYl2GmLMt5lsiQ0lCAdjar btQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=vzE/9ZAZSVj58W2iMTUt4+aJPCZEk6FTlA2Y/Cs75H4=; b=YaUvX0Y6HlJsptGxEekU3FG+munMn6pLc7ktd5v5EO48xEapkyrUyIXwMYqFA0Kr6/ FIO/0pS+e71z5fO96WWTGxGRbfc40XR/SSge01a/LwdXK3y1napwdbWm372zClRYP2gM FzajwWxu5p3hek8oNaXDVBGsorPeXGaXa5TjAiqYCXIPBefC243yFtSrDk+VjqNYeiuO 0nm5pfZZiHcAM7NgCy2w4ygs0Y+UJ+Nre8qTPntLTSw9CYyvSF+FmdwKtcHT7YjMsXKh 7RuDGAfelMBUIRk3vKyyH1u+P19KTcPYf/P2RSC7MucrIsFJmBW0UhHA/drtkYPQfq3V 3Vrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yeJLODcY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay12-v6si10255678plb.554.2018.04.22.23.44.37; Sun, 22 Apr 2018 23:44:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yeJLODcY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754117AbeDWGnQ (ORCPT + 99 others); Mon, 23 Apr 2018 02:43:16 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:36360 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753018AbeDWGm5 (ORCPT ); Mon, 23 Apr 2018 02:42:57 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3N6gsBb013698; Mon, 23 Apr 2018 01:42:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524465775; bh=s8WD12q7T5ng4bjE5AuAMwcZ7hRXFaQcFC+S4EYN9r0=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=yeJLODcYV5488LOwjL/mAHK4idlCYOXgz49Qn8KSaNsPlkaZXqqJKfss9PEF110z4 fSej11vpL8zD8o7ZcP4fgvfzjOul/CjnOJOKfRT74cyQQUEgZJAdoXNqmUvCzvtdvc LE1Qt1wabUqBr4xIXtv+6Edw6XepU7U5cadgYljU= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3N6gswO018009; Mon, 23 Apr 2018 01:42:54 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 23 Apr 2018 01:42:54 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 23 Apr 2018 01:42:54 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3N6graA021182; Mon, 23 Apr 2018 01:42:53 -0500 Subject: Re: [PATCH] phy: Add a driver for the ATH79 USB phy To: Alban Bedel References: <1521931120-31118-1-git-send-email-albeu@free.fr> CC: From: Kishon Vijay Abraham I Message-ID: <8052c841-0950-9f03-c21e-0395db198969@ti.com> Date: Mon, 23 Apr 2018 12:12:52 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1521931120-31118-1-git-send-email-albeu@free.fr> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sunday 25 March 2018 04:08 AM, Alban Bedel wrote: > The ATH79 USB phy is very simple, it only have a reset. On some SoC a > second reset is used to force the phy in suspend mode regardless of the > USB controller status. > > This driver is added to the qualcom directory as atheros is now part > of qualcom and newer SoC of this familly are marketed under the > qualcom name. merged, thanks! -Kishon > > Signed-off-by: Alban Bedel > --- > MAINTAINERS | 8 +++ > drivers/phy/qualcomm/Kconfig | 11 +++- > drivers/phy/qualcomm/Makefile | 1 + > drivers/phy/qualcomm/phy-ath79-usb.c | 108 +++++++++++++++++++++++++++++++++++ > 4 files changed, 127 insertions(+), 1 deletion(-) > create mode 100644 drivers/phy/qualcomm/phy-ath79-usb.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 73c0cda..ce5ecd6 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2294,6 +2294,14 @@ S: Maintained > F: drivers/gpio/gpio-ath79.c > F: Documentation/devicetree/bindings/gpio/gpio-ath79.txt > > +ATHEROS 71XX/9XXX USB PHY DRIVER > +M: Alban Bedel > +W: https://github.com/AlbanBedel/linux > +T: git git://github.com/AlbanBedel/linux > +S: Maintained > +F: drivers/phy/qualcomm/phy-ath79-usb.c > +F: Documentation/devicetree/bindings/phy/phy-ath79-usb.txt > + > ATHEROS ATH GENERIC UTILITIES > M: "Luis R. Rodriguez" > L: linux-wireless@vger.kernel.org > diff --git a/drivers/phy/qualcomm/Kconfig b/drivers/phy/qualcomm/Kconfig > index 7bfa64b..632a0e7 100644 > --- a/drivers/phy/qualcomm/Kconfig > +++ b/drivers/phy/qualcomm/Kconfig > @@ -1,6 +1,15 @@ > # > -# Phy drivers for Qualcomm platforms > +# Phy drivers for Qualcomm and Atheros platforms > # > +config PHY_ATH79_USB > + tristate "Atheros AR71XX/9XXX USB PHY driver" > + depends on OF && (ATH79 || COMPILE_TEST) > + default y if USB_EHCI_HCD_PLATFORM || USB_OHCI_HCD_PLATFORM > + select RESET_CONTROLLER > + select GENERIC_PHY > + help > + Enable this to support the USB PHY on Atheros AR71XX/9XXX SoCs. > + > config PHY_QCOM_APQ8064_SATA > tristate "Qualcomm APQ8064 SATA SerDes/PHY driver" > depends on ARCH_QCOM > diff --git a/drivers/phy/qualcomm/Makefile b/drivers/phy/qualcomm/Makefile > index 9abb789..deb831f4 100644 > --- a/drivers/phy/qualcomm/Makefile > +++ b/drivers/phy/qualcomm/Makefile > @@ -1,4 +1,5 @@ > # SPDX-License-Identifier: GPL-2.0 > +obj-$(CONFIG_PHY_ATH79_USB) += phy-ath79-usb.o > obj-$(CONFIG_PHY_QCOM_APQ8064_SATA) += phy-qcom-apq8064-sata.o > obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o > obj-$(CONFIG_PHY_QCOM_QMP) += phy-qcom-qmp.o > diff --git a/drivers/phy/qualcomm/phy-ath79-usb.c b/drivers/phy/qualcomm/phy-ath79-usb.c > new file mode 100644 > index 0000000..6fd6e07 > --- /dev/null > +++ b/drivers/phy/qualcomm/phy-ath79-usb.c > @@ -0,0 +1,108 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Atheros AR71XX/9XXX USB PHY driver > + * > + * Copyright (C) 2015-2018 Alban Bedel > + */ > + > +#include > +#include > +#include > +#include > + > +struct ath79_usb_phy { > + struct reset_control *reset; > + /* The suspend override logic is inverted, hence the no prefix > + * to make the code a bit easier to understand. > + */ > + struct reset_control *no_suspend_override; > +}; > + > +static int ath79_usb_phy_power_on(struct phy *phy) > +{ > + struct ath79_usb_phy *priv = phy_get_drvdata(phy); > + int err = 0; > + > + if (priv->no_suspend_override) { > + err = reset_control_assert(priv->no_suspend_override); > + if (err) > + return err; > + } > + > + err = reset_control_deassert(priv->reset); > + if (err && priv->no_suspend_override) > + reset_control_assert(priv->no_suspend_override); > + > + return err; > +} > + > +static int ath79_usb_phy_power_off(struct phy *phy) > +{ > + struct ath79_usb_phy *priv = phy_get_drvdata(phy); > + int err = 0; > + > + err = reset_control_assert(priv->reset); > + if (err) > + return err; > + > + if (priv->no_suspend_override) { > + err = reset_control_deassert(priv->no_suspend_override); > + if (err) > + reset_control_deassert(priv->reset); > + } > + > + return err; > +} > + > +static const struct phy_ops ath79_usb_phy_ops = { > + .power_on = ath79_usb_phy_power_on, > + .power_off = ath79_usb_phy_power_off, > + .owner = THIS_MODULE, > +}; > + > +static int ath79_usb_phy_probe(struct platform_device *pdev) > +{ > + struct ath79_usb_phy *priv; > + struct phy *phy; > + > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + priv->reset = devm_reset_control_get(&pdev->dev, "usb-phy"); > + if (IS_ERR(priv->reset)) > + return PTR_ERR(priv->reset); > + > + priv->no_suspend_override = devm_reset_control_get_optional( > + &pdev->dev, "usb-suspend-override"); > + if (IS_ERR(priv->no_suspend_override)) > + return PTR_ERR(priv->no_suspend_override); > + > + phy = devm_phy_create(&pdev->dev, NULL, &ath79_usb_phy_ops); > + if (IS_ERR(phy)) > + return PTR_ERR(phy); > + > + phy_set_drvdata(phy, priv); > + > + return PTR_ERR_OR_ZERO(devm_of_phy_provider_register( > + &pdev->dev, of_phy_simple_xlate)); > +} > + > +static const struct of_device_id ath79_usb_phy_of_match[] = { > + { .compatible = "qca,ar7100-usb-phy" }, > + {} > +}; > +MODULE_DEVICE_TABLE(of, ath79_usb_phy_of_match); > + > +static struct platform_driver ath79_usb_phy_driver = { > + .probe = ath79_usb_phy_probe, > + .driver = { > + .of_match_table = ath79_usb_phy_of_match, > + .name = "ath79-usb-phy", > + } > +}; > +module_platform_driver(ath79_usb_phy_driver); > + > +MODULE_DESCRIPTION("ATH79 USB PHY driver"); > +MODULE_AUTHOR("Alban Bedel "); > +MODULE_LICENSE("GPL"); >