[U-Boot] [PATCH v2 01/10] ARM: move interrupt_init to before relocation

From: Rob Herring rob.herring@calxeda.com
interrupt_init also sets up the abort stack, but is not setup before relocation. So any aborts during relocation will hang and not print out any useful information. Fix this by moving the interrupt_init to after the stack setup in board_init_f.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: - Remove interrupt_init from board_init_r
arch/arm/lib/board.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 09ab4ad..c90843e 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -447,6 +447,7 @@ void board_init_f(ulong bootflag) addr_sp += 128; /* leave 32 words for abort-stack */ gd->irq_sp = addr_sp; #endif + interrupt_init();
debug("New Stack Pointer is: %08lx\n", addr_sp);
@@ -648,8 +649,6 @@ void board_init_r(gd_t *id, ulong dest_addr) misc_init_r(); #endif
- /* set up exceptions */ - interrupt_init(); /* enable exceptions */ enable_interrupts();

From: Rob Herring rob.herring@calxeda.com
There is no reason to wait for the entire frame to start DMA on receive, so enable rx cut-thru for better performance.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: no change, resend
drivers/net/calxedaxgmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c index e3553d6..803687a 100644 --- a/drivers/net/calxedaxgmac.c +++ b/drivers/net/calxedaxgmac.c @@ -400,7 +400,7 @@ static int xgmac_init(struct eth_device *dev, bd_t * bis) /* set flow control parameters and store and forward mode */ value = (FIFO_MINUS_12K << XGMAC_CORE_OMR_RFD_SHIFT) | (FIFO_MINUS_4K << XGMAC_CORE_OMR_RFA_SHIFT) | - XGMAC_CORE_OMR_EFC | XGMAC_CORE_OMR_TSF | XGMAC_CORE_OMR_RSF; + XGMAC_CORE_OMR_EFC | XGMAC_CORE_OMR_TSF; writel(value, ®s->core_opmode);
/* enable pause frames */

