Skip to contentSkip to conversation

arm, am33xx: update for the am33xx based siemens boards

PATCH Superseded Heiko Schocher 3 participants 11 messages Oct 22, 2013 – Oct 24, 2013

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover arm, am33xx: update for the am33xx based siemens boards

Patch 1 introduces bootcount support for the 3 siemens boards. As there is no other possibility on this boards, the bootcounter is stored in the environment. To prevent a "saveenv" on all reboots, a "upgrade_available" U-Boot Environment variable is introduced.

Patch 2 makes the enabling of the RTC32K OSC configurable, as on the dxr2 board it is not used, and
http://www.denx.de/wiki/view/U-Boot/DesignPrinciples#2_Keep_it_Fast
says not enable things not used ...

Patch 3 adds an option to set the iSerialNumber board specific, which is used on the 3 siemens boards.

Patch 4 adds an option to set the bcdDevice number board specific, which is used on the 3 siemens boards.

Patch 5 contains a lot of updates for the siemens boards, see commit message for detailed information.

already posted patches on which this patchserie is based:

[U-Boot,v4] i2c, omap24xx: convert driver to new mutlibus/mutliadapter framework
http://patchwork.ozlabs.org/patch/285390/

[U-Boot] video, cfb_console: make background and foreground color configurable
http://patchwork.ozlabs.org/patch/285385/

[U-Boot] video, formike: change tag/val write
http://patchwork.ozlabs.org/patch/285386/

[U-Boot] net, phy: fix AR8031 phy_mask
http://patchwork.ozlabs.org/patch/276944/

[U-Boot,2/3] net, phy: fix NULL pointer deference
http://patchwork.ozlabs.org/patch/272797/

"./MAKEALL arm" on current u-boot mainline commit
183acb700378a8cfc5d50a01a65de93fb2c24586
compiles without errors

Heiko Schocher (4):
bootcount: store bootcount var in environment arm, am33x: make RTC32K OSC enable configurable usb, g_dnl: make iSerialNumber board configurable usb, g_dnl: make bcdDevice value configurable

Samuel Egli (1):
arm, am335x: update for the siemens boards

 README                                 |  19 ++++
 arch/arm/cpu/armv7/am33xx/board.c      |   4 +
 board/siemens/common/factoryset.c      |  27 +++++-
 board/siemens/common/factoryset.h      |   4 +
 board/siemens/dxr2/board.c             |  11 +--
 board/siemens/dxr2/board.h             |   9 +-
 board/siemens/dxr2/mux.c               | 158 +++++++++++++++++++++++++++++++++
 board/siemens/pxm2/board.c             |   3 +-
 board/siemens/rut/board.c              |  51 +++++++++--
 drivers/bootcount/Makefile             |   1 +
 drivers/bootcount/bootcount_env.c      |  29 ++++++
 drivers/usb/gadget/g_dnl.c             |  51 ++++++++++-
 include/configs/dxr2.h                 |  13 ++-
 include/configs/pxm2.h                 |   7 +-
 include/configs/rut.h                  |  10 ++-
 include/configs/siemens-am33x-common.h |  70 +++++++++++----
 include/configs/ti_am335x_common.h     |   1 +
 include/g_dnl.h                        |   3 +
 18 files changed, 415 insertions(+), 56 deletions(-)
 create mode 100644 drivers/bootcount/bootcount_env.c
Cc Tom Rini <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Samuel Egli <[email protected]>
Cc Pascal Bach <[email protected]>
Cc Roger Meier <[email protected]>
Cc Matthias Michel <[email protected]>
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/5 bootcount: store bootcount var in environment

If no softreset save registers are found on the hardware "bootcount" is stored in the environment. To prevent a saveenv on all reboots, the environment variable "upgrade_available" is introduced. If "upgrade_available" is 0, "bootcount" is always 0 therefore no need to save the environment on u-boot boot, if "upgrade_available" is 1 "bootcount" is incremented in the environment and environment gets written on u-boot start.
So the Userspace Applikation must set the "upgrade_available" and "bootcount" variable to 0 (for example with fw_setenv), if a boot was successfully.

---
 README                            | 16 ++++++++++++++++
 drivers/bootcount/Makefile        |  1 +
 drivers/bootcount/bootcount_env.c | 29 +++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_env.c
README +16 -0
index 232c96a..2558e42 100644
@@ -784,6 +784,22 @@ The following options need to be configured:
 		as a convenience, when switching between booting from
 		RAM and NFS.
 
