summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-03-05 15:53:08 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-03-25 21:36:51 +0000
commit2810c549a65327c1d42cdacdf16247d3211ab75c (patch)
tree2482ad1c7b64daf79a7ed001047fb75db454d754
parent7cb49cfb33647941d4a706675832bfc57a4e27cf (diff)
downloadrockbox-2810c549a6.tar.gz
rockbox-2810c549a6.zip
x1000: spl: remove dual boot support code
Removes the SPL's dual boot support code, and removes the dual boot selection code on the M3K and Q1 since they can now do it from the main bootloader. Change-Id: Ie1b27e98c6ed4b3e37db86cfb485d6f3a6c5b25e
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c65
-rw-r--r--firmware/target/mips/ingenic_x1000/shanlingq1/spl-shanlingq1.c65
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-x1000.c86
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-x1000.h4
4 files changed, 0 insertions, 220 deletions
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c
index cbbe8b1d5d..771082b2a7 100644
--- a/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c
+++ b/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c
@@ -24,21 +24,6 @@
#include "spl-x1000.h"
#include "gpio-x1000.h"
-#define CMDLINE_COMMON \
- "mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off"
-#define CMDLINE_NORMAL \
- " init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw loglevel=8"
-
-static int dualboot_setup(void)
-{
- spl_dualboot_init_clocktree();
- spl_dualboot_init_uart2();
-
- /* load PDMA MCU firmware */
- jz_writef(CPM_CLKGR, PDMA(0));
- return spl_storage_read(0x4000, 0x2000, (void*)0xb3422000);
-}
-
const struct spl_boot_option spl_boot_options[] = {
[BOOT_OPTION_ROCKBOX] = {
.storage_addr = 0x6800,
@@ -47,60 +32,10 @@ const struct spl_boot_option spl_boot_options[] = {
.exec_addr = X1000_DRAM_BASE,
.flags = BOOTFLAG_UCLPACK,
},
- [BOOT_OPTION_OFW_PLAYER] = {
- .storage_addr = 0x20000,
- .storage_size = 4 * 1024 * 1024,
- .load_addr = 0x80efffc0,
- .exec_addr = 0x80f00000,
- .cmdline = CMDLINE_COMMON CMDLINE_NORMAL,
- .cmdline_addr = 0x80004000,
- .setup = dualboot_setup,
- },
- [BOOT_OPTION_OFW_RECOVERY] = {
- .storage_addr = 0x420000,
- .storage_size = 5 * 1024 * 1024,
- .load_addr = 0x80efffc0,
- .exec_addr = 0x80f00000,
- .cmdline = CMDLINE_COMMON,
- .cmdline_addr = 0x80004000,
- .setup = dualboot_setup,
- },
};
int spl_get_boot_option(void)
{
- /* Button debounce time in OST clock cycles */
- const uint32_t btn_stable_time = 100 * (X1000_EXCLK_FREQ / 4000);
-
- /* Buttons to poll */
- const unsigned port = GPIO_A;
- const uint32_t recov_pin = (1 << 19); /* Volume Up */
- const uint32_t orig_fw_pin = (1 << 17); /* Play */
-
- uint32_t pin = -1, lastpin = 0;
- uint32_t deadline = 0;
- int iter_count = 30; /* to avoid an infinite loop */
-
- /* set GPIOs to input state */
- gpioz_configure(port, recov_pin|orig_fw_pin, GPIOF_INPUT);
-
- /* Poll until we get a stable reading */
- do {
- lastpin = pin;
- pin = ~REG_GPIO_PIN(port) & (recov_pin|orig_fw_pin);
- if(pin != lastpin) {
- deadline = __ost_read32() + btn_stable_time;
- iter_count -= 1;
- }
- } while(iter_count > 0 && __ost_read32() < deadline);
-
- if(iter_count >= 0 && (pin & orig_fw_pin)) {
- if(pin & recov_pin)
- return BOOT_OPTION_OFW_RECOVERY;
- else
- return BOOT_OPTION_OFW_PLAYER;
- }
-
return BOOT_OPTION_ROCKBOX;
}
diff --git a/firmware/target/mips/ingenic_x1000/shanlingq1/spl-shanlingq1.c b/firmware/target/mips/ingenic_x1000/shanlingq1/spl-shanlingq1.c
index 33303c5e6b..c0cc7df0dd 100644
--- a/firmware/target/mips/ingenic_x1000/shanlingq1/spl-shanlingq1.c
+++ b/firmware/target/mips/ingenic_x1000/shanlingq1/spl-shanlingq1.c
@@ -24,21 +24,6 @@
#include "spl-x1000.h"
#include "gpio-x1000.h"
-#define CMDLINE_COMMON \
- "mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off"
-#define CMDLINE_NORMAL \
- " init=/linuxrc ubi.mtd=5 root=ubi0:rootfs ubi.mtd=6 rootfstype=ubifs rw"
-
-static int dualboot_setup(void)
-{
- spl_dualboot_init_clocktree();
- spl_dualboot_init_uart2();
-
- /* load PDMA MCU firmware */
- jz_writef(CPM_CLKGR, PDMA(0));
- return spl_storage_read(0x4000, 0x2000, (void*)0xb3422000);
-}
-
const struct spl_boot_option spl_boot_options[] = {
[BOOT_OPTION_ROCKBOX] = {
.storage_addr = 0x6800,
@@ -47,60 +32,10 @@ const struct spl_boot_option spl_boot_options[] = {
.exec_addr = X1000_DRAM_BASE,
.flags = BOOTFLAG_UCLPACK,
},
- [BOOT_OPTION_OFW_PLAYER] = {
- .storage_addr = 0x140000,
- .storage_size = 8 * 1024 * 1024,
- .load_addr = 0x80efffc0,
- .exec_addr = 0x80f00000,
- .cmdline = CMDLINE_COMMON CMDLINE_NORMAL,
- .cmdline_addr = 0x80004000,
- .setup = dualboot_setup,
- },
- [BOOT_OPTION_OFW_RECOVERY] = {
- .storage_addr = 0x940000,
- .storage_size = 10 * 1024 * 1024,
- .load_addr = 0x80efffc0,
- .exec_addr = 0x80f00000,
- .cmdline = CMDLINE_COMMON,
- .cmdline_addr = 0x80004000,
- .setup = dualboot_setup,
- },
};
int spl_get_boot_option(void)
{
- /* Button debounce time in OST clock cycles */
- const uint32_t btn_stable_time = 100 * (X1000_EXCLK_FREQ / 4000);
-
- /* Buttons to poll */
- const unsigned port = GPIO_B;
- const uint32_t recov_pin = (1 << 22); /* Next */
- const uint32_t orig_fw_pin = (1 << 21); /* Prev */
-
- uint32_t pin = -1, lastpin = 0;
- uint32_t deadline = 0;
- int iter_count = 30; /* to avoid an infinite loop */
-
- /* set GPIOs to input state */
- gpioz_configure(port, recov_pin|orig_fw_pin, GPIOF_INPUT);
-
- /* Poll until we get a stable reading */
- do {
- lastpin = pin;
- pin = ~REG_GPIO_PIN(port) & (recov_pin|orig_fw_pin);
- if(pin != lastpin) {
- deadline = __ost_read32() + btn_stable_time;
- iter_count -= 1;
- }
- } while(iter_count > 0 && __ost_read32() < deadline);
-
- if(iter_count >= 0 && (pin & orig_fw_pin)) {
- if(pin & recov_pin)
- return BOOT_OPTION_OFW_RECOVERY;
- else
- return BOOT_OPTION_OFW_PLAYER;
- }
-
return BOOT_OPTION_ROCKBOX;
}
diff --git a/firmware/target/mips/ingenic_x1000/spl-x1000.c b/firmware/target/mips/ingenic_x1000/spl-x1000.c
index ac3a17f69f..1abbdcd7a4 100644
--- a/firmware/target/mips/ingenic_x1000/spl-x1000.c
+++ b/firmware/target/mips/ingenic_x1000/spl-x1000.c
@@ -55,92 +55,6 @@ void* spl_alloc(size_t count)
return heap;
}
-/* Used by:
- * - FiiO M3K
- * - Shanling Q1
- *
- * Amend it and add #ifdefs for other targets if needed.
- */
-void spl_dualboot_init_clocktree(void)
-{
- /* Make sure these are gated to match the OF behavior. */
- jz_writef(CPM_CLKGR, PCM(1), MAC(1), LCD(1), MSC0(1), MSC1(1), OTG(1), CIM(1));
-
- /* Set clock sources, and make sure every clock starts out stopped */
- jz_writef(CPM_I2SCDR, CS_V(EXCLK));
- jz_writef(CPM_PCMCDR, CS_V(EXCLK));
-
- jz_writef(CPM_MACCDR, CLKSRC_V(MPLL), CE(1), STOP(1), CLKDIV(0xfe));
- while(jz_readf(CPM_MACCDR, BUSY));
-
- jz_writef(CPM_LPCDR, CLKSRC_V(MPLL), CE(1), STOP(1), CLKDIV(0xfe));
- while(jz_readf(CPM_LPCDR, BUSY));
-
- jz_writef(CPM_MSC0CDR, CLKSRC_V(MPLL), CE(1), STOP(1), CLKDIV(0xfe));
- while(jz_readf(CPM_MSC0CDR, BUSY));
-
- jz_writef(CPM_MSC1CDR, CE(1), STOP(1), CLKDIV(0xfe));
- while(jz_readf(CPM_MSC1CDR, BUSY));
-
- jz_writef(CPM_CIMCDR, CLKSRC_V(MPLL), CE(1), STOP(1), CLKDIV(0xfe));
- while(jz_readf(CPM_CIMCDR, BUSY));
-
- jz_writef(CPM_USBCDR, CLKSRC_V(EXCLK), CE(1), STOP(1));
- while(jz_readf(CPM_USBCDR, BUSY));
-}
-
-void spl_dualboot_init_uart2(void)
-{
- /* Ungate the clock and select UART2 device function */
- jz_writef(CPM_CLKGR, UART2(0));
- gpioz_configure(GPIO_C, 3 << 30, GPIOF_DEVICE(1));
-
- /* Disable all interrupts */
- jz_write(UART_UIER(2), 0);
-
- /* FIFO configuration */
- jz_overwritef(UART_UFCR(2),
- RDTR(3), /* FIFO trigger level = 60? */
- UME(0), /* UART module disable */
- DME(1), /* DMA mode enable? */
- TFRT(1), /* transmit FIFO reset */
- RFRT(1), /* receive FIFO reset */
- FME(1)); /* FIFO mode enable */
-
- /* IR mode configuration */
- jz_overwritef(UART_ISR(2),
- RDPL(1), /* Zero is negative pulse for receive */
- TDPL(1), /* ... and for transmit */
- XMODE(1), /* Pulse width 1.6us */
- RCVEIR(0), /* Disable IR for recieve */
- XMITIR(0)); /* ... and for transmit */
-
- /* Line configuration */
- jz_overwritef(UART_ULCR(2), DLAB(0),
- WLS_V(8BITS), /* 8 bit words */
- SBLS_V(1_STOP_BIT), /* 1 stop bit */
- PARE(0), /* no parity */
- SBK(0)); /* don't set break */
-
- /* Set the baud rate... not too sure how this works. (Docs unclear!) */
- const unsigned divisor = 0x0004;
- jz_writef(UART_ULCR(2), DLAB(1));
- jz_write(UART_UDLHR(2), (divisor >> 8) & 0xff);
- jz_write(UART_UDLLR(2), divisor & 0xff);
- jz_write(UART_UMR(2), 16);
- jz_write(UART_UACR(2), 0);
- jz_writef(UART_ULCR(2), DLAB(0));
-
- /* Enable UART */
- jz_overwritef(UART_UFCR(2),
- RDTR(0), /* FIFO trigger level = 1 */
- DME(0), /* DMA mode disable */
- UME(1), /* UART module enable */
- TFRT(1), /* transmit FIFO reset */
- RFRT(1), /* receive FIFO reset */
- FME(1)); /* FIFO mode enable */
-}
-
static void init_ost(void)
{
/* NOTE: the prescaler needs to be the same as in system-x1000.c */
diff --git a/firmware/target/mips/ingenic_x1000/spl-x1000.h b/firmware/target/mips/ingenic_x1000/spl-x1000.h
index 6d60dbf880..40ea97a5b8 100644
--- a/firmware/target/mips/ingenic_x1000/spl-x1000.h
+++ b/firmware/target/mips/ingenic_x1000/spl-x1000.h
@@ -58,10 +58,6 @@ extern int spl_storage_open(void);
extern void spl_storage_close(void);
extern int spl_storage_read(uint32_t addr, uint32_t length, void* buffer);
-/* Helpers for dual-booting with the Ingenic Linux OF */
-extern void spl_dualboot_init_clocktree(void);
-extern void spl_dualboot_init_uart2(void);
-
/* Get the boot option selected by the user, eg. by a key press */
extern int spl_get_boot_option(void);