All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs
@ 2013-09-06 13:04 Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 02/13] tricorder: update flash partitioning Andreas Bießmann
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Thomas Weber <thomas.weber@corscience.de>

Signed-off-by: Thomas Weber <thomas.weber@corscience.de>
Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index a9b2714..1291a08 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -147,14 +147,12 @@
 	"loadaddr=0x82000000\0" \
 	"console=ttyO2,115200n8\0" \
 	"mmcdev=0\0" \
-	"vram=12M\0" \
-	"lcdmode=800x600\0" \
+	"vram=3M\0" \
 	"defaultdisplay=lcd\0" \
 	"kernelopts=rw rootwait\0" \
 	"commonargs=" \
 		"setenv bootargs console=${console} " \
 		"vram=${vram} " \
-		"omapfb.mode=lcd:${lcdmode} " \
 		"omapdss.def_disp=${defaultdisplay}\0" \
 	"mmcargs=" \
 		"run commonargs; " \
@@ -164,7 +162,6 @@
 	"nandargs=" \
 		"run commonargs; " \
 		"setenv bootargs ${bootargs} " \
-		"omapfb.mode=lcd:${lcdmode} " \
 		"omapdss.def_disp=${defaultdisplay} " \
 		"root=ubi0:root " \
 		"ubi.mtd=4 " \
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 02/13] tricorder: update flash partitioning
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 03/13] tricorder: use generic provided loadaddr Andreas Bießmann
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

The new flash layout respects posible bad blocks in sectors reserved for e.g.
SPL, u-boot, kernel, env a.s.o.

Additionally this patch prepares for U-Boot Falcon mode for boot time saving.

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |   40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 1291a08..72341a2 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -53,8 +53,6 @@
 #define CONFIG_OF_LIBFDT
 
 /* Size of malloc() pool */
-#define CONFIG_ENV_SIZE			(128 << 10)	/* 128 KiB */
-						/* Sector */
 #define CONFIG_SYS_MALLOC_LEN		(1024*1024)
 
 /* Hardware drivers */
@@ -92,13 +90,16 @@
 /* Board NAND Info */
 #define CONFIG_SYS_NO_FLASH		/* no NOR flash */
 #define CONFIG_MTD_DEVICE		/* needed for mtdparts commands */
-#define MTDIDS_DEFAULT			"nand0=nand"
-#define MTDPARTS_DEFAULT		"mtdparts=nand:" \
-						"512k(u-boot-spl)," \
-						"1920k(u-boot)," \
-						"128k(u-boot-env)," \
-						"4m(kernel)," \
-						"-(fs)"
+#define MTDIDS_DEFAULT			"nand0=omap2-nand.0"
+#define MTDPARTS_DEFAULT		"mtdparts=omap2-nand.0:" \
+						"128k(SPL)," \
+						"1m(u-boot)," \
+						"384k(u-boot-env1)," \
+						"1152k(mtdoops)," \
+						"384k(u-boot-env2)," \
+						"5m(kernel)," \
+						"2m(fdt)," \
+						"-(ubi)"
 
 #define CONFIG_NAND_OMAP_GPMC
 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
@@ -152,6 +153,7 @@
 	"kernelopts=rw rootwait\0" \
 	"commonargs=" \
 		"setenv bootargs console=${console} " \
+		"${mtdparts} " \
 		"vram=${vram} " \
 		"omapdss.def_disp=${defaultdisplay}\0" \
 	"mmcargs=" \
@@ -164,26 +166,26 @@
 		"setenv bootargs ${bootargs} " \
 		"omapdss.def_disp=${defaultdisplay} " \
 		"root=ubi0:root " \
-		"ubi.mtd=4 " \
+		"ubi.mtd=7 " \
 		"rootfstype=ubifs " \
 		"${kernelopts}\0" \
 	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
 		"source ${loadaddr}\0" \
 	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
-	"eraseenv=nand unlock 0x260000 0x20000; nand erase 0x260000 0x20000\0" \
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr}\0" \
 	"loaduimage_ubi=mtd default; " \
-		"ubi part fs; " \
+		"ubi part ubi; " \
 		"ubifsmount ubi:root; " \
 		"ubifsload ${loadaddr} /boot/uImage\0" \
 	"nandboot=echo Booting from nand ...; " \
 		"run nandargs; " \
 		"run loaduimage_ubi; " \
 		"bootm ${loadaddr}\0" \
-	"autoboot=mmc dev ${mmcdev}; if mmc rescan; then " \
+	"autoboot=mtdparts default;" \
+			"mmc dev ${mmcdev}; if mmc rescan; then " \
 			"if run loadbootscript; then " \
 				"run bootscript; " \
 			"else " \
@@ -194,7 +196,6 @@
 			"fi; " \
 		"else run nandboot; fi\0"
 
-
 #define CONFIG_BOOTCOMMAND "run autoboot"
 
 /* Miscellaneous configurable options */
@@ -236,8 +237,11 @@
 
 #define CONFIG_SYS_MONITOR_LEN		(256 << 10)	/* Reserve 2 sectors */
 
-#define CONFIG_ENV_IS_IN_NAND		1
-#define CONFIG_ENV_OFFSET		0x260000 /* environment starts here */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET		0x120000    /* env start */
+#define CONFIG_ENV_OFFSET_REDUND	0x2A0000    /* redundant env start */
+#define CONFIG_ENV_SIZE			(16 << 10)  /* use 16KiB for env */
+#define CONFIG_ENV_RANGE		(384 << 10) /* allow badblocks in env */
 
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_RAM_ADDR	0x4020f800
@@ -298,8 +302,8 @@
 
 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
 
-#define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
-#define CONFIG_SYS_NAND_U_BOOT_SIZE	0x200000
+#define CONFIG_SYS_NAND_U_BOOT_OFFS	0x20000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE	0x100000
 
 #define CONFIG_SYS_SPL_MALLOC_START	0x80208000
 #define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000	/* 1 MB */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 03/13] tricorder: use generic provided loadaddr
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 02/13] tricorder: update flash partitioning Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 04/13] tricorder: add configuration for a flashcard u-boot Andreas Bießmann
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 72341a2..249ee72 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -144,8 +144,11 @@
 
 #define CONFIG_BOOTDELAY		3
 
