Skip to contentSkip to conversation

ARM: move interrupt_init to before relocation

PATCH New Rob Herring 2 participants 11 messages Jun 13, 2013 – Jul 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/10 ARM: move interrupt_init to before relocation

From: Rob Herring <[email protected]>

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.

---
v2:
- Remove interrupt_init from board_init_r

 arch/arm/lib/board.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/lib/board.c +1 -2
index 09ab4ad..c90843e 100644
@@ -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();
 
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v2 2/10 net: calxedaxgmac: enable rx cut-thru

From: Rob Herring <[email protected]>

There is no reason to wait for the entire frame to start DMA on receive, so enable rx cut-thru for better performance.

---
v2: no change, resend

 drivers/net/calxedaxgmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/calxedaxgmac.c +1 -1
index e3553d6..803687a 100644
@@ -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, &regs->core_opmode);
 
 	/* enable pause frames */
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v2 3/10 ARM: highbank: update config options

In reply to Rob Herring

From: Rob Herring <[email protected]>

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

---
v2:
- Drop CONFIG_SYS_PROMPT_HUSH_PS2

 include/configs/highbank.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
include/configs/highbank.h +12 -2
index 62cc08c..5e5d8e6 100644
@@ -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
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH v2 4/10 ARM: highbank: fix get_tbclk value to timer rate

In reply to Rob Herring

From: Rob Herring <[email protected]>

get_tbclk should return the timer's frequency, not CONFIG_SYS_HZ.

---
v2: no change, resend

 arch/arm/cpu/armv7/highbank/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/highbank/timer.c +1 -1
index 0f985e2..da33d3c 100644
@@ -124,5 +124,5 @@ ulong get_timer_masked(void)
 
 ulong get_tbclk(void)
 {
-	return CONFIG_SYS_HZ;
+	return SYSTIMER_RATE;
 }
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH v2 5/10 ARM: highbank: set timer prescaler to 256

In reply to Rob Herring

From: Rob Herring <[email protected]>

The 150MHz clock rate gives u-boot time functions problems and there's no benefit to a fast clock, so lower the rate.

---
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(-)
arch/arm/cpu/armv7/highbank/timer.c +4 -2
index da33d3c..d93de1e 100644
@@ -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();
 
arch/arm/include/asm/arch-armv7/systimer.h +2 -0
index e745e37..08125f7 100644
@@ -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 */
Signature · 1 line
1.8.1.2
#5 lore raw

PATCH v2 6/10 ARM: highbank: avoid bss write in timer_init

In reply to Rob Herring

From: Rob Herring <[email protected]>

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.

---
v2: no change, resend

 arch/arm/cpu/armv7/highbank/timer.c | 2 --
 1 file changed, 2 deletions(-)
arch/arm/cpu/armv7/highbank/timer.c +0 -2
index d93de1e..832c012 100644
@@ -46,8 +46,6 @@ int timer_init(void)
 	writel(SYSTIMER_EN | SYSTIMER_32BIT | SYSTIMER_PRESC_256,
 		&systimer_base->timer0control);
 
-	reset_timer_masked();
-
 	return 0;
 
 }
Signature · 1 line
1.8.1.2
#6 lore raw

PATCH v2 7/10 ARM: highbank: enable reset on command timeout

In reply to Rob Herring

From: Rob Herring <[email protected]>

Enable resetting on command timeout. The timeout is set with environment setting bootretry.

---
v2: no change, resend

 include/configs/highbank.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/highbank.h +3 -0
index 5e5d8e6..9bf56c7 100644
@@ -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
  */
Signature · 1 line
1.8.1.2
#7 lore raw

PATCH v2 8/10 ARM: highbank: setup peripherals based on power domain status

In reply to Rob Herring

From: Rob Herring <[email protected]>

Accessing powered down peripherals will hang the bus, so check power domain status before initializing SATA and fixup the FDT to disable unused peripherals.

---
v2:
- Add proper defines for register addresses.

 board/highbank/highbank.c  | 31 +++++++++++++++++++++++++++++--
 include/configs/highbank.h |  1 +
 2 files changed, 30 insertions(+), 2 deletions(-)
board/highbank/highbank.c +29 -2
index 09cd45d..b224aae 100644
@@ -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);
include/configs/highbank.h +1 -0
index 9bf56c7..e01d4bb 100644
@@ -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)
Signature · 1 line
1.8.1.2
#8 lore raw

PATCH v2 9/10 ARM: highbank: compile misc_init_r only if CONFIG_MISC_INIT_R

In reply to Rob Herring

From: Rob Herring <[email protected]>

Compile misc_init_r only if CONFIG_MISC_INIT_R is enabled.

---
v2:
- Reword commit message

 board/highbank/highbank.c | 2 ++
 1 file changed, 2 insertions(+)
board/highbank/highbank.c +2 -0
index b224aae..b0c20fe 100644
@@ -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)
 {
Signature · 1 line
1.8.1.2
#9 lore raw

PATCH v2 10/10 highbank: enable keyed autoboot stop

In reply to Rob Herring

From: Rob Herring <[email protected]>

Restrict autoboot interruption to "s" or "d" keys. This will prevent some unwanted stopping and also allow disabling the reset on command timeout.

---
v2: no change, resend

 include/configs/highbank.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/highbank.h +2 -0
index e01d4bb..5710be5 100644
@@ -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
Signature · 1 line
1.8.1.2
#10 lore raw

PATCH v2 1/10 ARM: move interrupt_init to before relocation

In reply to Rob Herring

Hi Rob,

Quoted 28 lines · Rob Herring

From: Rob Herring <[email protected]>

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.

---
v2:
- Remove interrupt_init from board_init_r

 arch/arm/lib/board.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/lib/board.c +1 -0
index 09ab4ad..c90843e 100644
@@ -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);
 

arch/arm/lib/board.c void board_init_r(gd_t *id, ulong dest_addr) · line 654

Quoted 8 lines
arch/arm/lib/board.c +0 -2
@@ -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,

Signature · 1 line
Albert.