From: Rob Herring rob.herring@calxeda.com
Various changes to highbank config:
Enable EFI partitions Enable ext4 and FAT filesystems Enable bootz command and raw initrd Increase cmd and print buffer size to 1K Change serial baudrate to 115200 Enable hush shell
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: - Drop CONFIG_SYS_PROMPT_HUSH_PS2
include/configs/highbank.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/configs/highbank.h b/include/configs/highbank.h index 62cc08c..5e5d8e6 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -18,7 +18,9 @@ #ifndef __CONFIG_H #define __CONFIG_H
+#define CONFIG_SYS_DCACHE_OFF #define CONFIG_L2_OFF +#define CONFIG_SYS_THUMB_BUILD
#define CONFIG_SYS_NO_FLASH #define CFG_HZ 1000 @@ -26,6 +28,7 @@
#define CONFIG_OF_LIBFDT #define CONFIG_FIT +#define CONFIG_SUPPORT_RAW_INITRD #define CONFIG_SYS_BOOTMAPSZ (16 << 20)
/* @@ -38,7 +41,7 @@ #define CONFIG_PL01x_PORTS { (void *)(0xFFF36000) } #define CONFIG_CONS_INDEX 0
-#define CONFIG_BAUDRATE 38400 +#define CONFIG_BAUDRATE 115200
#define CONFIG_BOOTCOUNT_LIMIT #define CONFIG_SYS_BOOTCOUNT_SINGLEWORD @@ -54,6 +57,7 @@ CONFIG_SYS_SCSI_MAX_LUN)
#define CONFIG_DOS_PARTITION +#define CONFIG_EFI_PARTITION
#define CONFIG_CALXEDA_XGMAC
@@ -68,12 +72,15 @@ #include <config_cmd_default.h>
#define CONFIG_CMD_BDI +#define CONFIG_CMD_BOOTZ #define CONFIG_CMD_DHCP #define CONFIG_CMD_ELF #define CONFIG_CMD_MEMORY #define CONFIG_CMD_LOADS #define CONFIG_CMD_SCSI #define CONFIG_CMD_EXT2 +#define CONFIG_CMD_EXT4 +#define CONFIG_CMD_FAT #define CONFIG_CMD_PXE #define CONFIG_MENU
@@ -84,15 +91,18 @@ #define CONFIG_CMDLINE_EDITING #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_LONGHELP /* undef to save memory */ -#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ #define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE #define CONFIG_SYS_PROMPT "Highbank #" +#define CONFIG_SYS_HUSH_PARSER /* Print Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ sizeof(CONFIG_SYS_PROMPT)+16)
#define CONFIG_SYS_LOAD_ADDR 0x800000 +#define CONFIG_SYS_64BIT_LBA +
/*----------------------------------------------------------------------- * Physical Memory Map

From: Rob Herring rob.herring@calxeda.com
get_tbclk should return the timer's frequency, not CONFIG_SYS_HZ.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: no change, resend
arch/arm/cpu/armv7/highbank/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c index 0f985e2..da33d3c 100644 --- a/arch/arm/cpu/armv7/highbank/timer.c +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -124,5 +124,5 @@ ulong get_timer_masked(void)
ulong get_tbclk(void) { - return CONFIG_SYS_HZ; + return SYSTIMER_RATE; }

From: Rob Herring rob.herring@calxeda.com
The 150MHz clock rate gives u-boot time functions problems and there's no benefit to a fast clock, so lower the rate.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: no change, resend
arch/arm/cpu/armv7/highbank/timer.c | 6 ++++-- arch/arm/include/asm/arch-armv7/systimer.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c index da33d3c..d93de1e 100644 --- a/arch/arm/cpu/armv7/highbank/timer.c +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -26,7 +26,7 @@
#undef SYSTIMER_BASE #define SYSTIMER_BASE 0xFFF34000 /* Timer 0 and 1 base */ -#define SYSTIMER_RATE 150000000 +#define SYSTIMER_RATE (150000000 / 256)
static ulong timestamp; static ulong lastinc; @@ -40,9 +40,11 @@ int timer_init(void) /* * Setup timer0 */ + writel(0, &systimer_base->timer0control); writel(SYSTIMER_RELOAD, &systimer_base->timer0load); writel(SYSTIMER_RELOAD, &systimer_base->timer0value); - writel(SYSTIMER_EN | SYSTIMER_32BIT, &systimer_base->timer0control); + writel(SYSTIMER_EN | SYSTIMER_32BIT | SYSTIMER_PRESC_256, + &systimer_base->timer0control);
reset_timer_masked();
diff --git a/arch/arm/include/asm/arch-armv7/systimer.h b/arch/arm/include/asm/arch-armv7/systimer.h index e745e37..08125f7 100644 --- a/arch/arm/include/asm/arch-armv7/systimer.h +++ b/arch/arm/include/asm/arch-armv7/systimer.h @@ -30,6 +30,8 @@ #define SYSTIMER_RELOAD 0xFFFFFFFF #define SYSTIMER_EN (1 << 7) #define SYSTIMER_32BIT (1 << 1) +#define SYSTIMER_PRESC_16 (1 << 2) +#define SYSTIMER_PRESC_256 (1 << 3)
struct systimer { u32 timer0load; /* 0x00 */

From: Rob Herring rob.herring@calxeda.com
The timer_init function is called before relocation and writes to bss data were corrupting relocation data. Fix this by removing the call to reset_timer_masked. The initial timer count should be 0 or near 0 anyway, so initializing the variables are not needed.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: no change, resend
arch/arm/cpu/armv7/highbank/timer.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c index d93de1e..832c012 100644 --- a/arch/arm/cpu/armv7/highbank/timer.c +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -46,8 +46,6 @@ int timer_init(void) writel(SYSTIMER_EN | SYSTIMER_32BIT | SYSTIMER_PRESC_256, &systimer_base->timer0control);
- reset_timer_masked(); - return 0;
}

From: Rob Herring rob.herring@calxeda.com
Enable resetting on command timeout. The timeout is set with environment setting bootretry.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: no change, resend
include/configs/highbank.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/configs/highbank.h b/include/configs/highbank.h index 5e5d8e6..9bf56c7 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -85,6 +85,9 @@ #define CONFIG_MENU
#define CONFIG_BOOTDELAY 2 +#define CONFIG_BOOT_RETRY_TIME -1 +#define CONFIG_RESET_TO_RETRY + /* * Miscellaneous configurable options */