+/* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend
+ * value can not be used here! */
+#define CONFIG_LOADADDR		0x82000000
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"loadaddr=0x82000000\0" \
 	"console=ttyO2,115200n8\0" \
 	"mmcdev=0\0" \
 	"vram=3M\0" \
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 04/13] tricorder: add configuration for a flashcard u-boot
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 02/13] tricorder: update flash partitioning Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 03/13] tricorder: use generic provided loadaddr Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-10 22:45   ` Wolfgang Denk
  2013-09-06 13:04 ` [U-Boot] [PATCH 05/13] tricorder: add cmdline history Andreas Bießmann
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

The 'flashcard' u-boot configuration has a readonly environment and boots a
bare kernel/initrd to program the device from an clean environment.

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 boards.cfg                  |    1 +
 include/configs/tricorder.h |   71 ++++++++++++++++++++++++++++++++++---------
 2 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/boards.cfg b/boards.cfg
index be810c7..b219f5d 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -315,6 +315,7 @@ omap3_sdp3430                arm         armv7       sdp3430             ti
 devkit8000                   arm         armv7       devkit8000          timll          omap3
 mcx                          arm         armv7       mcx                 htkw           omap3
 tricorder                    arm         armv7       tricorder           corscience     omap3
+tricorder_flashcard          arm         armv7       tricorder           corscience     omap3   tricorder:FLASHCARD
 twister                      arm         armv7       twister             technexion     omap3
 nokia_rx51                   arm         armv7       rx51                nokia          omap3
 omap4_panda                  arm         armv7       panda               ti             omap4
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 249ee72..220dbdc 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -139,39 +139,86 @@
 #define CONFIG_MTD_DEVICE       /* needed for mtdparts commands */
 #define CONFIG_MTD_PARTITIONS
 
-/* Environment information */
-#define CONFIG_ENV_OVERWRITE /* allow to overwrite serial and ethaddr */
+/* Environment information (this is the common part) */
 
 #define CONFIG_BOOTDELAY		3
 
+/* environment placement (for NAND), is different for FLASHCARD but does not
+ * harm there */
+#define CONFIG_ENV_OFFSET		0x120000    /* env start */
+#define CONFIG_ENV_OFFSET_REDUND	0x2A0000    /* redundant env start */
+#define CONFIG_ENV_SIZE			(16 << 10)  /* use 16KiB for env */
+#define CONFIG_ENV_RANGE		(384 << 10) /* allow badblocks in env */
+
 /* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend
  * value can not be used here! */
 #define CONFIG_LOADADDR		0x82000000
 
-#define CONFIG_EXTRA_ENV_SETTINGS \
+#define CONFIG_COMMON_ENV_SETTINGS \
 	"console=ttyO2,115200n8\0" \
 	"mmcdev=0\0" \
 	"vram=3M\0" \
 	"defaultdisplay=lcd\0" \
-	"kernelopts=rw rootwait\0" \
+	"kernelopts=mtdoops.mtddev=3\0" \
 	"commonargs=" \
 		"setenv bootargs console=${console} " \
 		"${mtdparts} " \
+		"${kernelopts} " \
+		"vt.global_cursor_default=0 " \
 		"vram=${vram} " \
-		"omapdss.def_disp=${defaultdisplay}\0" \
+		"omapdss.def_disp=${defaultdisplay}\0"
+
+#define CONFIG_BOOTCOMMAND "run autoboot"
+
+/* specific environment settings for different use cases
+ * FLASHCARD: used to run a rdimage from sdcard to program the device
+ * 'NORMAL': used to boot kernel from sdcard, nand, ...
+ *
+ * The main aim for the FLASHCARD skin is to have an embedded environment
+ * which will not be influenced by any data already on the device.
+ */
+#ifdef CONFIG_FLASHCARD
+
+#define CONFIG_ENV_IS_NOWHERE
+
+/* the rdaddr is 16 MiB before the loadaddr */
+#define CONFIG_ENV_RDADDR	"rdaddr=0x81000000\0"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_COMMON_ENV_SETTINGS \
+	CONFIG_ENV_RDADDR \
+	"autoboot=" \
+	"mtdparts default; " \
+	"run commonargs; " \
+	"setenv bootargs ${bootargs} " \
+		"flashy_updateimg=/dev/mmcblk0p1:corscience_update.img " \
+		"rdinit=/sbin/init; " \
+	"mmc dev ${mmcdev}; mmc rescan; " \
+	"fatload mmc ${mmcdev} ${loadaddr} uImage; " \
+	"fatload mmc ${mmcdev} ${rdaddr} uRamdisk; " \
+	"bootm ${loadaddr} ${rdaddr}\0"
+
+#else /* CONFIG_FLASHCARD */
+
+#define CONFIG_ENV_OVERWRITE /* allow to overwrite serial and ethaddr */
+
+#define CONFIG_ENV_IS_IN_NAND
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_COMMON_ENV_SETTINGS \
 	"mmcargs=" \
 		"run commonargs; " \
 		"setenv bootargs ${bootargs} " \
 		"root=/dev/mmcblk0p2 " \
-		"${kernelopts}\0" \
+		"rootwait " \
+		"rw\0" \
 	"nandargs=" \
 		"run commonargs; " \
 		"setenv bootargs ${bootargs} " \
-		"omapdss.def_disp=${defaultdisplay} " \
 		"root=ubi0:root " \
 		"ubi.mtd=7 " \
 		"rootfstype=ubifs " \
-		"${kernelopts}\0" \
+		"ro\0" \
 	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
 		"source ${loadaddr}\0" \
@@ -199,7 +246,7 @@
 			"fi; " \
 		"else run nandboot; fi\0"
 
-#define CONFIG_BOOTCOMMAND "run autoboot"
+#endif /* CONFIG_FLASHCARD */
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
@@ -240,12 +287,6 @@
 
 #define CONFIG_SYS_MONITOR_LEN		(256 << 10)	/* Reserve 2 sectors */
 
-#define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET		0x120000    /* env start */
-#define CONFIG_ENV_OFFSET_REDUND	0x2A0000    /* redundant env start */
-#define CONFIG_ENV_SIZE			(16 << 10)  /* use 16KiB for env */
-#define CONFIG_ENV_RANGE		(384 << 10) /* allow badblocks in env */
-
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_RAM_ADDR	0x4020f800
 #define CONFIG_SYS_INIT_RAM_SIZE	0x800
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 05/13] tricorder: add cmdline history
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (2 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 04/13] tricorder: add configuration for a flashcard u-boot Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 06/13] tricorder: add mtdparts to environment Andreas Bießmann
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 220dbdc..b2642a4 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -251,6 +251,7 @@
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser */
+#define CONFIG_CMDLINE_EDITING		/* enable cmdline history */
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_PROMPT		"OMAP3 Tricorder # "
 #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 06/13] tricorder: add mtdparts to environment
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (3 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 05/13] tricorder: add cmdline history Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 07/13] tricorder: add tricordereeprom command Andreas Bießmann
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

