Skip to contentSkip to conversation

siemens: update and cleanup code

PATCH New Samuel Egli 2 participants 11 messages Apr 24, 2014 – May 14, 2014

lore
Share & tools
lore
#0 lore raw

cover siemens: update and cleanup code

This patch series provides a general update and clean up for siemens boards.

* Update DDR3 settings for dxr2 board. Provide DDR3 software leveling parameters for new engineering samples

* Add more flexible control of LEDs

* Cosmetic changes in dxr2 and pxm2

Samuel Egli (5):
siemens: cosmetic: remove unused and rename defines
siemens: update DDR3 parameters for dxr2
siemens: add led cmd for flexible LED control
siemens: change LED indication in DFU mode
siemens: cosmetic: rename project_dir

 board/siemens/common/board.c           |   46 +++++++++++++++++++++++++++-----
 board/siemens/dxr2/board.c             |   41 +++++++++++++++++++---------
 board/siemens/dxr2/board.h             |   24 +++++++++--------
 board/siemens/pxm2/board.c             |   10 +++----
 include/configs/dxr2.h                 |    4 +--
 include/configs/pxm2.h                 |    2 +-
 include/configs/siemens-am33x-common.h |    8 ++++--
 7 files changed, 96 insertions(+), 39 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/5 siemens: cosmetic: remove unused and rename defines

For dxr2 board DXR2_IOCTRL_VAL is set by data in EEPROM. In pxm2 board it does not make sense to have dxr2 as prefix. Replace it with more meaningful DDR prefix.

Cc Pascal Bach <[email protected]>
Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 board/siemens/pxm2/board.c |   10 +++++-----
 include/configs/dxr2.h     |    1 -
 include/configs/pxm2.h     |    2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)
