imx: usb: ehci-mx6: add usb support for imx7d soc
Subsystems (2)
PATCH 1/1 imx: usb: ehci-mx6: add usb support for imx7d soc
Extend ehci-mx6 usb driver to support imx7d usb
--- drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-mx6.c | 125 ++++++++++++++++++++++++++++++++------------ 2 files changed, 92 insertions(+), 34 deletions(-)
drivers/usb/host/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o obj-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o obj-$(CONFIG_USB_EHCI_MX5) += ehci-mx5.o obj-$(CONFIG_USB_EHCI_MX6) += ehci-mx6.o +obj-$(CONFIG_USB_EHCI_MX7) += ehci-mx6.o obj-$(CONFIG_USB_EHCI_OMAP) += ehci-omap.o obj-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o obj-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
drivers/usb/host/ehci-mx6.c +91 -34
252 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 1/1 imx: usb: ehci-mx6: add usb support for imx7d soc
Quoted 1 line · Adrian Alonso
Extend ehci-mx6 usb driver to support imx7d usb
Hi Adrian,
this is not all the patch does and I know you can do better, really. If you want to do accessor cleanups, please put them into separate patch. If you also add kerneldoc for functions, please add that to a separate patch as well. If you add new features, that should be the last patch(es) in the series.
Quoted 6 lines
Signed-off-by Adrian Alonso <[email protected]>--- drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-mx6.c | 125++++++++++++++++++++++++++++++++------------ 2 files changed, 92 insertions(+), 34 deletions(-)
[...]
Quoted 14 lines
drivers/usb/host/ehci-mx6.c +10
-0+/* +* board_ehci_power - enables/disables usb vbus voltage +* @port: usb otg port +* @on: on/off vbus voltage +* +* Enables/disables supply vbus voltage for usb otg port. +* Machine board file overrides board_ehci_power +* +* Return: 0 Success +*/ int __weak board_ehci_power (int port,int on) {return 0 ;
drivers/usb/host/ehci-mx6.c int __weak board_ehci_power(int port, int on) · line 273
Quoted 4 lines
drivers/usb/host/ehci-mx6.c +1
-0@@ -228,9 +270,14 @@ int __weak board_ehci_power(int port, int on)int ehci_hcd_init (int index,enum usb_init_type init,struct ehci_hccr **hccr,struct ehci_hcor **hcor) { +#if defined(CONFIG_MX6 )
A helper variable like "u32 controller_spacing = 0x200" or 0x10000 based on the ifdef would make the ifdef much smaller.
drivers/usb/host/ehci-mx6.c int __weak board_ehci_power(int port, int on) · line 279
Quoted 6 lines
drivers/usb/host/ehci-mx6.c +3
-0enum usb_init_type type;struct usb_ehci *ehci = (struct usb_ehci *)(USB_BASE_ADDR + (0x200 * index)); +#elif defined(CONFIG_MX7 ) +struct usb_ehci *ehci = (struct usb_ehci *)(USB_BASE_ADDR + + (0x10000 * index));
And then use it here to have just one struct usb_ehci *ehci ...
drivers/usb/host/ehci-mx6.c int ehci_hcd_init(int index, enum usb_init_type init, · line 291
Quoted 10 lines
drivers/usb/host/ehci-mx6.c +2
-0+#endif if (index >3 )return -EINVAL ;@@ -240,24 +287,34 @@ int ehci_hcd_init(int index, enum usb_init_type init,/* Do board specific initialization */ board_ehci_hcd_init (index); +#if defined(CONFIG_MX6 )usb_power_config (index);
Maybe you can implement empty functions for MX7 here instead of the ifdeffery ?
Quoted 9 lines
drivers/usb/host/ehci-mx6.c +3
-0+#endif usb_oc_config (index); +#if defined(CONFIG_MX6 )usb_internal_phy_clock_gate (index,1 );usb_phy_enable (index, ehci); type =board_usb_phy_mode (index); +#endif *hccr = (struct ehci_hccr *)((uint32_t )&ehci->caplength);
drivers/usb/host/ehci-mx6.c int ehci_hcd_init(int index, enum usb_init_type init, · line 310
Quoted 10 lines
drivers/usb/host/ehci-mx6.c +1
-0*hcor = (struct ehci_hcor *)((uint32_t )*hccr +HC_LENGTH (ehci_readl (&(*hccr)->cr_capbase))); +#if defined(CONFIG_MX6 )if ((type == init) || (type ==USB_INIT_DEVICE ))board_ehci_power (index, (type ==USB_INIT_DEVICE ) ?0 :1 );if (type != init)return -ENODEV ;if (type ==USB_INIT_DEVICE )return 0 ;
Can't this code be used for MX7 as well ? Why not ?
Quoted 11 lines
drivers/usb/host/ehci-mx6.c +6
-1+#elif defined(CONFIG_MX7 ) +board_ehci_power (index, (init ==USB_INIT_DEVICE ) ?0 :1 ); +if (init ==USB_INIT_DEVICE ) +return 0 ; +#endif setbits_le32 (&ehci->usbmode,CM_HOST ); -__raw_writel (CONFIG_MXC_USB_PORTSC , &ehci->portsc); +writel (CONFIG_MXC_USB_PORTSC , &ehci->portsc);setbits_le32 (&ehci->portsc,USB_EN );mdelay (10 );