summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-01-21 00:56:03 +0200
committerFelipe Balbi <balbi@ti.com>2015-01-27 09:39:42 -0600
commit100832abf065bc186ae48165c16546784b90a4be (patch)
tree2c61406ba75310395682841280323d2b0256dee0
parent7ef077a8ad3557f030d0407c4f56c5a0cf1e418a (diff)
downloadlinux-100832abf065bc186ae48165c16546784b90a4be.tar.bz2
usb: isp1760: Make HCD support optional
Enable compilation of the isp1760 driver in pure host mode, pure device mode, or dual-role mode. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/isp1760/Kconfig47
-rw-r--r--drivers/usb/isp1760/Makefile3
-rw-r--r--drivers/usb/isp1760/isp1760-hcd.h25
-rw-r--r--drivers/usb/isp1760/isp1760-udc.h4
4 files changed, 71 insertions, 8 deletions
diff --git a/drivers/usb/isp1760/Kconfig b/drivers/usb/isp1760/Kconfig
index c09ab8fa0e10..c94b7d953399 100644
--- a/drivers/usb/isp1760/Kconfig
+++ b/drivers/usb/isp1760/Kconfig
@@ -1,6 +1,6 @@
config USB_ISP1760
tristate "NXP ISP 1760/1761 support"
- depends on USB
+ depends on USB || USB_GADGET
help
Say Y or M here if your system as an ISP1760 USB host controller
or an ISP1761 USB dual-role controller.
@@ -14,9 +14,46 @@ config USB_ISP1760
To compile this driver as a module, choose M here: the
module will be called isp1760.
+config USB_ISP1760_HCD
+ bool
+
config USB_ISP1761_UDC
- boolean "NXP ISP1761 USB Device Controller"
- depends on USB_ISP1760 && USB_GADGET
+ bool
+
+if USB_ISP1760
+
+choice
+ bool "ISP1760 Mode Selection"
+ default USB_ISP1760_DUAL_ROLE if (USB && USB_GADGET)
+ default USB_ISP1760_HOST_ROLE if (USB && !USB_GADGET)
+ default USB_ISP1760_GADGET_ROLE if (!USB && USB_GADGET)
+
+config USB_ISP1760_HOST_ROLE
+ bool "Host only mode"
+ depends on USB=y || USB=USB_ISP1760
+ select USB_ISP1760_HCD
+ help
+ Select this if you want to use the ISP1760 in host mode only. The
+ gadget function will be disabled.
+
+config USB_ISP1760_GADGET_ROLE
+ bool "Gadget only mode"
+ depends on USB_GADGET=y || USB_GADGET=USB_ISP1760
+ select USB_ISP1761_UDC
+ help
+ Select this if you want to use the ISP1760 in peripheral mode only.
+ The host function will be disabled.
+
+config USB_ISP1760_DUAL_ROLE
+ bool "Dual Role mode"
+ depends on USB=y || USB=USB_ISP1760
+ depends on USB_GADGET=y || USB_GADGET=USB_ISP1760
+ select USB_ISP1760_HCD
+ select USB_ISP1761_UDC
help
- The NXP ISP1761 is a dual-role high-speed USB host and device
- controller.
+ Select this if you want to use the ISP1760 in both host and
+ peripheral modes.
+
+endchoice
+
+endif
diff --git a/drivers/usb/isp1760/Makefile b/drivers/usb/isp1760/Makefile
index 698ccb0b2c65..2b741074ad2b 100644
--- a/drivers/usb/isp1760/Makefile
+++ b/drivers/usb/isp1760/Makefile
@@ -1,4 +1,5 @@
-isp1760-y := isp1760-core.o isp1760-hcd.o isp1760-if.o
+isp1760-y := isp1760-core.o isp1760-if.o
+isp1760-$(CONFIG_USB_ISP1760_HCD) += isp1760-hcd.o
isp1760-$(CONFIG_USB_ISP1761_UDC) += isp1760-udc.o
obj-$(CONFIG_USB_ISP1760) += isp1760.o
diff --git a/drivers/usb/isp1760/isp1760-hcd.h b/drivers/usb/isp1760/isp1760-hcd.h
index df7ea3684b77..0c1c98d6ea08 100644
--- a/drivers/usb/isp1760/isp1760-hcd.h
+++ b/drivers/usb/isp1760/isp1760-hcd.h
@@ -47,6 +47,7 @@ enum isp1760_queue_head_types {
};
struct isp1760_hcd {
+#ifdef CONFIG_USB_ISP1760_HCD
struct usb_hcd *hcd;
u32 hcs_params;
@@ -64,8 +65,10 @@ struct isp1760_hcd {
unsigned i_thresh;
unsigned long reset_done;
unsigned long next_statechange;
+#endif
};
+#ifdef CONFIG_USB_ISP1760_HCD
int isp1760_hcd_register(struct isp1760_hcd *priv, void __iomem *regs,
struct resource *mem, int irq, unsigned long irqflags,
struct device *dev);
@@ -73,5 +76,27 @@ void isp1760_hcd_unregister(struct isp1760_hcd *priv);
int isp1760_init_kmem_once(void);
void isp1760_deinit_kmem_cache(void);
+#else
+static inline int isp1760_hcd_register(struct isp1760_hcd *priv,
+ void __iomem *regs, struct resource *mem,
+ int irq, unsigned long irqflags,
+ struct device *dev)
+{
+ return 0;
+}
+
+static inline void isp1760_hcd_unregister(struct isp1760_hcd *priv)
+{
+}
+
+static inline int isp1760_init_kmem_once(void)
+{
+ return 0;
+}
+
+static inline void isp1760_deinit_kmem_cache(void)
+{
+}
+#endif
#endif /* _ISP1760_HCD_H_ */
diff --git a/drivers/usb/isp1760/isp1760-udc.h b/drivers/usb/isp1760/isp1760-udc.h
index 4af6ba6eda86..26899ed81145 100644
--- a/drivers/usb/isp1760/isp1760-udc.h
+++ b/drivers/usb/isp1760/isp1760-udc.h
@@ -62,7 +62,7 @@ struct isp1760_ep {
* connected: Tracks gadget driver bus connection state
*/
struct isp1760_udc {
-#if CONFIG_USB_ISP1761_UDC
+#ifdef CONFIG_USB_ISP1761_UDC
struct isp1760_device *isp;
int irq;
@@ -87,7 +87,7 @@ struct isp1760_udc {
#endif
};
-#if CONFIG_USB_ISP1761_UDC
+#ifdef CONFIG_USB_ISP1761_UDC
int isp1760_udc_register(struct isp1760_device *isp, int irq,
unsigned long irqflags);
void isp1760_udc_unregister(struct isp1760_device *isp);