Before we always ran 'mtdparts default' which also set the mtdparts and mtdids
environment. But if we changed that values by intention we will overwrite
them with our default values. This is obviously bad!

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index b2642a4..abd5bb3 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -160,6 +160,8 @@
 	"vram=3M\0" \
 	"defaultdisplay=lcd\0" \
 	"kernelopts=mtdoops.mtddev=3\0" \
+	"mtdparts=" MTDPARTS_DEFAULT "\0" \
+	"mtdids=" MTDIDS_DEFAULT "\0" \
 	"commonargs=" \
 		"setenv bootargs console=${console} " \
 		"${mtdparts} " \
@@ -188,7 +190,6 @@
 	CONFIG_COMMON_ENV_SETTINGS \
 	CONFIG_ENV_RDADDR \
 	"autoboot=" \
-	"mtdparts default; " \
 	"run commonargs; " \
 	"setenv bootargs ${bootargs} " \
 		"flashy_updateimg=/dev/mmcblk0p1:corscience_update.img " \
@@ -226,16 +227,14 @@
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr}\0" \
-	"loaduimage_ubi=mtd default; " \
-		"ubi part ubi; " \
+	"loaduimage_ubi=ubi part ubi; " \
 		"ubifsmount ubi:root; " \
 		"ubifsload ${loadaddr} /boot/uImage\0" \
 	"nandboot=echo Booting from nand ...; " \
 		"run nandargs; " \
 		"run loaduimage_ubi; " \
 		"bootm ${loadaddr}\0" \
-	"autoboot=mtdparts default;" \
-			"mmc dev ${mmcdev}; if mmc rescan; then " \
+	"autoboot=mmc dev ${mmcdev}; if mmc rescan; then " \
 			"if run loadbootscript; then " \
 				"run bootscript; " \
 			"else " \
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 07/13] tricorder: add tricordereeprom command
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (4 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 06/13] tricorder: add mtdparts to environment Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 08/13] tricorder: panic() on unknown board Andreas Bießmann
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

The new tricordereeprom command can read and write the eeprom for hardware
detection on tricorder devices.

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 board/corscience/tricorder/Makefile           |    2 +-
 board/corscience/tricorder/tricorder-eeprom.c |  251 +++++++++++++++++++++++++
 board/corscience/tricorder/tricorder-eeprom.h |   41 ++++
 include/configs/tricorder.h                   |    7 +
 4 files changed, 300 insertions(+), 1 deletion(-)
 create mode 100644 board/corscience/tricorder/tricorder-eeprom.c
 create mode 100644 board/corscience/tricorder/tricorder-eeprom.h