+- Bootcount:
+		CONFIG_BOOTCOUNT_LIMIT
+		Implements a mechanism for detecting a repeating reboot
+		cycle, see:
+		http://www.denx.de/wiki/view/DULG/UBootBootCountLimit
+
+		CONFIG_BOOTCOUNT_ENV
+		If no softreset save registers are found on the hardware
+		"bootcount" is stored in the environment. To prevent a
+		saveenv on all reboots, the environment variable
+		"upgrade_available" is used. If "upgrade_available" is
+		0, "bootcount" is always 0, if "upgrade_available" is
+		1 "bootcount" is incremented in the environment.
+		So the Userspace Applikation must set the "upgrade_available"
+		and "bootcount" variable to 0, if a boot was successfully.
+
 - Pre-Boot Commands:
 		CONFIG_PREBOOT
 
drivers/bootcount/Makefile +1 -0
index 2b517b6..8ec0423 100644
@@ -11,6 +11,7 @@ COBJS-$(CONFIG_AT91SAM9XE)	+= bootcount_at91.o
 COBJS-$(CONFIG_BLACKFIN)	+= bootcount_blackfin.o
 COBJS-$(CONFIG_SOC_DA8XX)	+= bootcount_davinci.o
 COBJS-$(CONFIG_BOOTCOUNT_RAM)	+= bootcount_ram.o
+COBJS-$(CONFIG_BOOTCOUNT_ENV)	+= bootcount_env.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/bootcount/bootcount_env.c new file +29 -0
new file mode 100644
index 0000000..2d6e8db
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2013
+ * Heiko Schocher, DENX Software Engineering, hs at denx.de.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+void bootcount_store(ulong a)
+{
+	int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
+
+	if (upgrade_available) {
+		setenv_ulong("bootcount", a);
+		saveenv();
+	}
+}
+
+ulong bootcount_load(void)
+{
+	int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
+	ulong val = 0;
+
+	if (upgrade_available)
+		val = getenv_ulong("bootcount", 10, 0);
+
+	return val;
+}
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/5 bootcount: store bootcount var in environment

Hi Heiko,

Quoted 12 lines · Heiko Schocher

If no softreset save registers are found on the hardware "bootcount" is stored in the environment. To prevent a saveenv on all reboots, the environment variable "upgrade_available" is introduced. If "upgrade_available" is 0, "bootcount" is always 0 therefore no need to save the environment on u-boot boot, if "upgrade_available" is 1 "bootcount" is incremented in the environment and environment gets written on u-boot start.
So the Userspace Applikation must set the "upgrade_available" and "bootcount" variable to 0 (for example with fw_setenv), if a boot was successfully.

Quoted 1 line

Just curious... why not save the bootcount in a RTC scratchpad register? IIRC that's persistent across boot cycles if there's battery backup.

#3 lore raw

PATCH 2/5 arm, am33x: make RTC32K OSC enable configurable

In reply to Heiko Schocher

As
http://www.denx.de/wiki/view/U-Boot/DesignPrinciples#2_Keep_it_Fast
states:
"Initialize devices only when they are needed within U-Boot"

enable the RTC32K OSC only, if CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC is enabled. Enable this in ti_am335x_common.h, so all boards in mainline should work as before.

---

On the dxr2 board the RTC32K_OSC it is not used, so disable it for this board, done in the 5th patch of this patchserie "arm-am335x-update-for-the-siemens-boards"

 README                             | 3 +++
 arch/arm/cpu/armv7/am33xx/board.c  | 4 ++++
 include/configs/ti_am335x_common.h | 1 +
 3 files changed, 8 insertions(+)
README +3 -0
index 2558e42..529c2d4 100644
@@ -4300,6 +4300,9 @@ Low Level (hardware related) configuration options:
 
 		NOTE : currently only supported on AM335x platforms.
 
+- CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC:
+		Enables the RTC32K OSC on AM33xx based plattforms
+
 Freescale QE/FMAN Firmware Support:
 -----------------------------------
 
arch/arm/cpu/armv7/am33xx/board.c +4 -0
index a31bf40..7465ec5 100644
@@ -148,6 +148,7 @@ __weak void am33xx_spl_board_init(void)
 	do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
 }
 
+#if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
 static void rtc32k_enable(void)
 {
 	struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE;
@@ -163,6 +164,7 @@ static void rtc32k_enable(void)
 	/* Enable the RTC 32K OSC by setting bits 3 and 6. */
 	writel((1 << 3) | (1 << 6), &rtc->osc);
 }
+#endif
 
 static void uart_soft_reset(void)
 {
@@ -231,8 +233,10 @@ void s_init(void)
 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
 	prcm_init();
 	set_mux_conf_regs();
+#if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
 	/* Enable RTC32K clock */
 	rtc32k_enable();
+#endif
 	sdram_init();
 #endif
 }
include/configs/ti_am335x_common.h +1 -0
index d2e34ae..3441b0a 100644
@@ -18,6 +18,7 @@
 #define CONFIG_SYS_CACHELINE_SIZE       64
 #define CONFIG_MAX_RAM_BANK_SIZE	(1024 << 20)	/* 1GB */
 #define CONFIG_SYS_TIMERBASE		0x48040000	/* Use Timer2 */
