blob: 80ba4c753c5fe1b1a7b1d545f4b40281dbee3f7e [file]
From 64231e18413b145307bc03349dafdf86218b8cb5 Mon Sep 17 00:00:00 2001
From: "he.he" <he.he@amlogic.com>
Date: Thu, 28 Jul 2022 17:07:40 +0800
Subject: [PATCH 36/95] usb: A separate macro contains USB modifications [1/2]
PD#SWPL-89165
Problem:
A separate macro contains USB modifications for common Dir,
so when CONFIG_AMLOGIC_COMMON_USB = n will not affect
the normal function of USB
Solution:
add CONFIG_AMLOGIC_COMMON_USB
Verify:
SC2
Change-Id: If559551695a04c2ab81ce0cad5cc9500025d9079
Signed-off-by: he.he <he.he@amlogic.com>
---
drivers/usb/core/message.c | 8 ++++----
drivers/usb/core/usb.h | 2 +-
drivers/usb/gadget/configfs.c | 6 +++---
drivers/usb/host/xhci-hub.c | 6 +++---
include/linux/usb.h | 2 +-
include/linux/usb/phy.h | 13 -------------
6 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 7c2164a2415c..b1126a977777 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -31,7 +31,7 @@ struct api_context {
int status;
};
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
#define USB_EHTEST_DELAY_TEST
static int usb_test_port;
@@ -1921,7 +1921,7 @@ static void __usb_queue_reset_device(struct work_struct *ws)
usb_put_intf(iface); /* Undo _get_ in usb_queue_reset_device() */
}
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
static void usb_eltest_poll_status(struct work_struct *ws)
{
u16 portstatus = 0;
@@ -2410,7 +2410,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
/* Enable LTM if it was turned off by usb_disable_device. */
usb_enable_ltm(dev);
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
if (usb_host_test_vid > 0) {
if (dev->descriptor.idVendor == USB_HSET_TEST_VID) {
usb_host_test_vid = dev->descriptor.idVendor;
@@ -2452,7 +2452,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
intf->cur_altsetting->desc.bInterfaceNumber);
device_enable_async_suspend(&intf->dev);
ret = device_add(&intf->dev);
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
if (!intf->dev.driver) {
if (intf->cur_altsetting->desc.bInterfaceClass == 0x09)
dev_err(&dev->dev, "Unsupported the hub\n");
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 32b09c1dd7b2..60218ef84f79 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -6,7 +6,7 @@
#include <linux/pm.h>
#include <linux/acpi.h>
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
#define USB_HSET_TEST_VID 0x1A0A
#endif
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 155fda95e690..33a507df0dc5 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -25,7 +25,7 @@ static struct device *android_device;
static int index;
static int gadget_index;
-#ifdef CONFIG_AMLOGIC_USB
+#ifdef CONFIG_AMLOGIC_COMMON_USB
static struct gadget_info *gi_backup;
#endif
@@ -1873,7 +1873,7 @@ static struct config_group *gadgets_make(
if (android_device_create(gi) < 0)
goto err;
-#ifdef CONFIG_AMLOGIC_USB
+#ifdef CONFIG_AMLOGIC_COMMON_USB
gi_backup = gi;
#endif
@@ -1923,7 +1923,7 @@ void unregister_gadget_item(struct config_item *item)
}
EXPORT_SYMBOL_GPL(unregister_gadget_item);
-#ifdef CONFIG_AMLOGIC_USB
+#ifdef CONFIG_AMLOGIC_COMMON_USB
int crg_otg_write_UDC(const char *udc_name)
{
struct gadget_info *gi = gi_backup;
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 02766b124b39..fe6f2ca83a1b 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -699,7 +699,7 @@ static void xhci_port_set_test_mode(struct xhci_hcd *xhci,
temp |= test_mode << PORT_TEST_MODE_SHIFT;
writel(temp, port->addr + PORTPMSC);
xhci->test_mode = test_mode;
- #if !IS_ENABLED(CONFIG_AMLOGIC_USB)
+ #if !IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
if (test_mode == USB_TEST_FORCE_ENABLE)
xhci_start(xhci);
#endif
@@ -1180,7 +1180,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
return status;
}
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
static int xhci_test_suspend_resume(struct usb_hcd *hcd,
u16 wIndex)
{
@@ -1605,7 +1605,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
temp |= PORT_U2_TIMEOUT(timeout);
writel(temp, ports[wIndex]->addr + PORTPMSC);
break;
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
case USB_PORT_FEAT_TEST:
/* 4.19.6 Port Test Modes (USB2 Test Mode) */
if (hcd->speed != HCD_USB2)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 0148e1787b25..817ed4fb85a6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -719,7 +719,7 @@ struct usb_device {
unsigned lpm_disable_count;
u16 hub_delay;
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
struct delayed_work portstatus_work;
#endif
unsigned use_generic_driver:1;
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index fd76e8492a6a..fd0f13ba9e65 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -157,10 +157,6 @@ struct usb_phy {
* manually detect the charger type.
*/
enum usb_charger_type (*charger_detect)(struct usb_phy *x);
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
- void (*phy_trim_tuning)(struct usb_phy *x,
- int port, int default_val);
-#endif
ANDROID_VENDOR_DATA(1);
ANDROID_KABI_RESERVE(1);
@@ -222,15 +218,6 @@ usb_phy_vbus_off(struct usb_phy *x)
return x->set_vbus(x, false);
}
-#if IS_ENABLED(CONFIG_AMLOGIC_USB)
-static inline void
-usb_phy_trim_tuning(struct usb_phy *x, int port, int default_val)
-{
- if (x && x->phy_trim_tuning)
- x->phy_trim_tuning(x, port, default_val);
-}
-#endif
-
/* for usb host and peripheral controller drivers */
#if IS_ENABLED(CONFIG_USB_PHY)
extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
--
2.25.1