diff options
author | Peter Chen <peter.chen@freescale.com> | 2013-01-17 05:03:15 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-01-18 07:08:20 -0500 |
commit | f0ea8834df058371d1e59012d4a67488429fb4a2 (patch) | |
tree | d4c4aa21d8c6de1890e6526e169441e39e868c96 /drivers/usb | |
parent | 091a62c9b3d899d99dbf4e3dbebc8dfa3edbccdd (diff) |
usb: gadget: 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, one cpu_is_mx35 is useless as it has
already used pdata to differentiate runtime
Meanwhile we update the platform code accordingly.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/fsl_mxc_udc.c | 24 | ||||
-rw-r--r-- | drivers/usb/gadget/fsl_udc_core.c | 38 |
2 files changed, 32 insertions, 30 deletions
diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 1b0f086426bd..de851e530917 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c | |||
@@ -18,8 +18,6 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | 20 | ||
21 | #include <mach/hardware.h> | ||
22 | |||
23 | static struct clk *mxc_ahb_clk; | 21 | static struct clk *mxc_ahb_clk; |
24 | static struct clk *mxc_per_clk; | 22 | static struct clk *mxc_per_clk; |
25 | static struct clk *mxc_ipg_clk; | 23 | static struct clk *mxc_ipg_clk; |
@@ -59,7 +57,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) | |||
59 | clk_prepare_enable(mxc_per_clk); | 57 | clk_prepare_enable(mxc_per_clk); |
60 | 58 | ||
61 | /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ | 59 | /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ |
62 | if (!cpu_is_mx51()) { | 60 | if (!strcmp(pdev->id_entry->name, "imx-udc-mx27")) { |
63 | freq = clk_get_rate(mxc_per_clk); | 61 | freq = clk_get_rate(mxc_per_clk); |
64 | if (pdata->phy_mode != FSL_USB2_PHY_ULPI && | 62 | if (pdata->phy_mode != FSL_USB2_PHY_ULPI && |
65 | (freq < 59999000 || freq > 60001000)) { | 63 | (freq < 59999000 || freq > 60001000)) { |
@@ -82,17 +80,15 @@ eclkrate: | |||
82 | void fsl_udc_clk_finalize(struct platform_device *pdev) | 80 | void fsl_udc_clk_finalize(struct platform_device *pdev) |
83 | { | 81 | { |
84 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; | 82 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; |
85 | if (cpu_is_mx35()) { | 83 | unsigned int v; |
86 | unsigned int v; | 84 | |
87 | 85 | /* workaround ENGcm09152 for i.MX35 */ | |
88 | /* workaround ENGcm09152 for i.MX35 */ | 86 | if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) { |
89 | if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) { | 87 | v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + |
90 | v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + | 88 | USBPHYCTRL_OTGBASE_OFFSET)); |
91 | USBPHYCTRL_OTGBASE_OFFSET)); | 89 | writel(v | USBPHYCTRL_EVDO, |
92 | writel(v | USBPHYCTRL_EVDO, | 90 | MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + |
93 | MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + | 91 | USBPHYCTRL_OTGBASE_OFFSET)); |
94 | USBPHYCTRL_OTGBASE_OFFSET)); | ||
95 | } | ||
96 | } | 92 | } |
97 | 93 | ||
98 | /* ULPI transceivers don't need usbpll */ | 94 | /* ULPI transceivers don't need usbpll */ |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index c19f7f13790b..5fc1d724f38c 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/fsl_devices.h> | 41 | #include <linux/fsl_devices.h> |
42 | #include <linux/dmapool.h> | 42 | #include <linux/dmapool.h> |
43 | #include <linux/delay.h> | 43 | #include <linux/delay.h> |
44 | #include <linux/of_device.h> | ||
44 | 45 | ||
45 | #include <asm/byteorder.h> | 46 | #include <asm/byteorder.h> |
46 | #include <asm/io.h> | 47 | #include <asm/io.h> |
@@ -2438,11 +2439,6 @@ static int __init fsl_udc_probe(struct platform_device *pdev) | |||
2438 | unsigned int i; | 2439 | unsigned int i; |
2439 | u32 dccparams; | 2440 | u32 dccparams; |
2440 | 2441 | ||
2441 | if (strcmp(pdev->name, driver_name)) { | ||
2442 | VDBG("Wrong device"); | ||
2443 | return -ENODEV; | ||
2444 | } | ||
2445 | |||
2446 | udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL); | 2442 | udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL); |
2447 | if (udc_controller == NULL) { | 2443 | if (udc_controller == NULL) { |
2448 | ERR("malloc udc failed\n"); | 2444 | ERR("malloc udc failed\n"); |
@@ -2756,22 +2752,32 @@ static int fsl_udc_otg_resume(struct device *dev) | |||
2756 | 2752 | ||
2757 | return fsl_udc_resume(NULL); | 2753 | return fsl_udc_resume(NULL); |
2758 | } | 2754 | } |
2759 | |||
2760 | /*------------------------------------------------------------------------- | 2755 | /*------------------------------------------------------------------------- |
2761 | Register entry point for the peripheral controller driver | 2756 | Register entry point for the peripheral controller driver |
2762 | --------------------------------------------------------------------------*/ | 2757 | --------------------------------------------------------------------------*/ |
2763 | 2758 | static const struct platform_device_id fsl_udc_devtype[] = { | |
2759 | { | ||
2760 | .name = "imx-udc-mx27", | ||
2761 | }, { | ||
2762 | .name = "imx-udc-mx51", | ||
2763 | }, { | ||
2764 | /* sentinel */ | ||
2765 | } | ||
2766 | }; | ||
2767 | MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); | ||
2764 | static struct platform_driver udc_driver = { | 2768 | static struct platform_driver udc_driver = { |
2765 | .remove = __exit_p(fsl_udc_remove), | 2769 | .remove = __exit_p(fsl_udc_remove), |
2770 | /* Just for FSL i.mx SoC currently */ | ||
2771 | .id_table = fsl_udc_devtype, | ||
2766 | /* these suspend and resume are not usb suspend and resume */ | 2772 | /* these suspend and resume are not usb suspend and resume */ |
2767 | .suspend = fsl_udc_suspend, | 2773 | .suspend = fsl_udc_suspend, |
2768 | .resume = fsl_udc_resume, | 2774 | .resume = fsl_udc_resume, |
2769 | .driver = { | 2775 | .driver = { |
2770 | .name = (char *)driver_name, | 2776 | .name = (char *)driver_name, |
2771 | .owner = THIS_MODULE, | 2777 | .owner = THIS_MODULE, |
2772 | /* udc suspend/resume called from OTG driver */ | 2778 | /* udc suspend/resume called from OTG driver */ |
2773 | .suspend = fsl_udc_otg_suspend, | 2779 | .suspend = fsl_udc_otg_suspend, |
2774 | .resume = fsl_udc_otg_resume, | 2780 | .resume = fsl_udc_otg_resume, |
2775 | }, | 2781 | }, |
2776 | }; | 2782 | }; |
2777 | 2783 | ||