summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-06-29 23:22:55 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-07-10 09:48:39 -0400
commit131566b8f80355aa64bba904f9de4d1506b90442 (patch)
treea480bc6140029199ef3569204b29162de23674b8
parentd0d13baf3e263d5aa270b3d26686cd01deb3b059 (diff)
downloadrockbox-131566b8f80355aa64bba904f9de4d1506b90442.tar.gz
rockbox-131566b8f80355aa64bba904f9de4d1506b90442.zip
x1000: fix linux boot USB issues
If the USB controller is active when we hand over to Linux it'll often trigger "irq nobody cared" warnings. Disabling the controller before boot prevents that. Also move the USB PHY bit workaround from the dualboot cleanup hook to the main Linux boot function. Mainline kernels don't clear these bits either. Change-Id: Ieaf896c3b8c3e58a8c47de5afeb384ae2511a5fa
-rw-r--r--firmware/export/config.h3
-rw-r--r--firmware/target/mips/ingenic_x1000/boot-x1000.c13
2 files changed, 12 insertions, 4 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 6465bdcb0e..a640a47b9c 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -926,6 +926,9 @@ Lyre prototype 1 */
#define INCLUDE_TIMEOUT_API
#define USB_DRIVER_CLOSE
#endif
+#if CONFIG_CPU == X1000
+#define USB_DRIVER_CLOSE
+#endif
#endif
#else /* !BOOTLOADER */
diff --git a/firmware/target/mips/ingenic_x1000/boot-x1000.c b/firmware/target/mips/ingenic_x1000/boot-x1000.c
index c8e97b4d6a..f59ec5c4ea 100644
--- a/firmware/target/mips/ingenic_x1000/boot-x1000.c
+++ b/firmware/target/mips/ingenic_x1000/boot-x1000.c
@@ -20,6 +20,7 @@
****************************************************************************/
#include "system.h"
+#include "usb.h"
#include "boot-x1000.h"
#include "nand-x1000.h"
#include "gpio-x1000.h"
@@ -113,6 +114,14 @@ void x1000_boot_linux(const void* source, size_t length,
{
size_t args_len = strlen(args);
+ /* Shut off USB to avoid "irq 21 nobody cared" error */
+ usb_close();
+ usb_enable(false);
+
+ /* clear USB PHY voodoo bits, not all kernels use them */
+ jz_writef(CPM_OPCR, GATE_USBPHY_CLK(0));
+ jz_writef(CPM_USBCDR, PHY_GATE(0));
+
disable_irq();
/* --- Beyond this point, do not call into DRAM --- */
@@ -151,10 +160,6 @@ void x1000_dualboot_cleanup(void)
jz_writef(LCD_CTRL, BEDN(0), EOFM(0), SOFM(0), IFUM(0), QDM(0));
jz_writef(CPM_CLKGR, LCD(1));
- /* clear USB PHY voodoo bits, not all kernels use them */
- jz_writef(CPM_OPCR, GATE_USBPHY_CLK(0));
- jz_writef(CPM_USBCDR, PHY_GATE(0));
-
#if defined(FIIO_M3K) || defined(EROS_QN)
/*
* Need to bring up MPLL before booting Linux