diff --git a/board/corscience/tricorder/Makefile b/board/corscience/tricorder/Makefile
index 2ab12bb..22ad8c5 100644
--- a/board/corscience/tricorder/Makefile
+++ b/board/corscience/tricorder/Makefile
@@ -12,7 +12,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS	:= tricorder.o
+COBJS	:= tricorder.o tricorder-eeprom.o
 
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/board/corscience/tricorder/tricorder-eeprom.c b/board/corscience/tricorder/tricorder-eeprom.c
new file mode 100644
index 0000000..1c74a0f
--- /dev/null
+++ b/board/corscience/tricorder/tricorder-eeprom.c
@@ -0,0 +1,251 @@
+/*
+ * (C) Copyright 2013
+ * Corscience GmbH & Co. KG, <www.corscience.de>
+ * Andreas Bie?mann <andreas.biessmann@corscience.de>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <i2c.h>
+
+#include "tricorder-eeprom.h"
+
+static inline void warn_wrong_value(const char *msg, unsigned int a,
+		unsigned int b)
+{
+	printf("Expected EEPROM %s %08x, got %08x\n", msg, a, b);
+}
+
+static int handle_eeprom_v0(struct tricorder_eeprom *eeprom)
+{
+	struct tricorder_eeprom_v0 {
+		uint32_t magic;
+		uint16_t length;
+		uint16_t version;
+		char board_name[TRICORDER_BOARD_NAME_LENGTH];
+		char board_version[TRICORDER_BOARD_VERSION_LENGTH];
+		char board_serial[TRICORDER_BOARD_SERIAL_LENGTH];
+		uint32_t crc32;
+	} __packed eepromv0;
+	uint32_t crc;
+
+	printf("Old EEPROM (v0), consider rewrite!\n");
+
+	if (be16_to_cpu(eeprom->length) != sizeof(eepromv0)) {
+		warn_wrong_value("length", sizeof(eepromv0),
+				 be16_to_cpu(eeprom->length));
+		return 1;
+	}
+
+	memcpy(&eepromv0, eeprom, sizeof(eepromv0));
+
+	crc = crc32(0L, (unsigned char *)&eepromv0,
+		    sizeof(eepromv0) - sizeof(eepromv0.crc32));
+	if (be32_to_cpu(eepromv0.crc32) != crc) {
+		warn_wrong_value("CRC", be32_to_cpu(eepromv0.crc32),
+				 crc);
+		return 1;
+	}
+
+	/* Ok the content is correct, do the conversion */
+	memset(eeprom->interface_version, 0x0,
+	       TRICORDER_INTERFACE_VERSION_LENGTH);
+	crc = crc32(0L, (unsigned char *)eeprom, TRICORDER_EEPROM_CRC_SIZE);
+	eeprom->crc32 = cpu_to_be32(crc);
+
+	return 0;
+}
+
+static int handle_eeprom_v1(struct tricorder_eeprom *eeprom)
+{
+	uint32_t crc;
+
+	if (be16_to_cpu(eeprom->length) != TRICORDER_EEPROM_SIZE) {
+		warn_wrong_value("length", TRICORDER_EEPROM_SIZE,
+				 be16_to_cpu(eeprom->length));
+		return 1;
+	}
+
+	crc = crc32(0L, (unsigned char *)eeprom, TRICORDER_EEPROM_CRC_SIZE);
+	if (be32_to_cpu(eeprom->crc32) != crc) {
+		warn_wrong_value("CRC", be32_to_cpu(eeprom->crc32), crc);
+		return 1;
+	}
+
+	return 0;
+}
+
+int tricorder_get_eeprom(int addr, struct tricorder_eeprom *eeprom)
+{
+#ifdef CONFIG_SYS_EEPROM_BUS_NUM
+	unsigned int bus = i2c_get_bus_num();
+	i2c_set_bus_num(CONFIG_SYS_EEPROM_BUS_NUM);
+#endif
+
+	memset(eeprom, 0, TRICORDER_EEPROM_SIZE);
+
+	i2c_read(addr, 0, 2, (unsigned char *)eeprom, TRICORDER_EEPROM_SIZE);
+#ifdef CONFIG_SYS_EEPROM_BUS_NUM
+	i2c_set_bus_num(bus);
+#endif
+
+	if (be32_to_cpu(eeprom->magic) != TRICORDER_EEPROM_MAGIC) {
+		warn_wrong_value("magic", TRICORDER_EEPROM_MAGIC,
+				 be32_to_cpu(eeprom->magic));
+		return 1;
+	}
+
+	switch (be16_to_cpu(eeprom->version)) {
+	case 0:
+		return handle_eeprom_v0(eeprom);
+	case 1:
+		return handle_eeprom_v1(eeprom);
+	default:
+		warn_wrong_value("version", TRICORDER_EEPROM_VERSION,
+				 be16_to_cpu(eeprom->version));
+		return 1;
+	}
+}
+
+#if !defined(CONFIG_SPL)
+int tricorder_eeprom_read(unsigned devaddr)
+{
+	struct tricorder_eeprom eeprom;
+	int ret = tricorder_get_eeprom(devaddr, &eeprom);
+
+	if (ret)
+		return ret;
+
+	printf("Board type:               %.*s\n",
+	       sizeof(eeprom.board_name), eeprom.board_name);
+	printf("Board version:            %.*s\n",
+	       sizeof(eeprom.board_version), eeprom.board_version);
+	printf("Board serial:             %.*s\n",
+	       sizeof(eeprom.board_serial), eeprom.board_serial);
+	printf("Board interface version:  %.*s\n",
+	       sizeof(eeprom.interface_version),
+	       eeprom.interface_version);
+
+	return ret;
+}
+
+int tricorder_eeprom_write(unsigned devaddr, const char *name,
+		const char *version, const char *serial, const char *interface)
+{
+	struct tricorder_eeprom eeprom, eeprom_verify;
+	size_t length;
+	uint32_t crc;
+	int ret;
+	unsigned char *p;
+	int i;
+#ifdef CONFIG_SYS_EEPROM_BUS_NUM
+	unsigned int bus;
+#endif
+
+	memset(eeprom, 0, TRICORDER_EEPROM_SIZE);
+	memset(eeprom_verify, 0, TRICORDER_EEPROM_SIZE);
+
+	eeprom.magic = cpu_to_be32(TRICORDER_EEPROM_MAGIC);
+	eeprom.length = cpu_to_be16(TRICORDER_EEPROM_SIZE);
+	eeprom.version = cpu_to_be16(TRICORDER_EEPROM_VERSION);
+
+	length = min(sizeof(eeprom.board_name), strlen(name));
+	strncpy(eeprom.board_name, name, length);
+
+	length = min(sizeof(eeprom.board_version), strlen(version));
+	strncpy(eeprom.board_version, version, length);
+
+	length = min(sizeof(eeprom.board_serial), strlen(serial));
+	strncpy(eeprom.board_serial, serial, length);
+
+	if (interface) {
+		length = min(sizeof(eeprom.interface_version),
+				strlen(interface));
+		strncpy(eeprom.interface_version, interface, length);
+	}
+
+	crc = crc32(0L, (unsigned char *)&eeprom, TRICORDER_EEPROM_CRC_SIZE);
+	eeprom.crc32 = cpu_to_be32(crc);
+
+#if defined(DEBUG)
+	puts("Tricorder EEPROM content:\n");
+	print_buffer(0, &eeprom, 1, sizeof(eeprom), 16);
+#endif
+
+#ifdef CONFIG_SYS_EEPROM_BUS_NUM
+	bus = i2c_get_bus_num();
+	i2c_set_bus_num(CONFIG_SYS_EEPROM_BUS_NUM);
+#endif
+
+	/* do page write to the eeprom */
+	for (i = 0, p = (unsigned char *)&eeprom;
+	     i < sizeof(eeprom);
+	     i += 32, p += 32) {
+		ret = i2c_write(devaddr, i, CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
+				p, min(sizeof(eeprom) - i, 32));
+		if (ret)
+			break;
+		udelay(5000); /* 5ms write cycle timing */
+	}
+
+	ret = i2c_read(devaddr, 0, 2, (unsigned char *)&eeprom_verify,
+			TRICORDER_EEPROM_SIZE);
+
+	if (memcmp(&eeprom, &eeprom_verify, sizeof(eeprom)) != 0) {
+		printf("Tricorder: Could not verify EEPROM content!\n");
+		ret = 1;
+	}
+
+#ifdef CONFIG_SYS_EEPROM_BUS_NUM
+	i2c_set_bus_num(bus);
+#endif
+	return ret;
+}
+
+int do_tricorder_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	if (argc == 3) {
+		ulong dev_addr = simple_strtoul(argv[2], NULL, 16);
+		eeprom_init();
+		if (strcmp(argv[1], "read") == 0) {
+			int rcode;
+
+			rcode = tricorder_eeprom_read(dev_addr);
+
+			return rcode;
+		}
+	} else if (argc == 6 || argc == 7) {
+		ulong dev_addr = simple_strtoul(argv[2], NULL, 16);
+		char *name = argv[3];
+		char *version = argv[4];
+		char *serial = argv[5];
+		char *interface = NULL;
+		eeprom_init();
+
+		if (argc == 7)
+			interface = argv[6];
+
+		if (strcmp(argv[1], "write") == 0) {
+			int rcode;
+
+			rcode = tricorder_eeprom_write(dev_addr, name, version,
+					serial, interface);
+
+			return rcode;
+		}
+	}
+
+	return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(
+	tricordereeprom,	7,	1,	do_tricorder_eeprom,
+	"Tricorder EEPROM",
+	"read  devaddr\n"
+	"       - read Tricorder EEPROM at devaddr and print content\n"
+	"tricordereeprom write devaddr name version serial [interface]\n"
+	"       - write Tricorder EEPROM@devaddr with 'name', 'version'"
+	"and 'serial'\n"
+	"         optional add an HW interface parameter"
+);
+#endif /* CONFIG_SPL */
diff --git a/board/corscience/tricorder/tricorder-eeprom.h b/board/corscience/tricorder/tricorder-eeprom.h
new file mode 100644
index 0000000..06ed9a5
--- /dev/null
+++ b/board/corscience/tricorder/tricorder-eeprom.h
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2013
+ * Corscience GmbH & Co. KG, <www.corscience.de>
+ * Andreas Bie?mann <andreas.biessmann@corscience.de>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef TRICORDER_EEPROM_H_
+#define TRICORDER_EEPROM_H_
+
+#include <linux/compiler.h>
+
+#define TRICORDER_EEPROM_MAGIC 0xc2a94f52
+#define TRICORDER_EEPROM_VERSION 1
+
+#define TRICORDER_BOARD_NAME_LENGTH		12
+#define TRICORDER_BOARD_VERSION_LENGTH		4
+#define TRICORDER_BOARD_SERIAL_LENGTH		12
+#define TRICORDER_INTERFACE_VERSION_LENGTH	4
+
+struct tricorder_eeprom {
+	uint32_t magic;
+	uint16_t length;
+	uint16_t version;
+	char board_name[TRICORDER_BOARD_NAME_LENGTH];
+	char board_version[TRICORDER_BOARD_VERSION_LENGTH];
+	char board_serial[TRICORDER_BOARD_SERIAL_LENGTH];
+	char interface_version[TRICORDER_INTERFACE_VERSION_LENGTH];
+	uint32_t crc32;
+} __packed;
+
+#define TRICORDER_EEPROM_SIZE		sizeof(struct tricorder_eeprom)
+#define TRICORDER_EEPROM_CRC_SIZE	(TRICORDER_EEPROM_SIZE - \
+					 sizeof(uint32_t))
+
+/**
+ * @brief read eeprom information from a specific eeprom address
+ */
+int tricorder_get_eeprom(int addr, struct tricorder_eeprom *eeprom);
+
+#endif /* TRICORDER_EEPROM_H_ */
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index abd5bb3..9e4e0f0 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -82,6 +82,13 @@
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_DRIVER_OMAP34XX_I2C	1
+#define CONFIG_I2C_MULTI_BUS
+
+/* EEPROM */
+#define CONFIG_SYS_I2C_MULTI_EEPROMS
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	2
+#define CONFIG_SYS_EEPROM_BUS_NUM	1
 
 /* TWL4030 */
 #define CONFIG_TWL4030_POWER
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 08/13] tricorder: panic() on unknown board
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (5 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 07/13] tricorder: add tricordereeprom command Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 09/13] tricorder: add led support Andreas Bießmann
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

