summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rw-r--r--board/sx1/flash.c8
-rw-r--r--drivers/usbtty.c28
-rw-r--r--include/configs/SX1.h8
4 files changed, 39 insertions, 8 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9bebdeb9442..c8abefe6d1c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@
Changes for U-Boot 1.0.2:
======================================================================
+* SX1 patches: use "serial#" for USB serial #; use redundand environment
+ storage; auto-set console on USB port (using preboot command)
+
* Add support for SX1 mobile phone; add support for USB-based console
(enable with "setenv stdout usbtty; setenv stdin usbtty")
diff --git a/board/sx1/flash.c b/board/sx1/flash.c
index a4bed61474d..1373406668a 100644
--- a/board/sx1/flash.c
+++ b/board/sx1/flash.c
@@ -26,6 +26,7 @@
#include <common.h>
#include <linux/byteorder/swab.h>
+#include <environment.h>
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
@@ -94,6 +95,13 @@ unsigned long flash_init (void)
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
&flash_info[0]);
+#ifdef CFG_ENV_ADDR_REDUND
+ flash_protect ( FLAG_PROTECT_SET,
+ CFG_ENV_ADDR_REDUND,
+ CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
+ &flash_info[0]);
+#endif
+
return size;
}
diff --git a/drivers/usbtty.c b/drivers/usbtty.c
index 2f89e2b7411..7e553b382c7 100644
--- a/drivers/usbtty.c
+++ b/drivers/usbtty.c
@@ -70,12 +70,17 @@ int usbtty_configured_flag = 0;
/*
+ * Serial number
+ */
+static char serial_number[16];
+
+/*
* Descriptors
*/
static u8 wstrLang[4] = {4,USB_DT_STRING,0x9,0x4};
static u8 wstrManufacturer[2 + 2*(sizeof(CONFIG_USBD_MANUFACTURER)-1)];
static u8 wstrProduct[2 + 2*(sizeof(CONFIG_USBD_PRODUCT_NAME)-1)];
-static u8 wstrSerial[2 + 2*(sizeof(CONFIG_USBD_SERIAL_NUMBER)-1)];
+static u8 wstrSerial[2 + 2*(sizeof(serial_number) - 1)];
static u8 wstrConfiguration[2 + 2*(sizeof(CONFIG_USBD_CONFIGURATION_STR)-1)];
static u8 wstrInterface[2 + 2*(sizeof(CONFIG_USBD_INTERFACE_STR)-1)];
@@ -307,7 +312,20 @@ void usbtty_puts (const char *str)
int drv_usbtty_init (void)
{
int rc;
-
+ char * sn;
+ int snlen;
+
+ if (!(sn = getenv("serial#"))) {
+ sn = "000000000000";
+ }
+ snlen = strlen(sn);
+ if (snlen > sizeof(serial_number) - 1) {
+ printf ("Warning: serial number %s is too long (%d > %d)\n",
+ sn, snlen, sizeof(serial_number) - 1);
+ snlen = sizeof(serial_number) - 1;
+ }
+ memcpy (serial_number, sn, snlen);
+ serial_number[snlen] = '\0';
/* prepare buffers... */
buf_init (&usbtty_input, USBTTY_BUFFER_SIZE);
@@ -355,9 +373,9 @@ static void usbtty_init_strings (void)
str2wide (CONFIG_USBD_PRODUCT_NAME, string->wData);
string = (struct usb_string_descriptor *) wstrSerial;
- string->bLength = sizeof (wstrSerial);
+ string->bLength = 2 + 2*strlen(serial_number);
string->bDescriptorType = USB_DT_STRING;
- str2wide (CONFIG_USBD_SERIAL_NUMBER, string->wData);
+ str2wide (serial_number, string->wData);
string = (struct usb_string_descriptor *) wstrConfiguration;
string->bLength = sizeof (wstrConfiguration);
@@ -392,7 +410,7 @@ static void usbtty_init_instances (void)
bus_instance->endpoint_array = endpoint_instance;
bus_instance->max_endpoints = 1;
bus_instance->maxpacketsize = 64;
- bus_instance->serial_number_str = CONFIG_USBD_SERIAL_NUMBER;
+ bus_instance->serial_number_str = serial_number;
/* configuration instance */
memset (config_instance, 0,
diff --git a/include/configs/SX1.h b/include/configs/SX1.h
index ca536c5d3f6..ae4cf60083c 100644
--- a/include/configs/SX1.h
+++ b/include/configs/SX1.h
@@ -83,8 +83,6 @@
#define CONFIG_USBD_PRODUCTID 0x5678
#define CONFIG_USBD_MANUFACTURER "Siemens"
#define CONFIG_USBD_PRODUCT_NAME "SX1"
-#define CONFIG_USBD_SERIAL_NUMBER "000000000001"
-
/*
* I2C configuration
@@ -109,8 +107,8 @@
#include <cmd_confdefs.h>
#include <configs/omap1510.h>
-#define CONFIG_BOOTDELAY 3
#define CONFIG_BOOTARGS "mem=16M console=ttyS0,115200n8 root=/dev/mtdblock3 rw"
+#define CONFIG_PREBOOT "setenv stdout usbtty;setenv stdin usbtty"
/*
* Miscellaneous configurable options
@@ -174,4 +172,8 @@
#define CFG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */
#define CFG_ENV_OFFSET 0x20000 /* environment starts here */
+/* Address and size of Redundant Environment Sector */
+#define CFG_ENV_SIZE_REDUND 0x20000
+#define CFG_ENV_OFFSET_REDUND 0x40000
+
#endif /* __CONFIG_H */