SX1 patches: use "serial#" for USB serial #;

use redundand environment storage;
auto-set console on USB port (using preboot command)
This commit is contained in:
wdenk 2004-03-12 15:38:25 +00:00
parent bdda519d3c
commit 6629d2f22b
4 changed files with 39 additions and 8 deletions

View File

@ -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")

View 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;
}

View 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,

View 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
@ -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 */