+#define CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
 
 #include <asm/arch/omap.h>
 
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 3/5 usb, g_dnl: make iSerialNumber board configurable

In reply to Heiko Schocher

add the possibility to set the iSerialNumber board specific. Therefore the CONFIG_G_DNL_SERIAL_STRING is introduced, which defines the maximum length of the iSerialNumber string. The new function g_dnl_set_serialnumber() must called from g_dnl_bind_fixup(), to setup the iSerialNumber string.

Cc Marek Vasut <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/usb/gadget/g_dnl.c | 28 ++++++++++++++++++++++++++++
 include/g_dnl.h            |  3 +++
 2 files changed, 31 insertions(+)
drivers/usb/gadget/g_dnl.c +28 -0
index 40868c0..5f09d66 100644
@@ -39,8 +39,21 @@
 
 static const char shortname[] = "usb_dnl_";
 static const char product[] = "USB download gadget";
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+#define STRING_SERIAL  3
+static char g_dnl_serial[CONFIG_G_DNL_SERIAL_STRING + 1];
+#endif
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
 
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+void g_dnl_set_serialnumber(char *s)
+{
+	memset(g_dnl_serial, 0, CONFIG_G_DNL_SERIAL_STRING + 1);
+	if (strlen(s) <= CONFIG_G_DNL_SERIAL_STRING)
+		strncpy(g_dnl_serial, s, strlen(s));
+}
+#endif
+
 static struct usb_device_descriptor device_desc = {
 	.bLength = sizeof device_desc,
 	.bDescriptorType = USB_DT_DEVICE,
@@ -52,6 +65,9 @@ static struct usb_device_descriptor device_desc = {
 	.idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
 	.idProduct = __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM),
 	.iProduct = STRING_PRODUCT,
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	.iSerialNumber = STRING_SERIAL,
+#endif
 	.bNumConfigurations = 1,
 };
 
