Fix the Build error for fsl_mxc_udc.c
Subsystems (4)
v3 cover Fix the Build error for fsl_mxc_udc.c
Changes for v3:
- Split the one big patch into three patches
Changes for v2:
- Add const for fsl_udc_devtype
- Do ioremap for phy address at fsl-mxc-udc
Peter Chen (3):
usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
arch/arm/mach-imx/clk-imx25.c | 6 +- arch/arm/mach-imx/clk-imx27.c | 6 +- arch/arm/mach-imx/clk-imx31.c | 6 +- arch/arm/mach-imx/clk-imx35.c | 6 +- arch/arm/mach-imx/clk-imx51-imx53.c | 6 +- arch/arm/mach-imx/devices/devices-common.h | 1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 23 +++++---- drivers/usb/gadget/fsl_udc_core.c | 52 +++++++++++++------- drivers/usb/gadget/fsl_usb2_udc.h | 13 ++++-- include/linux/fsl_devices.h | 8 +++ 11 files changed, 87 insertions(+), 55 deletions(-)
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
As mach/hardware.h is deleted, we need to use platform_device_id to differentiate SoCs.
Besides we update the platform code accordingly.
--- arch/arm/mach-imx/devices/devices-common.h | 1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 11 ++-- drivers/usb/gadget/fsl_udc_core.c | 52 +++++++++++++------- drivers/usb/gadget/fsl_usb2_udc.h | 13 ++++-- include/linux/fsl_devices.h | 8 +++ 6 files changed, 65 insertions(+), 35 deletions(-)
arch/arm/mach-imx/devices/devices-common.h +1 -0
@@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan(#include <linux/fsl_devices.h> struct imx_fsl_usb2_udc_data { +const char *devid;resource_size_t iobase;resource_size_t irq; };
arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +8 -7
@@ -11,35 +11,36 @@#include "../hardware.h" #include "devices-common.h" -#define imx_fsl_usb2_udc_data_entry_single (soc) \ +#define imx_fsl_usb2_udc_data_entry_single (soc, _devid) \ { \ + .devid = _devid, \ .iobase = soc ## _USB_OTG_BASE_ADDR, \ .irq = soc ## _INT_USB_OTG, \ }#ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data__initconst = -imx_fsl_usb2_udc_data_entry_single (MX25 ); +imx_fsl_usb2_udc_data_entry_single (MX25 ,"imx-udc-mx25" );#endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data__initconst = -imx_fsl_usb2_udc_data_entry_single (MX27 ); +imx_fsl_usb2_udc_data_entry_single (MX27 ,"imx-udc-mx27" );#endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data__initconst = -imx_fsl_usb2_udc_data_entry_single (MX31 ); +imx_fsl_usb2_udc_data_entry_single (MX31 ,"imx-udc-mx31" );#endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data__initconst = -imx_fsl_usb2_udc_data_entry_single (MX35 ); +imx_fsl_usb2_udc_data_entry_single (MX35 ,"imx-udc-mx35" );#endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data__initconst = -imx_fsl_usb2_udc_data_entry_single (MX51 ); +imx_fsl_usb2_udc_data_entry_single (MX51 ,"imx-udc-mx51" );#endif struct platform_device *__init imx_add_fsl_usb2_udc(
@@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; -return imx_add_platform_device_dmamask ("fsl-usb2-udc" ,-1 , +return imx_add_platform_device_dmamask (data->devid,-1 , res,ARRAY_SIZE (res), pdata,sizeof (*pdata),DMA_BIT_MASK (32 )); }
drivers/usb/gadget/fsl_mxc_udc.c +5 -6
@@ -18,8 +18,6 @@#include <linux/platform_device.h> #include <linux/io.h> -#include <mach/hardware.h> -static struct clk *mxc_ahb_clk;static struct clk *mxc_per_clk;static struct clk *mxc_ipg_clk;
@@ -28,7 +26,7 @@ static struct clk *mxc_ipg_clk;#define USBPHYCTRL_OTGBASE_OFFSET 0x608#define USBPHYCTRL_EVDO (1 << 23) -int fsl_udc_clk_init (struct platform_device *pdev) +int fsl_udc_clk_init (enum fsl_udc_type devtype,struct platform_device *pdev) {struct fsl_usb2_platform_data *pdata;unsigned long freq;
@@ -59,7 +57,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)clk_prepare_enable (mxc_per_clk);/* make sure USB_CLK is running@60 MHz +/- 1000 Hz */ -if (!cpu_is_mx51 ()) { +if (!(devtype ==IMX51_UDC )) { freq =clk_get_rate (mxc_per_clk);if (pdata->phy_mode !=FSL_USB2_PHY_ULPI && (freq <59999000 || freq >60001000 )) {
@@ -79,10 +77,11 @@ eclkrate:return ret; } -void fsl_udc_clk_finalize (struct platform_device *pdev) +void fsl_udc_clk_finalize (enum fsl_udc_type devtype, +struct platform_device *pdev) {struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; -if (cpu_is_mx35 ()) { +if (devtype ==IMX35_UDC ) {unsigned int v;/* workaround ENGcm09152 for i.MX35 */
drivers/usb/gadget/fsl_udc_core.c +34 -18
93 lines not on this page · raw message
drivers/usb/gadget/fsl_usb2_udc.h +9 -4
@@ -505,6 +505,8 @@ struct fsl_udc {u32 ep0_dir;/* Endpoint zero direction: can be USB_DIR_IN or USB_DIR_OUT */ u8 device_address;/* Device USB address */ +/* devtype for kinds of SoC, only i.mx uses it now */ +enum fsl_udc_type devtype; };/*-------------------------------------------------------------------------*/
@@ -591,15 +593,18 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep)struct platform_device ;#ifdef CONFIG_ARCH_MXC -int fsl_udc_clk_init (struct platform_device *pdev); -void fsl_udc_clk_finalize (struct platform_device *pdev); +int fsl_udc_clk_init (enum fsl_udc_type devtype,struct platform_device *pdev); +void fsl_udc_clk_finalize (enum fsl_udc_type devtype, +struct platform_device *pdev);void fsl_udc_clk_release (void );#else -static inline int fsl_udc_clk_init (struct platform_device *pdev) +static inline int fsl_udc_clk_init (enum fsl_udc_type devtype, +struct platform_device *pdev) {return 0 ; } -static inline void fsl_udc_clk_finalize (struct platform_device *pdev) +static inline void fsl_udc_clk_finalize (enum fsl_udc_type devtype, +struct platform_device *pdev) { }static inline void fsl_udc_clk_release (void )
include/linux/fsl_devices.h +8 -0
@@ -66,6 +66,14 @@ enum fsl_usb2_phy_modes { FSL_USB2_PHY_SERIAL, }; +enum fsl_udc_type { +IMX25_UDC , +IMX27_UDC , +IMX31_UDC , +IMX35_UDC , +IMX51_UDC , +}; +struct clk ;struct platform_device ;
Signature · 1 line
1.7.0.4
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Hi,
Quoted 17 lines · Peter Chen
drivers/usb/gadget/fsl_udc_core.c +8
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev)return fsl_udc_resume (NULL ); } -/*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name ="imx-udc-mx25" , + .driver_data =IMX25_UDC , + }, { + .name ="imx-udc-mx27" , + .driver_data =IMX27_UDC , + }, {
drivers/usb/gadget/fsl_udc_core.c static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 10 lines
drivers/usb/gadget/fsl_udc_core.c +10
-0+ .name = "imx-udc-mx31", + .driver_data = IMX31_UDC, + }, { + .name = "imx-udc-mx35", + .driver_data = IMX35_UDC, + }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};
I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/b57b5c4d/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
drivers/usb/gadget/fsl_udc_core.c +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev)return fsl_udc_resume (NULL ); } -/*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name ="imx-udc-mx25" , + .driver_data =IMX25_UDC , + }, { + .name ="imx-udc-mx27" , + .driver_data =IMX27_UDC , + }, { + .name ="imx-udc-mx31" , + .driver_data =IMX31_UDC , + }, { + .name ="imx-udc-mx35" , + .driver_data =IMX35_UDC ,
Quoted 8 lines
drivers/usb/gadget/fsl_udc_core.c static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
drivers/usb/gadget/fsl_udc_core.c +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Why use a string compare, if the kernel infrastructure already does this for you?
Marc
Signature · 12 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/557b9063/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 35 lines · Marc Kleine-Budde
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
drivers/usb/gadget/fsl_udc_core.c +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev)return fsl_udc_resume (NULL ); } -/*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name ="imx-udc-mx25" , + .driver_data =IMX25_UDC , + }, { + .name ="imx-udc-mx27" , + .driver_data =IMX27_UDC , + }, { + .name ="imx-udc-mx31" , + .driver_data =IMX31_UDC , + }, { + .name ="imx-udc-mx35" , + .driver_data =IMX35_UDC ,Quoted 8 lines
drivers/usb/gadget/fsl_udc_core.c static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
drivers/usb/gadget/fsl_udc_core.c +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Quoted 2 lines
Why use a string compare, if the kernel infrastructure already does this for you?
what do you mean ? What kernel infrastructure is doing waht for me ?
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/f051f1fa/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 36 lines · Felipe Balbi
Quoted 35 lines · Marc Kleine-Budde
Quoted 33 lines · Felipe Balbi
Hi,
Quoted 17 lines · Peter Chen
drivers/usb/gadget/fsl_udc_core.c +8
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev)return fsl_udc_resume (NULL ); } -/*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name ="imx-udc-mx25" , + .driver_data =IMX25_UDC , + }, { + .name ="imx-udc-mx27" , + .driver_data =IMX27_UDC , + }, {drivers/usb/gadget/fsl_udc_core.c static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 10 lines
drivers/usb/gadget/fsl_udc_core.c +10
-0+ .name = "imx-udc-mx31", + .driver_data = IMX31_UDC, + }, { + .name = "imx-udc-mx35", + .driver_data = IMX35_UDC, + }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Quoted 4 lines
Quoted 2 lines
Why use a string compare, if the kernel infrastructure already does this for you?
what do you mean ? What kernel infrastructure is doing waht for me ?
The kernel infrastructure is doing the string compare for you to match the device against the driver (via platform_device_id->name). You get the a pointer to the driver_data for free. So you don't need any string compare in the driver later.
Marc
Signature · 12 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/102df909/attachment-0001.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 40 lines · Marc Kleine-Budde
Quoted 39 lines · Felipe Balbi
Quoted 37 lines · Marc Kleine-Budde
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
drivers/usb/gadget/fsl_udc_core.c +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev)return fsl_udc_resume (NULL ); } -/*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name ="imx-udc-mx25" , + .driver_data =IMX25_UDC , + }, { + .name ="imx-udc-mx27" , + .driver_data =IMX27_UDC , + }, { + .name ="imx-udc-mx31" , + .driver_data =IMX31_UDC , + }, { + .name ="imx-udc-mx35" , + .driver_data =IMX35_UDC ,Quoted 8 lines
drivers/usb/gadget/fsl_udc_core.c static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
drivers/usb/gadget/fsl_udc_core.c +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Why use a string compare, if the kernel infrastructure already does this for you?
Quoted 6 lines
Quoted 1 line
what do you mean ? What kernel infrastructure is doing waht for me ?
The kernel infrastructure is doing the string compare for you to match the device against the driver (via
platform_device_id->name). You get the a pointer to thedriver_datafor free. So you don't need any string compare in the driver later.
but current driver data is just duplicating name with an integer, it's pretty useless driver data.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/f338144b/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 43 lines · Felipe Balbi
Quoted 42 lines · Marc Kleine-Budde
Quoted 40 lines · Felipe Balbi
Quoted 35 lines · Marc Kleine-Budde
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
drivers/usb/gadget/fsl_udc_core.c +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev)return fsl_udc_resume (NULL ); } -/*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name ="imx-udc-mx25" , + .driver_data =IMX25_UDC , + }, { + .name ="imx-udc-mx27" , + .driver_data =IMX27_UDC , + }, { + .name ="imx-udc-mx31" , + .driver_data =IMX31_UDC , + }, { + .name ="imx-udc-mx35" , + .driver_data =IMX35_UDC ,Quoted 8 lines
drivers/usb/gadget/fsl_udc_core.c static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
drivers/usb/gadget/fsl_udc_core.c +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Quoted 2 lines
Why use a string compare, if the kernel infrastructure already does this for you?
what do you mean ? What kernel infrastructure is doing waht for me ?
Quoted 7 lines
Quoted 4 lines
The kernel infrastructure is doing the string compare for you to match the device against the driver (via
platform_device_id->name). You get the a pointer to thedriver_datafor free. So you don't need any string compare in the driver later.but current driver data is just duplicating name with an integer, it's pretty useless driver data.
I don't think so - another argument:
Less code. As struct platform_device_id is a static array the space is allocated anyway. So it doesn't make any difference if driver_data is NULL or not. Later you just need to make an integer comparison instead of a call to a strcmp(), if you have a switch/case and IMX*_UDC is an enum, the compiler will warn you if you've missed an IMX variant.
Marc
Signature · 12 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/fb23c595/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Hi,
Quoted 52 lines · Marc Kleine-Budde
Quoted 43 lines · Felipe Balbi
Quoted 42 lines · Marc Kleine-Budde
Quoted 40 lines · Felipe Balbi
Quoted 35 lines · Marc Kleine-Budde
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
(quoted diff) +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev) return fsl_udc_resume(NULL); } - /*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name = "imx-udc-mx25", + .driver_data = IMX25_UDC, + }, { + .name = "imx-udc-mx27", + .driver_data = IMX27_UDC, + }, { + .name = "imx-udc-mx31", + .driver_data = IMX31_UDC, + }, { + .name = "imx-udc-mx35", + .driver_data = IMX35_UDC,Quoted 8 lines
Review static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
(quoted diff) +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Quoted 2 lines
Why use a string compare, if the kernel infrastructure already does this for you?
what do you mean ? What kernel infrastructure is doing waht for me ?
Quoted 7 lines
Quoted 4 lines
The kernel infrastructure is doing the string compare for you to match the device against the driver (via
platform_device_id->name). You get the a pointer to thedriver_datafor free. So you don't need any string compare in the driver later.but current driver data is just duplicating name with an integer, it's pretty useless driver data.
Quoted 6 lines
I don't think so - another argument:
Less code. As structplatform_device_idis a static array the space is allocated anyway. So it doesn't make any difference ifdriver_datais NULL or not. Later you just need to make an integer comparison instead of a call to astrcmp(), if you have a switch/case and IMX*_UDC is an enum, the compiler will warn you if you've missed an IMX variant.
fair enough, but then don't create a different enum value for each imx instance if they're mostly the same. Differentiate only what's actually different.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/e755c1c5/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 62 lines · Felipe Balbi
Hi,
Quoted 52 lines · Marc Kleine-Budde
Quoted 43 lines · Felipe Balbi
Quoted 42 lines · Marc Kleine-Budde
Quoted 40 lines · Felipe Balbi
Quoted 35 lines · Marc Kleine-Budde
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
(quoted diff) +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev) return fsl_udc_resume(NULL); } - /*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name = "imx-udc-mx25", + .driver_data = IMX25_UDC, + }, { + .name = "imx-udc-mx27", + .driver_data = IMX27_UDC, + }, { + .name = "imx-udc-mx31", + .driver_data = IMX31_UDC, + }, { + .name = "imx-udc-mx35", + .driver_data = IMX35_UDC,Quoted 8 lines
Review static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
(quoted diff) +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Quoted 2 lines
Why use a string compare, if the kernel infrastructure already does this for you?
what do you mean ? What kernel infrastructure is doing waht for me ?
Quoted 7 lines
Quoted 4 lines
The kernel infrastructure is doing the string compare for you to match the device against the driver (via
platform_device_id->name). You get the a pointer to thedriver_datafor free. So you don't need any string compare in the driver later.but current driver data is just duplicating name with an integer, it's pretty useless driver data.
Quoted 6 lines
I don't think so - another argument:
Less code. As structplatform_device_idis a static array the space is allocated anyway. So it doesn't make any difference ifdriver_datais NULL or not. Later you just need to make an integer comparison instead of a call to astrcmp(), if you have a switch/case and IMX*_UDC is an enum, the compiler will warn you if you've missed an IMX variant.
Quoted 3 lines
fair enough, but then don't create a different enum value for each imx instance if they're mostly the same. Differentiate only what's actually different.
Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation.
just my 2?
Marc
Signature · 12 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/a34cc75b/attachment-0001.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 67 lines · Marc Kleine-Budde
Quoted 62 lines · Felipe Balbi
Hi,
Quoted 52 lines · Marc Kleine-Budde
Quoted 43 lines · Felipe Balbi
Quoted 42 lines · Marc Kleine-Budde
Quoted 40 lines · Felipe Balbi
Quoted 35 lines · Marc Kleine-Budde
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
(quoted diff) +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev) return fsl_udc_resume(NULL); } - /*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name = "imx-udc-mx25", + .driver_data = IMX25_UDC, + }, { + .name = "imx-udc-mx27", + .driver_data = IMX27_UDC, + }, { + .name = "imx-udc-mx31", + .driver_data = IMX31_UDC, + }, { + .name = "imx-udc-mx35", + .driver_data = IMX35_UDC,Quoted 8 lines
Review static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
(quoted diff) +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Quoted 2 lines
Why use a string compare, if the kernel infrastructure already does this for you?
what do you mean ? What kernel infrastructure is doing waht for me ?
Quoted 7 lines
Quoted 4 lines
The kernel infrastructure is doing the string compare for you to match the device against the driver (via
platform_device_id->name). You get the a pointer to thedriver_datafor free. So you don't need any string compare in the driver later.but current driver data is just duplicating name with an integer, it's pretty useless driver data.
Quoted 6 lines
I don't think so - another argument:
Less code. As structplatform_device_idis a static array the space is allocated anyway. So it doesn't make any difference ifdriver_datais NULL or not. Later you just need to make an integer comparison instead of a call to astrcmp(), if you have a switch/case and IMX*_UDC is an enum, the compiler will warn you if you've missed an IMX variant.Quoted 3 lines
fair enough, but then don't create a different enum value for each imx instance if they're mostly the same. Differentiate only what's actually different.
Quoted 7 lines
Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation.
just my 2?
$SUBJECT is trying to differentiate a single feature (or maybe two) to replace cpu_is_xxx(), then expose that on driver_data without creating one enum value for each release from fsl.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/ade53040/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 74 lines · Felipe Balbi
Quoted 73 lines · Marc Kleine-Budde
Quoted 62 lines · Felipe Balbi
Hi,
Quoted 52 lines · Marc Kleine-Budde
Quoted 43 lines · Felipe Balbi
Quoted 42 lines · Marc Kleine-Budde
Quoted 40 lines · Felipe Balbi
Quoted 35 lines · Marc Kleine-Budde
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 22 lines · Peter Chen
(quoted diff) +13
-2@@ -2756,22 +2753,41 @@ static int fsl_udc_otg_resume(struct device *dev) return fsl_udc_resume(NULL); } - /*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ - +static const struct platform_device_id fsl_udc_devtype[] = { + { + .name = "imx-udc-mx25", + .driver_data = IMX25_UDC, + }, { + .name = "imx-udc-mx27", + .driver_data = IMX27_UDC, + }, { + .name = "imx-udc-mx31", + .driver_data = IMX31_UDC, + }, { + .name = "imx-udc-mx35", + .driver_data = IMX35_UDC,Quoted 8 lines
Review static int fsl_udc_otg_resume(struct device *dev) · line 2776
Quoted 5 lines
(quoted diff) +5
-0+ }, { + .name = "imx-udc-mx51", + .driver_data = IMX51_UDC, + } +};I wonder if your driver-data is actually needed since you can use string comparisson to achieve the exact same outcome.
Quoted 2 lines
Why use a string compare, if the kernel infrastructure already does this for you?
what do you mean ? What kernel infrastructure is doing waht for me ?
Quoted 7 lines
Quoted 4 lines
The kernel infrastructure is doing the string compare for you to match the device against the driver (via
platform_device_id->name). You get the a pointer to thedriver_datafor free. So you don't need any string compare in the driver later.but current driver data is just duplicating name with an integer, it's pretty useless driver data.
Quoted 6 lines
I don't think so - another argument:
Less code. As structplatform_device_idis a static array the space is allocated anyway. So it doesn't make any difference ifdriver_datais NULL or not. Later you just need to make an integer comparison instead of a call to astrcmp(), if you have a switch/case and IMX*_UDC is an enum, the compiler will warn you if you've missed an IMX variant.Quoted 3 lines
fair enough, but then don't create a different enum value for each imx instance if they're mostly the same. Differentiate only what's actually different.
Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation.
Quoted 5 lines
Quoted 1 line
just my 2?
$SUBJECT is trying to differentiate a single feature (or maybe two) to replace
cpu_is_xxx(), then expose that ondriver_datawithout creating one enum value for each release from fsl.
Felipe, every one or two SoCs may have their special operations for integrate PHY interface, clk operation, or workaround for IC limitation.
Maybe, it will add more future or SoCs (maybe not for this driver)
in the future, using enum is easier than string comparison for expanding something.
Quoted 3 lines
Signature · 2 lines
-- balbi
Signature · 2 lines
Best Regards, Peter Chen
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Hi,
On Mon, Jan 14, 2013 at 08:56:33PM +0800, Peter Chen wrote:
<snip>
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation.
just my 2?
Quoted 7 lines
Quoted 3 lines
$SUBJECT is trying to differentiate a single feature (or maybe two) to replace
cpu_is_xxx(), then expose that ondriver_datawithout creating one enum value for each release from fsl.Felipe, every one or two SoCs may have their special operations for integrate PHY interface, clk operation, or workaround for IC limitation.
the particular PHY and clk used should be hidden by phy layer and clk API respectively. Workarounds, fair enough, we need to handle them; but ideally those should be based on runtime revision detection, not some hackery using driver_data.
Quoted 3 lines
Maybe, it will add more future or SoCs (maybe not for this driver) in the future, using enum is easier than string comparison for expanding something.
a) I never told you to *not* use enum. I said that creating DEVICE_A, DEVICE_B, DEVICE_C, DEVICE_D and DEVICE_E values when DEVICE_B, DEVICE_C and DEVICE_E behave exactly the same is unnecessary.
b) you can't be expecting to add future SoCs support to fsl udc, I have already said and will repeat for the last time: move to chipidea ASAP.
New SoCs cannot be added to fsl udc, you *must* use chipidea for anything new and move the legacy to chipidea eventually. I will wait for a full year for you to do that, but after that I will have to start deleting drivers for the sake of avoid duplication of effort.
cheers
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/953ab9d5/attachment-0001.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 18 lines · Felipe Balbi
Hi,
On Mon, Jan 14, 2013 at 08:56:33PM +0800, Peter Chen wrote:
<snip>
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation.
just my 2?
$SUBJECT is trying to differentiate a single feature (or maybe two) to replace
cpu_is_xxx(), then expose that ondriver_datawithout creating one enum value for each release from fsl.
Quoted 8 lines
Quoted 3 lines
Felipe, every one or two SoCs may have their special operations for integrate PHY interface, clk operation, or workaround for IC limitation.
the particular PHY and clk used should be hidden by phy layer and clk API respectively. Workarounds, fair enough, we need to handle them; but ideally those should be based on runtime revision detection, not some hackery using
driver_data.
If this is actually possible, I'd love to do this. But IP vendor don't include a version register in their cores. :(
Quoted 8 lines
Quoted 3 lines
Maybe, it will add more future or SoCs (maybe not for this driver) in the future, using enum is easier than string comparison for expanding something.
a) I never told you to *not* use enum. I said that creating
DEVICE_A,DEVICE_B,DEVICE_C,DEVICE_DandDEVICE_Evalues whenDEVICE_B,DEVICE_CandDEVICE_Ebehave exactly the same is unnecessary.
Quoted 7 lines
b) you can't be expecting to add future SoCs support to fsl udc, I have already said and will repeat for the last time: move to chipidea ASAP.
New SoCs cannot be added to fsl udc, you *must* use chipidea for anything new and move the legacy to chipidea eventually. I will wait for a full year for you to do that, but after that I will have to start deleting drivers for the sake of avoid duplication of effort.
+1
Marc
Signature · 12 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/d69ca078/attachment-0001.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 23 lines · Marc Kleine-Budde
Quoted 22 lines · Felipe Balbi
Hi,
On Mon, Jan 14, 2013 at 08:56:33PM +0800, Peter Chen wrote:
<snip>
Quoted 15 lines
Quoted 11 lines
Quoted 7 lines
Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation.
just my 2?
$SUBJECT is trying to differentiate a single feature (or maybe two) to replace
cpu_is_xxx(), then expose that ondriver_datawithout creating one enum value for each release from fsl.Felipe, every one or two SoCs may have their special operations for integrate PHY interface, clk operation, or workaround for IC limitation.
Quoted 7 lines
Quoted 4 lines
the particular PHY and clk used should be hidden by phy layer and clk API respectively. Workarounds, fair enough, we need to handle them; but ideally those should be based on runtime revision detection, not some hackery using
driver_data.If this is actually possible, I'd love to do this. But IP vendor don't include a version register in their cores. :(
then fair enough, driver_data or platform_data is the way to go, still my point (a) below is valid.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/747025be/attachment.sig>
PATCH v3 1/3 usb: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
Quoted 29 lines · Felipe Balbi
Quoted 28 lines · Marc Kleine-Budde
Quoted 26 lines · Felipe Balbi
Hi,
On Mon, Jan 14, 2013 at 08:56:33PM +0800, Peter Chen wrote:
<snip>
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Usually there isn't any Changelog between IP cores used in the different fsl processors (at least available outside of fsl), that makes it quite difficult to say if something found on one imx is really the same as on the other one. And they (usually) don't provide any versioning information in a register or the documentation.
just my 2?
Quoted 7 lines
Quoted 3 lines
$SUBJECT is trying to differentiate a single feature (or maybe two) to replace
cpu_is_xxx(), then expose that ondriver_datawithout creating one enum value for each release from fsl.Felipe, every one or two SoCs may have their special operations for integrate PHY interface, clk operation, or workaround for IC limitation.
the particular PHY and clk used should be hidden by phy layer and clk API respectively. Workarounds, fair enough, we need to handle them; but ideally those should be based on runtime revision detection, not some hackery using
driver_data.
Quoted 5 lines
Quoted 2 lines
If this is actually possible, I'd love to do this. But IP vendor don't include a version register in their cores. :(
then fair enough,
driver_dataorplatform_datais the way to go, still my point (a) below is valid.
I will send v5 patch with your suggestion.
Quoted 3 lines
Signature · 2 lines
-- balbi
Signature · 2 lines
Best Regards, Peter Chen
PATCH v3 2/3 usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
In reply to Peter ChenAs mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround.
--- drivers/usb/gadget/fsl_mxc_udc.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/usb/gadget/fsl_mxc_udc.c +7 -5
@@ -23,7 +23,8 @@ static struct clk *mxc_per_clk;static struct clk *mxc_ipg_clk;/* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8#define USBPHYCTRL_EVDO (1 << 23)int fsl_udc_clk_init (enum fsl_udc_type devtype,struct platform_device *pdev)
@@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype,struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;if (devtype ==IMX35_UDC ) {unsigned int v; +void __iomem *phy_regs =ioremap ((unsigned long )pdata->regs + +MX35_USBPHYCTRL_OFFSET ,512 );/* workaround ENGcm09152 for i.MX35 */ if (pdata->workaround &FLS_USB2_WORKAROUND_ENGCM09152 ) { - v =readl (MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); + v =readl (phy_regs +USBPHYCTRL_OTGBASE_OFFSET );writel (v |USBPHYCTRL_EVDO , -MX35_IO_ADDRESS (MX35_USB_BASE_ADDR + -USBPHYCTRL_OTGBASE_OFFSET )); + phy_regs +USBPHYCTRL_OTGBASE_OFFSET ); } +iounmap (phy_regs); }/* ULPI transceivers don't need usbpll */
Signature · 1 line
1.7.0.4
PATCH v3 2/3 usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
Quoted 24 lines · Peter Chen
As
mach/hardware.his deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround.Signed-off-by Peter Chen <[email protected]>--- drivers/usb/gadget/fsl_mxc_udc.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)drivers/usb/gadget/fsl_mxc_udc.c +2
-1@@ -23,7 +23,8 @@ static struct clk *mxc_per_clk;static struct clk *mxc_ipg_clk;/* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8#define USBPHYCTRL_EVDO (1 << 23)int fsl_udc_clk_init (enum fsl_udc_type devtype,struct platform_device *pdev)
drivers/usb/gadget/fsl_mxc_udc.c void fsl_udc_clk_finalize(enum fsl_udc_type devtype, · line 88
Quoted 5 lines
drivers/usb/gadget/fsl_mxc_udc.c +2
-0@@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype,struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;if (devtype ==IMX35_UDC ) {unsigned int v; +void __iomem *phy_regs =ioremap ((unsigned long )pdata->regs + +MX35_USBPHYCTRL_OFFSET ,512 );
as I said before, this should be passed via struct resource, not pdata.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130114/3b90d250/attachment-0001.sig>
PATCH v3 2/3 usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
Quoted 23 lines · Felipe Balbi
Quoted 22 lines · Peter Chen
As
mach/hardware.his deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround.Signed-off-by Peter Chen <[email protected]>--- drivers/usb/gadget/fsl_mxc_udc.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)drivers/usb/gadget/fsl_mxc_udc.c +2
-1@@ -23,7 +23,8 @@ static struct clk *mxc_per_clk;static struct clk *mxc_ipg_clk;/* workaround ENGcm09152 for i.MX35 */ -#define USBPHYCTRL_OTGBASE_OFFSET 0x608 +#define MX35_USBPHYCTRL_OFFSET 0x600 +#define USBPHYCTRL_OTGBASE_OFFSET 0x8#define USBPHYCTRL_EVDO (1 << 23)
Quoted 9 lines
drivers/usb/gadget/fsl_mxc_udc.c void fsl_udc_clk_finalize(enum fsl_udc_type devtype, · line 88
Quoted 7 lines
drivers/usb/gadget/fsl_mxc_udc.c +2
-0int fsl_udc_clk_init (enum fsl_udc_type devtype,struct platform_device *pdev)@@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype,struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;if (devtype ==IMX35_UDC ) {unsigned int v; +void __iomem *phy_regs =ioremap ((unsigned long )pdata->regs + +MX35_USBPHYCTRL_OFFSET ,512 );as I said before, this should be passed via struct resource, not pdata.
My careless, will change at next version
Quoted 3 lines
Signature · 2 lines
-- balbi
Signature · 2 lines
Best Regards, Peter Chen
PATCH v3 2/3 usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
In reply to Peter Chendrivers/usb/gadget/fsl_mxc_udc.c void fsl_udc_clk_finalize(enum fsl_udc_type devtype, · line 88
Quoted 6 lines · Peter Chen
drivers/usb/gadget/fsl_mxc_udc.c +2
-0@@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype,struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;if (devtype ==IMX35_UDC ) {unsigned int v; +void __iomem *phy_regs =ioremap ((unsigned long )pdata->regs + +MX35_USBPHYCTRL_OFFSET ,512 );
Consider that ioremap() can fail.
PATCH v3 2/3 usb: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
Quoted 10 lines · Russell King - ARM Linux
drivers/usb/gadget/fsl_mxc_udc.c void fsl_udc_clk_finalize(enum fsl_udc_type devtype, · line 88
Quoted 6 lines · Peter Chen
drivers/usb/gadget/fsl_mxc_udc.c +2
-0@@ -83,15 +84,16 @@ void fsl_udc_clk_finalize(enum fsl_udc_type devtype,struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;if (devtype ==IMX35_UDC ) {unsigned int v; +void __iomem *phy_regs =ioremap ((unsigned long )pdata->regs + +MX35_USBPHYCTRL_OFFSET ,512 );Consider that
ioremap()can fail.
Thanks, will check NULL pointer.
Signature · 2 lines
Best Regards, Peter Chen
PATCH v3 3/3 ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
In reply to Peter ChenAs we use platform_device_id for fsl-usb2-udc driver, it needs to change clk connection-id, or the related devm_clk_get will be failed.
--- arch/arm/mach-imx/clk-imx25.c | 6 +++--- arch/arm/mach-imx/clk-imx27.c | 6 +++--- arch/arm/mach-imx/clk-imx31.c | 6 +++--- arch/arm/mach-imx/clk-imx35.c | 6 +++--- arch/arm/mach-imx/clk-imx51-imx53.c | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-)
arch/arm/mach-imx/clk-imx25.c +3 -3
@@ -254,9 +254,9 @@ int __init mx25_clocks_init(void)clk_register_clkdev (clk[ipg],"ipg" ,"mxc-ehci.2" );clk_register_clkdev (clk[usbotg_ahb],"ahb" ,"mxc-ehci.2" );clk_register_clkdev (clk[usb_div],"per" ,"mxc-ehci.2" ); -clk_register_clkdev (clk[ipg],"ipg" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usbotg_ahb],"ahb" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usb_div],"per" ,"fsl-usb2-udc" ); +clk_register_clkdev (clk[ipg],"ipg" ,"imx-udc-mx25" ); +clk_register_clkdev (clk[usbotg_ahb],"ahb" ,"imx-udc-mx25" ); +clk_register_clkdev (clk[usb_div],"per" ,"imx-udc-mx25" );clk_register_clkdev (clk[nfc_ipg_per],NULL ,"imx25-nand.0" );/* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev (clk[cspi1_ipg],NULL ,"imx35-cspi.0" );
arch/arm/mach-imx/clk-imx27.c +3 -3
@@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref)clk_register_clkdev (clk[lcdc_ahb_gate],"ahb" ,"imx21-fb.0" );clk_register_clkdev (clk[csi_ahb_gate],"ahb" ,"imx27-camera.0" );clk_register_clkdev (clk[per4_gate],"per" ,"imx27-camera.0" ); -clk_register_clkdev (clk[usb_div],"per" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usb_ipg_gate],"ipg" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usb_ahb_gate],"ahb" ,"fsl-usb2-udc" ); +clk_register_clkdev (clk[usb_div],"per" ,"imx-udc-mx27" ); +clk_register_clkdev (clk[usb_ipg_gate],"ipg" ,"imx-udc-mx27" ); +clk_register_clkdev (clk[usb_ahb_gate],"ahb" ,"imx-udc-mx27" );clk_register_clkdev (clk[usb_div],"per" ,"mxc-ehci.0" );clk_register_clkdev (clk[usb_ipg_gate],"ipg" ,"mxc-ehci.0" );clk_register_clkdev (clk[usb_ahb_gate],"ahb" ,"mxc-ehci.0" );
arch/arm/mach-imx/clk-imx31.c +3 -3
@@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref)clk_register_clkdev (clk[usb_div_post],"per" ,"mxc-ehci.2" );clk_register_clkdev (clk[usb_gate],"ahb" ,"mxc-ehci.2" );clk_register_clkdev (clk[ipg],"ipg" ,"mxc-ehci.2" ); -clk_register_clkdev (clk[usb_div_post],"per" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usb_gate],"ahb" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[ipg],"ipg" ,"fsl-usb2-udc" ); +clk_register_clkdev (clk[usb_div_post],"per" ,"imx-udc-mx31" ); +clk_register_clkdev (clk[usb_gate],"ahb" ,"imx-udc-mx31" ); +clk_register_clkdev (clk[ipg],"ipg" ,"imx-udc-mx31" );clk_register_clkdev (clk[csi_gate],NULL ,"mx3-camera.0" );/* i.mx31 has the i.mx21 type uart */ clk_register_clkdev (clk[uart1_gate],"per" ,"imx21-uart.0" );
arch/arm/mach-imx/clk-imx35.c +3 -3
@@ -251,9 +251,9 @@ int __init mx35_clocks_init()clk_register_clkdev (clk[usb_div],"per" ,"mxc-ehci.2" );clk_register_clkdev (clk[ipg],"ipg" ,"mxc-ehci.2" );clk_register_clkdev (clk[usbotg_gate],"ahb" ,"mxc-ehci.2" ); -clk_register_clkdev (clk[usb_div],"per" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[ipg],"ipg" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usbotg_gate],"ahb" ,"fsl-usb2-udc" ); +clk_register_clkdev (clk[usb_div],"per" ,"imx-udc-mx35" ); +clk_register_clkdev (clk[ipg],"ipg" ,"imx-udc-mx35" ); +clk_register_clkdev (clk[usbotg_gate],"ahb" ,"imx-udc-mx35" );clk_register_clkdev (clk[wdog_gate],NULL ,"imx2-wdt.0" );clk_register_clkdev (clk[nfc_div],NULL ,"imx25-nand.0" );clk_register_clkdev (clk[csi_gate],NULL ,"mx3-camera.0" );
arch/arm/mach-imx/clk-imx51-imx53.c +3 -3
@@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,clk_register_clkdev (clk[usboh3_per_gate],"per" ,"mxc-ehci.2" );clk_register_clkdev (clk[usboh3_gate],"ipg" ,"mxc-ehci.2" );clk_register_clkdev (clk[usboh3_gate],"ahb" ,"mxc-ehci.2" ); -clk_register_clkdev (clk[usboh3_per_gate],"per" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usboh3_gate],"ipg" ,"fsl-usb2-udc" ); -clk_register_clkdev (clk[usboh3_gate],"ahb" ,"fsl-usb2-udc" ); +clk_register_clkdev (clk[usboh3_per_gate],"per" ,"imx-udc-mx51" ); +clk_register_clkdev (clk[usboh3_gate],"ipg" ,"imx-udc-mx51" ); +clk_register_clkdev (clk[usboh3_gate],"ahb" ,"imx-udc-mx51" );clk_register_clkdev (clk[nfc_gate],NULL ,"imx51-nand" );clk_register_clkdev (clk[ssi1_ipg_gate],NULL ,"imx-ssi.0" );clk_register_clkdev (clk[ssi2_ipg_gate],NULL ,"imx-ssi.1" );
Signature · 1 line
1.7.0.4