build/patch/kernel/rockchip-dev/assert-phy-reset-when-waking-up-in-rk3288-platform.patch.disabled
Thomas McKahan f48b01a9b0 [ tinkerboard ] Bump Dev to 4.19, update patchset
- Boots, Bluetooth, Reboot OK
- Audio missing
- spidev error (I think it's been here a while)
- disabled both DWC2 patches, added 1008-rockchip-dwc2-usb-partial-power-down.patch from @Miouyouyou
	- Review/test, boards USB hotplug works on boot for Tinker
	- If other circumstances (if any) aren't addressed this way, obviously re-enable.  @paolosabatino
- Plugging in an old U3 USB stick made the scsi CD-ROM driver go insane.  Not a modern problem.
- Strange error on IRQ 56/57:

[    1.477928] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:559 __enable_irq+0x54/0x7c
[    1.477935] Unbalanced enable for IRQ 57
[    1.477940] Modules linked in:
[    1.477958] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.19.4-rockchip 
[    1.477965] Hardware name: Rockchip (Device Tree)
[    1.477995] [<c0112c64>] (unwind_backtrace) from [<c010e1d8>] (show_stack+0x20/0x24)
[    1.478016] [<c010e1d8>] (show_stack) from [<c0e40674>] (dump_stack+0x80/0x94)
[    1.478037] [<c0e40674>] (dump_stack) from [<c0125400>] (__warn+0xf0/0x108)
[    1.478055] [<c0125400>] (__warn) from [<c0125470>] (warn_slowpath_fmt+0x58/0x74)
[    1.478075] [<c0125470>] (warn_slowpath_fmt) from [<c018fb50>] (__enable_irq+0x54/0x7c)
[    1.478094] [<c018fb50>] (__enable_irq) from [<c018fbcc>] (enable_irq+0x54/0xa0)
[    1.478113] [<c018fbcc>] (enable_irq) from [<c07d59c4>] (vop_unbind+0x24/0x54)
[    1.478130] [<c07d59c4>] (vop_unbind) from [<c07e3344>] (component_unbind+0x40/0x78)
[    1.478145] [<c07e3344>] (component_unbind) from [<c07e3764>] (component_bind_all+0x1f0/0x238)
[    1.478158] [<c07e3764>] (component_bind_all) from [<c07d3628>] (rockchip_drm_bind+0xac/0x1e4)
[    1.478173] [<c07d3628>] (rockchip_drm_bind) from [<c07e3ab0>] (try_to_bring_up_master+0x15c/0x198)
[    1.478187] [<c07e3ab0>] (try_to_bring_up_master) from [<c07e3d18>] (component_master_add_with_match+0xdc/0x110)
[    1.478201] [<c07e3d18>] (component_master_add_with_match) from [<c07d39c8>] (rockchip_drm_platform_probe+0x1f4/0x2ec)
[    1.478217] [<c07d39c8>] (rockchip_drm_platform_probe) from [<c07ec708>] (platform_drv_probe+0x58/0xa8)
[    1.478234] [<c07ec708>] (platform_drv_probe) from [<c07ea2a4>] (really_probe+0x1e0/0x2cc)
[    1.478253] [<c07ea2a4>] (really_probe) from [<c07ea564>] (driver_probe_device+0x70/0x18c)
[    1.478270] [<c07ea564>] (driver_probe_device) from [<c07ea760>] (__driver_attach+0xe0/0xe4)
[    1.478286] [<c07ea760>] (__driver_attach) from [<c07e81f0>] (bus_for_each_dev+0x84/0xc4)
[    1.478303] [<c07e81f0>] (bus_for_each_dev) from [<c07e9ba8>] (driver_attach+0x2c/0x30)
[    1.478320] [<c07e9ba8>] (driver_attach) from [<c07e95ac>] (bus_add_driver+0x19c/0x220)
[    1.478336] [<c07e95ac>] (bus_add_driver) from [<c07eb4f4>] (driver_register+0x8c/0x124)
[    1.478352] [<c07eb4f4>] (driver_register) from [<c07ec658>] (__platform_driver_register+0x50/0x58)
[    1.478369] [<c07ec658>] (__platform_driver_register) from [<c1346fd8>] (rockchip_drm_init+0x74/0x90)
[    1.478388] [<c1346fd8>] (rockchip_drm_init) from [<c0103200>] (do_one_initcall+0x64/0x288)
[    1.478410] [<c0103200>] (do_one_initcall) from [<c1301370>] (kernel_init_freeable+0x360/0x3fc)
[    1.478428] [<c1301370>] (kernel_init_freeable) from [<c0e55a38>] (kernel_init+0x18/0x120)
[    1.478442] [<c0e55a38>] (kernel_init) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
[    1.478450] Exception stack(0xee975fb0 to 0xee975ff8)
[    1.478461] 5fa0:                                     00000000 00000000 00000000 00000000
[    1.478475] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.478486] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.478502] ---[ end trace 390e2ce79ed4d5fa ]---
[    1.478567] ------------[ cut here ]------------
[    1.478585] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:559 __enable_irq+0x54/0x7c
[    1.478592] Unbalanced enable for IRQ 56
[    1.478596] Modules linked in:
[    1.478614] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         4.19.4-rockchip 
[    1.478620] Hardware name: Rockchip (Device Tree)
[    1.478640] [<c0112c64>] (unwind_backtrace) from [<c010e1d8>] (show_stack+0x20/0x24)
[    1.478656] [<c010e1d8>] (show_stack) from [<c0e40674>] (dump_stack+0x80/0x94)
[    1.478674] [<c0e40674>] (dump_stack) from [<c0125400>] (__warn+0xf0/0x108)
[    1.478691] [<c0125400>] (__warn) from [<c0125470>] (warn_slowpath_fmt+0x58/0x74)
[    1.478710] [<c0125470>] (warn_slowpath_fmt) from [<c018fb50>] (__enable_irq+0x54/0x7c)
[    1.478728] [<c018fb50>] (__enable_irq) from [<c018fbcc>] (enable_irq+0x54/0xa0)
[    1.478745] [<c018fbcc>] (enable_irq) from [<c07d59c4>] (vop_unbind+0x24/0x54)
[    1.478760] [<c07d59c4>] (vop_unbind) from [<c07e3344>] (component_unbind+0x40/0x78)
[    1.478774] [<c07e3344>] (component_unbind) from [<c07e3764>] (component_bind_all+0x1f0/0x238)
[    1.478788] [<c07e3764>] (component_bind_all) from [<c07d3628>] (rockchip_drm_bind+0xac/0x1e4)
[    1.478802] [<c07d3628>] (rockchip_drm_bind) from [<c07e3ab0>] (try_to_bring_up_master+0x15c/0x198)
[    1.478817] [<c07e3ab0>] (try_to_bring_up_master) from [<c07e3d18>] (component_master_add_with_match+0xdc/0x110)
[    1.478831] [<c07e3d18>] (component_master_add_with_match) from [<c07d39c8>] (rockchip_drm_platform_probe+0x1f4/0x2ec)
[    1.478845] [<c07d39c8>] (rockchip_drm_platform_probe) from [<c07ec708>] (platform_drv_probe+0x58/0xa8)
[    1.478862] [<c07ec708>] (platform_drv_probe) from [<c07ea2a4>] (really_probe+0x1e0/0x2cc)
[    1.478880] [<c07ea2a4>] (really_probe) from [<c07ea564>] (driver_probe_device+0x70/0x18c)
[    1.478897] [<c07ea564>] (driver_probe_device) from [<c07ea760>] (__driver_attach+0xe0/0xe4)
[    1.478913] [<c07ea760>] (__driver_attach) from [<c07e81f0>] (bus_for_each_dev+0x84/0xc4)
[    1.478929] [<c07e81f0>] (bus_for_each_dev) from [<c07e9ba8>] (driver_attach+0x2c/0x30)
[    1.478946] [<c07e9ba8>] (driver_attach) from [<c07e95ac>] (bus_add_driver+0x19c/0x220)
[    1.478962] [<c07e95ac>] (bus_add_driver) from [<c07eb4f4>] (driver_register+0x8c/0x124)
[    1.478978] [<c07eb4f4>] (driver_register) from [<c07ec658>] (__platform_driver_register+0x50/0x58)
[    1.478993] [<c07ec658>] (__platform_driver_register) from [<c1346fd8>] (rockchip_drm_init+0x74/0x90)
[    1.479010] [<c1346fd8>] (rockchip_drm_init) from [<c0103200>] (do_one_initcall+0x64/0x288)
[    1.479028] [<c0103200>] (do_one_initcall) from [<c1301370>] (kernel_init_freeable+0x360/0x3fc)
[    1.479045] [<c1301370>] (kernel_init_freeable) from [<c0e55a38>] (kernel_init+0x18/0x120)
[    1.479059] [<c0e55a38>] (kernel_init) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
[    1.479066] Exception stack(0xee975fb0 to 0xee975ff8)
[    1.479077] 5fa0:                                     00000000 00000000 00000000 00000000
[    1.479090] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.479101] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.479109] ---[ end trace 390e2ce79ed4d5fb ]---
2018-11-25 23:40:23 -05:00

