* [PATCH v3 0/5] usb: change clock information for chipidea @ 2015-09-21 0:43 Peter Chen [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Peter Chen @ 2015-09-21 0:43 UTC (permalink / raw) To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A, linux-usb-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, fabio.estevam-KZfg59tc24xl57MIdRCFDg, Peter Chen This patch set changes usb clock information for legacy i.mx platforms. At these platforms, they needs three clocks to let controller work. Hi Fabio, Would you please have a test at imx27 and imx25 boards, thanks. Changes for v3: - Delete property "needs-three-clocks", and using of_device_id->data to differentiate platforms - change <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> #v3.19+ to <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> #v4.1+ Changes for v2: - Add imx25 & imx27 dts change - Add Fabio's tested-by and Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> #v3.19+ - Some typo and commit description Peter Chen (5): doc: dt-binding: ci-hdrc-usb2: split vendor specific properties ARM: dts: imx27.dtsi: change the clock information for usb ARM: dts: imx25.dtsi: change the clock information for usb ARM: dts: imx35.dtsi: change the clock information for usb usb: chipidea: imx: refine clock operations to adapt for all platforms .../devicetree/bindings/usb/ci-hdrc-usb2.txt | 10 +- arch/arm/boot/dts/imx25.dtsi | 8 +- arch/arm/boot/dts/imx27.dtsi | 16 ++- arch/arm/boot/dts/imx35.dtsi | 8 +- drivers/usb/chipidea/ci_hdrc_imx.c | 156 ++++++++++++++++++--- 5 files changed, 164 insertions(+), 34 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>]
* [PATCH v3 1/5] doc: dt-binding: ci-hdrc-usb2: split vendor specific properties [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> @ 2015-09-21 0:43 ` Peter Chen [not found] ` <1442796186-2574-2-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 2015-09-21 0:43 ` [PATCH v3 3/5] ARM: dts: imx25.dtsi: change the clock information for usb Peter Chen ` (2 subsequent siblings) 3 siblings, 1 reply; 10+ messages in thread From: Peter Chen @ 2015-09-21 0:43 UTC (permalink / raw) To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A, linux-usb-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, fabio.estevam-KZfg59tc24xl57MIdRCFDg, Peter Chen Each vendor may have its specific properties, they are not belonged to common optional properties, split them from common's. Signed-off-by: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> --- Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt index 77946f5..27dc705 100644 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt @@ -27,10 +27,6 @@ Optional properties: - vbus-supply: reference to the VBUS regulator - maximum-speed: limit the maximum connection speed to "full-speed". - tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts -- fsl,usbmisc: (FSL only) phandler of non-core register device, with one - argument that indicate usb controller index -- disable-over-current: (FSL only) disable over current detect -- external-vbus-divider: (FSL only) enables off-chip resistor divider for Vbus - itc-setting: interrupt threshold control register control, the setting should be aligned with ITC bits at register USBCMD. - ahb-burst-config: it is vendor dependent, the required value should be @@ -54,6 +50,12 @@ Optional properties: - phy-clkgate-delay-us: the delay time (us) between putting the PHY into low power mode and gating the PHY clock. +i.mx specific properties +- fsl,usbmisc: phandler of non-core register device, with one + argument that indicate usb controller index +- disable-over-current: disable over current detect +- external-vbus-divider: enables off-chip resistor divider for Vbus + Example: usb@f7ed0000 { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 10+ messages in thread
[parent not found: <1442796186-2574-2-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>]
* Re: [PATCH v3 1/5] doc: dt-binding: ci-hdrc-usb2: split vendor specific properties [not found] ` <1442796186-2574-2-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> @ 2015-09-21 15:08 ` Rob Herring 0 siblings, 0 replies; 10+ messages in thread From: Rob Herring @ 2015-09-21 15:08 UTC (permalink / raw) To: Peter Chen Cc: shawn.guo-QSEj5FYQhm4dnm+yROfE0A, linux-usb-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, fabio.estevam-KZfg59tc24xl57MIdRCFDg On 09/20/2015 07:43 PM, Peter Chen wrote: > Each vendor may have its specific properties, they are not belonged > to common optional properties, split them from common's. > > Signed-off-by: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > --- > Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt > index 77946f5..27dc705 100644 > --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt > +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt > @@ -27,10 +27,6 @@ Optional properties: > - vbus-supply: reference to the VBUS regulator > - maximum-speed: limit the maximum connection speed to "full-speed". > - tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts > -- fsl,usbmisc: (FSL only) phandler of non-core register device, with one > - argument that indicate usb controller index > -- disable-over-current: (FSL only) disable over current detect > -- external-vbus-divider: (FSL only) enables off-chip resistor divider for Vbus > - itc-setting: interrupt threshold control register control, the setting > should be aligned with ITC bits at register USBCMD. > - ahb-burst-config: it is vendor dependent, the required value should be > @@ -54,6 +50,12 @@ Optional properties: > - phy-clkgate-delay-us: the delay time (us) between putting the PHY into > low power mode and gating the PHY clock. > > +i.mx specific properties > +- fsl,usbmisc: phandler of non-core register device, with one > + argument that indicate usb controller index > +- disable-over-current: disable over current detect > +- external-vbus-divider: enables off-chip resistor divider for Vbus > + > Example: > > usb@f7ed0000 { > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 3/5] ARM: dts: imx25.dtsi: change the clock information for usb [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 2015-09-21 0:43 ` [PATCH v3 1/5] doc: dt-binding: ci-hdrc-usb2: split vendor specific properties Peter Chen @ 2015-09-21 0:43 ` Peter Chen 2015-09-21 0:43 ` [PATCH v3 4/5] ARM: dts: imx35.dtsi: " Peter Chen 2015-09-22 0:49 ` [PATCH v3 0/5] usb: change clock information for chipidea Fabio Estevam 3 siblings, 0 replies; 10+ messages in thread From: Peter Chen @ 2015-09-21 0:43 UTC (permalink / raw) To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A, linux-usb-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, fabio.estevam-KZfg59tc24xl57MIdRCFDg, Peter Chen For imx25, it needs three clocks to let the controller work, the old code is wrong, and usbmisc has not included clock handling code any more. Signed-off-by: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> --- arch/arm/boot/dts/imx25.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index 677f81d..ab843bd 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -493,7 +493,8 @@ compatible = "fsl,imx25-usb", "fsl,imx27-usb"; reg = <0x53ff4000 0x0200>; interrupts = <37>; - clocks = <&clks 70>; + clocks = <&clks 9>, <&clks 70>, <&clks 8>; + clock-names = "ipg", "ahb", "per"; fsl,usbmisc = <&usbmisc 0>; fsl,usbphy = <&usbphy0>; status = "disabled"; @@ -503,7 +504,8 @@ compatible = "fsl,imx25-usb", "fsl,imx27-usb"; reg = <0x53ff4400 0x0200>; interrupts = <35>; - clocks = <&clks 70>; + clocks = <&clks 9>, <&clks 70>, <&clks 8>; + clock-names = "ipg", "ahb", "per"; fsl,usbmisc = <&usbmisc 1>; fsl,usbphy = <&usbphy1>; status = "disabled"; @@ -512,8 +514,6 @@ usbmisc: usbmisc@53ff4600 { #index-cells = <1>; compatible = "fsl,imx25-usbmisc"; - clocks = <&clks 9>, <&clks 70>, <&clks 8>; - clock-names = "ipg", "ahb", "per"; reg = <0x53ff4600 0x00f>; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 4/5] ARM: dts: imx35.dtsi: change the clock information for usb [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 2015-09-21 0:43 ` [PATCH v3 1/5] doc: dt-binding: ci-hdrc-usb2: split vendor specific properties Peter Chen 2015-09-21 0:43 ` [PATCH v3 3/5] ARM: dts: imx25.dtsi: change the clock information for usb Peter Chen @ 2015-09-21 0:43 ` Peter Chen 2015-09-22 0:49 ` [PATCH v3 0/5] usb: change clock information for chipidea Fabio Estevam 3 siblings, 0 replies; 10+ messages in thread From: Peter Chen @ 2015-09-21 0:43 UTC (permalink / raw) To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A, linux-usb-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, fabio.estevam-KZfg59tc24xl57MIdRCFDg, Peter Chen For imx35, it needs three clocks to let the controller work, the old code is wrong, and the usbmisc does not include clock handling code any more. Signed-off-by: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> --- arch/arm/boot/dts/imx35.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi index e6540b5..5b887d0 100644 --- a/arch/arm/boot/dts/imx35.dtsi +++ b/arch/arm/boot/dts/imx35.dtsi @@ -305,7 +305,8 @@ compatible = "fsl,imx35-usb", "fsl,imx27-usb"; reg = <0x53ff4000 0x0200>; interrupts = <37>; - clocks = <&clks 73>; + clocks = <&clks 9>, <&clks 73>, <&clks 28>; + clock-names = "ipg", "ahb", "per"; fsl,usbmisc = <&usbmisc 0>; fsl,usbphy = <&usbphy0>; status = "disabled"; @@ -315,7 +316,8 @@ compatible = "fsl,imx35-usb", "fsl,imx27-usb"; reg = <0x53ff4400 0x0200>; interrupts = <35>; - clocks = <&clks 73>; + clocks = <&clks 9>, <&clks 73>, <&clks 28>; + clock-names = "ipg", "ahb", "per"; fsl,usbmisc = <&usbmisc 1>; fsl,usbphy = <&usbphy1>; dr_mode = "host"; @@ -325,8 +327,6 @@ usbmisc: usbmisc@53ff4600 { #index-cells = <1>; compatible = "fsl,imx35-usbmisc"; - clocks = <&clks 9>, <&clks 73>, <&clks 28>; - clock-names = "ipg", "ahb", "per"; reg = <0x53ff4600 0x00f>; }; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/5] usb: change clock information for chipidea [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> ` (2 preceding siblings ...) 2015-09-21 0:43 ` [PATCH v3 4/5] ARM: dts: imx35.dtsi: " Peter Chen @ 2015-09-22 0:49 ` Fabio Estevam [not found] ` <CAOMZO5BG9=m18tLqtv8Dsg6bEQVtzGMC2e1oOfHQ__aknW1Mjw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 3 siblings, 1 reply; 10+ messages in thread From: Fabio Estevam @ 2015-09-22 0:49 UTC (permalink / raw) To: Peter Chen Cc: Shawn Guo, USB list, Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Pawel Moll, Mark Rutland, Fabio Estevam On Sun, Sep 20, 2015 at 9:43 PM, Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote: > This patch set changes usb clock information for legacy i.mx platforms. > At these platforms, they needs three clocks to let controller work. > > Hi Fabio, > > Would you please have a test at imx27 and imx25 boards, thanks. Works fine on both boards, thanks -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <CAOMZO5BG9=m18tLqtv8Dsg6bEQVtzGMC2e1oOfHQ__aknW1Mjw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v3 0/5] usb: change clock information for chipidea [not found] ` <CAOMZO5BG9=m18tLqtv8Dsg6bEQVtzGMC2e1oOfHQ__aknW1Mjw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2015-09-21 23:56 ` Peter Chen 2015-09-30 2:10 ` Shawn Guo 0 siblings, 1 reply; 10+ messages in thread From: Peter Chen @ 2015-09-21 23:56 UTC (permalink / raw) To: Fabio Estevam Cc: Shawn Guo, USB list, Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Pawel Moll, Mark Rutland, Fabio Estevam On Mon, Sep 21, 2015 at 09:49:11PM -0300, Fabio Estevam wrote: > On Sun, Sep 20, 2015 at 9:43 PM, Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote: > > This patch set changes usb clock information for legacy i.mx platforms. > > At these platforms, they needs three clocks to let controller work. > > > > Hi Fabio, > > > > Would you please have a test at imx27 and imx25 boards, thanks. > > Works fine on both boards, thanks Hi Shawn, Would you please help to queue dts changes (2/5, 3/5, 4/5)? I will queue others, thanks. -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/5] usb: change clock information for chipidea 2015-09-21 23:56 ` Peter Chen @ 2015-09-30 2:10 ` Shawn Guo 0 siblings, 0 replies; 10+ messages in thread From: Shawn Guo @ 2015-09-30 2:10 UTC (permalink / raw) To: Peter Chen Cc: Fabio Estevam, USB list, Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Pawel Moll, Mark Rutland, Fabio Estevam On Tue, Sep 22, 2015 at 7:56 AM, Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote: > On Mon, Sep 21, 2015 at 09:49:11PM -0300, Fabio Estevam wrote: >> On Sun, Sep 20, 2015 at 9:43 PM, Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote: >> > This patch set changes usb clock information for legacy i.mx platforms. >> > At these platforms, they needs three clocks to let controller work. >> > >> > Hi Fabio, >> > >> > Would you please have a test at imx27 and imx25 boards, thanks. >> >> Works fine on both boards, thanks > > Hi Shawn, > > Would you please help to queue dts changes (2/5, 3/5, 4/5)? Please send them to Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>. Shawn -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 2/5] ARM: dts: imx27.dtsi: change the clock information for usb 2015-09-21 0:43 [PATCH v3 0/5] usb: change clock information for chipidea Peter Chen [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> @ 2015-09-21 0:43 ` Peter Chen 2015-09-21 0:43 ` [PATCH v3 5/5] usb: chipidea: imx: refine clock operations to adapt for all platforms Peter Chen 2 siblings, 0 replies; 10+ messages in thread From: Peter Chen @ 2015-09-21 0:43 UTC (permalink / raw) To: shawn.guo, linux-usb Cc: kernel, devicetree, robh+dt, pawel.moll, mark.rutland, fabio.estevam, Peter Chen, stable For imx27, it needs three clocks to let the controller work, the old code is wrong, and usbmisc has not included clock handling code any more. Without this patch, it will cause below data abort when accessing usbmisc registers. usbcore: registered new interface driver usb-storage Unhandled fault: external abort on non-linefetch (0x008) at 0xf4424600 pgd = c0004000 [f4424600] *pgd=10000452(bad) Internal error: : 8 [#1] PREEMPT ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.0-next-20150701-dirty #3089 Hardware name: Freescale i.MX27 (Device Tree Support) task: c7832b60 ti: c783e000 task.ti: c783e000 PC is at usbmisc_imx27_init+0x4c/0xbc LR is at usbmisc_imx27_init+0x40/0xbc pc : [<c03cb5c0>] lr : [<c03cb5b4>] psr: 60000093 sp : c783fe08 ip : 00000000 fp : 00000000 r10: c0576434 r9 : 0000009c r8 : c7a773a0 r7 : 01000000 r6 : 60000013 r5 : c7a776f0 r4 : c7a773f0 r3 : f4424600 r2 : 00000000 r1 : 00000001 r0 : 00000001 Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 0005317f Table: a0004000 DAC: 00000017 Process swapper (pid: 1, stack limit = 0xc783e190) Stack: (0xc783fe08 to 0xc7840000) Signed-off-by: Peter Chen <peter.chen@freescale.com> Reported-by: Fabio Estevam <fabio.estevam@freescale.com> Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Cc: <stable@vger.kernel.org> #v4.1+ --- arch/arm/boot/dts/imx27.dtsi | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi index feb9d34..f818ea4 100644 --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi @@ -486,7 +486,10 @@ compatible = "fsl,imx27-usb"; reg = <0x10024000 0x200>; interrupts = <56>; - clocks = <&clks IMX27_CLK_USB_IPG_GATE>; + clocks = <&clks IMX27_CLK_USB_IPG_GATE>, + <&clks IMX27_CLK_USB_AHB_GATE>, + <&clks IMX27_CLK_USB_DIV>; + clock-names = "ipg", "ahb", "per"; fsl,usbmisc = <&usbmisc 0>; status = "disabled"; }; @@ -495,7 +498,10 @@ compatible = "fsl,imx27-usb"; reg = <0x10024200 0x200>; interrupts = <54>; - clocks = <&clks IMX27_CLK_USB_IPG_GATE>; + clocks = <&clks IMX27_CLK_USB_IPG_GATE>, + <&clks IMX27_CLK_USB_AHB_GATE>, + <&clks IMX27_CLK_USB_DIV>; + clock-names = "ipg", "ahb", "per"; fsl,usbmisc = <&usbmisc 1>; dr_mode = "host"; status = "disabled"; @@ -505,7 +511,10 @@ compatible = "fsl,imx27-usb"; reg = <0x10024400 0x200>; interrupts = <55>; - clocks = <&clks IMX27_CLK_USB_IPG_GATE>; + clocks = <&clks IMX27_CLK_USB_IPG_GATE>, + <&clks IMX27_CLK_USB_AHB_GATE>, + <&clks IMX27_CLK_USB_DIV>; + clock-names = "ipg", "ahb", "per"; fsl,usbmisc = <&usbmisc 2>; dr_mode = "host"; status = "disabled"; @@ -515,7 +524,6 @@ #index-cells = <1>; compatible = "fsl,imx27-usbmisc"; reg = <0x10024600 0x200>; - clocks = <&clks IMX27_CLK_USB_AHB_GATE>; }; sahara2: sahara@10025000 { -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 5/5] usb: chipidea: imx: refine clock operations to adapt for all platforms 2015-09-21 0:43 [PATCH v3 0/5] usb: change clock information for chipidea Peter Chen [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 2015-09-21 0:43 ` [PATCH v3 2/5] ARM: dts: imx27.dtsi: change the clock information for usb Peter Chen @ 2015-09-21 0:43 ` Peter Chen 2 siblings, 0 replies; 10+ messages in thread From: Peter Chen @ 2015-09-21 0:43 UTC (permalink / raw) To: shawn.guo, linux-usb Cc: kernel, devicetree, robh+dt, pawel.moll, mark.rutland, fabio.estevam, Peter Chen, stable Some i.mx platforms need three clocks to let controller work, but others only need one, refine clock operation to adapt for all platforms, it fixes a regression found at i.mx27. Signed-off-by: Peter Chen <peter.chen@freescale.com> Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Cc: <stable@vger.kernel.org> #v4.1+ --- drivers/usb/chipidea/ci_hdrc_imx.c | 156 ++++++++++++++++++++++++++++++++----- 1 file changed, 138 insertions(+), 18 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 6ccbf60..6ec0fbc 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -32,6 +32,10 @@ static const struct ci_hdrc_imx_platform_flag imx27_usb_data = { CI_HDRC_DISABLE_STREAMING, }; +static const struct ci_hdrc_imx_platform_flag imx31_usb_data = { + CI_HDRC_DISABLE_STREAMING, +}; + static const struct ci_hdrc_imx_platform_flag imx28_usb_data = { .flags = CI_HDRC_IMX28_WRITE_FIX | CI_HDRC_TURN_VBUS_EARLY_ON | @@ -68,6 +72,13 @@ static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = { static const struct of_device_id ci_hdrc_imx_dt_ids[] = { { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data}, { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data}, + { .compatible = "fsl,imx25-usb", .data = &imx27_usb_data}, + { .compatible = "fsl,imx35-usb", .data = &imx27_usb_data}, + { .compatible = "fsl,imx23-usb", .data = &imx31_usb_data}, + { .compatible = "fsl,imx31-usb", .data = &imx31_usb_data}, + { .compatible = "fsl,imx50-usb", .data = &imx31_usb_data}, + { .compatible = "fsl,imx51-usb", .data = &imx31_usb_data}, + { .compatible = "fsl,imx53-usb", .data = &imx31_usb_data}, { .compatible = "fsl,imx6q-usb", .data = &imx6q_usb_data}, { .compatible = "fsl,imx6sl-usb", .data = &imx6sl_usb_data}, { .compatible = "fsl,imx6sx-usb", .data = &imx6sx_usb_data}, @@ -77,6 +88,15 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids); +static inline bool imx_needs_three_clocks + (const struct ci_hdrc_imx_platform_flag *imx_platform_flag) +{ + if (imx_platform_flag == &imx27_usb_data) + return true; + + return false; +} + struct ci_hdrc_imx_data { struct usb_phy *phy; struct platform_device *ci_pdev; @@ -84,6 +104,12 @@ struct ci_hdrc_imx_data { struct imx_usbmisc_data *usbmisc_data; bool supports_runtime_pm; bool in_lpm; + /* SoC before i.mx6 (except imx23/imx28) needs three clks */ + bool need_three_clks; + struct clk *clk_ipg; + struct clk *clk_ahb; + struct clk *clk_per; + /* --------------------------------- */ }; /* Common functions shared by usbmisc drivers */ @@ -135,6 +161,105 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) } /* End of common functions shared by usbmisc drivers*/ +static int imx_get_clks(struct device *dev) +{ + struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); + int ret = 0; + + if (data->need_three_clks) { + data->clk_ipg = devm_clk_get(dev, "ipg"); + if (IS_ERR(data->clk_ipg)) { + ret = PTR_ERR(data->clk_ipg); + dev_err(dev, + "Failed to get ipg clock, err=%d\n", ret); + return ret; + } + + data->clk_ahb = devm_clk_get(dev, "ahb"); + if (IS_ERR(data->clk_ahb)) { + ret = PTR_ERR(data->clk_ahb); + dev_err(dev, + "Failed to get ahb clock, err=%d\n", ret); + return ret; + } + + data->clk_per = devm_clk_get(dev, "per"); + if (IS_ERR(data->clk_per)) { + ret = PTR_ERR(data->clk_per); + dev_err(dev, + "Failed to get per clock, err=%d\n", ret); + return ret; + } + } else { + data->clk = devm_clk_get(dev, NULL); + if (IS_ERR(data->clk)) { + ret = PTR_ERR(data->clk); + dev_err(dev, + "Failed to get clock, err=%d\n", ret); + return ret; + } + } + + return ret; +} + +static int imx_prepare_enable_clks(struct device *dev) +{ + struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); + int ret = 0; + + if (data->need_three_clks) { + ret = clk_prepare_enable(data->clk_ipg); + if (ret) { + dev_err(dev, + "Failed to prepare/enable ipg clk, err=%d\n", + ret); + return ret; + } + + ret = clk_prepare_enable(data->clk_ahb); + if (ret) { + dev_err(dev, + "Failed to prepare/enable ahb clk, err=%d\n", + ret); + clk_disable_unprepare(data->clk_ipg); + return ret; + } + + ret = clk_prepare_enable(data->clk_per); + if (ret) { + dev_err(dev, + "Failed to prepare/enable per clk, err=%d\n", + ret); + clk_disable_unprepare(data->clk_ahb); + clk_disable_unprepare(data->clk_ipg); + return ret; + } + } else { + ret = clk_prepare_enable(data->clk); + if (ret) { + dev_err(dev, + "Failed to prepare/enable clk, err=%d\n", + ret); + return ret; + } + } + + return ret; +} + +static void imx_disable_unprepare_clks(struct device *dev) +{ + struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); + + if (data->need_three_clks) { + clk_disable_unprepare(data->clk_per); + clk_disable_unprepare(data->clk_ipg); + clk_disable_unprepare(data->clk_ahb); + } else { + clk_disable_unprepare(data->clk); + } +} static int ci_hdrc_imx_probe(struct platform_device *pdev) { @@ -153,23 +278,20 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) if (!data) return -ENOMEM; + platform_set_drvdata(pdev, data); data->usbmisc_data = usbmisc_get_init_data(&pdev->dev); if (IS_ERR(data->usbmisc_data)) return PTR_ERR(data->usbmisc_data); - data->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(data->clk)) { - dev_err(&pdev->dev, - "Failed to get clock, err=%ld\n", PTR_ERR(data->clk)); - return PTR_ERR(data->clk); - } + data->need_three_clks = imx_needs_three_clocks(imx_platform_flag); - ret = clk_prepare_enable(data->clk); - if (ret) { - dev_err(&pdev->dev, - "Failed to prepare or enable clock, err=%d\n", ret); + ret = imx_get_clks(&pdev->dev); + if (ret) + return ret; + + ret = imx_prepare_enable_clks(&pdev->dev); + if (ret) return ret; - } data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0); if (IS_ERR(data->phy)) { @@ -212,8 +334,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) goto disable_device; } - platform_set_drvdata(pdev, data); - if (data->supports_runtime_pm) { pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); @@ -226,7 +346,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) disable_device: ci_hdrc_remove_device(data->ci_pdev); err_clk: - clk_disable_unprepare(data->clk); + imx_disable_unprepare_clks(&pdev->dev); return ret; } @@ -240,7 +360,7 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev) pm_runtime_put_noidle(&pdev->dev); } ci_hdrc_remove_device(data->ci_pdev); - clk_disable_unprepare(data->clk); + imx_disable_unprepare_clks(&pdev->dev); return 0; } @@ -252,7 +372,7 @@ static int imx_controller_suspend(struct device *dev) dev_dbg(dev, "at %s\n", __func__); - clk_disable_unprepare(data->clk); + imx_disable_unprepare_clks(dev); data->in_lpm = true; return 0; @@ -270,7 +390,7 @@ static int imx_controller_resume(struct device *dev) return 0; } - ret = clk_prepare_enable(data->clk); + ret = imx_prepare_enable_clks(dev); if (ret) return ret; @@ -285,7 +405,7 @@ static int imx_controller_resume(struct device *dev) return 0; clk_disable: - clk_disable_unprepare(data->clk); + imx_disable_unprepare_clks(dev); return ret; } -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-09-30 2:10 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-09-21 0:43 [PATCH v3 0/5] usb: change clock information for chipidea Peter Chen [not found] ` <1442796186-2574-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 2015-09-21 0:43 ` [PATCH v3 1/5] doc: dt-binding: ci-hdrc-usb2: split vendor specific properties Peter Chen [not found] ` <1442796186-2574-2-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org> 2015-09-21 15:08 ` Rob Herring 2015-09-21 0:43 ` [PATCH v3 3/5] ARM: dts: imx25.dtsi: change the clock information for usb Peter Chen 2015-09-21 0:43 ` [PATCH v3 4/5] ARM: dts: imx35.dtsi: " Peter Chen 2015-09-22 0:49 ` [PATCH v3 0/5] usb: change clock information for chipidea Fabio Estevam [not found] ` <CAOMZO5BG9=m18tLqtv8Dsg6bEQVtzGMC2e1oOfHQ__aknW1Mjw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2015-09-21 23:56 ` Peter Chen 2015-09-30 2:10 ` Shawn Guo 2015-09-21 0:43 ` [PATCH v3 2/5] ARM: dts: imx27.dtsi: change the clock information for usb Peter Chen 2015-09-21 0:43 ` [PATCH v3 5/5] usb: chipidea: imx: refine clock operations to adapt for all platforms Peter Chen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).