Skip to contentSkip to conversation

Highbank platform updates

PATCH New Rob Herring 2 participants 9 messages Feb 2, 2012 – Feb 21, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover Highbank platform updates

From: Rob Herring <[email protected]>

This is a collection of updates to Calxeda highbank platform that adds environment in nvram, boot counter, reset and bootcmd selection support.

Regards,
Rob

Jason Hobbs (1):
ARM: highbank: change env config to use nvram

Rob Herring (5):
ARM: highbank: fix us_to_tick calculation
ARM: highbank: change TEXT_BASE to 0x8000
ARM: highbank: Add boot counter support
ARM: highbank: add reset support
ARM: highbank: setup env from boot source register

 arch/arm/cpu/armv7/highbank/Makefile    |    2 +-
 arch/arm/cpu/armv7/highbank/bootcount.c |   36 +++++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/highbank/config.mk   |    1 +
 arch/arm/cpu/armv7/highbank/timer.c     |    4 +-
 board/highbank/highbank.c               |   22 +++++++++++++++++++
 include/configs/highbank.h              |   21 +++++++++--------
 6 files changed, 73 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/highbank/bootcount.c
 create mode 100644 arch/arm/cpu/armv7/highbank/config.mk
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/6 ARM: highbank: fix us_to_tick calculation

From: Rob Herring <[email protected]>

udelay calls were off due to failing to convert us to ns. Fix this and drop the unnecessary shifts since NS_PER_TICK is only 7ns.

---
 arch/arm/cpu/armv7/highbank/timer.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/highbank/timer.c +2 -2
index d8a0288..d5b6cb6 100644
@@ -66,10 +66,10 @@ static inline unsigned long long time_to_tick(unsigned long long time)
 
 static inline unsigned long long us_to_tick(unsigned long long us)
 {
-	unsigned long long tick = us << 16;
+	unsigned long long tick = us * 1000;
 	tick += NS_PER_TICK - 1;
 	do_div(tick, NS_PER_TICK);
-	return tick >> 16;
+	return tick;
 }
 
 unsigned long long get_ticks(void)
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/6 ARM: highbank: change TEXT_BASE to 0x8000

In reply to Rob Herring

From: Rob Herring <[email protected]>

Make some space at the beginning of RAM so the FDT can be loaded to a known fixed address at 0x1000.

---
 include/configs/highbank.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/highbank.h +1 -1
index 5604733..e717273 100644
@@ -120,7 +120,7 @@
 #define CONFIG_ENV_IS_NOWHERE
 
 #define CONFIG_SYS_SDRAM_BASE		0x00000000
-#define CONFIG_SYS_TEXT_BASE		0x00001000
+#define CONFIG_SYS_TEXT_BASE		0x00008000
 #define CONFIG_SYS_INIT_SP_ADDR		0x01000000
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/6 ARM: highbank: Add boot counter support

In reply to Rob Herring

From: Rob Herring <[email protected]>

Add boot counter support using an sysreg which is persistent across reset.

---
 arch/arm/cpu/armv7/highbank/Makefile    |    2 +-
 arch/arm/cpu/armv7/highbank/bootcount.c |   36 +++++++++++++++++++++++++++++++
 board/highbank/highbank.c               |    1 +
 include/configs/highbank.h              |    3 ++
 4 files changed, 41 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/highbank/bootcount.c
arch/arm/cpu/armv7/highbank/Makefile +1 -1
index 76faeb0..917c3a3 100644
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(SOC).o
 