69 lines
2.3 KiB
Text

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 9548d3e..0cd5896 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -919,6 +919,7 @@ struct dwc2_hsotg {
unsigned int ll_hw_enabled:1;
struct phy *phy;
+ struct work_struct phy_rst_work;
struct usb_phy *uphy;
struct dwc2_hsotg_plat *plat;
struct regulator_bulk_data supplies[ARRAY_SIZE(dwc2_hsotg_supply_names)];
diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
index 5b228ba..bf1c029 100644
--- a/drivers/usb/dwc2/core_intr.c
+++ b/drivers/usb/dwc2/core_intr.c
@@ -345,6 +345,7 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg)
static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
{
int ret;
+ struct device_node *np = hsotg->dev->of_node;
/* Clear interrupt */
dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
@@ -379,6 +380,16 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
/* Restart the Phy Clock */
pcgcctl &= ~PCGCTL_STOPPCLK;
dwc2_writel(pcgcctl, hsotg->regs + PCGCTL);
+
+ /*
+ * It is a quirk in Rockchip RK3288, causing by
+ * a hardware bug. This will propagate out and
+ * eventually we'll re-enumerate the device.
+ * Not great but the best we can do.
+ */
+ if (of_device_is_compatible(np, "rockchip,rk3288-usb"))
+ schedule_work(&hsotg->phy_rst_work);
+
mod_timer(&hsotg->wkp_timer,
jiffies + msecs_to_jiffies(71));
} else {
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 4fc8c60..8ef278e 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -207,6 +207,14 @@ int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg)
return ret;
}
+/* Only used to reset usb phy at interrupter runtime */
+static void dwc2_reset_phy_work(struct work_struct *data)
+{
+ struct dwc2_hsotg *hsotg = container_of(data, struct dwc2_hsotg,
+ phy_rst_work);
+ phy_reset(hsotg->phy);
+}
+
static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
{
int i, ret;
@@ -251,6 +259,7 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
return ret;
}
}
+ INIT_WORK(&hsotg->phy_rst_work, dwc2_reset_phy_work);
if (!hsotg->phy) {
hsotg->uphy = devm_usb_get_phy(hsotg->dev, USB_PHY_TYPE_USB2);