blob: 0097accf1445c97e4b1941df06f7d3ffff650f81 [file]
From ea4925200f0638816539225f32a363db7b5e9d08 Mon Sep 17 00:00:00 2001
From: "he.he" <he.he@amlogic.com>
Date: Sun, 23 Apr 2023 14:34:55 +0800
Subject: [PATCH] usb: USB low speed problem [1/1]
PD#SWPL-118459
Problem:
Mouse not be recognized
Solution:
modify USB PHY parameters: 0x0c and 0x10
Verify:
t3x
Change-Id: If6c8e177fdddfbead5a2b0d8239af15adffa4139
Signed-off-by: he.he <he.he@amlogic.com>
---
drivers/usb/core/hub.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a48fe03a5b2e..a4f662decfdc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -36,6 +36,10 @@
#include <asm/byteorder.h>
#include <trace/hooks/usb.h>
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
+#include <linux/amlogic/usb-v2-common.h>
+#endif
+
#include "hub.h"
#include "otg_productlist.h"
@@ -2205,6 +2209,9 @@ void usb_disconnect(struct usb_device **pdev)
struct usb_device *udev = *pdev;
struct usb_hub *hub = NULL;
int port1 = 1;
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
+ struct usb_hcd *hcd = bus_to_hcd(udev->bus);
+#endif
/* mark the device as inactive, so any further urb submissions for
* this device (and any of its children) will fail immediately.
@@ -2213,6 +2220,10 @@ void usb_disconnect(struct usb_device **pdev)
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
dev_info(&udev->dev, "USB disconnect, device number %d\n",
udev->devnum);
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
+ if (udev->portnum > 0 && udev->level == 1)
+ usb_phy_trim_tuning(hcd->usb_phy, udev->portnum - 1, 1);
+#endif
/*
* Ensure that the pm runtime code knows that the USB device
@@ -5387,6 +5398,13 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
loop_disable:
hub_port_disable(hub, port1, 1);
loop:
+#if IS_ENABLED(CONFIG_AMLOGIC_COMMON_USB)
+ if (PORT_INIT_TRIES == (i + 1))
+ if (hdev->level == 0)
+ usb_phy_trim_tuning(hcd->usb_phy, port1 - 1, 1);
+ if (PORT_INIT_TRIES == (i + 2) && hdev->level == 0)
+ usb_phy_trim_tuning(hcd->usb_phy, port1 - 1, 0);
+#endif
usb_ep0_reinit(udev);
release_devnum(udev);
hub_free_dev(udev);
--
2.34.1