Also hang() the board on panic().

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 board/corscience/tricorder/tricorder.c |   77 ++++++++++++++++++++++++++++++++
 include/configs/tricorder.h            |    7 +++
 2 files changed, 84 insertions(+)

diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
index c7099e5..b812916 100644
--- a/board/corscience/tricorder/tricorder.c
+++ b/board/corscience/tricorder/tricorder.c
@@ -13,11 +13,13 @@
 #include <common.h>
 #include <twl4030.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mem.h>
 #include "tricorder.h"
+#include "tricorder-eeprom.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -34,12 +36,87 @@ int board_init(void)
 	return 0;
 }
 
+/**
+ * get_eeprom - read the eeprom
+ *
+ * @eeprom - pointer to a eeprom struct to fill
+ *
+ * This function will panic() on wrong EEPROM content
+ */
+static void get_eeprom(struct tricorder_eeprom *eeprom)
+{
+	int ret;
+
+	if (!eeprom)
+		panic("No eeprom given!\n");
+
+	ret = gpio_request(7, "BMS");
+	if (ret)
+		panic("gpio: requesting BMS pin failed\n");
+
+	ret = gpio_direction_input(7);
+	if (ret)
+		panic("gpio: set BMS as input failed\n");
+
+	ret = gpio_get_value(7);
+	if (ret < 0)
+		panic("gpio: get BMS pin state failed\n");
+
+	gpio_free(7);
+
+	if (ret == 0) {
+		/* BMS is _not_ set, do the EEPROM check */
+		ret = tricorder_get_eeprom(0x51, eeprom);
+		if (!ret) {
+			if (strncmp(eeprom->board_name, "CS10411", 7) != 0)
+				panic("Wrong board name '%.*s'\n",
+				      sizeof(eeprom->board_name),
+						eeprom->board_name);
+			if (eeprom->board_version[0] < 'D')
+				panic("Wrong board version '%.*s'\n",
+				      sizeof(eeprom->board_version),
+						eeprom->board_version);
+		} else {
+			panic("Could not get board revision\n");
+		}
+	}
+}
+
+/**
+ * print_hwversion - print out a HW version string
+ *
+ * @eeprom - pointer to the eeprom
+ */
+static void print_hwversion(struct tricorder_eeprom *eeprom)
+{
+	size_t len;
+	if (!eeprom)
+		panic("No eeprom given!");
+
+	printf("Board %.*s:%.*s serial %.*s",
+	       sizeof(eeprom->board_name), eeprom->board_name,
+	       sizeof(eeprom->board_version), eeprom->board_version,
+	       sizeof(eeprom->board_serial), eeprom->board_serial);
+
+	len = strnlen(eeprom->interface_version,
+		      sizeof(eeprom->interface_version));
+	if (len > 0)
+		printf(" HW interface version %.*s",
+		       sizeof(eeprom->interface_version),
+		       eeprom->interface_version);
+	puts("\n");
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
  */
 int misc_init_r(void)
 {
+	struct tricorder_eeprom eeprom;
+	get_eeprom(&eeprom);
+	print_hwversion(&eeprom);
+
 	twl4030_power_init();
 #ifdef CONFIG_TWL4030_LED
 	twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 9e4e0f0..26b7a8b 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -57,6 +57,9 @@
 
 /* Hardware drivers */
 
+/* GPIO support */
+#define CONFIG_OMAP_GPIO
+
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
@@ -150,6 +153,9 @@
 
 #define CONFIG_BOOTDELAY		3
 
+/* hang() the board on panic() */
+#define CONFIG_PANIC_HANG
+
 /* environment placement (for NAND), is different for FLASHCARD but does not
  * harm there */
 #define CONFIG_ENV_OFFSET		0x120000    /* env start */
@@ -311,6 +317,7 @@
 #define CONFIG_SPL_NAND_SIMPLE
 
 #define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_GPIO_SUPPORT
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_I2C_SUPPORT
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 09/13] tricorder: add led support
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (6 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 08/13] tricorder: panic() on unknown board Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 10/13] tricorder: Make u-boot faster Andreas Bießmann
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 board/corscience/tricorder/Makefile    |    2 +-
 board/corscience/tricorder/led.c       |   80 ++++++++++++++++++++++++++++++++
 board/corscience/tricorder/tricorder.c |    6 +--
 board/corscience/tricorder/tricorder.h |    4 +-
 include/configs/tricorder.h            |   14 ++++++
 5 files changed, 100 insertions(+), 6 deletions(-)
 create mode 100644 board/corscience/tricorder/led.c

