[U-Boot] [PATCH 0/4] MIPS Malta fixes

This series fixes a few issues with the MIPS Malta board. The first 2 patches correct the handling of the UART baudrate and allow Linux to correctly inherit that used by U-boot. The third patch enables an interrupt which Linux relies upon but does not enable itself. I will submit a patch to Linux in due course but enabling it in U-boot is required in order for current Linux kernels to function correctly. The final patch isn't a fix but allows larger kernel images to be booted which improves the experience of using U-boot on a Malta.
Paul Burton (4): mips: don't hardcode Malta env baudrate malta: correct UART baudrate malta: enable PIIX4 SERIRQ malta: set CONFIG_SYS_BOOTM_LEN to 64MB
arch/mips/include/asm/malta.h | 7 +++++++ arch/mips/lib/bootm.c | 6 ++++-- board/imgtec/malta/malta.c | 12 ++++++++++++ include/configs/malta.h | 3 ++- 4 files changed, 25 insertions(+), 3 deletions(-)

The baudrate passed to Linux in the environment was hardcoded at 38400. Instead pass the correct baudrate from global data, allowing Linux to correctly inherit the baudrate used by U-boot when console setup is not explicitly specified.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- arch/mips/lib/bootm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 1febf29..71bb0d2 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -196,8 +196,10 @@ static void boot_prep_linux(bootm_headers_t *images) if (cp) linux_env_set("eth1addr", cp);
- if (mips_boot_malta) - linux_env_set("modetty0", "38400n8r"); + if (mips_boot_malta) { + sprintf(env_buf, "%un8r", gd->baudrate); + linux_env_set("modetty0", env_buf); + } }
static void boot_jump_linux(bootm_headers_t *images)

CONFIG_SYS_NS16550_CLK specifies the rate of the clock 16x the baud rate. The SMSC FDC37M81x datasheet states that a divider of 1 results in a UART at 115200 baud, thus the x16 clock rate is 115200 * 16. Previously the divider was left at 0 which led to a rate of 38400 baud regardless of CONFIG_BAUDRATE or the baudrate environment variable.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- include/configs/malta.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/malta.h b/include/configs/malta.h index 458c33a..666cca9 100644 --- a/include/configs/malta.h +++ b/include/configs/malta.h @@ -80,7 +80,7 @@ #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE 1 -#define CONFIG_SYS_NS16550_CLK 115200 +#define CONFIG_SYS_NS16550_CLK (115200 * 16) #define CONFIG_SYS_NS16550_COM1 CKSEG1ADDR(MALTA_GT_UART0_BASE) #define CONFIG_SYS_NS16550_COM2 CKSEG1ADDR(MALTA_MSC01_UART0_BASE) #define CONFIG_CONS_INDEX 1

Whilst U-boot does not require this itself, Linux currently relies upon it having been muxed and enabled by the bootloader. Thus in order to preserve compatibility with current kernels before a fix is merged in Linux we will enable the SERIRQ interrupt and mux it to its pin.
Without doing this current kernels will never receive serial port interrupts and the end result is typically that userland appears to hang.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- arch/mips/include/asm/malta.h | 7 +++++++ board/imgtec/malta/malta.c | 12 ++++++++++++ 2 files changed, 19 insertions(+)
diff --git a/arch/mips/include/asm/malta.h b/arch/mips/include/asm/malta.h index bd9043d..9e7c045 100644 --- a/arch/mips/include/asm/malta.h +++ b/arch/mips/include/asm/malta.h @@ -56,5 +56,12 @@ #define PCI_CFG_PIIX4_PIRQRCB 0x61 #define PCI_CFG_PIIX4_PIRQRCC 0x62 #define PCI_CFG_PIIX4_PIRQRCD 0x63 +#define PCI_CFG_PIIX4_SERIRQC 0x64 +#define PCI_CFG_PIIX4_GENCFG 0xb0 + +#define PCI_CFG_PIIX4_SERIRQC_EN (1 << 7) +#define PCI_CFG_PIIX4_SERIRQC_CONT (1 << 6) + +#define PCI_CFG_PIIX4_GENCFG_SERIRQ (1 << 16)
#endif /* _MIPS_ASM_MALTA_H */ diff --git a/board/imgtec/malta/malta.c b/board/imgtec/malta/malta.c index a1a4c01..d363e49 100644 --- a/board/imgtec/malta/malta.c +++ b/board/imgtec/malta/malta.c @@ -171,6 +171,8 @@ struct serial_device *default_serial_console(void) void pci_init_board(void) { pci_dev_t bdf; + u32 val32; + u8 val8;
switch (malta_sys_con()) { case SYSCON_GT64120: @@ -205,4 +207,14 @@ void pci_init_board(void) pci_write_config_byte(bdf, PCI_CFG_PIIX4_PIRQRCB, 10); pci_write_config_byte(bdf, PCI_CFG_PIIX4_PIRQRCC, 11); pci_write_config_byte(bdf, PCI_CFG_PIIX4_PIRQRCD, 11); + + /* mux SERIRQ onto SERIRQ pin */ + pci_read_config_dword(bdf, PCI_CFG_PIIX4_GENCFG, &val32); + val32 |= PCI_CFG_PIIX4_GENCFG_SERIRQ; + pci_write_config_dword(bdf, PCI_CFG_PIIX4_GENCFG, val32); + + /* enable SERIRQ - Linux currently depends upon this */ + pci_read_config_byte(bdf, PCI_CFG_PIIX4_SERIRQC, &val8); + val8 |= PCI_CFG_PIIX4_SERIRQC_EN | PCI_CFG_PIIX4_SERIRQC_CONT; + pci_write_config_byte(bdf, PCI_CFG_PIIX4_SERIRQC, val8); }

Allow a larger kernel binary to be decompressed - the default 8MB can become limiting on a Malta.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- include/configs/malta.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/malta.h b/include/configs/malta.h index 666cca9..cc574ed 100644 --- a/include/configs/malta.h +++ b/include/configs/malta.h @@ -54,6 +54,7 @@
#define CONFIG_SYS_MALLOC_LEN (128 * 1024) #define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) +#define CONFIG_SYS_BOOTM_LEN (64 * 1024 * 1024)
/* * Console configuration

2013/11/26 Paul Burton paul.burton@imgtec.com:
This series fixes a few issues with the MIPS Malta board. The first 2 patches correct the handling of the UART baudrate and allow Linux to correctly inherit that used by U-boot. The third patch enables an interrupt which Linux relies upon but does not enable itself. I will submit a patch to Linux in due course but enabling it in U-boot is required in order for current Linux kernels to function correctly. The final patch isn't a fix but allows larger kernel images to be booted which improves the experience of using U-boot on a Malta.
Paul Burton (4): mips: don't hardcode Malta env baudrate malta: correct UART baudrate malta: enable PIIX4 SERIRQ malta: set CONFIG_SYS_BOOTM_LEN to 64MB
arch/mips/include/asm/malta.h | 7 +++++++ arch/mips/lib/bootm.c | 6 ++++-- board/imgtec/malta/malta.c | 12 ++++++++++++ include/configs/malta.h | 3 ++- 4 files changed, 25 insertions(+), 3 deletions(-)
-- 1.8.4.2
all patches applied to u-boot-mips/master, thanks
participants (2)
-
Daniel Schwierzeck
-
Paul Burton