diff options
author | Russell Robinson Jr <rrobinson@phytec.com> | 2013-02-11 15:33:19 -0800 |
---|---|---|
committer | Russell Robinson Jr <rrobinson@phytec.com> | 2013-02-11 15:33:19 -0800 |
commit | fd5b59f7d6fc1736c2b00f306dcfeb574fea4512 (patch) | |
tree | c01146a87c1b72b41dc310d7314da802548972f1 | |
parent | 10d675e891b7969fe0658db17ad0ecc88fd6eda5 (diff) |
mvf: usb: create modular defines for ehci and some hardware address changes.
ehci changes are currently only used with phyCORE-Vybrid (pcm052)
Signed-off-by: Russell Robinson Jr <rrobinson@phytec.com>
-rw-r--r-- | arch/arm/mach-mvf/clock.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-mvf/devices-mvf.h | 26 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c | 12 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-fsl-usb2-wakeup.c | 12 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mxc-ehci.c | 15 | ||||
-rwxr-xr-x | arch/arm/plat-mxc/include/mach/arc_otg.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/mvf.h | 19 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 19 |
8 files changed, 98 insertions, 9 deletions
diff --git a/arch/arm/mach-mvf/clock.c b/arch/arm/mach-mvf/clock.c index c7279adba4d2..74ce8a9f290e 100644 --- a/arch/arm/mach-mvf/clock.c +++ b/arch/arm/mach-mvf/clock.c @@ -670,10 +670,12 @@ static int _clk_pll3_usb_otg_set_rate(struct clk *clk, unsigned long rate) else return -EINVAL; +#ifndef CONFIG_MACH_PCM052 reg = __raw_readl(PLL3_480_USB1_BASE_ADDR); reg &= ~ANADIG_PLL_480_DIV_SELECT_MASK; reg |= div; __raw_writel(reg, PLL3_480_USB1_BASE_ADDR); +#endif return 0; } diff --git a/arch/arm/mach-mvf/devices-mvf.h b/arch/arm/mach-mvf/devices-mvf.h index c434834ba0b2..f4ec88b062ac 100644 --- a/arch/arm/mach-mvf/devices-mvf.h +++ b/arch/arm/mach-mvf/devices-mvf.h @@ -52,6 +52,15 @@ extern const struct imx_mxc_nand_data mvf_nand_data __initconst; #define mvf_add_nand(pdata) \ imx_add_mxc_nand(&mvf_nand_data, pdata) +#ifdef CONFIG_MACH_PCM052 +extern const struct imx_fsl_usb2_udc_data mvf_fsl_usb2_udc_data[] __initconst; +#define mvf_add_fsl_usb2_udc(id, pdata) \ + imx_add_fsl_usb2_udc(&mvf_fsl_usb2_udc_data[id], pdata) + +extern const struct imx_mxc_ehci_data mvf_mxc_ehci_otg_data[] __initconst; +#define mvf_add_fsl_ehci_otg(id, pdata) \ + imx_add_fsl_ehci(&mvf_mxc_ehci_otg_data[id], pdata) +#else extern const struct imx_fsl_usb2_udc_data mvf_fsl_usb2_udc_data __initconst; #define mvf_add_fsl_usb2_udc(pdata) \ imx_add_fsl_usb2_udc(&mvf_fsl_usb2_udc_data, pdata) @@ -59,10 +68,16 @@ extern const struct imx_fsl_usb2_udc_data mvf_fsl_usb2_udc_data __initconst; extern const struct imx_mxc_ehci_data mvf_mxc_ehci_otg_data __initconst; #define mvf_add_fsl_ehci_otg(pdata) \ imx_add_fsl_ehci(&mvf_mxc_ehci_otg_data, pdata) +#endif extern const struct imx_mxc_ehci_data mvf_mxc_ehci_hs_data[] __initconst; +#ifdef CONFIG_MACH_PCM052 +#define mvf_add_fsl_ehci_hs(id, pdata) \ + imx_add_fsl_ehci(&mvf_mxc_ehci_hs_data[id], pdata) +#else #define mvf_add_fsl_ehci_hs(id, pdata) \ imx_add_fsl_ehci(&mvf_mxc_ehci_hs_data[id - 1], pdata) +#endif extern const struct imx_fsl_usb2_otg_data mvf_fsl_usb2_otg_data __initconst; #define mvf_add_fsl_usb2_otg(pdata) \ @@ -70,15 +85,26 @@ extern const struct imx_fsl_usb2_otg_data mvf_fsl_usb2_otg_data __initconst; extern const struct imx_fsl_usb2_wakeup_data mvf_fsl_otg_wakeup_data[] __initconst; +#ifdef CONFIG_MACH_PCM052 +#define mvf_add_fsl_usb2_ehci_otg_wakeup(id, pdata) \ + imx_add_fsl_usb2_wakeup(&mvf_fsl_otg_wakeup_data[id], pdata) +#define mvf_add_fsl_usb2_udc_wakeup(id, pdata) \ + imx_add_fsl_usb2_wakeup(&mvf_fsl_otg_wakeup_data[id], pdata) +#else #define mvf_add_fsl_usb2_ehci_otg_wakeup(pdata) \ imx_add_fsl_usb2_wakeup(&mvf_fsl_otg_wakeup_data[1], pdata) #define mvf_add_fsl_usb2_udc_wakeup(pdata) \ imx_add_fsl_usb2_wakeup(&mvf_fsl_otg_wakeup_data[0], pdata) +#endif extern const struct imx_fsl_usb2_wakeup_data mvf_fsl_hs_wakeup_data[] __initconst; +#ifdef CONFIG_MACH_PCM052 +#define mvf_add_fsl_usb2_hs_wakeup(id, pdata) \ + imx_add_fsl_usb2_wakeup(&mvf_fsl_hs_wakeup_data[id], pdata) #define mvf_add_fsl_usb2_hs_wakeup(id, pdata) \ imx_add_fsl_usb2_wakeup(&mvf_fsl_hs_wakeup_data[id - 1], pdata) +#endif extern const struct imx_imx_esai_data mvf_imx_esai_data[] __initconst; #define mvf_add_imx_esai(id, pdata) \ diff --git a/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c b/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c index d50c5b0be550..5d7605421294 100644 --- a/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c +++ b/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c @@ -18,6 +18,12 @@ .irq = soc ## _INT_USB_OTG, \ } +#define mvf_fsl_usb2_udc_data_entry_single(arch, _id) \ + { \ + .iobase = arch ## _USBC ## _id ## _BASE_ADDR, \ + .irq = arch ## _INT_USB ## _id, \ + } + #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); @@ -44,9 +50,15 @@ const struct imx_fsl_usb2_udc_data imx6q_fsl_usb2_udc_data __initconst = #endif /* ifdef CONFIG_SOC_IMX6Q */ #ifdef CONFIG_ARCH_MVF +#ifdef CONFIG_MACH_PCM052 +const struct imx_fsl_usb2_udc_data mvf_fsl_usb2_udc_data[] __initconst = { + mvf_fsl_usb2_udc_data_entry_single(MVF, 0), + mvf_fsl_usb2_udc_data_entry_single(MVF, 1), +#else const struct imx_fsl_usb2_udc_data mvf_fsl_usb2_udc_data __initconst = { .iobase = MVF_USBC0_BASE_ADDR, .irq = MVF_INT_USBOTG0, +#endif }; #endif diff --git a/arch/arm/plat-mxc/devices/platform-fsl-usb2-wakeup.c b/arch/arm/plat-mxc/devices/platform-fsl-usb2-wakeup.c index 957c96a7996e..80c44f48393d 100644 --- a/arch/arm/plat-mxc/devices/platform-fsl-usb2-wakeup.c +++ b/arch/arm/plat-mxc/devices/platform-fsl-usb2-wakeup.c @@ -17,6 +17,13 @@ .irq_core = soc ## _INT_USB_ ## hs, \ } +#define mvf_fsl_usb2_wakeup_data_entry_single(arch, _id) \ + { \ + .id = _id, \ + .irq_phy = arch ## _INT_USB ## _id, \ + .irq_core = arch ## _INT_USB ## _id, \ + } + #ifdef CONFIG_SOC_IMX6Q const struct imx_fsl_usb2_wakeup_data imx6q_fsl_otg_wakeup_data __initconst = imx_fsl_usb2_wakeup_data_entry_single(MX6Q, 0, OTG); @@ -28,6 +35,10 @@ const struct imx_fsl_usb2_wakeup_data imx6q_fsl_hs_wakeup_data[] __initconst = { #endif /* ifdef CONFIG_SOC_IMX6Q */ #ifdef CONFIG_SOC_MVFA5 const struct imx_fsl_usb2_wakeup_data mvf_fsl_otg_wakeup_data[] __initconst = { +#ifdef CONFIG_MACH_PCM052 + mvf_fsl_usb2_wakeup_data_entry_single(MVF, 0), + mvf_fsl_usb2_wakeup_data_entry_single(MVF, 1), +#else { .id = 0, .irq_phy = MVF_INT_USBOTG0, @@ -38,6 +49,7 @@ const struct imx_fsl_usb2_wakeup_data mvf_fsl_otg_wakeup_data[] __initconst = { .irq_phy = MVF_INT_USB2, .irq_core = MVF_INT_USB2, } +#endif }; #endif diff --git a/arch/arm/plat-mxc/devices/platform-mxc-ehci.c b/arch/arm/plat-mxc/devices/platform-mxc-ehci.c index f700d656c3b7..928f3b792e0f 100644 --- a/arch/arm/plat-mxc/devices/platform-mxc-ehci.c +++ b/arch/arm/plat-mxc/devices/platform-mxc-ehci.c @@ -16,6 +16,13 @@ .irq = soc ## _INT_USB_ ## hs, \ } +#define mvf_mxc_ehci_data_entry_single(arch, _id) \ + { \ + .id = _id, \ + .iobase = arch ## _USBC ## _id ## _BASE_ADDR, \ + .irq = arch ## _INT_USB ## _id, \ + } + #ifdef CONFIG_SOC_IMX25 const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst = imx_mxc_ehci_data_entry_single(MX25, 0, OTG); @@ -59,12 +66,18 @@ const struct imx_mxc_ehci_data imx6q_mxc_ehci_hs_data[] __initconst = { #endif /* ifdef CONFIG_SOC_IMX6Q */ #ifdef CONFIG_ARCH_MVF +#ifdef CONFIG_MACH_PCM052 +const struct imx_mxc_ehci_data mvf_mxc_ehci_otg_data[] __initconst = { + mvf_mxc_ehci_data_entry_single(MVF, 0), + mvf_mxc_ehci_data_entry_single(MVF, 1), +#else const struct imx_mxc_ehci_data mvf_mxc_ehci_otg_data __initconst = { .id = 0, .iobase = MVF_USBC1_BASE_ADDR, .irq = MVF_INT_USB2, -}; #endif +}; +#endif /* ifdef CONFIG_ARCH_MVF */ struct platform_device *__init imx_add_mxc_ehci( const struct imx_mxc_ehci_data *data, diff --git a/arch/arm/plat-mxc/include/mach/arc_otg.h b/arch/arm/plat-mxc/include/mach/arc_otg.h index 51945e0fa957..af06f51759e5 100755 --- a/arch/arm/plat-mxc/include/mach/arc_otg.h +++ b/arch/arm/plat-mxc/include/mach/arc_otg.h @@ -31,7 +31,7 @@ extern void __iomem *imx_otg_base; #define USB_OTGREGS_BASE MVF_IO_ADDRESS(0x40034000) #define USB_OTG2REGS_BASE MVF_IO_ADDRESS(0x400B4000) -#define USB_H1REGS_BASE MVF_IO_ADDRESS(0x400B4000) +#define USB_H1REGS_BASE MVF_IO_ADDRESS(0x40034000) /* dummy h2regs for MVF */ #define USB_H2REGS_BASE MVF_IO_ADDRESS(0x400B4000) #define USBC0_OTHERREGS_BASE MVF_IO_ADDRESS(0x40034800) diff --git a/arch/arm/plat-mxc/include/mach/mvf.h b/arch/arm/plat-mxc/include/mach/mvf.h index 838eef400e95..4a47636fa741 100644 --- a/arch/arm/plat-mxc/include/mach/mvf.h +++ b/arch/arm/plat-mxc/include/mach/mvf.h @@ -183,14 +183,14 @@ #define L2_BASE_ADDR MVF_L2C_BASE_ADDR -#define MVF_USBC0_CTRL_BASE_ADDR 0x40034800 -#define MVF_USBC1_CTRL_BASE_ADDR 0x400B4800 -#define MVF_USBC0_PHY_BASE_ADDR 0x40034818 -#define MVF_USBC1_PHY_BASE_ADDR 0x400B4818 +#define MVF_USBC0_CTRL_BASE_ADDR 0x40035800 +#define MVF_USBC1_CTRL_BASE_ADDR 0x400B5800 +#define MVF_USBC0_PHY_BASE_ADDR 0x40035818 +#define MVF_USBC1_PHY_BASE_ADDR 0x400B5818 #define MVF_USBC0_BASE_ADDR 0x40034000 #define MVF_USBC1_BASE_ADDR 0x400B4000 #define MVF_USBPHY0_BASE_ADDR 0x40050800 -#define MVF_USBPHY1_BASE_ADDR 0x40050B00 +#define MVF_USBPHY1_BASE_ADDR 0x40050C00 #define MVF_MSCM_INT_ROUTER_BASE (MVF_MSCM_BASE_ADDR + 0x800) @@ -553,8 +553,13 @@ #define MVF_INT_I2C1 104 #define MVF_INT_I2C2 105 #define MVF_INT_I2C3 106 -#define MVF_INT_USBOTG0 107 -#define MVF_INT_USB2 108 + +#ifdef CONFIG_MACH_PCM052 +#define MVF_INT_USB0 107 +#define MVF_INT_USB1 108 +#else +#endif + #define MVF_INT_ENET_MAC0 110 #define MVF_INT_ENET_MAC1 111 #define MVF_INT_1588_TIMER0 112 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 694476ea22ac..f056707d0986 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -42,6 +42,11 @@ extern void fsl_platform_set_usb_phy_dis(struct fsl_usb2_platform_data *pdata, #ifdef CONFIG_ARCH_MVF #define MVF_USB_HOST_HACK #include <linux/fsl_devices.h> + +extern void fsl_platform_set_usb0_phy_dis(struct fsl_usb2_platform_data *pdata, + bool enable); +extern void fsl_platform_set_usb1_phy_dis(struct fsl_usb2_platform_data *pdata, + bool enable); #endif /* if we are in debug mode, always announce new devices */ #ifdef DEBUG @@ -1669,8 +1674,15 @@ void usb_disconnect(struct usb_device **pdev) udev->devnum); #ifdef MVF_USB_HOST_HACK if (udev->speed == USB_SPEED_HIGH && udev->level == 1) +#ifdef CONFIG_MACH_PCM052 + { + fsl_platform_set_usb0_phy_dis(NULL, 0); + fsl_platform_set_usb1_phy_dis(NULL, 0); + } +#else fsl_platform_set_usb_phy_dis(NULL, 0); #endif +#endif usb_lock_device(udev); /* Free up all the children before we remove this device */ @@ -2917,8 +2929,15 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, } #ifdef MVF_USB_HOST_HACK if (udev->speed == USB_SPEED_HIGH && udev->level == 1) +#ifdef CONFIG_MACH_PCM052 + { + fsl_platform_set_usb0_phy_dis(NULL, 1); + fsl_platform_set_usb1_phy_dis(NULL, 1); + } +#else fsl_platform_set_usb_phy_dis(NULL, 1); #endif +#endif /* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way? * Because device hardware and firmware is sometimes buggy in * this area, and this is how Linux has done it for ages. |