-COBJS	:= timer.o
+COBJS	:= timer.o bootcount.o
 SOBJS	:=
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
arch/arm/cpu/armv7/highbank/bootcount.c new file +36 -0
new file mode 100644
index 0000000..9ca0656
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+void bootcount_store(ulong a)
+{
+	writel((BOOTCOUNT_MAGIC & 0xffff0000) | a, CONFIG_SYS_BOOTCOUNT_ADDR);
+}
+
+ulong bootcount_load(void)
+{
+	u32 tmp = readl(CONFIG_SYS_BOOTCOUNT_ADDR);
+
+	if ((tmp & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
+		return 0;
+	else
+		return tmp & 0x0000ffff;
+}
+#endif
board/highbank/highbank.c +1 -0
index b0aa182..2de0091 100644
@@ -20,6 +20,7 @@
 #include <scsi.h>
 
 #include <asm/sizes.h>
+#include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
include/configs/highbank.h +3 -0
index e717273..801f4ae 100644
@@ -41,6 +41,9 @@
 #define CONFIG_BAUDRATE			38400
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
 
+#define CONFIG_BOOTCOUNT_LIMIT
+#define CONFIG_SYS_BOOTCOUNT_ADDR	0xfff3cf0c
+
 #define CONFIG_MISC_INIT_R
 #define CONFIG_SCSI_AHCI
 #define CONFIG_SCSI_AHCI_PLAT
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 4/6 ARM: highbank: add reset support

In reply to Rob Herring

From: Rob Herring <[email protected]>

Implement reset for highbank platform. Reset is triggered via a wfi instruction, so enabling armv7 for the compiler is necessary.

---
 arch/arm/cpu/armv7/highbank/config.mk |    1 +
 board/highbank/highbank.c             |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/highbank/config.mk
arch/arm/cpu/armv7/highbank/config.mk new file +1 -0
new file mode 100644
index 0000000..935a147
@@ -0,0 +1 @@
+PLATFORM_CPPFLAGS += -march=armv7-a
board/highbank/highbank.c +8 -0
index 2de0091..b771cc8 100644
@@ -22,6 +22,12 @@
 #include <asm/sizes.h>
 #include <asm/io.h>
 
+#define HB_SREG_A9_PWR_REQ		0xfff3cf00
+#define HB_PWR_SUSPEND			0
+#define HB_PWR_SOFT_RESET		1
+#define HB_PWR_HARD_RESET		2
+#define HB_PWR_SHUTDOWN			3
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -67,4 +73,6 @@ void dram_init_banksize(void)
 
 void reset_cpu(ulong addr)
 {
+	writel(HB_PWR_HARD_RESET, HB_SREG_A9_PWR_REQ);
+	asm("	wfi");
 }
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH 5/6 ARM: highbank: change env config to use nvram

In reply to Rob Herring

From: Jason Hobbs <[email protected]>

Update the highbank config to use env from NVRAM. Also remove extra env settings as they are not used unless the default env is used.

---
 include/configs/highbank.h |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
include/configs/highbank.h +7 -9
index 801f4ae..7f93d5e 100644
@@ -93,12 +93,6 @@
 
 #define CONFIG_SYS_LOAD_ADDR		0x800000
 
-#define CONFIG_EXTRA_ENV_SETTINGS	\
-		"fdtaddr_r=0x600000\0" \
-		"pxefile_addr_r=0x700000\0" \
-		"kernel_addr_r=0x800000\0" \
-		"ramdisk_addr_r=0x01000000\0" \
-
 /*-----------------------------------------------------------------------
  * Stack sizes
  *
@@ -118,9 +112,13 @@
 #define CONFIG_SYS_MEMTEST_START	0x100000
 #define CONFIG_SYS_MEMTEST_END		(PHYS_SDRAM_1_SIZE - 0x100000)
 
-/* Room required on the stack for the environment data */
-#define CONFIG_ENV_SIZE			0x2000
-#define CONFIG_ENV_IS_NOWHERE
+/* Environment data setup 
+*/
+#define CONFIG_ENV_IS_IN_NVRAM
+#define CONFIG_SYS_NVRAM_BASE_ADDR	0xfff88000	/* NVRAM base address */
+#define CONFIG_SYS_NVRAM_SIZE		0x8000		/* NVRAM size */
+#define CONFIG_ENV_SIZE			0x2000		/* Size of Environ */
+#define CONFIG_ENV_ADDR			CONFIG_SYS_NVRAM_BASE_ADDR
 
 #define CONFIG_SYS_SDRAM_BASE		0x00000000
 #define CONFIG_SYS_TEXT_BASE		0x00008000
Signature · 1 line
1.7.5.4
#6 lore raw

PATCH 6/6 ARM: highbank: setup env from boot source register

In reply to Rob Herring

From: Rob Herring <[email protected]>

Add support to read the boot src register and set bootcmd env from the selected bootcmdX env setting.

Based on Linkstation boot choice selection.

---
 board/highbank/highbank.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
board/highbank/highbank.c +13 -0
index b771cc8..e2dce53 100644
@@ -23,6 +23,7 @@
 #include <asm/io.h>
 
 #define HB_SREG_A9_PWR_REQ		0xfff3cf00
+#define HB_SREG_A9_BOOT_SRC_STAT	0xfff3cf04
 #define HB_PWR_SUSPEND			0
 #define HB_PWR_SOFT_RESET		1
 #define HB_PWR_HARD_RESET		2
@@ -54,8 +55,20 @@ int board_eth_init(bd_t *bis)
 
 int misc_init_r(void)
 {
+	char envbuffer[16];
+	u32 boot_choice;
+
 	ahci_init(0xffe08000);
 	scsi_scan(1);
+
+	boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
+	sprintf(envbuffer, "bootcmd%d", boot_choice);
+	if (getenv(envbuffer)) {
+		sprintf(envbuffer, "run bootcmd%d", boot_choice);
+		setenv("bootcmd", envbuffer);
+	} else
+		setenv("bootcmd", "");
+
 	return 0;
 }
 
Signature · 1 line
1.7.5.4
#7 lore raw

cover Highbank platform updates

In reply to Rob Herring

Hi Rob,

Le 02/02/2012 03:57, Rob Herring a ?crit :

Quoted 25 lines

From: Rob Herring<[email protected]>

This is a collection of updates to Calxeda highbank platform that adds environment in nvram, boot counter, reset and bootcmd selection support.

Regards,
Rob

Jason Hobbs (1):
ARM: highbank: change env config to use nvram

Rob Herring (5):
ARM: highbank: fix us_to_tick calculation
ARM: highbank: change TEXT_BASE to 0x8000
ARM: highbank: Add boot counter support
ARM: highbank: add reset support
ARM: highbank: setup env from boot source register

  arch/arm/cpu/armv7/highbank/Makefile    |    2 +-
  arch/arm/cpu/armv7/highbank/bootcount.c |   36 +++++++++++++++++++++++++++++++
  arch/arm/cpu/armv7/highbank/config.mk   |    1 +
  arch/arm/cpu/armv7/highbank/timer.c     |    4 +-
  board/highbank/highbank.c               |   22 +++++++++++++++++++
  include/configs/highbank.h              |   21 +++++++++--------
  6 files changed, 73 insertions(+), 13 deletions(-)
Quoted 2 lines

create mode 100644 arch/arm/cpu/armv7/highbank/bootcount.c create mode 100644 arch/arm/cpu/armv7/highbank/config.mk

Of all these, only the us/ns fix could go to /master and into 2012.03, the rest being improvements, not fixes. I'd rather have the whole patch set go in together, though. Can the us/ns fix wait until after the 2012.03 release?

Amicalement,

Signature · 1 line
Albert.
#8 lore raw

cover Highbank platform updates

Albert,

Quoted 32 lines · Albert ARIBAUD

Hi Rob,

Le 02/02/2012 03:57, Rob Herring a ?crit :

Quoted 26 lines

From: Rob Herring<[email protected]>

This is a collection of updates to Calxeda highbank platform that adds environment in nvram, boot counter, reset and bootcmd selection support.

Regards,
Rob

Jason Hobbs (1):
ARM: highbank: change env config to use nvram

Rob Herring (5):
ARM: highbank: fix us_to_tick calculation
ARM: highbank: change TEXT_BASE to 0x8000
ARM: highbank: Add boot counter support
ARM: highbank: add reset support
ARM: highbank: setup env from boot source register

  arch/arm/cpu/armv7/highbank/Makefile    |    2 +-
  arch/arm/cpu/armv7/highbank/bootcount.c |   36
+++++++++++++++++++++++++++++++
  arch/arm/cpu/armv7/highbank/config.mk   |    1 +
  arch/arm/cpu/armv7/highbank/timer.c     |    4 +-
  board/highbank/highbank.c               |   22 +++++++++++++++++++
  include/configs/highbank.h              |   21 +++++++++--------
  6 files changed, 73 insertions(+), 13 deletions(-)
Quoted 2 lines

create mode 100644 arch/arm/cpu/armv7/highbank/bootcount.c create mode 100644 arch/arm/cpu/armv7/highbank/config.mk

Quoted 4 lines

Of all these, only the us/ns fix could go to /master and into 2012.03, the rest being improvements, not fixes. I'd rather have the whole patch set go in together, though. Can the us/ns fix wait until after the 2012.03 release?

Without the fix boot delay is broken and SATA has intermittent timeout errors, so I'd prefer the fix go in for 2012.03.

Rob