OTG+Host mode was not workable due lack defines for code
this patch fixes it
OTG only mode was not buildable , this patch only fixes building
Signed-off-by: Alexsey Shestacov <
wing...@linux-sunxi.org>
---
drivers/usb/gadget/Kconfig | 1 +
drivers/usb/sunxi_usb/Kconfig | 25 ++++++++++++++++-------
drivers/usb/sunxi_usb/hcd/core/sw_hcd_core.c | 4 ++++
drivers/usb/sunxi_usb/manager/usb_hcd_servers.c | 4 ++--
drivers/usb/sunxi_usb/manager/usb_msg_center.c | 18 ++++++++++------
5 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 8bd50b6..7c5bdee 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -547,6 +547,7 @@ endchoice
config USB_SW_SUNXI_UDC0
bool
depends on USB_SW_SUNXI_USB_MANAGER
+ select USB_SW_SUNXI_USB0_OTG
# Selected by UDC drivers that support high-speed operation.
diff --git a/drivers/usb/sunxi_usb/Kconfig b/drivers/usb/sunxi_usb/Kconfig
index 013441e..a881653 100644
--- a/drivers/usb/sunxi_usb/Kconfig
+++ b/drivers/usb/sunxi_usb/Kconfig
@@ -18,6 +18,15 @@ config USB_SW_SUNXI_USB_MANAGER
depends on USB_SW_SUNXI_USB
help
manager all usb controller.
+#
+# Workaround, fix request massive define remake
+#
+
+config USB_SW_SUNXI_USB0_OTG
+ boolean "SoftWinner SUNXI USB HCD0 OTG Support"
+ depends on USB_SW_SUNXI_UDC0
+ help
+ SoftWinner SUNXI USB2.0 Host Controller0, OTG port
#---------------------------------------------
#-
@@ -28,6 +37,7 @@ choice
prompt "USB0 Controller support"
depends on (USB_SW_SUNXI_USB && USB_SW_SUNXI_USB_MANAGER)
+ default USB_SW_SUNXI_USB0_OTG
help
usb0 Controller mode select. choice "device only", then usb0 can only use for device.
choice "host only", then usb0 can only use for host. choice "OTG", then usb0 can only
@@ -37,21 +47,22 @@ choice
SUNXI USB Peripheral Controller", enabled under USB gadget config.
config USB_SW_SUNXI_USB0_HOST_ONLY
- boolean "host only support"
+ boolean "Host only mode"
select USB_SW_SUNXI_HCD0
help
usb0 can only use for host.
-config USB_SW_SUNXI_USB0_OTG
- boolean "otg support"
- depends on USB_SW_SUNXI_UDC0
+config USB_SW_SUNXI_USB0_OTG_AND_HOST
+ boolean "OTG and Host mode"
+ select USB_SW_SUNXI_UDC0
select USB_SW_SUNXI_HCD0
help
- usb0 can only use for device and host.
+ usb0 can use for device and host.
config USB_SW_SUNXI_USB0_DEVICE_ONLY
- boolean "device only support"
- depends on USB_SW_SUNXI_UDC0
+ boolean "OTG only mode"
+ select USB_SW_SUNXI_UDC0
+ select USB_SW_SUNXI_USB0_OTG
help
usb0 can only use for device.
diff --git a/drivers/usb/sunxi_usb/hcd/core/sw_hcd_core.c b/drivers/usb/sunxi_usb/hcd/core/sw_hcd_core.c
index f8a8366..aaf8910 100644
--- a/drivers/usb/sunxi_usb/hcd/core/sw_hcd_core.c
+++ b/drivers/usb/sunxi_usb/hcd/core/sw_hcd_core.c
@@ -811,7 +811,9 @@ static irqreturn_t sw_hcd_stage0_irq(struct sw_hcd *sw_hcd, u8 int_usb, u8 devct
struct usb_hcd *hcd = sw_hcd_to_hcd(sw_hcd);
DMSG_INFO("\n------------IRQ CONNECT-------------\n\n");
+#ifdef CONFIG_USB_SW_SUNXI_HCD0
set_hcd0_connect_status(1);
+#endif
USBC_INT_ClearMiscPending(sw_hcd->sw_hcd_io->usb_bsp_hdle, (1 << USBC_BP_INTUSB_CONNECT));
handled = IRQ_HANDLED;
@@ -928,7 +930,9 @@ static irqreturn_t sw_hcd_stage2_irq(struct sw_hcd *sw_hcd,
if ((int_usb & (1 << USBC_BP_INTUSB_DISCONNECT)) && !sw_hcd->ignore_disconnect) {
DMSG_INFO("\n------------IRQ DISCONNECT-------------\n\n");
+#ifdef CONFIG_USB_SW_SUNXI_HDD0
set_hcd0_connect_status(0);
+#endif
USBC_INT_ClearMiscPending(sw_hcd->sw_hcd_io->usb_bsp_hdle, (1 << USBC_BP_INTUSB_DISCONNECT));
handled = IRQ_HANDLED;
diff --git a/drivers/usb/sunxi_usb/manager/usb_hcd_servers.c b/drivers/usb/sunxi_usb/manager/usb_hcd_servers.c
index 7034e2d..64f6a69 100644
--- a/drivers/usb/sunxi_usb/manager/usb_hcd_servers.c
+++ b/drivers/usb/sunxi_usb/manager/usb_hcd_servers.c
@@ -54,7 +54,7 @@ static enum sw_usbc_type controller_type = SW_USB_EHCI;
int sw_usb_disable_hcd(__u32 usbc_no)
{
if (usbc_no == 0) {
-#if defined(CONFIG_USB_SW_SUNXI_USB0_OTG) || defined(USB_SW_SUNXI_USB0_HOST_ONLY)
+#ifdef CONFIG_USB_SW_SUNXI_HCD0
sw_usb_disable_hcd0();
#endif
} else if (usbc_no == 1 || usbc_no == 2) {
@@ -113,7 +113,7 @@ int sw_usb_enable_hcd(__u32 usbc_no)
"usb_controller_type failed\n");
if (usbc_no == 0) {
-#if defined(CONFIG_USB_SW_SUNXI_USB0_OTG) || defined(USB_SW_SUNXI_USB0_HOST_ONLY)
+#ifdef CONFIG_USB_SW_SUNXI_HDC0
sw_usb_enable_hcd0();
#endif
} else if (usbc_no == 1 || usbc_no == 2) {
diff --git a/drivers/usb/sunxi_usb/manager/usb_msg_center.c b/drivers/usb/sunxi_usb/manager/usb_msg_center.c
index 9451beb..b06fdd3 100644
--- a/drivers/usb/sunxi_usb/manager/usb_msg_center.c
+++ b/drivers/usb/sunxi_usb/manager/usb_msg_center.c
@@ -171,11 +171,14 @@ static void modify_msg(struct usb_msg *msg)
*/
static void insmod_host_driver(struct usb_msg_center_info *center_info)
{
- DMSG_INFO("\n\ninsmod_host_driver\n\n");
+#ifdef CONFIG_USB_SW_SUNXI_HCD0
+ DMSG_INFO("insmod_host_driver\n");
set_usb_role(center_info, USB_ROLE_HOST);
sw_usb_host0_enable();
-
+#else
+ DMSG_INFO("IGNORE -host driver not builded within currect kernel.\n");
+#endif
return;
}
@@ -199,18 +202,21 @@ static void insmod_host_driver(struct usb_msg_center_info *center_info)
*/
static void rmmod_host_driver(struct usb_msg_center_info *center_info)
{
- int ret = 0;
-
- DMSG_INFO("\n\nrmmod_host_driver\n\n");
+#ifdef CONFIG_USB_SW_SUNXI_HCD0
+ int ret = 0;
+ DMSG_INFO("rmmod_host_driver\n");
ret = sw_usb_host0_disable();
if(ret != 0){
DMSG_PANIC("err: disable hcd0 failed\n");
return;
}
-
set_usb_role(center_info, USB_ROLE_NULL);
+#else
+ DMSG_INFO("IGNORE - Host driver not builed in\n");
+#endif
+
return;
}
/*
--
1.7.10.4