@@ -62,6 +78,9 @@ static struct usb_device_descriptor device_desc = {
 static struct usb_string g_dnl_string_defs[] = {
 	{.s = manufacturer},
 	{.s = product},
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	{.s = g_dnl_serial},
+#endif
 	{ }		/* end of list */
 };
 
@@ -145,6 +164,15 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 	g_dnl_string_defs[1].id = id;
 	device_desc.iProduct = id;
 
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	id = usb_string_id(cdev);
+	if (id < 0)
+		return id;
+
+	g_dnl_string_defs[2].id = id;
+	device_desc.iSerialNumber = id;
+#endif
+
 	g_dnl_bind_fixup(&device_desc);
 	ret = g_dnl_config_register(cdev);
 	if (ret)
include/g_dnl.h +3 -0
index 2b2f11a..a539a34 100644
@@ -13,6 +13,9 @@
 int g_dnl_bind_fixup(struct usb_device_descriptor *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+void g_dnl_set_serialnumber(char *);
+#endif
 
 /* USB initialization declaration - board specific */
 void board_usb_init(void);
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 3/5 usb, g_dnl: make iSerialNumber board configurable

Hi Heiko,

Quoted 20 lines

add the possibility to set the iSerialNumber board specific. Therefore the CONFIG_G_DNL_SERIAL_STRING is introduced, which defines the maximum length of the iSerialNumber string. The new function g_dnl_set_serialnumber() must called from g_dnl_bind_fixup(), to setup the iSerialNumber string.

Cc Marek Vasut <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/usb/gadget/g_dnl.c | 28 ++++++++++++++++++++++++++++
 include/g_dnl.h            |  3 +++
 2 files changed, 31 insertions(+)
drivers/usb/gadget/g_dnl.c +0 -0
index 40868c0..5f09d66 100644

drivers/usb/gadget/g_dnl.c line 42

Quoted 4 lines
drivers/usb/gadget/g_dnl.c +1 -0
@@ -39,8 +39,21 @@
 
 static const char shortname[] = "usb_dnl_";
 static const char product[] = "USB download gadget";
+#if defined(CONFIG_G_DNL_SERIAL_STRING)

I don't like the #if defined preprocessor directives here. The g_dnl.c code is a generic code, to "glue" all functions together.

Quoted 20 lines
drivers/usb/gadget/g_dnl.c +12 -0
+#define STRING_SERIAL  3
+static char g_dnl_serial[CONFIG_G_DNL_SERIAL_STRING + 1];
+#endif
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
 
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+void g_dnl_set_serialnumber(char *s)
+{
+	memset(g_dnl_serial, 0, CONFIG_G_DNL_SERIAL_STRING + 1);
+	if (strlen(s) <= CONFIG_G_DNL_SERIAL_STRING)
+		strncpy(g_dnl_serial, s, strlen(s));
+}
+#endif
+
 static struct usb_device_descriptor device_desc = {
 	.bLength = sizeof device_desc,
 	.bDescriptorType = USB_DT_DEVICE,
@@ -52,6 +65,9 @@ static struct usb_device_descriptor device_desc = {
 	.idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
 	.idProduct =
Quoted 2 lines

__constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM), .iProduct = STRING_PRODUCT, +#if defined(CONFIG_G_DNL_SERIAL_STRING)

I think that #if defined(CONFIG_G_DNL_SERIAL_STRING) can be easily removed, since the iSerialNumber is a valid member of struct usb_descriptor.

In my opinion, instead of defining #ifdefs, we can define some "default" iSerialNumber for all devices.

Then this value can be overridden by board when needed by call to g_dnl_set_serialnumber() function

Quoted 45 lines
drivers/usb/gadget/g_dnl.c +14 -0
+	.iSerialNumber = STRING_SERIAL,
+#endif
 	.bNumConfigurations = 1,
 };
@@ -62,6 +78,9 @@ static struct usb_device_descriptor device_desc = {
 static struct usb_string g_dnl_string_defs[] = {
 	{.s = manufacturer},
 	{.s = product},
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	{.s = g_dnl_serial},
+#endif
 	{ }		/* end of list */
 };
 
@@ -145,6 +164,15 @@ static int g_dnl_bind(struct usb_composite_dev
 *cdev) g_dnl_string_defs[1].id = id;
 	device_desc.iProduct = id;
 
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	id = usb_string_id(cdev);
+	if (id < 0)
+		return id;
+
+	g_dnl_string_defs[2].id = id;
+	device_desc.iSerialNumber = id;
+#endif
+
 	g_dnl_bind_fixup(&device_desc);
 	ret = g_dnl_config_register(cdev);
 	if (ret)
include/g_dnl.h +3 -0
index 2b2f11a..a539a34 100644
@@ -13,6 +13,9 @@
 int g_dnl_bind_fixup(struct usb_device_descriptor *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+void g_dnl_set_serialnumber(char *);
+#endif
 
 /* USB initialization declaration - board specific */
 void board_usb_init(void);
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#6 lore raw

PATCH 3/5 usb, g_dnl: make iSerialNumber board configurable

Hello Lukasz,

Am 22.10.2013 14:37, schrieb Lukasz Majewski:

Quoted 57 lines

Hi Heiko,

Quoted 20 lines

add the possibility to set the iSerialNumber board specific. Therefore the CONFIG_G_DNL_SERIAL_STRING is introduced, which defines the maximum length of the iSerialNumber string. The new function g_dnl_set_serialnumber() must called from g_dnl_bind_fixup(), to setup the iSerialNumber string.

Cc Marek Vasut<[email protected]>
Cc Lukasz Majewski<[email protected]>
Cc Kyungmin Park<[email protected]>
---
  drivers/usb/gadget/g_dnl.c | 28 ++++++++++++++++++++++++++++
  include/g_dnl.h            |  3 +++
  2 files changed, 31 insertions(+)
drivers/usb/gadget/g_dnl.c +0 -0
index 40868c0..5f09d66 100644

drivers/usb/gadget/g_dnl.c line 42

Quoted 4 lines
drivers/usb/gadget/g_dnl.c +1 -0
@@ -39,8 +39,21 @@
 
  static const char shortname[] = "usb_dnl_";
  static const char product[] = "USB download gadget";
+#if defined(CONFIG_G_DNL_SERIAL_STRING)

I don't like the #if defined preprocessor directives here. The g_dnl.c code is a generic code, to "glue" all functions together.

Quoted 20 lines
drivers/usb/gadget/g_dnl.c +12 -0
+#define STRING_SERIAL  3
+static char g_dnl_serial[CONFIG_G_DNL_SERIAL_STRING + 1];
+#endif
  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
 
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+void g_dnl_set_serialnumber(char *s)
+{
+	memset(g_dnl_serial, 0, CONFIG_G_DNL_SERIAL_STRING + 1);
+	if (strlen(s)<= CONFIG_G_DNL_SERIAL_STRING)
+		strncpy(g_dnl_serial, s, strlen(s));
+}
+#endif
+
  static struct usb_device_descriptor device_desc = {
  	.bLength = sizeof device_desc,
  	.bDescriptorType = USB_DT_DEVICE,
@@ -52,6 +65,9 @@ static struct usb_device_descriptor device_desc = {
  	.idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
  	.idProduct =
Quoted 2 lines

__constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM), .iProduct = STRING_PRODUCT, +#if defined(CONFIG_G_DNL_SERIAL_STRING)

I think that #if defined(CONFIG_G_DNL_SERIAL_STRING) can be easily removed, since the iSerialNumber is a valid member of struct usb_descriptor.

Quoted 2 lines

In my opinion, instead of defining #ifdefs, we can define some "default" iSerialNumber for all devices.

Ok! How would look like the default serial number?

Quoted 2 lines

Then this value can be overridden by board when needed by call to g_dnl_set_serialnumber() function

Ok. Will change it in this direction, thanks for the review!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#7 lore raw

PATCH 3/5 usb, g_dnl: make iSerialNumber board configurable

Hi Heiko,

Quoted 60 lines

Hello Lukasz,

Am 22.10.2013 14:37, schrieb Lukasz Majewski:

Quoted 57 lines

Hi Heiko,

Quoted 20 lines

add the possibility to set the iSerialNumber board specific. Therefore the CONFIG_G_DNL_SERIAL_STRING is introduced, which defines the maximum length of the iSerialNumber string. The new function g_dnl_set_serialnumber() must called from g_dnl_bind_fixup(), to setup the iSerialNumber string.

Cc Marek Vasut<[email protected]>
Cc Lukasz Majewski<[email protected]>
Cc Kyungmin Park<[email protected]>
---
  drivers/usb/gadget/g_dnl.c | 28 ++++++++++++++++++++++++++++
  include/g_dnl.h            |  3 +++
  2 files changed, 31 insertions(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/g_dnl.c index 40868c0..5f09d66 100644

drivers/usb/gadget/g_dnl.c line 42

Quoted 4 lines
drivers/usb/gadget/g_dnl.c +1 -0
@@ -39,8 +39,21 @@
 
  static const char shortname[] = "usb_dnl_";
  static const char product[] = "USB download gadget";
+#if defined(CONFIG_G_DNL_SERIAL_STRING)

I don't like the #if defined preprocessor directives here. The g_dnl.c code is a generic code, to "glue" all functions together.

Quoted 20 lines
drivers/usb/gadget/g_dnl.c +12 -0
+#define STRING_SERIAL  3
+static char g_dnl_serial[CONFIG_G_DNL_SERIAL_STRING + 1];
+#endif
  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
 
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+void g_dnl_set_serialnumber(char *s)
+{
+	memset(g_dnl_serial, 0, CONFIG_G_DNL_SERIAL_STRING + 1);
+	if (strlen(s)<= CONFIG_G_DNL_SERIAL_STRING)
+		strncpy(g_dnl_serial, s, strlen(s));
+}
+#endif
+
  static struct usb_device_descriptor device_desc = {
  	.bLength = sizeof device_desc,
  	.bDescriptorType = USB_DT_DEVICE,
@@ -52,6 +65,9 @@ static struct usb_device_descriptor device_desc
 = { .idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
  	.idProduct =
Quoted 2 lines

__constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM), .iProduct = STRING_PRODUCT, +#if defined(CONFIG_G_DNL_SERIAL_STRING)

I think that #if defined(CONFIG_G_DNL_SERIAL_STRING) can be easily removed, since the iSerialNumber is a valid member of struct usb_descriptor.

Quoted 4 lines
Quoted 2 lines

In my opinion, instead of defining #ifdefs, we can define some "default" iSerialNumber for all devices.

Ok! How would look like the default serial number?

Some devices have default serial number set to 0 or 0xFFFFFFFF. Maybe we can start with the 0 value?

Quoted 5 lines
Quoted 3 lines

Then this value can be overridden by board when needed by call to g_dnl_set_serialnumber() function

Ok. Will change it in this direction, thanks for the review!

No problem. You are welcome.

Quoted 3 lines

bye,
Heiko

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#8 lore raw

PATCH 4/5 usb, g_dnl: make bcdDevice value configurable

In reply to Heiko Schocher

add the possibility to set the bcdDevice number board specific. Therefore the weak function g_dnl_get_board_bcd_device_number() is introduced. Used on the siemens boards.

Cc Marek Vasut <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/usb/gadget/g_dnl.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/usb/gadget/g_dnl.c +19 -4
index 5f09d66..942920e 100644
@@ -142,6 +142,23 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev)
 	return 0;
 }
 
+__weak int g_dnl_get_board_bcd_device_number(int gcnum)
+{
+	return gcnum;
+}
+
+static int g_dnl_get_bcd_device_number(struct usb_composite_dev *cdev)
+{
+	struct usb_gadget *gadget = cdev->gadget;
+	int gcnum;
+
+	gcnum = usb_gadget_controller_number(gadget);
+	if (gcnum > 0)
+		gcnum += 0x200;
+
+	return g_dnl_get_board_bcd_device_number(gcnum);
+}
+
 static int g_dnl_bind(struct usb_composite_dev *cdev)
 {
 	struct usb_gadget *gadget = cdev->gadget;
@@ -178,11 +195,9 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 	if (ret)
 		goto error;
 
-	gcnum = usb_gadget_controller_number(gadget);
-
-	debug("gcnum: %d\n", gcnum);
+	gcnum = g_dnl_get_bcd_device_number(cdev);
 	if (gcnum >= 0)
-		device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum);
+		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
 			shortname, gadget->name);
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH 4/5 usb, g_dnl: make bcdDevice value configurable

Hi Heiko,

Quoted 3 lines

add the possibility to set the bcdDevice number board specific. Therefore the weak function g_dnl_get_board_bcd_device_number() is introduced. Used on the siemens boards.

Quoted 51 lines
Cc Marek Vasut <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/usb/gadget/g_dnl.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/usb/gadget/g_dnl.c +18 -4
index 5f09d66..942920e 100644
@@ -142,6 +142,23 @@ int g_dnl_bind_fixup(struct
 usb_device_descriptor *dev) return 0;
 }
 
+__weak int g_dnl_get_board_bcd_device_number(int gcnum)
+{
+	return gcnum;
+}
+
+static int g_dnl_get_bcd_device_number(struct usb_composite_dev
 *cdev) +{
+	struct usb_gadget *gadget = cdev->gadget;
+	int gcnum;
+
+	gcnum = usb_gadget_controller_number(gadget);
+	if (gcnum > 0)
+		gcnum += 0x200;
+
+	return g_dnl_get_board_bcd_device_number(gcnum);
+}
+
 static int g_dnl_bind(struct usb_composite_dev *cdev)
 {
 	struct usb_gadget *gadget = cdev->gadget;
@@ -178,11 +195,9 @@ static int g_dnl_bind(struct usb_composite_dev
 *cdev) if (ret)
 		goto error;
 
-	gcnum = usb_gadget_controller_number(gadget);
-
-	debug("gcnum: %d\n", gcnum);
+	gcnum = g_dnl_get_bcd_device_number(cdev);
 	if (gcnum >= 0)
-		device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum);
+		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
 			shortname, gadget->name);
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#10 lore raw

PATCH 5/5 arm, am335x: update for the siemens boards

In reply to Heiko Schocher

From: Samuel Egli <[email protected]>

- dxr2: define unused pins as input
- do not enable RTC32K OSC on dxr2 board
- update default environment
- add splashpos=m,m to default environment, so splash screen is always centered.
- adapt environment for bootcount feature
- add altbootcmd to default environment
- rut: SPL add early reset pulse for eth-phy, maXTouch and display
- rut: display timing aenderungen
- siemens boards: adapt for background color = white
- add boutcount feature for the siemens boards
store the bootcount in the environment, as we have no softreset save registers on this hardware. Use therefore the CONFIG_BOOTCOUNT_ENV bootcount driver.
- change spi mode from 3 to 0 for the lcd init
- add gpio pin for lcd reset with state 0 and add mdelay
- siemens boards: use own USB id's
- add dfu serial and device number for siemens boards
Add for the siemens boards the possibility to define in dfu mode, the iSerialNumber and the bcdDevice fields in the USB Device descriptor.
- fix upgrade mechanism based on bootcount
Correct location of saveenv and remove not active variable.

Add CONFIG_BOOT_RETRY_TIME and CONFIG_RESET_TO_RETRY to reboot board in case of empty kernel partition. Without these defines an empty kernel partition leads to an abort of boot process and one remains in u-boot prompt.

- general cleanup of dxr2, pxm2 and rut boards all:
* Remove net boot from bootcmd
Ping can cause a crash on boards without ethernet phy. net_nfs command is used only for development

* Add reset at the end of bootcmd
In order to have an immediate reset of the boot when bootcmd fails, add reset at the end of bootcmd.

rut:
* add nand_img_size

dxr2:
* update nand_img_size

* ddr3 timings updated with iocontrol property that can be modified via eeprom. New default parameters from software leveling with draco ES2.

---
 board/siemens/common/factoryset.c      |  27 +++++-
 board/siemens/common/factoryset.h      |   4 +
 board/siemens/dxr2/board.c             |  11 +--
 board/siemens/dxr2/board.h             |   9 +-
 board/siemens/dxr2/mux.c               | 158 +++++++++++++++++++++++++++++++++
 board/siemens/pxm2/board.c             |   3 +-
 board/siemens/rut/board.c              |  51 +++++++++--
 include/configs/dxr2.h                 |  13 ++-
 include/configs/pxm2.h                 |   7 +-
 include/configs/rut.h                  |  10 ++-
 include/configs/siemens-am33x-common.h |  70 +++++++++++----
 11 files changed, 311 insertions(+), 52 deletions(-)
board/siemens/common/factoryset.c +25 -2
index eda9141..cbc31e6 100644
@@ -15,7 +15,8 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/unaligned.h>
 #include <net.h>
-#include <usbdescriptors.h>
+#include <errno.h>
+#include <g_dnl.h>
 #include "factoryset.h"
 
 #define EEPR_PG_SZ		0x80
@@ -224,8 +225,22 @@ int factoryset_read_eeprom(int i2c_addr)
 					MAX_STRING_LENGTH)) {
 		debug("display name: %s\n", factory_dat.disp_name);
 	}
