[U-Boot] [PATCH 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 --- arch/arm/lib/board.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 09ab4ad..6dbe7e2 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);

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 --- 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 --- include/configs/highbank.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/include/configs/highbank.h b/include/configs/highbank.h index 62cc08c..d4659cb 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,19 @@ #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_PROMPT_HUSH_PS2 "> " +#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 --- 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 --- 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 --- 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 --- include/configs/highbank.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/configs/highbank.h b/include/configs/highbank.h index d4659cb..978681e 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 --- board/highbank/highbank.c | 29 +++++++++++++++++++++++++++-- include/configs/highbank.h | 1 + 2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index 09cd45d..4cc4b1c 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -25,11 +25,17 @@
#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 +64,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(0xffe08000); + scsi_scan(1); + }
boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff; sprintf(envbuffer, "bootcmd%d", boot_choice); @@ -85,6 +94,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 978681e..06c13f2 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)

On Wed, May 15, 2013 at 02:56:14PM -0500, Rob Herring wrote:
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.
[snip]
- ahci_init(0xffe08000);
- scsi_scan(1);
- if (reg & PWRDOM_STAT_SATA) {
ahci_init(0xffe08000);
scsi_scan(1);
- }
Define the magic value to something while you're in here cleaning up please, thanks!

From: Rob Herring rob.herring@calxeda.com
Signed-off-by: Rob Herring rob.herring@calxeda.com --- board/highbank/highbank.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index 4cc4b1c..82ebeea 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -60,6 +60,7 @@ int board_eth_init(bd_t *bis) return rc; }
+#ifdef CONFIG_MISC_INIT_R int misc_init_r(void) { char envbuffer[16]; @@ -81,6 +82,7 @@ int misc_init_r(void)
return 0; } +#endif
int dram_init(void) {

Hi Rob,
On Wed, 15 May 2013 14:56:15 -0500, Rob Herring robherring2@gmail.com wrote:
From: Rob Herring rob.herring@calxeda.com
Signed-off-by: Rob Herring rob.herring@calxeda.com
This commit could have more meaningful summary, such as "compile misc_init_r only if CONFIG_MISC_INIT_R"
board/highbank/highbank.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index 4cc4b1c..82ebeea 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -60,6 +60,7 @@ int board_eth_init(bd_t *bis) return rc; }
+#ifdef CONFIG_MISC_INIT_R int misc_init_r(void) { char envbuffer[16]; @@ -81,6 +82,7 @@ int misc_init_r(void)
return 0; } +#endif
int dram_init(void) {
Amicalement,

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 --- 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
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 --- 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
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 --- 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
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 --- 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();

Hi Rob,
On Tue, 21 May 2013 16:33:44 -0500, Rob Herring robherring2@gmail.com wrote:
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
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) {
This patch probably beloings to a series, only it lacks history and the post subject lacks nn/NN indications as well.
Ditto for:
http://patchwork.ozlabs.org/patch/245407/ http://patchwork.ozlabs.org/patch/245411/ http://patchwork.ozlabs.org/patch/245412/
Amicalement,

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 --- include/configs/highbank.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/highbank.h b/include/configs/highbank.h index 06c13f2..a47ef3c 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, 15 May 2013 14:56:07 -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
arch/arm/lib/board.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 09ab4ad..6dbe7e2 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);
I fail to understand how this is even supposed to work through relocation: exception vectors are not relocated, so if they work before relocation, then they won't work any more afterward unless some code is added to relocate them.
Also: if this patch is moving interrupt_init(), then where is the line where a call to interrupt_init() is removed?
Amicalement,

On Wed, May 15, 2013 at 3:26 PM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hi Rob,
On Wed, 15 May 2013 14:56:07 -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
arch/arm/lib/board.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 09ab4ad..6dbe7e2 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);
I fail to understand how this is even supposed to work through relocation: exception vectors are not relocated, so if they work before relocation, then they won't work any more afterward unless some code is added to relocate them.
They work before and after in my testing. The vectors are relocated along with the rest of u-boot and the vector base is updated by c_runtime_cpu_setup. I'm simply setting up the abort stack earlier. An alternative would be to setup a different abort handler and stack before relocation. I'm open to suggestions, but as it stands now aborts before or during relocation will simply hang without this.
Also: if this patch is moving interrupt_init(), then where is the line where a call to interrupt_init() is removed?
Yes, the later call to interrupt_init should be removed assuming we keep this approach.
Rob

Hi Rob,
On Wed, 15 May 2013 16:29:41 -0500, Rob Herring robherring2@gmail.com wrote:
On Wed, May 15, 2013 at 3:26 PM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hi Rob,
On Wed, 15 May 2013 14:56:07 -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
arch/arm/lib/board.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 09ab4ad..6dbe7e2 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);
I fail to understand how this is even supposed to work through relocation: exception vectors are not relocated, so if they work before relocation, then they won't work any more afterward unless some code is added to relocate them.
They work before and after in my testing. The vectors are relocated along with the rest of u-boot and the vector base is updated by c_runtime_cpu_setup. I'm simply setting up the abort stack earlier. An alternative would be to setup a different abort handler and stack before relocation. I'm open to suggestions, but as it stands now aborts before or during relocation will simply hang without this.
Thanks for the clarification.
This opens at least two quite interesting issues:
1. interrupts_init() does not initialize interrupts but stacks, and does not initialize only interrupt stacks but also exception stacks; it badly needs a rename (and so does the abort stack, BTW).
2. Much more worrying, interrupt vectors are only fixed for armv7, and only by setting VBAR. This seems to imply that for all other ARM targets, VBAR is not modified, and neither are the exception vectors at either 0x00000000 or 0xFFFF0000; and this means that exceptions are never pointed to the RAM-running U-Boot; they would work for NOR FLASH based U-Boots, but any other case I simply fail to see how it would work as intended.
But issue 2 is so big that I probably simply missed something obvious. Anyone able to show me how dumb I am here, feel free. :)
Regarding your change, Rob, it's good news anyway as I'm not going to ask you to overhaul the whole of ARM exception handling code in any case :) and I am fine with the change as it is, except:
Also: if this patch is moving interrupt_init(), then where is the line where a call to interrupt_init() is removed?
Yes, the later call to interrupt_init should be removed assuming we keep this approach.
Then I would like the removal to be paired with this addition in a single commit.
Rob
Amicalement,
participants (3)
-
Albert ARIBAUD
-
Rob Herring
-
Tom Rini