board/siemens/pxm2/board.c +5 -5
index 98083d5..64e69dc 100644
@@ -70,11 +70,11 @@ struct cmd_control pxm2_ddr3_cmd_ctrl_data = {
 };
 
 const struct ctrl_ioregs ioregs = {
-	.cm0ioctl		= DXR2_IOCTRL_VAL,
-	.cm1ioctl		= DXR2_IOCTRL_VAL,
-	.cm2ioctl		= DXR2_IOCTRL_VAL,
-	.dt0ioctl		= DXR2_IOCTRL_VAL,
-	.dt1ioctl		= DXR2_IOCTRL_VAL,
+	.cm0ioctl		= DDR_IOCTRL_VAL,
+	.cm1ioctl		= DDR_IOCTRL_VAL,
+	.cm2ioctl		= DDR_IOCTRL_VAL,
+	.dt0ioctl		= DDR_IOCTRL_VAL,
+	.dt1ioctl		= DDR_IOCTRL_VAL,
 };
 
 	config_ddr(DDR_PLL_FREQ, &ioregs, &pxm2_ddr3_data,
include/configs/dxr2.h +0 -1
index 75f7812..4612f85 100644
@@ -20,7 +20,6 @@
 #include "siemens-am33x-common.h"
 
 #define CONFIG_SYS_MPUCLK	275
-#define DXR2_IOCTRL_VAL	0x18b
 #define DDR_PLL_FREQ	303
 #undef CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
 
include/configs/pxm2.h +1 -1
index 6276d43..d75d562 100644
@@ -21,7 +21,7 @@
 #include "siemens-am33x-common.h"
 
 #define CONFIG_SYS_MPUCLK	720
-#define DXR2_IOCTRL_VAL		0x18b
+#define DDR_IOCTRL_VAL		0x18b
 #define DDR_PLL_FREQ		266
 
 #define BOARD_DFU_BUTTON_GPIO	59
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/5 siemens: cosmetic: remove unused and rename defines

Quoted 9 lines · Samuel

For dxr2 board DXR2_IOCTRL_VAL is set by data in EEPROM. In pxm2 board it does not make sense to have dxr2 as prefix. Replace it with more meaningful DDR prefix.

Cc Pascal Bach <[email protected]>
Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
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/20140513/8a6af861/attachment.pgp>
#3 lore raw

PATCH 2/5 siemens: update DDR3 parameters for dxr2

In reply to Samuel Egli

* add parameters for factory and print them at start up to facilitate control of right DDR3 settings in EEPROM.

* cosmetic changes in a couple of printfs

Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 board/siemens/dxr2/board.c |   41 +++++++++++++++++++++++++++++------------
 board/siemens/dxr2/board.h |   24 +++++++++++++-----------
 2 files changed, 42 insertions(+), 23 deletions(-)
board/siemens/dxr2/board.c +29 -12
index 38ac93d..e9f157a 100644
@@ -38,12 +38,26 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_SPL_BUILD
 static struct dxr2_baseboard_id __attribute__((section(".data"))) settings;
-/* @303MHz-i0 */
+
+#if DDR_PLL_FREQ == 303
+/* Default at 303MHz-i0 */
+const struct ddr3_data ddr3_default = {
+	0x33524444, 0x56312e35, 0x0080, 0x0000, 0x003A, 0x003F, 0x009F,
+	0x0079, 0x0888A39B, 0x26247FDA, 0x501F821F, 0x00100206, 0x61A44A32,
+	0x0000093B, 0x0000014A,
+	"default name @303MHz           \0",
+	"default marking                \0",
+};
+#elif DDR_PLL_FREQ == 400
+/* Default at 400MHz-i0 */
 const struct ddr3_data ddr3_default = {
-	0x33524444, 0x56312e34, 0x0080, 0x0000, 0x0038, 0x003E, 0x00A4,
-	0x0075, 0x0888A39B, 0x26247FDA, 0x501F821F, 0x00100206, 0x61A44A32,
+	0x33524444, 0x56312e35, 0x0080, 0x0000, 0x0039, 0x0046, 0x00ab,
+	0x0080, 0x0AAAA4DB, 0x26307FDA, 0x501F821F, 0x00100207, 0x61A45232,
 	0x00000618, 0x0000014A,
+	"default name @400MHz           \0",
+	"default marking                \0",
 };
+#endif
 
 static void set_default_ddr3_timings(void)
 {
@@ -53,8 +67,12 @@ static void set_default_ddr3_timings(void)
 
 static void print_ddr3_timings(void)
 {
-	printf("\n\nDDR3 Timing parameters:\n");
-	printf("Diff     Eeprom  Default\n");
+	printf("\nDDR3\n");
+	printf("clock:\t\t%d MHz\n", DDR_PLL_FREQ);
+	printf("device:\t\t%s\n", settings.ddr3.manu_name);
+	printf("marking:\t%s\n", settings.ddr3.manu_marking);
+	printf("timing parameters\n");
+	printf("diff\teeprom\tdefault\n");
 	PRINTARGS(magic);
 	PRINTARGS(version);
 	PRINTARGS(ddr3_sratio);
@@ -78,9 +96,9 @@ static void print_ddr3_timings(void)
 
 static void print_chip_data(void)
 {
-	printf("\n");
-	printf("Device: '%s'\n", settings.chip.sdevname);
-	printf("HW version: '%s'\n", settings.chip.shwver);
+	printf("\nCPU BOARD\n");
+	printf("device: \t'%s'\n", settings.chip.sdevname);
+	printf("hw version: \t'%s'\n", settings.chip.shwver);
 }
 #endif /* CONFIG_SPL_BUILD */
 
@@ -112,19 +130,18 @@ static int read_eeprom(void)
 		printf("Using DDR3 settings from EEPROM\n");
 	} else {
 		if (ddr3_default.magic != settings.ddr3.magic)
-			printf("Error: No valid DDR3 data in eeprom.\n");
+			printf("Warning: No valid DDR3 data in eeprom.\n");
 		if (ddr3_default.version != settings.ddr3.version)
-			printf("Error: DDR3 data version does not match.\n");
+			printf("Warning: DDR3 data version does not match.\n");
 
 		printf("Using default settings\n");
 		set_default_ddr3_timings();
 	}
 
 	if (MAGIC_CHIP == settings.chip.magic) {
-		printf("Valid chip data in eeprom\n");
 		print_chip_data();
 	} else {
-		printf("Error: No chip data in eeprom\n");
+		printf("Warning: No chip data in eeprom\n");
 	}
 
 	print_ddr3_timings();
board/siemens/dxr2/board.h +13 -11
index abf5432..a59ffb0 100644
@@ -22,24 +22,26 @@
 #define MAGIC_CHIP	0x50494843
 
 /* Automatic generated definition */
-/* Wed, 18 Sep 2013 18:58:27 +0200 */
-/* From file: draco/ddr3-data-micron-v2.txt */
+/* Wed, 16 Apr 2014 16:50:41 +0200 */
+/* From file: draco/ddr3-data-universal-default at 303MHz-i0-ES3.txt */
 struct ddr3_data {
 	unsigned int magic;			/* 0x33524444 */
-	unsigned int version;			/* 0x56312e34 */
-	unsigned short int ddr3_sratio;		/* 0x0100 */
-	unsigned short int iclkout;		/* 0x0001 */
+	unsigned int version;			/* 0x56312e35 */
+	unsigned short int ddr3_sratio;		/* 0x0080 */
+	unsigned short int iclkout;		/* 0x0000 */
 	unsigned short int dt0rdsratio0;	/* 0x003A */
-	unsigned short int dt0wdsratio0;	/* 0x008A */
-	unsigned short int dt0fwsratio0;	/* 0x010B */
-	unsigned short int dt0wrsratio0;	/* 0x00C4 */
+	unsigned short int dt0wdsratio0;	/* 0x003F */
+	unsigned short int dt0fwsratio0;	/* 0x009F */
+	unsigned short int dt0wrsratio0;	/* 0x0079 */
 	unsigned int sdram_tim1;		/* 0x0888A39B */
 	unsigned int sdram_tim2;		/* 0x26247FDA */
 	unsigned int sdram_tim3;		/* 0x501F821F */
 	unsigned int emif_ddr_phy_ctlr_1;	/* 0x00100206 */
-	unsigned int sdram_config;		/* 0x61C04AB2 */
-	unsigned int ref_ctrl;			/* 0x00000618 */
-	unsigned int ioctr_val;			/* 0x0000018B */
+	unsigned int sdram_config;		/* 0x61A44A32 */
+	unsigned int ref_ctrl;			/* 0x0000093B */
+	unsigned int ioctr_val;			/* 0x0000014A */
+	char manu_name[32];			/* "default at 303MHz \0" */
+	char manu_marking[32];			/* "default \0" */
 };
 
 struct chip_data {
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 2/5 siemens: update DDR3 parameters for dxr2

Quoted 9 lines · Samuel

* add parameters for factory and print them at start up to facilitate control of right DDR3 settings in EEPROM.

* cosmetic changes in a couple of printfs

Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
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/20140513/40bdae1b/attachment.pgp>
#5 lore raw

PATCH 3/5 siemens: add led cmd for flexible LED control

In reply to Samuel Egli

* remove setting LED in user button function.
We want to decouple reading user button and setting LED. This two things need to be done independently.

* led cmd can be used to control LEDs that are defined in board file having a led cmd, one can easily set LEDs in u-boot shell. For example bootcmd can be extended to disable status LED before loading kernel.

Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 board/siemens/common/board.c |   46 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 40 insertions(+), 6 deletions(-)
board/siemens/common/board.c +40 -6
index 7e8731b..2782bcc 100644
@@ -128,12 +128,6 @@ do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		button = 0;
 
 	gpio_free(gpio);
-	if (!button) {
-		/* LED0 - RED=1: GPIO2_0 2*32 = 64 */
-		gpio_request(BOARD_DFU_BUTTON_LED, "");
-		gpio_direction_output(BOARD_DFU_BUTTON_LED, 1);
-		gpio_set_value(BOARD_DFU_BUTTON_LED, 1);
-	}
 
 	return button;
 }
@@ -144,6 +138,46 @@ U_BOOT_CMD(
 	""
 );
 #endif
+/*
+ * This command sets led
+ * Input -	name of led
+ *		value of led
+ * Returns -	1 if input does not match
+ *		0 if led was set
+ */
+static int
+do_setled(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	int gpio = 0;
+	if (argc != 3)
+		goto exit;
+#if defined(BOARD_STATUS_LED)
+	if (!strcmp(argv[1], "stat"))
+		gpio = BOARD_STATUS_LED;
+#endif
+#if defined(BOARD_DFU_BUTTON_LED)
+	if (!strcmp(argv[1], "dfu"))
+		gpio = BOARD_DFU_BUTTON_LED;
+#endif
+	/* If argument does not mach exit */
+	if (gpio == 0)
+		goto exit;
+	gpio_request(gpio, "");
+	gpio_direction_output(gpio, 1);
+	if (!strcmp(argv[2], "1"))
+		gpio_set_value(gpio, 1);
+	else
+		gpio_set_value(gpio, 0);
+	return 0;
+exit:
+	return 1;
+}
+
+U_BOOT_CMD(
+	led, CONFIG_SYS_MAXARGS, 2, do_setled,
+	"Set led on or off",
+	"dfu val - set dfu led\nled stat val - set status led"
+);
 
 static int
 do_usertestwdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 3/5 siemens: add led cmd for flexible LED control

Quoted 9 lines · Samuel

* remove setting LED in user button function.
We want to decouple reading user button and setting LED. This two things need to be done independently.

* led cmd can be used to control LEDs that are defined in board file having a led cmd, one can easily set LEDs in u-boot shell. For example bootcmd can be extended to disable status LED before loading kernel.

Quoted 4 lines
Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
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/20140513/b92ee482/attachment.pgp>
#7 lore raw

PATCH 4/5 siemens: change LED indication in DFU mode

In reply to Samuel Egli

In order to have the same LED indication like in another product when ready for updating, enable only red led and disable status LED when entering DFU mode.

The status LED is only switched off when defined in board file.

Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 include/configs/dxr2.h                 |    3 ++-
 include/configs/siemens-am33x-common.h |    6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
include/configs/dxr2.h +2 -1
index 4612f85..76e6cac 100644
@@ -24,7 +24,8 @@
 #undef CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
 
 #define BOARD_DFU_BUTTON_GPIO	27
-#define BOARD_DFU_BUTTON_LED	64
+#define BOARD_DFU_BUTTON_LED	64	/* red LED */
+#define BOARD_STATUS_LED	103	/* green LED */
 #define GPIO_LAN9303_NRST	88	/* GPIO2_24 = gpio88 */
 
 #undef CONFIG_DOS_PARTITION
include/configs/siemens-am33x-common.h +5 -1
index 721c4e6..261b348 100644
@@ -402,7 +402,11 @@
 	"dfu_args=run bootargs_defaults;" \
 		"setenv bootargs ${bootargs} ;" \
 		"mtdparts default; " \
-		"dfu 0 nand 0; \0" \
+		"led dfu 1;" \
+		"led stat 0;" \
+		"dfu 0 nand 0;" \
+		"led dfu 0;" \
+		"led stat 1;\0" \
 		"dfu_alt_info=" DFU_ALT_INFO_NAND "\0" \
 	"net_args=run bootargs_defaults;" \
 		"mtdparts default;" \
Signature · 1 line
1.7.10.4
#8 lore raw

PATCH 4/5 siemens: change LED indication in DFU mode

Quoted 10 lines · Samuel

In order to have the same LED indication like in another product when ready for updating, enable only red led and disable status LED when entering DFU mode.

The status LED is only switched off when defined in board file.

Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
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/20140513/06b97611/attachment.pgp>
#9 lore raw

PATCH 5/5 siemens: cosmetic: rename project_dir

In reply to Samuel Egli
Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 include/configs/siemens-am33x-common.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/siemens-am33x-common.h +1 -1
index 261b348..73a123d 100644
@@ -358,7 +358,7 @@
 
 #define CONFIG_COMMON_ENV_SETTINGS \
 	"verify=no \0" \
-	"project_dir=systemone\0" \
+	"project_dir=targetdir\0" \
 	"upgrade_available=0\0" \
 	"altbootcmd=run bootcmd\0" \
 	"bootlimit=3\0" \
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH 5/5 siemens: cosmetic: rename project_dir

Quoted 4 lines · Samuel
Cc Roger Meier <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
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/20140513/4ee74063/attachment.pgp>