usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
PATCH 1/1 usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
Instead of checking the CPU type in build-time, do it in run-time.
--- drivers/usb/gadget/fsl_mxc_udc.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/usb/gadget/fsl_mxc_udc.c +12 -11
@@ -88,17 +88,18 @@ eenahb:void fsl_udc_clk_finalize (struct platform_device *pdev) {struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; -#if defined(CONFIG_ARCH_MX35 ) -unsigned int v; - -/* workaround ENGcm09152 for i.MX35 */ -if (pdata->workaround &FLS_USB2_WORKAROUND_ENGCM09152 ) { - v =readl (MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); -writel (v |USBPHYCTRL_EVDO ,MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); - } -#endif +if (cpu_is_mx35 ()) { +unsigned int v; + +/* workaround ENGcm09152 for i.MX35 */ +if (pdata->workaround &FLS_USB2_WORKAROUND_ENGCM09152 ) { + v =readl (MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + +USBPHYCTRL_OTGBASE_OFFSET )); +writel (v |USBPHYCTRL_EVDO , +MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + +USBPHYCTRL_OTGBASE_OFFSET )); + } + }/* ULPI transceivers don't need usbpll */ if (pdata->phy_mode ==FSL_USB2_PHY_ULPI ) {
Signature · 1 line
1.6.0.4
PATCH 1/1 usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
Hi Fabio,
Quoted 29 lines · Fabio Estevam
Instead of checking the CPU type in build-time, do it in run-time.
Signed-off-by Fabio Estevam<[email protected]>--- drivers/usb/gadget/fsl_mxc_udc.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)drivers/usb/gadget/fsl_mxc_udc.c +3
-11@@ -88,17 +88,18 @@ eenahb:void fsl_udc_clk_finalize (struct platform_device *pdev) {struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; -#if defined(CONFIG_ARCH_MX35 ) -unsigned int v; - -/* workaround ENGcm09152 for i.MX35 */ -if (pdata->workaround&FLS_USB2_WORKAROUND_ENGCM09152 ) { - v =readl (MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); -writel (v |USBPHYCTRL_EVDO ,MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); - } -#endif +if (cpu_is_mx35 ()) { +unsigned int v; +
drivers/usb/gadget/fsl_mxc_udc.c eenahb: · line 103
Quoted 10 lines
drivers/usb/gadget/fsl_mxc_udc.c +9
-0+/* workaround ENGcm09152 for i.MX35 */ +if (pdata->workaround&FLS_USB2_WORKAROUND_ENGCM09152 ) { + v =readl (MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + +USBPHYCTRL_OTGBASE_OFFSET )); +writel (v |USBPHYCTRL_EVDO , +MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + +USBPHYCTRL_OTGBASE_OFFSET )); + } + }
are you sure this compiles when MX35 is not selected ?
Eric
PATCH 1/1 usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
On 1/19/2011 1:36 PM, Eric B?nard wrote:
...
Quoted 1 line
are you sure this compiles when MX35 is not selected ?
You?re right. Doesn?t build when I tried a mx5 kernel.
We can?t use this approach then.
Thanks,
Fabio Estevam
PATCH 1/1 usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
In reply to Eric BénardQuoted 35 lines · Eric B?nard
Hi Fabio,
Quoted 32 lines · Fabio Estevam
Instead of checking the CPU type in build-time, do it in run-time.
Signed-off-by Fabio Estevam<[email protected]>--- drivers/usb/gadget/fsl_mxc_udc.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)drivers/usb/gadget/fsl_mxc_udc.c +6
-11@@ -88,17 +88,18 @@ eenahb:void fsl_udc_clk_finalize (struct platform_device *pdev) {struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; -#if defined(CONFIG_ARCH_MX35 ) -unsigned int v; - -/* workaround ENGcm09152 for i.MX35 */ -if (pdata->workaround&FLS_USB2_WORKAROUND_ENGCM09152 ) { - v =readl (MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); -writel (v |USBPHYCTRL_EVDO ,MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); - } -#endif +if (cpu_is_mx35 ()) { +unsigned int v; + +/* workaround ENGcm09152 for i.MX35 */ +if (pdata->workaround&FLS_USB2_WORKAROUND_ENGCM09152 ) { + v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
Quoted 8 lines
drivers/usb/gadget/fsl_mxc_udc.c eenahb: · line 103
Quoted 7 lines
drivers/usb/gadget/fsl_mxc_udc.c +6
-0+ USBPHYCTRL_OTGBASE_OFFSET)); +writel (v |USBPHYCTRL_EVDO , +MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + +USBPHYCTRL_OTGBASE_OFFSET )); + } + }are you sure this compiles when MX35 is not selected ?
Including #include <mach/mx35.h> fixes the build for a non- mx35 kernel.
Would this be acceptable? If so, I can send v2.
Regards,
Fabio Estevam
PATCH 1/1 usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
Quoted 27 lines · Fabio Estevam
Quoted 26 lines · Eric B?nard
Hi Fabio,
Quoted 23 lines · Fabio Estevam
Instead of checking the CPU type in build-time, do it in run-time.
Signed-off-by Fabio Estevam<[email protected]>--- drivers/usb/gadget/fsl_mxc_udc.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)drivers/usb/gadget/fsl_mxc_udc.c +0
-8@@ -88,17 +88,18 @@ eenahb:void fsl_udc_clk_finalize (struct platform_device *pdev) {struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; -#if defined(CONFIG_ARCH_MX35) - unsigned int v; - - /* workaround ENGcm09152 for i.MX35 */ - if (pdata->workaround& FLS_USB2_WORKAROUND_ENGCM09152) { - v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + - USBPHYCTRL_OTGBASE_OFFSET)); - writel(v | USBPHYCTRL_EVDO, MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
Quoted 8 lines
Quoted 8 lines
drivers/usb/gadget/fsl_mxc_udc.c eenahb:
Quoted 8 lines
drivers/usb/gadget/fsl_mxc_udc.c +5
-3- USBPHYCTRL_OTGBASE_OFFSET)); - } -#endif +if (cpu_is_mx35 ()) { +unsigned int v; + +/* workaround ENGcm09152 for i.MX35 */ +if (pdata->workaround&FLS_USB2_WORKAROUND_ENGCM09152 ) {
can you please fix up the position of the '&'?
Quoted 5 lines
Quoted 5 lines
drivers/usb/gadget/fsl_mxc_udc.c eenahb: · line 100
Quoted 5 lines
drivers/usb/gadget/fsl_mxc_udc.c +5
-0+ v =readl (MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + +USBPHYCTRL_OTGBASE_OFFSET )); +writel (v |USBPHYCTRL_EVDO , +MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + +USBPHYCTRL_OTGBASE_OFFSET ));
I wonder if the address isn't mapped via ioremap in the driver and the cookie saved somewhere? (And no, I don't ask you to change that in this patch.) (If so, it this already problematic aliasing?)
Quoted 8 lines
Quoted 4 lines
drivers/usb/gadget/fsl_mxc_udc.c eenahb: · line 103
Quoted 3 lines
drivers/usb/gadget/fsl_mxc_udc.c +2
-0+ } + }are you sure this compiles when MX35 is not selected ?
Including #include <
mach/mx35.h> fixes the build for a non- mx35 kernel.Would this be acceptable? If so, I can send v2.
If you keep the #if defined(CONFIG_ARCH_MX35) and only add the if (cpu_is_mx35()) it should work without a new #include. Doing that seems a tad cleaner to me.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
Hi Uwe,
On Wed, Jan 19, 2011 at 4:54 PM, Uwe Kleine-K?nig
<[email protected]> wrote:
...
Quoted 1 line
can you please fix up the position of the '&'?
The original patch had the '&' in the correct position. Looks like it got shifted on some of the replies.
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ ? ? ? ? ? ?v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
+ ? ? ? ? ? ? ? ? ? ?USBPHYCTRL_OTGBASE_OFFSET));
+ ? ? ? ? ? ?writel(v |USBPHYCTRL_EVDO,
+ ? ? ? ? ? ? ? ?MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
+ ? ? ? ? ? ? ? ? ? ?USBPHYCTRL_OTGBASE_OFFSET));I wonder if the address isn't mapped via ioremap in the driver and the cookie saved somewhere? ?(And no, I don't ask you to change that in this patch.) ?(If so, it this already problematic aliasing?)
This address is only used once here and it is related to the MX35 USB erratum.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ ? ? ? ?}
+ ? ?}
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
are you sure this compiles when MX35 is not selected ?
Including #include <
mach/mx35.h> fixes the build for a non- mx35 kernel.Would this be acceptable? If so, I can send v2.
If you keep the #if
defined(CONFIG_ARCH_MX35)and only add the if (cpu_is_mx35()) it should work without a new #include. Doing that seems a tad cleaner to me.
Ok, will do as suggested in v2.
Thanks,
Fabio Estevam