Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753227AbbFWC6P (ORCPT ); Mon, 22 Jun 2015 22:58:15 -0400 Received: from mail-by2on0123.outbound.protection.outlook.com ([207.46.100.123]:29760 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751731AbbFWC6J (ORCPT ); Mon, 22 Jun 2015 22:58:09 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; gmail.com; dkim=none (message not signed) header.d=none; Date: Tue, 23 Jun 2015 10:55:35 +0800 From: Peter Chen To: "Maciej S. Szmigiero" CC: USB list , Rob Herring , Pawel Moll , Mark Rutland , "Ian Campbell" , Kumar Gala , Greg Kroah-Hartman , Markus Pargmann , "devicetree@vger.kernel.org" , linux-kernel , Fabio Estevam Subject: Re: [PATCH] usb: ci_hdrc_imx: add optional hub clock Message-ID: <20150623025534.GA15147@shlinux2> References: <5586EC36.1070403@maciej.szmigiero.name> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <5586EC36.1070403@maciej.szmigiero.name> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD020;1:LUjQtIx1xoAdU+u9bw1gFb5JYvQ865VzuzRCR1Ot86r8Kg5Mf8UVQVM0Z3UKN5Tfyw6qitOrCRdB+GHKRJTpqGxZ6Sxc2U6zq7TsuEy1wTWbqklOEqN5dE8wQ7kojoAGF2kpCY7OJoxlIi6S11zOeJEPr97WpAZK1mZEN/YHjX9fFPds4skAMxZEsuctwPfie/hg0XL8RvcVEiykGo9IxlVWUugzbJ17YVK+iaYhWmtl85Bi6b+BqPDTJkZkS1fjfD58lWGtf1j8MrTcuWH7bRA4pV4v28MjPYYgIBtxXsLHoHdMRLutwEyPKrYggt/M0W6EvxLFrTxwxsDkF6O/Kj1kN3YcDZyb0IVoybogvA4= X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(1060300003)(2980300002)(339900001)(51704005)(189002)(199003)(24454002)(87936001)(86362001)(575784001)(2950100001)(46102003)(105606002)(77096005)(4290100001)(92566002)(23726002)(64706001)(76176999)(47776003)(50986999)(54356999)(19580395003)(97756001)(33656002)(77156002)(62966003)(5001920100001)(110136002)(5001960100002)(6806004)(19580405001)(4001350100001)(83506001)(33716001)(104016003)(110436001)(106466001)(85426001)(50466002)(46406003);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR03MB282;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;MX:1;A:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1PR03MB282;2:x5fc6wHrSNbMmfYcmgmFH1MbAheEJ3SaJhs7m4f0AaWQMplxgsKpN+Mqkd3fMGyA;3:pURyYThmap8g4xkUOiEpL25/Zizv9qW2A/zv6n4PRXt7TwzDVaOAhgD+C78w3dQK0YEX7QjEehsOvB7S9UgXFiqjfO7Kyx9Nz+8TijauHK+Wnzczlyrr57XzFpdZUS7LI0YLf0SB4nOGkiJsVSNeZ2nsrVDqi4s0Gj7/vUlFKF/snM+zbEjDFm5qL0eBedYwyUNRYX2FYAHzg/Ri5xlQvRmtMJpm2VsJDar9RGB6pzY=;20:mdrk+qdqD0ib9YqDVxUmnOmyQfG2EOr0w1tMWu6wGqwWf6pZmBfc8bYo/J4s7L2mXcYQLlM+rUR4TiimQXxe3z6I+6f1LN7kIoa0zXhYjBBP7PHPd+NTmAuzLSC/oNTiQsYRi8RIOK8HwC48lX2uNVfMEjiFmCbZIfJl/ve3LqcMMdPVmE7WBYfFY4t0oTQ/VTLTYf6a8ukMHu6kmEzyR548J4eir3HSzbPaDXsGtqUA+wfYpN/ib9zEOdFNGHUIRn4a4q9DpW134FwlTIZ3TMsY529amWDgv+UOcjR+yeM/H6GcSTN728wohRk4NK8GxRHX2I0zQfTRwV/8lY2yL8EHpB2hI+CECEZ8rzTuFlw= X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:BN1PR03MB282; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1;PCL:0;RULEID:(601004)(5005006)(1201001)(3002001);SRVR:BN1PR03MB282;BCL:1;PCL:0;RULEID:;SRVR:BN1PR03MB282; X-Microsoft-Exchange-Diagnostics: 1;BN1PR03MB282;4:OsR9BIyN/pmV21CKXXjomxn/ti5wBaLa2UnQOmB8ryk94OEiSfDlDgo+Tf6/umyeMEKXS7NaXAw2gYKYO2VdL6yrnfg4T6YhJhQlYX1V5C3FXVkjzN98Q6DHHUVxqR0ovgggYz+jOYOmNS5S1Qor2yRhb1Kq+xmkZrpxhfanX3JysGNTZXf/E5uqX7nZV9ZEBJqjCiKgPVA6wzXYr/Zbr34SBygIZkcTNo6oYc38cwnKITfapCbInEFpseVykc3/YWPhSWnIpV5W2kJCnyaoT6VzKKCq/MJR+9qxJLi2BGtTAPjTLQqSlXlwsEUsFNVK X-Forefront-PRVS: 06167FAD59 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN1PR03MB282;23:bxIvvw5PEx3IYR+XCAoSe4HjbOm3IztHnzChY2jfQc?= =?us-ascii?Q?0uzk1Gc1Idk3Tk4onj33Yzi1gfqMh5i+iQEYj0e1wMKKuPs4JgZaPzSTt2NQ?= =?us-ascii?Q?d3Axn+hxGjJMy6Xk2lMYritmRh4T0Ls1ZW8vPUrb1CE5tAwTC88V130gwXTR?= =?us-ascii?Q?qoc0XlHafVHl/FMFywye0NRf0jQFUk+qy0p2q4ZwaSItkVrIG94xIYkSvano?= =?us-ascii?Q?oaZJBAs+pgrKPR0zN4p7whGdj35arJwRvtYAxvdyF5YGPC1yTrmviEeD6l2N?= =?us-ascii?Q?S4D+RfGB20mSmc/OXCSTzXUo6ZIZiuJrx921wjLyeE0fnndhejfW19d0UMtP?= =?us-ascii?Q?Yx98QMsLR1WyjNFf0rDOQtPlB66SMh25jLaVM/NcDBZmpv4Eus5393O4Ptog?= =?us-ascii?Q?NDOwFy8GxV+NYuQ+D3yIE8ENz5xjy8qALTLwcl821pCI6uYrhxhJYbFT30Q5?= =?us-ascii?Q?f9+zj2R+g6JehR/NgGWqeoTmnBAEFpWTssLwG53/miv5naqtarymsHbJHKYs?= =?us-ascii?Q?Ze8YP3Xh5+oTOqEOKMTnGPugA1lB3IzCjX+aQCsAvK1B0VPkX0E83RXE1Nog?= =?us-ascii?Q?IJ3oJ2ubg8/m9QKReplNVIoLcsCJLW18KTrgxoYR64VpefOAWIwzBnj7nykU?= =?us-ascii?Q?gaa6IwUQSEGaU4hxvWE2MLBChQvz+ew5CdLczgpcDTcFIjcwpx35vJvjHiY3?= =?us-ascii?Q?iHEr7vWPhDsCRqvu8wzxBrbZI+82r+r3MwcVABe9kHI8oaRGsAT0tlkmJ999?= =?us-ascii?Q?ygtWPe1ZNyEuH66bmCZszlpHN0rjNGGykq6LLncozFMGExUs4zU6m4aiRszh?= =?us-ascii?Q?XqkNkzXr0H4qeZVRhkyou5dM9NpBYdflJel4VtmEWbkX8RUgXVqqr5e2+kZX?= =?us-ascii?Q?InzRIlwwQh1WVQg2WgS6tPNTdBn8SF+O2OxpEuAwhlUqveITQY1vACicSa+U?= =?us-ascii?Q?MnXIZtkHOhVW29Fsu1VjCPlLLPQyE4vaSZnkVcFKdQn+UPq0KuqwDIdBYFYF?= =?us-ascii?Q?Yl6m8VkNiJTrcKGWRI+0xt9xBCDxPc4qqBccQH2mlV00lVMElmQxA6c8s+8k?= =?us-ascii?Q?BSR9DutaBVLGePIqWsrXmccY0sGGGTuV0MCL4/DuU5r0bLHQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN1PR03MB282;5:UVZqcnEMShEQIvcNzgUHN07P46Pi/k36Rq1iS4wow2V+qqcrO61Zw20Zl3p3KZ7atWFeghgEciUAmqtU294g+/NKDG0BCH66kVrQLbRFFjd5DaCNUJJX7l9CPzJF1D4WhJRSbIHyjI8pORk3EwkZLg==;24:ZHupAviRyZGlWF0/7GPXoCszpuFVBuDVA9TTvjUNh1/xeAd9kZz6p7y+4gihHNUGLU/GkX49zFhzFov8j65BW/KJD2mJdACPrtyoFTCVFhc=;20:zclMCeSJlYVkD8hI1VSBDSBKHUWGEDM/qaUnMA/tkGjRiHXdve98dMbaer9Xm466kUofiG+XMYjMnCG5MiLjQg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2015 02:58:05.8300 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR03MB282 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4422 Lines: 117 On Mon, Jun 22, 2015 at 12:54:14AM +0800, Maciej S. Szmigiero wrote: > This patch adds ability to define optional clock of connected > USB hub to ChipIdea i.MX usb controller driver. > > This is needed for example for UDOO board. > Previously, this board DT file used a fact that non-core registers > of this USB controller have a separate driver (usbmisc_imx) which > did allow defining a separate clock. > > Because the non-core registers are in fact using the same clock as > main controller this allowed to use one of such clock definitions > to enable USB hub clock instead. > > However, since commit 73dea4a912b2 > ("usb: chipidea: usbmisc_imx: delete clock information") this > possibility no longer exists and loading USB support on this board > results in a hard SoC lockup. > > Note that this is not specific to particular USB hub chip used, > rather than to a particular board. > Since this is a DT-based board there is no board platform file to > put such clock enable. > Also, USB bus devices aren't instantiated in DT file since it is an > enumerable bus. > > NOP PHY also can't be used as clock consumer since this > USB controller needs a true MXS phy definition, which accepts only > one clock (different from USB controller one). > > Based on a patch previously submitted by Fabio Estevam, with consent. > > Signed-off-by: Maciej Szmigiero > > diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt > index 38a5480..fc65f1c 100644 > --- a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt > +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt > @@ -5,6 +5,8 @@ Required properties: > - reg: Should contain registers location and length > - interrupts: Should contain controller interrupt > - fsl,usbphy: phandle of usb phy that connects to the port > +- clocks: phandles of clocks that drive the controller and optionally > + an USB hub connected to it > > Recommended properies: > - phy_type: the type of the phy connected to the core. Should be one > @@ -20,12 +22,14 @@ Optional properties: > - external-vbus-divider: enables off-chip resistor divider for Vbus > - maximum-speed: limit the maximum connection speed to "full-speed". > - tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts > +- clock-names: must be "default", "hub" if optional USB hub clock is used > > Examples: > usb@02184000 { /* USB OTG */ > compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; > reg = <0x02184000 0x200>; > interrupts = <0 43 0x04>; > + clocks = <&clks IMX6QDL_CLK_USBOH3>; > fsl,usbphy = <&usbphy1>; > fsl,usbmisc = <&usbmisc 0>; > disable-over-current; > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c > index 389f0e0..bb7f859 100644 > --- a/drivers/usb/chipidea/ci_hdrc_imx.c > +++ b/drivers/usb/chipidea/ci_hdrc_imx.c > @@ -65,6 +65,7 @@ struct ci_hdrc_imx_data { > struct usb_phy *phy; > struct platform_device *ci_pdev; > struct clk *clk; > + struct clk *clk_hub; > struct imx_usbmisc_data *usbmisc_data; > bool supports_runtime_pm; > bool in_lpm; > @@ -196,6 +197,16 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) > goto disable_device; > } > > + data->clk_hub = devm_clk_get(&pdev->dev, "hub"); > + if (!IS_ERR(data->clk_hub)) { > + ret = clk_prepare_enable(data->clk_hub); > + if (ret) { > + dev_err(&pdev->dev, > + "Failed to enable clk_hub: %d\n", ret); > + goto disable_device; > + } > + } > + Hi Maciej, As I said before, the USB HUB is just an USB peripheral, we should not put a peripheral's clock information to controller driver, I think hub driver should take responsibilities for it, just like other usb pheripheral drivers, like usb modem, etc. You can talk it with Alan Stern about it. > platform_set_drvdata(pdev, data); > > if (data->supports_runtime_pm) { > @@ -223,6 +234,8 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev) > pm_runtime_disable(&pdev->dev); > pm_runtime_put_noidle(&pdev->dev); > } > + if (!IS_ERR(data->clk_hub)) > + clk_disable_unprepare(data->clk_hub); > ci_hdrc_remove_device(data->ci_pdev); > clk_disable_unprepare(data->clk); > > -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/