From: Rob Herring rob.herring@calxeda.com
Accessing powered down peripherals will hang the bus, so check power domain status before initializing SATA and fixup the FDT to disable unused peripherals.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: - Add proper defines for register addresses.
board/highbank/highbank.c | 31 +++++++++++++++++++++++++++++-- include/configs/highbank.h | 1 + 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index 09cd45d..b224aae 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -23,13 +23,21 @@ #include <asm/sizes.h> #include <asm/io.h>
+#define HB_AHCI_BASE 0xffe08000 + #define HB_SREG_A9_PWR_REQ 0xfff3cf00 #define HB_SREG_A9_BOOT_SRC_STAT 0xfff3cf04 +#define HB_SREG_A9_PWRDOM_STAT 0xfff3cf20 + #define HB_PWR_SUSPEND 0 #define HB_PWR_SOFT_RESET 1 #define HB_PWR_HARD_RESET 2 #define HB_PWR_SHUTDOWN 3
+#define PWRDOM_STAT_SATA 0x80000000 +#define PWRDOM_STAT_PCI 0x40000000 +#define PWRDOM_STAT_EMMC 0x20000000 + DECLARE_GLOBAL_DATA_PTR;
/* @@ -58,9 +66,12 @@ int misc_init_r(void) { char envbuffer[16]; u32 boot_choice; + u32 reg = readl(HB_SREG_A9_PWRDOM_STAT);
- ahci_init(0xffe08000); - scsi_scan(1); + if (reg & PWRDOM_STAT_SATA) { + ahci_init(HB_AHCI_BASE); + scsi_scan(1); + }
boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff; sprintf(envbuffer, "bootcmd%d", boot_choice); @@ -85,6 +96,22 @@ void dram_init_banksize(void) gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; }
+#if defined(CONFIG_OF_BOARD_SETUP) +void ft_board_setup(void *fdt, bd_t *bd) +{ + static const char disabled[] = "disabled"; + u32 reg = readl(HB_SREG_A9_PWRDOM_STAT); + + if (!(reg & PWRDOM_STAT_SATA)) + do_fixup_by_compat(fdt, "calxeda,hb-ahci", "status", + disabled, sizeof(disabled), 1); + + if (!(reg & PWRDOM_STAT_EMMC)) + do_fixup_by_compat(fdt, "calxeda,hb-sdhci", "status", + disabled, sizeof(disabled), 1); +} +#endif + void reset_cpu(ulong addr) { writel(HB_PWR_HARD_RESET, HB_SREG_A9_PWR_REQ); diff --git a/include/configs/highbank.h b/include/configs/highbank.h index 9bf56c7..e01d4bb 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -27,6 +27,7 @@ #define CONFIG_SYS_HZ CFG_HZ
#define CONFIG_OF_LIBFDT +#define CONFIG_OF_BOARD_SETUP #define CONFIG_FIT #define CONFIG_SUPPORT_RAW_INITRD #define CONFIG_SYS_BOOTMAPSZ (16 << 20)

From: Rob Herring rob.herring@calxeda.com
Compile misc_init_r only if CONFIG_MISC_INIT_R is enabled.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: - Reword commit message
board/highbank/highbank.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index b224aae..b0c20fe 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -62,6 +62,7 @@ int board_eth_init(bd_t *bis) return rc; }
+#ifdef CONFIG_MISC_INIT_R int misc_init_r(void) { char envbuffer[16]; @@ -83,6 +84,7 @@ int misc_init_r(void)
return 0; } +#endif
int dram_init(void) {

From: Rob Herring rob.herring@calxeda.com
Restrict autoboot interruption to "s" or "d" keys. This will prevent some unwanted stopping and also allow disabling the reset on command timeout.
Signed-off-by: Rob Herring rob.herring@calxeda.com --- v2: no change, resend
include/configs/highbank.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/highbank.h b/include/configs/highbank.h index e01d4bb..5710be5 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -88,6 +88,8 @@ #define CONFIG_BOOTDELAY 2 #define CONFIG_BOOT_RETRY_TIME -1 #define CONFIG_RESET_TO_RETRY +#define CONFIG_AUTOBOOT_KEYED +#define CONFIG_AUTOBOOT_PROMPT "Autobooting in %d seconds...\nPress <s> to stop or <d> to delay\n", bootdelay
/* * Miscellaneous configurable options

Hi Rob,
On Wed, 12 Jun 2013 22:24:45 -0500, Rob Herring robherring2@gmail.com wrote:
From: Rob Herring rob.herring@calxeda.com
interrupt_init also sets up the abort stack, but is not setup before relocation. So any aborts during relocation will hang and not print out any useful information. Fix this by moving the interrupt_init to after the stack setup in board_init_f.
Signed-off-by: Rob Herring rob.herring@calxeda.com
v2:
- Remove interrupt_init from board_init_r
arch/arm/lib/board.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 09ab4ad..c90843e 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -447,6 +447,7 @@ void board_init_f(ulong bootflag) addr_sp += 128; /* leave 32 words for abort-stack */ gd->irq_sp = addr_sp; #endif
interrupt_init();
debug("New Stack Pointer is: %08lx\n", addr_sp);
@@ -648,8 +649,6 @@ void board_init_r(gd_t *id, ulong dest_addr) misc_init_r(); #endif
/* set up exceptions */
- interrupt_init(); /* enable exceptions */ enable_interrupts();
Whole series applied to u-boot-arm/master, thanks!
Amicalement,
participants (2)
-
Albert ARIBAUD
-
Rob Herring