diff --git a/board/corscience/tricorder/Makefile b/board/corscience/tricorder/Makefile
index 22ad8c5..8a7f15c 100644
--- a/board/corscience/tricorder/Makefile
+++ b/board/corscience/tricorder/Makefile
@@ -12,7 +12,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS	:= tricorder.o tricorder-eeprom.o
+COBJS	:= tricorder.o tricorder-eeprom.o led.o
 
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/board/corscience/tricorder/led.c b/board/corscience/tricorder/led.c
new file mode 100644
index 0000000..30f2f50
--- /dev/null
+++ b/board/corscience/tricorder/led.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013 Corscience GmbH & Co.KG
+ * Andreas Bie?mann <andreas.biessmann@corscience.de>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <status_led.h>
+#include <twl4030.h>
+#include <asm/arch/cpu.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/gpio.h>
+
+#define TRICORDER_STATUS_LED_YELLOW 42
+#define TRICORDER_STATUS_LED_GREEN  43
+
+void __led_init(led_id_t mask, int state)
+{
+	__led_set(mask, state);
+}
+
+void __led_toggle(led_id_t mask)
+{
+	int toggle_gpio = 0;
+#ifdef STATUS_LED_BIT
+	if (!toggle_gpio && STATUS_LED_BIT & mask)
+		toggle_gpio = TRICORDER_STATUS_LED_GREEN;
+#endif
+#ifdef STATUS_LED_BIT1
+	if (!toggle_gpio && STATUS_LED_BIT1 & mask)
+		toggle_gpio = TRICORDER_STATUS_LED_YELLOW;
+#endif
+#ifdef STATUS_LED_BIT2
+	if (!toggle_gpio && STATUS_LED_BIT2 & mask) {
+		uint8_t val;
+		twl4030_i2c_read_u8(TWL4030_CHIP_LED, TWL4030_LED_LEDEN,
+				    &val);
+		val ^= (TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDAPWM);
+		twl4030_i2c_write_u8(TWL4030_CHIP_LED, TWL4030_LED_LEDEN,
+				     val);
+	}
+#endif
+	if (toggle_gpio) {
+		int state;
+		gpio_request(toggle_gpio, "");
+		state = gpio_get_value(toggle_gpio);
+		gpio_set_value(toggle_gpio, !state);
+	}
+}
+
+void __led_set(led_id_t mask, int state)
+{
+#ifdef STATUS_LED_BIT
+	if (STATUS_LED_BIT & mask) {
+		gpio_request(TRICORDER_STATUS_LED_GREEN, "");
+		gpio_direction_output(TRICORDER_STATUS_LED_GREEN, 0);
+		gpio_set_value(TRICORDER_STATUS_LED_GREEN, state);
+	}
+#endif
+#ifdef STATUS_LED_BIT1
+	if (STATUS_LED_BIT1 & mask) {
+		gpio_request(TRICORDER_STATUS_LED_YELLOW, "");
+		gpio_direction_output(TRICORDER_STATUS_LED_YELLOW, 0);
+		gpio_set_value(TRICORDER_STATUS_LED_YELLOW, state);
+	}
+#endif
+#ifdef STATUS_LED_BIT2
+	if (STATUS_LED_BIT2 & mask) {
+		if (STATUS_LED_OFF == state)
+			twl4030_i2c_write_u8(TWL4030_CHIP_LED,
+					     TWL4030_LED_LEDEN, 0);
+		else
+			twl4030_i2c_write_u8(TWL4030_CHIP_LED,
+					     TWL4030_LED_LEDEN,
+					     (TWL4030_LED_LEDEN_LEDAON |
+					      TWL4030_LED_LEDEN_LEDAPWM));
+	}
+#endif
+}
diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
index b812916..fb5d036 100644
--- a/board/corscience/tricorder/tricorder.c
+++ b/board/corscience/tricorder/tricorder.c
@@ -118,9 +118,9 @@ int misc_init_r(void)
 	print_hwversion(&eeprom);
 
 	twl4030_power_init();
-#ifdef CONFIG_TWL4030_LED
-	twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
-#endif
+	status_led_set(0, STATUS_LED_ON);
+	status_led_set(1, STATUS_LED_ON);
+	status_led_set(2, STATUS_LED_ON);
 
 	dieid_num_r();
 
diff --git a/board/corscience/tricorder/tricorder.h b/board/corscience/tricorder/tricorder.h
index 820a50c..67c35c5 100644
--- a/board/corscience/tricorder/tricorder.h
+++ b/board/corscience/tricorder/tricorder.h
@@ -75,8 +75,8 @@ const omap3_sysinfo sysinfo = {
 	MUX_VAL(CP(GPMC_A6),		(IDIS | PTD | DIS | M0)) /*GPMC_A6*/\
 	MUX_VAL(CP(GPMC_A7),		(IDIS | PTD | DIS | M0)) /*GPMC_A7*/\
 	MUX_VAL(CP(GPMC_A8),		(IDIS | PTD | DIS | M0)) /*GPMC_A8*/\
-	MUX_VAL(CP(GPMC_A9),		(IDIS | PTD | DIS | M0)) /*GPMC_A9*/\
-	MUX_VAL(CP(GPMC_A10),		(IDIS | PTD | DIS | M0)) /*GPMC_A10*/\
+	MUX_VAL(CP(GPMC_A9),		(IDIS | PTU | EN  | M4)) /*GPIO 42*/\
+	MUX_VAL(CP(GPMC_A10),		(IDIS | PTU | EN  | M4)) /*GPIO 43*/\
 	MUX_VAL(CP(GPMC_D0),		(IEN  | PTD | DIS | M0)) /*GPMC_D0*/\
 	MUX_VAL(CP(GPMC_D1),		(IEN  | PTD | DIS | M0)) /*GPMC_D1*/\
 	MUX_VAL(CP(GPMC_D2),		(IEN  | PTD | DIS | M0)) /*GPMC_D2*/\
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 26b7a8b..1cd5faa 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -60,6 +60,20 @@
 /* GPIO support */
 #define CONFIG_OMAP_GPIO
 
+/* LED support */
+#define CONFIG_STATUS_LED
+#define CONFIG_BOARD_SPECIFIC_LED
+#define CONFIG_CMD_LED			/* LED command */
+#define STATUS_LED_BIT			(1 << 0)
+#define STATUS_LED_STATE		STATUS_LED_ON
+#define STATUS_LED_PERIOD		(CONFIG_SYS_HZ / 2)
+#define STATUS_LED_BIT1			(1 << 1)
+#define STATUS_LED_STATE1		STATUS_LED_ON
+#define STATUS_LED_PERIOD1		(CONFIG_SYS_HZ / 2)
+#define STATUS_LED_BIT2			(1 << 2)
+#define STATUS_LED_STATE2		STATUS_LED_ON
+#define STATUS_LED_PERIOD2		(CONFIG_SYS_HZ / 2)
+
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 10/13] tricorder: Make u-boot faster
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (7 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 09/13] tricorder: add led support Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 11/13] tricorder: switch to alternative memtest Andreas Bießmann
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Thomas Weber <thomas.weber@corscience.de>