-
 #endif
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV",
+					(uchar *)"num", factory_dat.serial,
+					MAX_STRING_LENGTH)) {
+		debug("serial number: %s\n", factory_dat.serial);
+	}
+#endif
+	if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV",
+					(uchar *)"ver", buf,
+					MAX_STRING_LENGTH)) {
+		factory_dat.version = simple_strtoul((char *)buf,
+							    NULL, 16);
+		debug("version number: %d\n", factory_dat.version);
+	}
+
 	return 0;
 
 err:
@@ -279,6 +294,14 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev)
 {
 	put_unaligned(factory_dat.usb_vendor_id, &dev->idVendor);
 	put_unaligned(factory_dat.usb_product_id, &dev->idProduct);
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	g_dnl_set_serialnumber((char *)factory_dat.serial);
+#endif
 	return 0;
 }
+
+int g_dnl_get_board_bcd_device_number(int gcnum)
+{
+	return factory_dat.version;
+}
 #endif /* defined(CONFIG_SPL_BUILD) */
board/siemens/common/factoryset.h +4 -0
index 445f384..bd53417 100644
@@ -18,6 +18,10 @@ struct factorysetcontainer {
 #if defined(CONFIG_VIDEO)
 	unsigned char disp_name[MAX_STRING_LENGTH];
 #endif
+#if defined(CONFIG_G_DNL_SERIAL_STRING)
+	unsigned char serial[MAX_STRING_LENGTH];
+#endif
+	int version;
 };
 
 int factoryset_read_eeprom(int i2c_addr);
