aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@nxp.com>2018-07-04 09:09:58 -0400
committerPeter Chen <peter.chen@nxp.com>2018-07-05 02:22:47 -0400
commita930d8bd94d8db7715d1af74299f710b1fb22fc8 (patch)
tree9f5e905ba2d47d7fd6811189331a472e800f63fe /drivers/usb/chipidea
parent90f26cc6bb90b35040f4da0347f480ea9df6e2fc (diff)
usb: chipidea: Always build ULPI code
Commit 03e6275ae381 ("usb: chipidea: Fix ULPI on imx51") causes a kernel hang on imx51 systems that use the ULPI interface and do not select the CONFIG_USB_CHIPIDEA_ULPI option. In order to avoid such potential misuse, let's always build the chipidea ULPI code into the final ci_hdrc object. Tested on a imx51-babbage board. Fixes: 03e6275ae381 ("usb: chipidea: Fix ULPI on imx51") Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/Kconfig9
-rw-r--r--drivers/usb/chipidea/Makefile3
-rw-r--r--drivers/usb/chipidea/ci.h8
-rw-r--r--drivers/usb/chipidea/ulpi.c3
4 files changed, 5 insertions, 18 deletions
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 785f0ed037f7..ee34e9046f7e 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -3,6 +3,7 @@ config USB_CHIPIDEA
3 depends on ((USB_EHCI_HCD && USB_GADGET) || (USB_EHCI_HCD && !USB_GADGET) || (!USB_EHCI_HCD && USB_GADGET)) && HAS_DMA 3 depends on ((USB_EHCI_HCD && USB_GADGET) || (USB_EHCI_HCD && !USB_GADGET) || (!USB_EHCI_HCD && USB_GADGET)) && HAS_DMA
4 select EXTCON 4 select EXTCON
5 select RESET_CONTROLLER 5 select RESET_CONTROLLER
6 select USB_ULPI_BUS
6 help 7 help
7 Say Y here if your system has a dual role high speed USB 8 Say Y here if your system has a dual role high speed USB
8 controller based on ChipIdea silicon IP. It supports: 9 controller based on ChipIdea silicon IP. It supports:
@@ -38,12 +39,4 @@ config USB_CHIPIDEA_HOST
38 help 39 help
39 Say Y here to enable host controller functionality of the 40 Say Y here to enable host controller functionality of the
40 ChipIdea driver. 41 ChipIdea driver.
41
42config USB_CHIPIDEA_ULPI
43 bool "ChipIdea ULPI PHY support"
44 depends on USB_ULPI_BUS=y || USB_ULPI_BUS=USB_CHIPIDEA
45 help
46 Say Y here if you have a ULPI PHY attached to your ChipIdea
47 controller.
48
49endif 42endif
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index e3d5e728fa53..12df94f78f72 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -1,11 +1,10 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o 2obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o
3 3
4ci_hdrc-y := core.o otg.o debug.o 4ci_hdrc-y := core.o otg.o debug.o ulpi.o
5ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o 5ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o
6ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o 6ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o
7ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o 7ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o
8ci_hdrc-$(CONFIG_USB_CHIPIDEA_ULPI) += ulpi.o
9 8
10# Glue/Bridge layers go here 9# Glue/Bridge layers go here
11 10
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 0bf244d50544..6a2cc5cd0281 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -240,10 +240,8 @@ struct ci_hdrc {
240 240
241 struct ci_hdrc_platform_data *platdata; 241 struct ci_hdrc_platform_data *platdata;
242 int vbus_active; 242 int vbus_active;
243#ifdef CONFIG_USB_CHIPIDEA_ULPI
244 struct ulpi *ulpi; 243 struct ulpi *ulpi;
245 struct ulpi_ops ulpi_ops; 244 struct ulpi_ops ulpi_ops;
246#endif
247 struct phy *phy; 245 struct phy *phy;
248 /* old usb_phy interface */ 246 /* old usb_phy interface */
249 struct usb_phy *usb_phy; 247 struct usb_phy *usb_phy;
@@ -426,15 +424,9 @@ static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci)
426#endif 424#endif
427} 425}
428 426
429#if IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)
430int ci_ulpi_init(struct ci_hdrc *ci); 427int ci_ulpi_init(struct ci_hdrc *ci);
431void ci_ulpi_exit(struct ci_hdrc *ci); 428void ci_ulpi_exit(struct ci_hdrc *ci);
432int ci_ulpi_resume(struct ci_hdrc *ci); 429int ci_ulpi_resume(struct ci_hdrc *ci);
433#else
434static inline int ci_ulpi_init(struct ci_hdrc *ci) { return 0; }
435static inline void ci_ulpi_exit(struct ci_hdrc *ci) { }
436static inline int ci_ulpi_resume(struct ci_hdrc *ci) { return 0; }
437#endif
438 430
439u32 hw_read_intr_enable(struct ci_hdrc *ci); 431u32 hw_read_intr_enable(struct ci_hdrc *ci);
440 432
diff --git a/drivers/usb/chipidea/ulpi.c b/drivers/usb/chipidea/ulpi.c
index 6da42dcd2888..dfec07e8ae1d 100644
--- a/drivers/usb/chipidea/ulpi.c
+++ b/drivers/usb/chipidea/ulpi.c
@@ -95,6 +95,9 @@ int ci_ulpi_resume(struct ci_hdrc *ci)
95{ 95{
96 int cnt = 100000; 96 int cnt = 100000;
97 97
98 if (ci->platdata->phy_mode != USBPHY_INTERFACE_MODE_ULPI)
99 return 0;
100
98 while (cnt-- > 0) { 101 while (cnt-- > 0) {
99 if (hw_read(ci, OP_ULPI_VIEWPORT, ULPI_SYNC_STATE)) 102 if (hw_read(ci, OP_ULPI_VIEWPORT, ULPI_SYNC_STATE))
100 return 0; 103 return 0;