Silent u-boot and no bootdelay

Signed-off-by: Thomas Weber <thomas.weber@corscience.de>
Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 1cd5faa..e16c2d6 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -39,6 +39,9 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
+#define CONFIG_SILENT_CONSOLE
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
 /* Clock Defines */
 #define V_OSCK				26000000 /* Clock output from T2 */
 #define V_SCLK				(V_OSCK >> 1)
@@ -165,7 +168,7 @@
 
 /* Environment information (this is the common part) */
 
-#define CONFIG_BOOTDELAY		3
+#define CONFIG_BOOTDELAY		0
 
 /* hang() the board on panic() */
 #define CONFIG_PANIC_HANG
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 11/13] tricorder: switch to alternative memtest
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (8 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 10/13] tricorder: Make u-boot faster Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 12/13] tricorder: read kernel directly from NAND Andreas Bießmann
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Thomas Weber <thomas.weber@corscience.de>

Increase the tested memory region for mtest and define
CONFIG_SYS_MEMTEST_SCRATCH for CONFIG_SYS_ALT_MEMTEST

Signed-off-by: Thomas Weber <thomas.weber@corscience.de>
Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index e16c2d6..e2bbebb 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -292,9 +292,9 @@
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE		(CONFIG_SYS_CBSIZE)
 
-#define CONFIG_SYS_MEMTEST_START	(OMAP34XX_SDRC_CS0 + 0x07000000)
+#define CONFIG_SYS_MEMTEST_START	(OMAP34XX_SDRC_CS0 + 0x00000000)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + \
-					0x01000000) /* 16MB */
+					0x07000000) /* 112 MB */
 
 #define CONFIG_SYS_LOAD_ADDR		(OMAP34XX_SDRC_CS0 + 0x02000000)
 
@@ -383,4 +383,6 @@
 #define CONFIG_SYS_SPL_MALLOC_START	0x80208000
 #define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000	/* 1 MB */
 
+#define CONFIG_SYS_ALT_MEMTEST
+#define CONFIG_SYS_MEMTEST_SCRATCH	0x81000000
 #endif /* __CONFIG_H */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 12/13] tricorder: read kernel directly from NAND
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (9 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 11/13] tricorder: switch to alternative memtest Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-09-06 13:04 ` [U-Boot] [PATCH 13/13] tricorder: support 256MiB SDRAM on revision > D Andreas Bießmann
  2013-11-04 14:17 ` [U-Boot] [U-Boot, 01/13] tricorder: remove lcdmode from bootargs Tom Rini
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 include/configs/tricorder.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index e2bbebb..7eff448 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -260,9 +260,10 @@
 	"loaduimage_ubi=ubi part ubi; " \
 		"ubifsmount ubi:root; " \
 		"ubifsload ${loadaddr} /boot/uImage\0" \
+	"loaduimage_nand=nand read ${loadaddr} kernel 0x500000\0" \
 	"nandboot=echo Booting from nand ...; " \
 		"run nandargs; " \
-		"run loaduimage_ubi; " \
+		"run loaduimage_nand; " \
 		"bootm ${loadaddr}\0" \
 	"autoboot=mmc dev ${mmcdev}; if mmc rescan; then " \
 			"if run loadbootscript; then " \
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 13/13] tricorder: support 256MiB SDRAM on revision > D
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (10 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 12/13] tricorder: read kernel directly from NAND Andreas Bießmann
@ 2013-09-06 13:04 ` Andreas Bießmann
  2013-11-04 14:17 ` [U-Boot] [U-Boot, 01/13] tricorder: remove lcdmode from bootargs Tom Rini
  12 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-06 13:04 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.biessmann@corscience.de>

Signed-off-by: Andreas Bie?mann <andreas.biessmann@corscience.de>
---
 board/corscience/tricorder/tricorder.c |   45 +++++++++++++++++++++++++++-----
 include/configs/tricorder.h            |    2 +-
 2 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
index fb5d036..2dfcb27 100644
--- a/board/corscience/tricorder/tricorder.c
+++ b/board/corscience/tricorder/tricorder.c
@@ -154,12 +154,43 @@ int board_mmc_init(bd_t *bis)
  */
 void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
-	/* General SDRC config */
-	timings->mcfg = MICRON_V_MCFG_165(128 << 20);
-	timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+	struct tricorder_eeprom eeprom;
+	get_eeprom(&eeprom);
 
