From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751096AbcGLENy (ORCPT ); Tue, 12 Jul 2016 00:13:54 -0400 Received: from mail-db5eur01on0060.outbound.protection.outlook.com ([104.47.2.60]:18139 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750739AbcGLENv convert rfc822-to-8bit (ORCPT ); Tue, 12 Jul 2016 00:13:51 -0400 X-Greylist: delayed 879 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Jul 2016 00:13:50 EDT From: Rajesh Bhagat To: Peter Chen CC: "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , Peter Chen , "gregkh@linuxfoundation.org" , "kishon@ti.com" , "robh+dt@kernel.org" , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH v2 3/5] drivers: usb: phy: Add qoriq usb 2.0 phy driver support Thread-Topic: [PATCH v2 3/5] drivers: usb: phy: Add qoriq usb 2.0 phy driver support Thread-Index: AQHR2Zq0H/SmGkQge0KEFhxCvSWsd6ASztUAgAFfX1A= Date: Tue, 12 Jul 2016 03:59:25 +0000 Message-ID: References: <1468038656-10345-1-git-send-email-rajesh.bhagat@nxp.com> <1468038656-10345-4-git-send-email-rajesh.bhagat@nxp.com> <20160711065408.GI31647@shlinux2> In-Reply-To: <20160711065408.GI31647@shlinux2> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rajesh.bhagat@nxp.com; x-originating-ip: [192.88.169.1] x-ms-office365-filtering-correlation-id: 621f0427-9f95-48ff-e952-08d3aa08ea06 x-microsoft-exchange-diagnostics: 1;DB5PR04MB1446;6:497WX4Uayr18SvtOeHbKTY287VsvlESbzRbN1YH/EPV3W19wSjMOx8wUySvqVdJn4DE30DoxdgHBsK8Hfbc9JK8gzJ/kzCIRhcYx8shQkyrid9cZFNQP7IDo1uT2DgHNWrkTKxTG6dXnboCuBAvnNAoQDt+isgibuMZjpHsKjNJvFNKGTV/r8KDYCqNHyKKXUgVMYB6wB4ExeQrAZM1oRNtO+u/DmakEXOB6PVij1rsKIlIGvTVu32xAKQhFgkTNjeaEu2ScnkoeYH9m1+btBNhZ9pfKh7l2jCXDZeCazNmzkfBwzn1cl2ABiksXOdtRpAbga0v/3g7j9ijgw06ofQ==;5:FtRjP+LyfKqUKxXro7vwYVqJ9SszaxZClaK1cdZqpoQrbI5kSLPJgsi2KAeUj4Mr3wyjBDXe47d5RGQYKg08zF7uTKYeIeY0duOX0yBHULNq1MHxRc1b5LTj0UiCf6UlVuNaOLuwjmYBEVXZ1DNFBg==;24:0ARiOFsy1IukhEjiHZxQBVprtr8Q1U3wKURF9qViYZDYwwhwRaGu2YMq/hTg9zo5fA9qyam2fdiRzvNpqWutmYfQnqiepFnSpcmFb05ViUA=;7:rpQPvXQcXiC7HlNIYuMzIbju8V0gy1jxz4+lfzEOK4RYh4u9z0gSxQJ8M9jc/9PMEfEuJ8LnFE5uwggQAwD8oR3DDHSKO6gTupFww754fyi5sP7BCGIiUoRwudPdQSs/hrjLZJzZImtk6KTgAtZwEf/ysxjnE03SYqSHk2ZphA17JPgZVMlavB6QaFoogDT8fDC7JauEoBFhVBtnnN3zm60I1mzvaxB9jDO13q9P3yr87U5o/KzDwmni7dQBCvoj x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR04MB1446; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(31051911155226)(9452136761055)(185117386973197)(258649278758335); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:DB5PR04MB1446;BCL:0;PCL:0;RULEID:;SRVR:DB5PR04MB1446; x-forefront-prvs: 0001227049 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(24454002)(189002)(13464003)(377454003)(199003)(3846002)(11100500001)(7846002)(586003)(305945005)(106356001)(6116002)(101416001)(102836003)(9686002)(105586002)(106116001)(7736002)(7696003)(5003600100003)(2906002)(68736007)(81166006)(189998001)(81156014)(19580395003)(110136002)(97736004)(33656002)(4326007)(19580405001)(8936002)(15975445007)(5002640100001)(54356999)(76176999)(76576001)(8676002)(2950100001)(2900100001)(50986999)(87936001)(77096005)(66066001)(3280700002)(3660700001)(10400500002)(92566002)(74316002)(122556002)(1411001)(86362001)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR04MB1446;H:HE1PR0401MB2331.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2016 03:59:25.0412 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1446 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Peter Chen [mailto:hzpeterchen@gmail.com] > Sent: Monday, July 11, 2016 12:24 PM > To: Rajesh Bhagat > Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; > devicetree@vger.kernel.org; Peter Chen ; > gregkh@linuxfoundation.org; kishon@ti.com; robh+dt@kernel.org; > shawnguo@kernel.org; linux-arm-kernel@lists.infradead.org > Subject: Re: [PATCH v2 3/5] drivers: usb: phy: Add qoriq usb 2.0 phy driver support > > On Sat, Jul 09, 2016 at 10:00:54AM +0530, Rajesh Bhagat wrote: > > Adds qoriq usb 2.0 phy driver support for LS1021A and LS1012A > > platform. > > > > Signed-off-by: Rajesh Bhagat > > --- > > Changes in v2: > > - Replaced Freescale with QorIQ in comments section > > - Changed the compatible string to fsl,qoriq-usb2-phy and added > > version > > - Added dependency on ARCH_MXC/ARCH_LAYERSCAPE and OF in Kconfig > > - Dropped CONFIG_ULPI #ifdefs to make code generic > > - Removed calls to devm free/release calls > > > > drivers/phy/Kconfig | 8 ++ > > drivers/phy/Makefile | 1 + > > drivers/phy/phy-qoriq-usb2.c | 228 > > +++++++++++++++++++++++++++++++++++++++++++ > > drivers/phy/phy-qoriq-usb2.h | 50 ++++++++++ > > 4 files changed, 287 insertions(+) > > create mode 100644 drivers/phy/phy-qoriq-usb2.c create mode 100644 > > drivers/phy/phy-qoriq-usb2.h > > > > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index > > b869b98..cc69299 100644 > > --- a/drivers/phy/Kconfig > > +++ b/drivers/phy/Kconfig > > @@ -434,4 +434,12 @@ config PHY_CYGNUS_PCIE > > > > source "drivers/phy/tegra/Kconfig" > > > > +config PHY_QORIQ_USB2 > > + tristate "QorIQ USB 2.0 PHY driver" > > + depends on ARCH_MXC || ARCH_LAYERSCAPE > Hello Peter, > It seems mxc platforms do not use this PHY. > Besides, if you are using ULPI phy, you need to depend on ULPI bus. > QorIQ platform are having both ULPI and non-ULPI PHY variants, Hence this PHY driver is targeted for both. And driver takes decision on run time which PHY is there according to information passed in DTS files. Best Regards, Rajesh Bhagat > Peter > > + depends on OF > > + select GENERIC_PHY > > + help > > + Enable this to support the USB2.0 PHY on the QorIQ SoC. > > + > > endmenu > > diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index > > 9c3e73c..044105a 100644 > > --- a/drivers/phy/Makefile > > +++ b/drivers/phy/Makefile > > @@ -53,5 +53,6 @@ obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o > > obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.o > > obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o > > obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o > > +obj-$(CONFIG_PHY_QORIQ_USB2) += phy-qoriq-usb2.o > > > > obj-$(CONFIG_ARCH_TEGRA) += tegra/ > > diff --git a/drivers/phy/phy-qoriq-usb2.c > > b/drivers/phy/phy-qoriq-usb2.c new file mode 100644 index > > 0000000..f74d255 > > --- /dev/null > > +++ b/drivers/phy/phy-qoriq-usb2.c > > @@ -0,0 +1,228 @@ > > +/* > > + * QorIQ SoC USB 2.0 PHY driver > > + * > > + * Copyright 2016 Freescale Semiconductor, Inc. > > + * Author: Rajesh Bhagat > > + * > > + * This program is free software; you can redistribute it and/or > > +modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + * > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "phy-qoriq-usb2.h" > > + > > +static int qoriq_usb2_phy_init(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + struct device *dev = ctx->dev; > > + > > + if (ctx->ulpi_phy) { > > + if (usb_phy_init(ctx->ulpi_phy)) { > > + dev_err(dev, "unable to init transceiver, probably missing\n"); > > + return -ENODEV; > > + } > > + } > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_power_on(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + u32 flags; > > + > > + if (ctx->ulpi_phy) { > > + flags = usb_phy_io_read(ctx->ulpi_phy, ULPI_OTG_CTRL); > > + usb_phy_io_write(ctx->ulpi_phy, flags | > > + (ULPI_OTG_CTRL_DRVVBUS_EXT | > > + ULPI_OTG_CTRL_EXTVBUSIND), ULPI_OTG_CTRL); > > + flags = usb_phy_io_read(ctx->ulpi_phy, ULPI_IFC_CTRL); > > + usb_phy_io_write(ctx->ulpi_phy, flags | > > + (ULPI_IFC_CTRL_EXTERNAL_VBUS | > > + ULPI_IFC_CTRL_PASSTHRU), ULPI_IFC_CTRL); > > + } > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_power_off(struct phy *_phy) { > > + /* TODO: Add logic to power off phy */ > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_exit(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + > > + if (ctx->ulpi_phy) > > + usb_phy_shutdown(ctx->ulpi_phy); > > + > > + return 0; > > +} > > + > > +static const struct phy_ops ops = { > > + .init = qoriq_usb2_phy_init, > > + .power_on = qoriq_usb2_phy_power_on, > > + .power_off = qoriq_usb2_phy_power_off, > > + .exit = qoriq_usb2_phy_exit, > > + .owner = THIS_MODULE, > > +}; > > + > > + > > +static enum qoriq_usb2_phy_ver of_usb_get_phy_version(struct > > +device_node *np) { > > + enum qoriq_usb2_phy_ver phy_version = QORIQ_PHY_UNKNOWN; > > + > > + if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy")) { > > + if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy-v1.0")) > > + phy_version = QORIQ_PHY_LEGACY; > > + else if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy-v2.0")) > > + phy_version = QORIQ_PHY_NXP_ISP1508; > > + } > > + return phy_version; > > +} > > + > > +static int qoriq_usb2_phy_probe(struct platform_device *pdev) { > > + int ret; > > + struct resource *res; > > + struct qoriq_usb2_phy_ctx *ctx; > > + struct device *dev = &pdev->dev; > > + const struct of_device_id *of_id; > > + struct phy_provider *phy_provider; > > + struct device_node *np = pdev->dev.of_node; > > + > > + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); > > + if (!ctx) > > + return -ENOMEM; > > + > > + ctx->dev = dev; > > + > > + of_id = of_match_device(dev->driver->of_match_table, dev); > > + if (!of_id) { > > + dev_err(dev, "failed to get device match\n"); > > + ret = -EINVAL; > > + goto err_out; > > + } > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + if (!res) { > > + dev_err(dev, "failed to get I/O memory\n"); > > + ret = -ENOENT; > > + goto err_out; > > + } > > + > > + ctx->regs = devm_ioremap(dev, res->start, resource_size(res)); > > + if (!ctx->regs) { > > + dev_err(dev, "failed to remap I/O memory\n"); > > + ret = -ENOMEM; > > + goto err_out; > > + } > > + > > + platform_set_drvdata(pdev, ctx); > > + > > + ctx->phy = devm_phy_create(ctx->dev, NULL, &ops); > > + if (IS_ERR(ctx->phy)) { > > + dev_err(dev, "failed to create PHY\n"); > > + ret = PTR_ERR(ctx->phy); > > + goto err_out; > > + } > > + phy_set_drvdata(ctx->phy, ctx); > > + > > + ctx->phy_version = of_usb_get_phy_version(np); > > + if (ctx->phy_version == QORIQ_PHY_UNKNOWN) { > > + ret = -EINVAL; > > + dev_err(dev, "failed to get PHY version\n"); > > + goto err_out; > > + } > > + > > + ctx->phy_type = of_usb_get_phy_mode(np); > > + switch (ctx->phy_type) { > > + case USBPHY_INTERFACE_MODE_ULPI: > > + switch (ctx->phy_version) { > > + case QORIQ_PHY_NXP_ISP1508: > > + ctx->ulpi_phy = qoriq_otg_ulpi_create(0); > > + if (!ctx->ulpi_phy) { > > + dev_err(dev, "qoriq_otg_ulpi_create returned NULL\n"); > > + ret = -ENOMEM; > > + goto err_out; > > + } > > + ctx->ulpi_phy->io_priv = ctx->regs + ULPI_VIEWPORT; > > + break; > > + default: > > + ctx->ulpi_phy = NULL; > > + break; > > + } > > + break; > > + default: > > + dev_err(&pdev->dev, "phy_type %d is invalid or unsupported\n", > > + ctx->phy_type); > > + ret = -EINVAL; > > + goto err_out; > > + } > > + > > + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > > + if (IS_ERR(phy_provider)) { > > + dev_err(dev, "failed to register phy_provider\n"); > > + ret = PTR_ERR_OR_ZERO(phy_provider); > > + goto err_out; > > + } > > + > > + dev_dbg(dev, "initialized\n"); > > + return 0; > > + > > +err_out: > > + return ret; > > +} > > + > > +static int qoriq_usb2_phy_remove(struct platform_device *pdev) { > > + struct device *dev = &pdev->dev; > > + struct qoriq_usb2_phy_ctx *ctx = platform_get_drvdata(pdev); > > + > > + devm_phy_destroy(ctx->dev, ctx->phy); > > + devm_iounmap(dev, ctx->regs); > > + dev_dbg(dev, "de-initialized\n"); > > + return 0; > > +} > > + > > +static const struct of_device_id qoriq_usb2_phy_dt_ids[] = { > > + { .compatible = "fsl,qoriq-usb2-phy"}, > > + {} > > +}; > > + > > +MODULE_DEVICE_TABLE(of, qoriq_usb2_phy_dt_ids); > > + > > +static struct platform_driver qoriq_usb2_phy_driver = { > > + .probe = qoriq_usb2_phy_probe, > > + .remove = qoriq_usb2_phy_remove, > > + .driver = { > > + .name = "qoriq_usb2_phy", > > + .owner = THIS_MODULE, > > + .of_match_table = of_match_ptr(qoriq_usb2_phy_dt_ids), > > + }, > > +}; > > + > > +module_platform_driver(qoriq_usb2_phy_driver); > > + > > +MODULE_ALIAS("platform:qoriq-usb2-phy"); > > +MODULE_LICENSE("GPL v2"); > > +MODULE_DESCRIPTION("QorIQ SoC USB PHY driver"); MODULE_AUTHOR("Rajesh > > +Bhagat "); > > diff --git a/drivers/phy/phy-qoriq-usb2.h > > b/drivers/phy/phy-qoriq-usb2.h new file mode 100644 index > > 0000000..47c37a5 > > --- /dev/null > > +++ b/drivers/phy/phy-qoriq-usb2.h > > @@ -0,0 +1,50 @@ > > +/* > > + * Freescale SoC USB 2.0 PHY driver > > + * > > + * Copyright 2016 Freescale Semiconductor, Inc. > > + * Author: Rajesh Bhagat > > + * > > + * This program is free software; you can redistribute it and/or > > +modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + * > > + */ > > +#ifndef _PHY_QORIQ_USB2_H > > +#define _PHY_QORIQ_USB2_H > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#define ULPI_VIEWPORT 0x170 > > + > > +enum qoriq_usb2_phy_ver { > > + QORIQ_PHY_LEGACY, > > + QORIQ_PHY_NXP_ISP1508, > > + QORIQ_PHY_UNKNOWN, > > +}; > > + > > +struct qoriq_usb2_phy_ctx { > > + struct phy *phy; > > + struct clk *clk; > > + struct device *dev; > > + void __iomem *regs; > > + struct usb_phy *ulpi_phy; > > + enum usb_phy_interface phy_type; > > + enum qoriq_usb2_phy_ver phy_version; }; > > + > > +#ifdef CONFIG_USB_ULPI_VIEWPORT > > +static inline struct usb_phy *qoriq_otg_ulpi_create(unsigned int > > +flags) { > > + return otg_ulpi_create(&ulpi_viewport_access_ops, flags); } #else > > +static inline struct usb_phy *qoriq_otg_ulpi_create(unsigned int > > +flags) { > > + return NULL; > > +} > > +#endif > > + > > +#endif > > -- > > 2.6.2.198.g614a2ac > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-usb" > > in the body of a message to majordomo@vger.kernel.org More majordomo > > info at http://vger.kernel.org/majordomo-info.html > > -- > > Best Regards, > Peter Chen From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rajesh Bhagat Subject: RE: [PATCH v2 3/5] drivers: usb: phy: Add qoriq usb 2.0 phy driver support Date: Tue, 12 Jul 2016 03:59:25 +0000 Message-ID: References: <1468038656-10345-1-git-send-email-rajesh.bhagat@nxp.com> <1468038656-10345-4-git-send-email-rajesh.bhagat@nxp.com> <20160711065408.GI31647@shlinux2> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160711065408.GI31647@shlinux2> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Peter Chen Cc: "devicetree@vger.kernel.org" , Peter Chen , "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kishon@ti.com" , "robh+dt@kernel.org" , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" List-Id: devicetree@vger.kernel.org > -----Original Message----- > From: Peter Chen [mailto:hzpeterchen@gmail.com] > Sent: Monday, July 11, 2016 12:24 PM > To: Rajesh Bhagat > Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; > devicetree@vger.kernel.org; Peter Chen ; > gregkh@linuxfoundation.org; kishon@ti.com; robh+dt@kernel.org; > shawnguo@kernel.org; linux-arm-kernel@lists.infradead.org > Subject: Re: [PATCH v2 3/5] drivers: usb: phy: Add qoriq usb 2.0 phy driver support > > On Sat, Jul 09, 2016 at 10:00:54AM +0530, Rajesh Bhagat wrote: > > Adds qoriq usb 2.0 phy driver support for LS1021A and LS1012A > > platform. > > > > Signed-off-by: Rajesh Bhagat > > --- > > Changes in v2: > > - Replaced Freescale with QorIQ in comments section > > - Changed the compatible string to fsl,qoriq-usb2-phy and added > > version > > - Added dependency on ARCH_MXC/ARCH_LAYERSCAPE and OF in Kconfig > > - Dropped CONFIG_ULPI #ifdefs to make code generic > > - Removed calls to devm free/release calls > > > > drivers/phy/Kconfig | 8 ++ > > drivers/phy/Makefile | 1 + > > drivers/phy/phy-qoriq-usb2.c | 228 > > +++++++++++++++++++++++++++++++++++++++++++ > > drivers/phy/phy-qoriq-usb2.h | 50 ++++++++++ > > 4 files changed, 287 insertions(+) > > create mode 100644 drivers/phy/phy-qoriq-usb2.c create mode 100644 > > drivers/phy/phy-qoriq-usb2.h > > > > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index > > b869b98..cc69299 100644 > > --- a/drivers/phy/Kconfig > > +++ b/drivers/phy/Kconfig > > @@ -434,4 +434,12 @@ config PHY_CYGNUS_PCIE > > > > source "drivers/phy/tegra/Kconfig" > > > > +config PHY_QORIQ_USB2 > > + tristate "QorIQ USB 2.0 PHY driver" > > + depends on ARCH_MXC || ARCH_LAYERSCAPE > Hello Peter, > It seems mxc platforms do not use this PHY. > Besides, if you are using ULPI phy, you need to depend on ULPI bus. > QorIQ platform are having both ULPI and non-ULPI PHY variants, Hence this PHY driver is targeted for both. And driver takes decision on run time which PHY is there according to information passed in DTS files. Best Regards, Rajesh Bhagat > Peter > > + depends on OF > > + select GENERIC_PHY > > + help > > + Enable this to support the USB2.0 PHY on the QorIQ SoC. > > + > > endmenu > > diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index > > 9c3e73c..044105a 100644 > > --- a/drivers/phy/Makefile > > +++ b/drivers/phy/Makefile > > @@ -53,5 +53,6 @@ obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o > > obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.o > > obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o > > obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o > > +obj-$(CONFIG_PHY_QORIQ_USB2) += phy-qoriq-usb2.o > > > > obj-$(CONFIG_ARCH_TEGRA) += tegra/ > > diff --git a/drivers/phy/phy-qoriq-usb2.c > > b/drivers/phy/phy-qoriq-usb2.c new file mode 100644 index > > 0000000..f74d255 > > --- /dev/null > > +++ b/drivers/phy/phy-qoriq-usb2.c > > @@ -0,0 +1,228 @@ > > +/* > > + * QorIQ SoC USB 2.0 PHY driver > > + * > > + * Copyright 2016 Freescale Semiconductor, Inc. > > + * Author: Rajesh Bhagat > > + * > > + * This program is free software; you can redistribute it and/or > > +modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + * > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "phy-qoriq-usb2.h" > > + > > +static int qoriq_usb2_phy_init(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + struct device *dev = ctx->dev; > > + > > + if (ctx->ulpi_phy) { > > + if (usb_phy_init(ctx->ulpi_phy)) { > > + dev_err(dev, "unable to init transceiver, probably missing\n"); > > + return -ENODEV; > > + } > > + } > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_power_on(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + u32 flags; > > + > > + if (ctx->ulpi_phy) { > > + flags = usb_phy_io_read(ctx->ulpi_phy, ULPI_OTG_CTRL); > > + usb_phy_io_write(ctx->ulpi_phy, flags | > > + (ULPI_OTG_CTRL_DRVVBUS_EXT | > > + ULPI_OTG_CTRL_EXTVBUSIND), ULPI_OTG_CTRL); > > + flags = usb_phy_io_read(ctx->ulpi_phy, ULPI_IFC_CTRL); > > + usb_phy_io_write(ctx->ulpi_phy, flags | > > + (ULPI_IFC_CTRL_EXTERNAL_VBUS | > > + ULPI_IFC_CTRL_PASSTHRU), ULPI_IFC_CTRL); > > + } > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_power_off(struct phy *_phy) { > > + /* TODO: Add logic to power off phy */ > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_exit(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + > > + if (ctx->ulpi_phy) > > + usb_phy_shutdown(ctx->ulpi_phy); > > + > > + return 0; > > +} > > + > > +static const struct phy_ops ops = { > > + .init = qoriq_usb2_phy_init, > > + .power_on = qoriq_usb2_phy_power_on, > > + .power_off = qoriq_usb2_phy_power_off, > > + .exit = qoriq_usb2_phy_exit, > > + .owner = THIS_MODULE, > > +}; > > + > > + > > +static enum qoriq_usb2_phy_ver of_usb_get_phy_version(struct > > +device_node *np) { > > + enum qoriq_usb2_phy_ver phy_version = QORIQ_PHY_UNKNOWN; > > + > > + if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy")) { > > + if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy-v1.0")) > > + phy_version = QORIQ_PHY_LEGACY; > > + else if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy-v2.0")) > > + phy_version = QORIQ_PHY_NXP_ISP1508; > > + } > > + return phy_version; > > +} > > + > > +static int qoriq_usb2_phy_probe(struct platform_device *pdev) { > > + int ret; > > + struct resource *res; > > + struct qoriq_usb2_phy_ctx *ctx; > > + struct device *dev = &pdev->dev; > > + const struct of_device_id *of_id; > > + struct phy_provider *phy_provider; > > + struct device_node *np = pdev->dev.of_node; > > + > > + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); > > + if (!ctx) > > + return -ENOMEM; > > + > > + ctx->dev = dev; > > + > > + of_id = of_match_device(dev->driver->of_match_table, dev); > > + if (!of_id) { > > + dev_err(dev, "failed to get device match\n"); > > + ret = -EINVAL; > > + goto err_out; > > + } > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + if (!res) { > > + dev_err(dev, "failed to get I/O memory\n"); > > + ret = -ENOENT; > > + goto err_out; > > + } > > + > > + ctx->regs = devm_ioremap(dev, res->start, resource_size(res)); > > + if (!ctx->regs) { > > + dev_err(dev, "failed to remap I/O memory\n"); > > + ret = -ENOMEM; > > + goto err_out; > > + } > > + > > + platform_set_drvdata(pdev, ctx); > > + > > + ctx->phy = devm_phy_create(ctx->dev, NULL, &ops); > > + if (IS_ERR(ctx->phy)) { > > + dev_err(dev, "failed to create PHY\n"); > > + ret = PTR_ERR(ctx->phy); > > + goto err_out; > > + } > > + phy_set_drvdata(ctx->phy, ctx); > > + > > + ctx->phy_version = of_usb_get_phy_version(np); > > + if (ctx->phy_version == QORIQ_PHY_UNKNOWN) { > > + ret = -EINVAL; > > + dev_err(dev, "failed to get PHY version\n"); > > + goto err_out; > > + } > > + > > + ctx->phy_type = of_usb_get_phy_mode(np); > > + switch (ctx->phy_type) { > > + case USBPHY_INTERFACE_MODE_ULPI: > > + switch (ctx->phy_version) { > > + case QORIQ_PHY_NXP_ISP1508: > > + ctx->ulpi_phy = qoriq_otg_ulpi_create(0); > > + if (!ctx->ulpi_phy) { > > + dev_err(dev, "qoriq_otg_ulpi_create returned NULL\n"); > > + ret = -ENOMEM; > > + goto err_out; > > + } > > + ctx->ulpi_phy->io_priv = ctx->regs + ULPI_VIEWPORT; > > + break; > > + default: > > + ctx->ulpi_phy = NULL; > > + break; > > + } > > + break; > > + default: > > + dev_err(&pdev->dev, "phy_type %d is invalid or unsupported\n", > > + ctx->phy_type); > > + ret = -EINVAL; > > + goto err_out; > > + } > > + > > + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > > + if (IS_ERR(phy_provider)) { > > + dev_err(dev, "failed to register phy_provider\n"); > > + ret = PTR_ERR_OR_ZERO(phy_provider); > > + goto err_out; > > + } > > + > > + dev_dbg(dev, "initialized\n"); > > + return 0; > > + > > +err_out: > > + return ret; > > +} > > + > > +static int qoriq_usb2_phy_remove(struct platform_device *pdev) { > > + struct device *dev = &pdev->dev; > > + struct qoriq_usb2_phy_ctx *ctx = platform_get_drvdata(pdev); > > + > > + devm_phy_destroy(ctx->dev, ctx->phy); > > + devm_iounmap(dev, ctx->regs); > > + dev_dbg(dev, "de-initialized\n"); > > + return 0; > > +} > > + > > +static const struct of_device_id qoriq_usb2_phy_dt_ids[] = { > > + { .compatible = "fsl,qoriq-usb2-phy"}, > > + {} > > +}; > > + > > +MODULE_DEVICE_TABLE(of, qoriq_usb2_phy_dt_ids); > > + > > +static struct platform_driver qoriq_usb2_phy_driver = { > > + .probe = qoriq_usb2_phy_probe, > > + .remove = qoriq_usb2_phy_remove, > > + .driver = { > > + .name = "qoriq_usb2_phy", > > + .owner = THIS_MODULE, > > + .of_match_table = of_match_ptr(qoriq_usb2_phy_dt_ids), > > + }, > > +}; > > + > > +module_platform_driver(qoriq_usb2_phy_driver); > > + > > +MODULE_ALIAS("platform:qoriq-usb2-phy"); > > +MODULE_LICENSE("GPL v2"); > > +MODULE_DESCRIPTION("QorIQ SoC USB PHY driver"); MODULE_AUTHOR("Rajesh > > +Bhagat "); > > diff --git a/drivers/phy/phy-qoriq-usb2.h > > b/drivers/phy/phy-qoriq-usb2.h new file mode 100644 index > > 0000000..47c37a5 > > --- /dev/null > > +++ b/drivers/phy/phy-qoriq-usb2.h > > @@ -0,0 +1,50 @@ > > +/* > > + * Freescale SoC USB 2.0 PHY driver > > + * > > + * Copyright 2016 Freescale Semiconductor, Inc. > > + * Author: Rajesh Bhagat > > + * > > + * This program is free software; you can redistribute it and/or > > +modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + * > > + */ > > +#ifndef _PHY_QORIQ_USB2_H > > +#define _PHY_QORIQ_USB2_H > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#define ULPI_VIEWPORT 0x170 > > + > > +enum qoriq_usb2_phy_ver { > > + QORIQ_PHY_LEGACY, > > + QORIQ_PHY_NXP_ISP1508, > > + QORIQ_PHY_UNKNOWN, > > +}; > > + > > +struct qoriq_usb2_phy_ctx { > > + struct phy *phy; > > + struct clk *clk; > > + struct device *dev; > > + void __iomem *regs; > > + struct usb_phy *ulpi_phy; > > + enum usb_phy_interface phy_type; > > + enum qoriq_usb2_phy_ver phy_version; }; > > + > > +#ifdef CONFIG_USB_ULPI_VIEWPORT > > +static inline struct usb_phy *qoriq_otg_ulpi_create(unsigned int > > +flags) { > > + return otg_ulpi_create(&ulpi_viewport_access_ops, flags); } #else > > +static inline struct usb_phy *qoriq_otg_ulpi_create(unsigned int > > +flags) { > > + return NULL; > > +} > > +#endif > > + > > +#endif > > -- > > 2.6.2.198.g614a2ac > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-usb" > > in the body of a message to majordomo@vger.kernel.org More majordomo > > info at http://vger.kernel.org/majordomo-info.html > > -- > > Best Regards, > Peter Chen From mboxrd@z Thu Jan 1 00:00:00 1970 From: rajesh.bhagat@nxp.com (Rajesh Bhagat) Date: Tue, 12 Jul 2016 03:59:25 +0000 Subject: [PATCH v2 3/5] drivers: usb: phy: Add qoriq usb 2.0 phy driver support In-Reply-To: <20160711065408.GI31647@shlinux2> References: <1468038656-10345-1-git-send-email-rajesh.bhagat@nxp.com> <1468038656-10345-4-git-send-email-rajesh.bhagat@nxp.com> <20160711065408.GI31647@shlinux2> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org > -----Original Message----- > From: Peter Chen [mailto:hzpeterchen at gmail.com] > Sent: Monday, July 11, 2016 12:24 PM > To: Rajesh Bhagat > Cc: linux-usb at vger.kernel.org; linux-kernel at vger.kernel.org; > devicetree at vger.kernel.org; Peter Chen ; > gregkh at linuxfoundation.org; kishon at ti.com; robh+dt at kernel.org; > shawnguo at kernel.org; linux-arm-kernel at lists.infradead.org > Subject: Re: [PATCH v2 3/5] drivers: usb: phy: Add qoriq usb 2.0 phy driver support > > On Sat, Jul 09, 2016 at 10:00:54AM +0530, Rajesh Bhagat wrote: > > Adds qoriq usb 2.0 phy driver support for LS1021A and LS1012A > > platform. > > > > Signed-off-by: Rajesh Bhagat > > --- > > Changes in v2: > > - Replaced Freescale with QorIQ in comments section > > - Changed the compatible string to fsl,qoriq-usb2-phy and added > > version > > - Added dependency on ARCH_MXC/ARCH_LAYERSCAPE and OF in Kconfig > > - Dropped CONFIG_ULPI #ifdefs to make code generic > > - Removed calls to devm free/release calls > > > > drivers/phy/Kconfig | 8 ++ > > drivers/phy/Makefile | 1 + > > drivers/phy/phy-qoriq-usb2.c | 228 > > +++++++++++++++++++++++++++++++++++++++++++ > > drivers/phy/phy-qoriq-usb2.h | 50 ++++++++++ > > 4 files changed, 287 insertions(+) > > create mode 100644 drivers/phy/phy-qoriq-usb2.c create mode 100644 > > drivers/phy/phy-qoriq-usb2.h > > > > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index > > b869b98..cc69299 100644 > > --- a/drivers/phy/Kconfig > > +++ b/drivers/phy/Kconfig > > @@ -434,4 +434,12 @@ config PHY_CYGNUS_PCIE > > > > source "drivers/phy/tegra/Kconfig" > > > > +config PHY_QORIQ_USB2 > > + tristate "QorIQ USB 2.0 PHY driver" > > + depends on ARCH_MXC || ARCH_LAYERSCAPE > Hello Peter, > It seems mxc platforms do not use this PHY. > Besides, if you are using ULPI phy, you need to depend on ULPI bus. > QorIQ platform are having both ULPI and non-ULPI PHY variants, Hence this PHY driver is targeted for both. And driver takes decision on run time which PHY is there according to information passed in DTS files. Best Regards, Rajesh Bhagat > Peter > > + depends on OF > > + select GENERIC_PHY > > + help > > + Enable this to support the USB2.0 PHY on the QorIQ SoC. > > + > > endmenu > > diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index > > 9c3e73c..044105a 100644 > > --- a/drivers/phy/Makefile > > +++ b/drivers/phy/Makefile > > @@ -53,5 +53,6 @@ obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o > > obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.o > > obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o > > obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o > > +obj-$(CONFIG_PHY_QORIQ_USB2) += phy-qoriq-usb2.o > > > > obj-$(CONFIG_ARCH_TEGRA) += tegra/ > > diff --git a/drivers/phy/phy-qoriq-usb2.c > > b/drivers/phy/phy-qoriq-usb2.c new file mode 100644 index > > 0000000..f74d255 > > --- /dev/null > > +++ b/drivers/phy/phy-qoriq-usb2.c > > @@ -0,0 +1,228 @@ > > +/* > > + * QorIQ SoC USB 2.0 PHY driver > > + * > > + * Copyright 2016 Freescale Semiconductor, Inc. > > + * Author: Rajesh Bhagat > > + * > > + * This program is free software; you can redistribute it and/or > > +modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + * > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "phy-qoriq-usb2.h" > > + > > +static int qoriq_usb2_phy_init(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + struct device *dev = ctx->dev; > > + > > + if (ctx->ulpi_phy) { > > + if (usb_phy_init(ctx->ulpi_phy)) { > > + dev_err(dev, "unable to init transceiver, probably missing\n"); > > + return -ENODEV; > > + } > > + } > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_power_on(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + u32 flags; > > + > > + if (ctx->ulpi_phy) { > > + flags = usb_phy_io_read(ctx->ulpi_phy, ULPI_OTG_CTRL); > > + usb_phy_io_write(ctx->ulpi_phy, flags | > > + (ULPI_OTG_CTRL_DRVVBUS_EXT | > > + ULPI_OTG_CTRL_EXTVBUSIND), ULPI_OTG_CTRL); > > + flags = usb_phy_io_read(ctx->ulpi_phy, ULPI_IFC_CTRL); > > + usb_phy_io_write(ctx->ulpi_phy, flags | > > + (ULPI_IFC_CTRL_EXTERNAL_VBUS | > > + ULPI_IFC_CTRL_PASSTHRU), ULPI_IFC_CTRL); > > + } > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_power_off(struct phy *_phy) { > > + /* TODO: Add logic to power off phy */ > > + > > + return 0; > > +} > > + > > +static int qoriq_usb2_phy_exit(struct phy *_phy) { > > + struct qoriq_usb2_phy_ctx *ctx = phy_get_drvdata(_phy); > > + > > + if (ctx->ulpi_phy) > > + usb_phy_shutdown(ctx->ulpi_phy); > > + > > + return 0; > > +} > > + > > +static const struct phy_ops ops = { > > + .init = qoriq_usb2_phy_init, > > + .power_on = qoriq_usb2_phy_power_on, > > + .power_off = qoriq_usb2_phy_power_off, > > + .exit = qoriq_usb2_phy_exit, > > + .owner = THIS_MODULE, > > +}; > > + > > + > > +static enum qoriq_usb2_phy_ver of_usb_get_phy_version(struct > > +device_node *np) { > > + enum qoriq_usb2_phy_ver phy_version = QORIQ_PHY_UNKNOWN; > > + > > + if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy")) { > > + if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy-v1.0")) > > + phy_version = QORIQ_PHY_LEGACY; > > + else if (of_device_is_compatible(np, "fsl,qoriq-usb2-phy-v2.0")) > > + phy_version = QORIQ_PHY_NXP_ISP1508; > > + } > > + return phy_version; > > +} > > + > > +static int qoriq_usb2_phy_probe(struct platform_device *pdev) { > > + int ret; > > + struct resource *res; > > + struct qoriq_usb2_phy_ctx *ctx; > > + struct device *dev = &pdev->dev; > > + const struct of_device_id *of_id; > > + struct phy_provider *phy_provider; > > + struct device_node *np = pdev->dev.of_node; > > + > > + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); > > + if (!ctx) > > + return -ENOMEM; > > + > > + ctx->dev = dev; > > + > > + of_id = of_match_device(dev->driver->of_match_table, dev); > > + if (!of_id) { > > + dev_err(dev, "failed to get device match\n"); > > + ret = -EINVAL; > > + goto err_out; > > + } > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + if (!res) { > > + dev_err(dev, "failed to get I/O memory\n"); > > + ret = -ENOENT; > > + goto err_out; > > + } > > + > > + ctx->regs = devm_ioremap(dev, res->start, resource_size(res)); > > + if (!ctx->regs) { > > + dev_err(dev, "failed to remap I/O memory\n"); > > + ret = -ENOMEM; > > + goto err_out; > > + } > > + > > + platform_set_drvdata(pdev, ctx); > > + > > + ctx->phy = devm_phy_create(ctx->dev, NULL, &ops); > > + if (IS_ERR(ctx->phy)) { > > + dev_err(dev, "failed to create PHY\n"); > > + ret = PTR_ERR(ctx->phy); > > + goto err_out; > > + } > > + phy_set_drvdata(ctx->phy, ctx); > > + > > + ctx->phy_version = of_usb_get_phy_version(np); > > + if (ctx->phy_version == QORIQ_PHY_UNKNOWN) { > > + ret = -EINVAL; > > + dev_err(dev, "failed to get PHY version\n"); > > + goto err_out; > > + } > > + > > + ctx->phy_type = of_usb_get_phy_mode(np); > > + switch (ctx->phy_type) { > > + case USBPHY_INTERFACE_MODE_ULPI: > > + switch (ctx->phy_version) { > > + case QORIQ_PHY_NXP_ISP1508: > > + ctx->ulpi_phy = qoriq_otg_ulpi_create(0); > > + if (!ctx->ulpi_phy) { > > + dev_err(dev, "qoriq_otg_ulpi_create returned NULL\n"); > > + ret = -ENOMEM; > > + goto err_out; > > + } > > + ctx->ulpi_phy->io_priv = ctx->regs + ULPI_VIEWPORT; > > + break; > > + default: > > + ctx->ulpi_phy = NULL; > > + break; > > + } > > + break; > > + default: > > + dev_err(&pdev->dev, "phy_type %d is invalid or unsupported\n", > > + ctx->phy_type); > > + ret = -EINVAL; > > + goto err_out; > > + } > > + > > + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > > + if (IS_ERR(phy_provider)) { > > + dev_err(dev, "failed to register phy_provider\n"); > > + ret = PTR_ERR_OR_ZERO(phy_provider); > > + goto err_out; > > + } > > + > > + dev_dbg(dev, "initialized\n"); > > + return 0; > > + > > +err_out: > > + return ret; > > +} > > + > > +static int qoriq_usb2_phy_remove(struct platform_device *pdev) { > > + struct device *dev = &pdev->dev; > > + struct qoriq_usb2_phy_ctx *ctx = platform_get_drvdata(pdev); > > + > > + devm_phy_destroy(ctx->dev, ctx->phy); > > + devm_iounmap(dev, ctx->regs); > > + dev_dbg(dev, "de-initialized\n"); > > + return 0; > > +} > > + > > +static const struct of_device_id qoriq_usb2_phy_dt_ids[] = { > > + { .compatible = "fsl,qoriq-usb2-phy"}, > > + {} > > +}; > > + > > +MODULE_DEVICE_TABLE(of, qoriq_usb2_phy_dt_ids); > > + > > +static struct platform_driver qoriq_usb2_phy_driver = { > > + .probe = qoriq_usb2_phy_probe, > > + .remove = qoriq_usb2_phy_remove, > > + .driver = { > > + .name = "qoriq_usb2_phy", > > + .owner = THIS_MODULE, > > + .of_match_table = of_match_ptr(qoriq_usb2_phy_dt_ids), > > + }, > > +}; > > + > > +module_platform_driver(qoriq_usb2_phy_driver); > > + > > +MODULE_ALIAS("platform:qoriq-usb2-phy"); > > +MODULE_LICENSE("GPL v2"); > > +MODULE_DESCRIPTION("QorIQ SoC USB PHY driver"); MODULE_AUTHOR("Rajesh > > +Bhagat "); > > diff --git a/drivers/phy/phy-qoriq-usb2.h > > b/drivers/phy/phy-qoriq-usb2.h new file mode 100644 index > > 0000000..47c37a5 > > --- /dev/null > > +++ b/drivers/phy/phy-qoriq-usb2.h > > @@ -0,0 +1,50 @@ > > +/* > > + * Freescale SoC USB 2.0 PHY driver > > + * > > + * Copyright 2016 Freescale Semiconductor, Inc. > > + * Author: Rajesh Bhagat > > + * > > + * This program is free software; you can redistribute it and/or > > +modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + * > > + */ > > +#ifndef _PHY_QORIQ_USB2_H > > +#define _PHY_QORIQ_USB2_H > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#define ULPI_VIEWPORT 0x170 > > + > > +enum qoriq_usb2_phy_ver { > > + QORIQ_PHY_LEGACY, > > + QORIQ_PHY_NXP_ISP1508, > > + QORIQ_PHY_UNKNOWN, > > +}; > > + > > +struct qoriq_usb2_phy_ctx { > > + struct phy *phy; > > + struct clk *clk; > > + struct device *dev; > > + void __iomem *regs; > > + struct usb_phy *ulpi_phy; > > + enum usb_phy_interface phy_type; > > + enum qoriq_usb2_phy_ver phy_version; }; > > + > > +#ifdef CONFIG_USB_ULPI_VIEWPORT > > +static inline struct usb_phy *qoriq_otg_ulpi_create(unsigned int > > +flags) { > > + return otg_ulpi_create(&ulpi_viewport_access_ops, flags); } #else > > +static inline struct usb_phy *qoriq_otg_ulpi_create(unsigned int > > +flags) { > > + return NULL; > > +} > > +#endif > > + > > +#endif > > -- > > 2.6.2.198.g614a2ac > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-usb" > > in the body of a message to majordomo at vger.kernel.org More majordomo > > info at http://vger.kernel.org/majordomo-info.html > > -- > > Best Regards, > Peter Chen