board/siemens/dxr2/board.c +6 -5
index af9d84f..1773ab7 100644
@@ -38,11 +38,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_SPL_BUILD
 static struct dxr2_baseboard_id __attribute__((section(".data"))) settings;
-
+/* @303MHz-i0 */
 const struct ddr3_data ddr3_default = {
-	0x33524444, 0x56312e33, 0x0100, 0x0001, 0x003A, 0x008A, 0x010B,
-	0x00C4, 0x0888A39B, 0x26247FDA, 0x501F821F, 0x0006, 0x61C04AB2,
-	0x00000618,
+	0x33524444, 0x56312e34, 0x0080, 0x0000, 0x0038, 0x003E, 0x00A4,
+	0x0075, 0x0888A39B, 0x26247FDA, 0x501F821F, 0x00100206, 0x61A44A32,
+	0x00000618, 0x0000014A,
 };
 
 static void set_default_ddr3_timings(void)
@@ -73,6 +73,7 @@ static void print_ddr3_timings(void)
 
 	PRINTARGS(sdram_config);
 	PRINTARGS(ref_ctrl);
+	PRINTARGS(ioctr_val);
 }
 
 static void print_chip_data(void)
@@ -168,7 +169,7 @@ struct cmd_control dxr2_ddr3_cmd_ctrl_data = {
 	dxr2_ddr3_cmd_ctrl_data.cmd2csratio = settings.ddr3.ddr3_sratio;
 	dxr2_ddr3_cmd_ctrl_data.cmd2iclkout = settings.ddr3.iclkout;
 
-	config_ddr(DDR_PLL_FREQ, DXR2_IOCTRL_VAL, &dxr2_ddr3_data,
+	config_ddr(DDR_PLL_FREQ, settings.ddr3.ioctr_val, &dxr2_ddr3_data,
 		   &dxr2_ddr3_cmd_ctrl_data, &dxr2_ddr3_emif_reg_data, 0);
 }
 
board/siemens/dxr2/board.h +5 -4
index 2be78fb..abf5432 100644
@@ -22,11 +22,11 @@
 #define MAGIC_CHIP	0x50494843
 
 /* Automatic generated definition */
-/* Wed, 19 Jun 2013 10:57:48 +0200 */
-/* From file: draco/ddr3-data-micron.txt */
+/* Wed, 18 Sep 2013 18:58:27 +0200 */
+/* From file: draco/ddr3-data-micron-v2.txt */
 struct ddr3_data {
 	unsigned int magic;			/* 0x33524444 */
-	unsigned int version;			/* 0x56312e33 */
+	unsigned int version;			/* 0x56312e34 */
 	unsigned short int ddr3_sratio;		/* 0x0100 */
 	unsigned short int iclkout;		/* 0x0001 */
 	unsigned short int dt0rdsratio0;	/* 0x003A */
@@ -36,9 +36,10 @@ struct ddr3_data {
 	unsigned int sdram_tim1;		/* 0x0888A39B */
 	unsigned int sdram_tim2;		/* 0x26247FDA */
 	unsigned int sdram_tim3;		/* 0x501F821F */
-	unsigned short int emif_ddr_phy_ctlr_1;	/* 0x0006 */
+	unsigned int emif_ddr_phy_ctlr_1;	/* 0x00100206 */
 	unsigned int sdram_config;		/* 0x61C04AB2 */
 	unsigned int ref_ctrl;			/* 0x00000618 */
+	unsigned int ioctr_val;			/* 0x0000018B */
 };
 
 struct chip_data {
board/siemens/dxr2/mux.c +158 -0

164 lines not on this page · raw message

board/siemens/pxm2/board.c +1 -2
index 2c1841f..094b4d6 100644
@@ -413,8 +413,7 @@ static int conf_disp_pll(int m, int n)
 
 static int board_video_init(void)
 {
-	/* set 300 MHz */
-	conf_disp_pll(25, 2);
+	conf_disp_pll(24, 1);
 	if (factory_dat.pxm50)
 		da8xx_video_init(&lcd_panels[0], &lcd_cfg, lcd_cfg.bpp);
 	else
board/siemens/rut/board.c +45 -6

86 lines not on this page · raw message

include/configs/dxr2.h +6 -7
index cd553ec..1e42f5c 100644
@@ -21,8 +21,8 @@
 
 #define CONFIG_SYS_MPUCLK	275
 #define DXR2_IOCTRL_VAL	0x18b
-#define DDR_PLL_FREQ	266
-#define CONFIG_SPL_AM33XX_DO_NOT_ENABLE_RTC32K
+#define DDR_PLL_FREQ	303
+#undef CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
 
 #define BOARD_DFU_BUTTON_GPIO	27
 #define BOARD_DFU_BUTTON_LED	64
@@ -62,7 +62,7 @@
 /* Default env settings */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"hostname=dxr2\0" \
-	"nand_img_size=0x300000\0" \
+	"nand_img_size=0x400000\0" \
 	"optargs=\0" \
 	CONFIG_COMMON_ENV_SETTINGS
 
@@ -75,10 +75,9 @@
 	"run dfu_start; " \
 	"reset; " \
 "fi;" \
-"if ping ${serverip}; then " \
-	"run net_nfs; " \
-"fi;" \
-"run nand_boot;"
+"run nand_boot;" \
+"reset;"
+
 
 #else
 #define CONFIG_BOOTDELAY		0
include/configs/pxm2.h +4 -3
index 20b0f9a..7722f7b 100644
@@ -70,6 +70,7 @@
 	"hostname=pxm2\0" \
 	"nand_img_size=0x500000\0" \
 	"optargs=\0" \
+	"splashpos=m,m\0"	\
 	CONFIG_COMMON_ENV_SETTINGS \
 	"mmc_dev=0\0" \
 	"mmc_root=/dev/mmcblk0p2 rw\0" \
@@ -118,9 +119,7 @@
 		"fi;" \
 	"fi;" \
 	"run nand_boot;" \
-	"if ping ${serverip}; then " \
-		"run net_nfs; " \
-	"fi; "
+	"reset;"
 
 #else
 #define CONFIG_BOOTDELAY		0
@@ -148,6 +147,8 @@
 #define DA8XX_LCD_CNTL_BASE	LCD_CNTL_BASE
 #define PWM_TICKS	0x1388
 #define PWM_DUTY	0x200
+#define CONFIG_SYS_CONSOLE_BG_COL	0xff
+#define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
 #endif	/* ! __CONFIG_PXM2_H */
include/configs/rut.h +6 -4
index 7c94644..d4519f9 100644
@@ -65,7 +65,8 @@
 /* Default env settings */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"hostname=rut\0" \
-	"splashpos=488,352\0" \
+	"nand_img_size=0x500000\0" \
+	"splashpos=m,m\0" \
 	"optargs=fixrtc --no-log consoleblank=0 \0" \
 	CONFIG_COMMON_ENV_SETTINGS \
 	"mmc_dev=0\0" \
@@ -111,9 +112,7 @@
 		"fi;" \
 	"fi;" \
 	"run nand_boot;" \
-	"if ping ${serverip}; then " \
-		"run net_nfs; " \
-	"fi; "
+	"reset;"
 
 #else
 #define CONFIG_BOOTDELAY		0
@@ -151,6 +150,9 @@
 #define BOARD_LCD_RESET		115	/* Bank 3 pin 19 */
 #define CONFIG_ARCH_EARLY_INIT_R
 #define CONFIG_FORMIKE
+#define DISPL_PLL_SPREAD_SPECTRUM
+#define CONFIG_SYS_CONSOLE_BG_COL	0xff
+#define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
 #endif	/* ! __CONFIG_RUT_H */
include/configs/siemens-am33x-common.h +51 -19

127 lines not on this page · raw message

Signature · 1 line
1.8.3.1