-	/* AC timings */
-	timings->ctrla = MICRON_V_ACTIMA_165;
-	timings->ctrlb = MICRON_V_ACTIMB_165;
-	timings->mr = MICRON_V_MR_165;
+	/* General SDRC config */
+	if (eeprom.board_version[0] > 'D') {
+		/* use optimized timings for our SDRAM device */
+		timings->mcfg = MCFG((256 << 20), 14);
+#define MT46H64M32_TDAL  6	/* Twr/Tck + Trp/tck		*/
+				/* 15/6 + 18/6 = 5.5 -> 6	*/
+#define MT46H64M32_TDPL  3	/* 15/6 = 2.5 -> 3 (Twr)	*/
+#define MT46H64M32_TRRD  2	/* 12/6 = 2			*/
+#define MT46H64M32_TRCD  3	/* 18/6 = 3			*/
+#define MT46H64M32_TRP   3	/* 18/6 = 3			*/
+#define MT46H64M32_TRAS  7	/* 42/6 = 7			*/
+#define MT46H64M32_TRC  10	/* 60/6 = 10			*/
+#define MT46H64M32_TRFC 12	/* 72/6 = 12			*/
+		timings->ctrla = ACTIM_CTRLA(MT46H64M32_TRFC, MT46H64M32_TRC,
+					     MT46H64M32_TRAS, MT46H64M32_TRP,
+					     MT46H64M32_TRCD, MT46H64M32_TRRD,
+					     MT46H64M32_TDPL,
+					     MT46H64M32_TDAL);
+
+#define MT46H64M32_TWTR 1
+#define MT46H64M32_TCKE 1
+#define MT46H64M32_XSR 19	/* 112.5/6 = 18.75 => ~19	*/
+#define MT46H64M32_TXP 1
+		timings->ctrlb = ACTIM_CTRLB(MT46H64M32_TWTR, MT46H64M32_TCKE,
+					     MT46H64M32_TXP, MT46H64M32_XSR);
+
+		timings->mr = MICRON_V_MR_165;
+		timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+	} else {
+		/* use conservative beagleboard timings as default */
+		timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+		timings->ctrla = MICRON_V_ACTIMA_165;
+		timings->ctrlb = MICRON_V_ACTIMB_165;
+		timings->mr = MICRON_V_MR_165;
+		timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+	}
 }
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 7eff448..608af03 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -354,7 +354,7 @@
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */
 
 #define CONFIG_SPL_TEXT_BASE		0x40200000 /*CONFIG_SYS_SRAM_START*/
-#define CONFIG_SPL_MAX_SIZE		(55 * 1024)	/* 7 KB for stack */
+#define CONFIG_SPL_MAX_SIZE		(57 * 1024)	/* 7 KB for stack */
 #define CONFIG_SPL_STACK		LOW_LEVEL_SRAM_STACK
 
 #define CONFIG_SPL_BSS_START_ADDR	0x80000000 /*CONFIG_SYS_SDRAM_BASE*/
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 04/13] tricorder: add configuration for a flashcard u-boot
  2013-09-06 13:04 ` [U-Boot] [PATCH 04/13] tricorder: add configuration for a flashcard u-boot Andreas Bießmann
@ 2013-09-10 22:45   ` Wolfgang Denk
  2013-09-11  7:08     ` Andreas Bießmann
  0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Denk @ 2013-09-10 22:45 UTC (permalink / raw)
  To: u-boot

Dear Andreas Bie?mann,

In message <1378472698-18557-4-git-send-email-andreas.devel@googlemail.com> you wrote:
> 
> The 'flashcard' u-boot configuration has a readonly environment and boots a
> bare kernel/initrd to program the device from an clean environment.

What exactly is a 'flashcard' ?

> +/* environment placement (for NAND), is different for FLASHCARD but does not
> + * harm there */

Incorrect multiline comment style.

>  /* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend
>   * value can not be used here! */

Ditto.  Please fix globally.

> +/* specific environment settings for different use cases
> + * FLASHCARD: used to run a rdimage from sdcard to program the device
> + * 'NORMAL': used to boot kernel from sdcard, nand, ...

And again...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
One difference between a man and a machine is that a machine is quiet
when well oiled.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 04/13] tricorder: add configuration for a flashcard u-boot
  2013-09-10 22:45   ` Wolfgang Denk
@ 2013-09-11  7:08     ` Andreas Bießmann
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Bießmann @ 2013-09-11  7:08 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk,

On 09/11/2013 12:45 AM, Wolfgang Denk wrote:
> Dear Andreas Bie?mann,
> 
> In message <1378472698-18557-4-git-send-email-andreas.devel@googlemail.com> you wrote:
>>
>> The 'flashcard' u-boot configuration has a readonly environment and boots a
>> bare kernel/initrd to program the device from an clean environment.
> 
> What exactly is a 'flashcard' ?

a specific u-boot variant with compiled in environment. So it ignores
environment on devices while upgrading.

>> +/* environment placement (for NAND), is different for FLASHCARD but does not
>> + * harm there */
> 
> Incorrect multiline comment style.
> 
>>  /* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend
>>   * value can not be used here! */
> 
> Ditto.  Please fix globally.

Will do.

Best regards

Andreas Bie?mann

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130911/f2a671ee/attachment.pgp>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [U-Boot, 01/13] tricorder: remove lcdmode from bootargs
  2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
                   ` (11 preceding siblings ...)
  2013-09-06 13:04 ` [U-Boot] [PATCH 13/13] tricorder: support 256MiB SDRAM on revision > D Andreas Bießmann
@ 2013-11-04 14:17 ` Tom Rini
  12 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2013-11-04 14:17 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 06, 2013 at 03:04:46PM +0200, Andreas Bie??mann wrote:

> From: Thomas Weber <thomas.weber@corscience.de>
> 
> Signed-off-by: Thomas Weber <thomas.weber@corscience.de>
> Signed-off-by: Andreas Bie??mann <andreas.biessmann@corscience.de>

Applied to u-boot-ti/master along with the rest of the series, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131104/009c2261/attachment.pgp>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-11-04 14:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 13:04 [U-Boot] [PATCH 01/13] tricorder: remove lcdmode from bootargs Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 02/13] tricorder: update flash partitioning Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 03/13] tricorder: use generic provided loadaddr Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 04/13] tricorder: add configuration for a flashcard u-boot Andreas Bießmann
2013-09-10 22:45   ` Wolfgang Denk
2013-09-11  7:08     ` Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 05/13] tricorder: add cmdline history Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 06/13] tricorder: add mtdparts to environment Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 07/13] tricorder: add tricordereeprom command Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 08/13] tricorder: panic() on unknown board Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 09/13] tricorder: add led support Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 10/13] tricorder: Make u-boot faster Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 11/13] tricorder: switch to alternative memtest Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 12/13] tricorder: read kernel directly from NAND Andreas Bießmann
2013-09-06 13:04 ` [U-Boot] [PATCH 13/13] tricorder: support 256MiB SDRAM on revision > D Andreas Bießmann
2013-11-04 14:17 ` [U-Boot] [U-Boot, 01/13] tricorder: remove lcdmode from bootargs Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.