]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
SX1 patches: use "serial#" for USB serial #;
authorwdenk <wdenk>
Fri, 12 Mar 2004 15:38:25 +0000 (15:38 +0000)
committerwdenk <wdenk>
Fri, 12 Mar 2004 15:38:25 +0000 (15:38 +0000)
use redundand environment storage;
auto-set console on USB port (using preboot command)

CHANGELOG
board/sx1/flash.c
drivers/usbtty.c
include/configs/SX1.h

index 9bebdeb944201f8eca661e39a3f22f592c17426b..c8abefe6d1cd6bf0e06aefde0c794cbdad472489 100644 (file)
--- 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")
 
index a4bed61474db463566dc7346c90f638577f8d078..1373406668af13dfc2850fcd061e7b5c0f900117 100644 (file)
@@ -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;
 }
 
index 2f89e2b7411c307cf27a5876ed6fb49b786e3d86..7e553b382c741c28618812b232778727eceb6db8 100644 (file)
@@ -69,13 +69,18 @@ static struct usb_endpoint_instance  endpoint_instance[NUM_ENDPOINTS+1]; /* one
 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,
index ca536c5d3f6dea29b2617fdc99e4cf3ecbda2e3a..ae4cf60083c34f656631161b2e6dd090dc5d1122 100644 (file)
@@ -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
 #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
 #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 */