aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoiz Sonasath <m-sonasath@ti.com>2011-03-16 16:10:50 -0500
committerDan Murphy <dmurphy@ti.com>2011-03-15 12:35:34 -0500
commit98fa4e1b51c9a09bfea1a09be73976d78405cd3e (patch)
treec3494d889df4e4d318731cce2c32bb9a263acaf0
parenta85adf7acff8e2eb2d56103fdeb2c97e49afda94 (diff)
downloadu-boot-pandroid-98fa4e1b51c9a09bfea1a09be73976d78405cd3e.tar.gz
UBOOT: FASTBOOT: Add device serial number for fastboot
This patch computes the device serial number and uses this serial number for the fastboot device. Change-Id: Ic9f26b1e9d7b06b9e4995e10fc7339d8256633c4 Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
-rw-r--r--drivers/fastboot.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/fastboot.c b/drivers/fastboot.c
index 64df5de9..09bea176 100644
--- a/drivers/fastboot.c
+++ b/drivers/fastboot.c
@@ -82,6 +82,13 @@ static volatile u32 *peri_dma_count = (volatile u32 *) OMAP_USB_DMA_COUNT_CH(DMA
#define DEVICE_PRODUCT_ID 0xD022
#define DEVICE_BCD 0x0100;
+/* This is used to get the serial number */
+#if defined(CONFIG_4430SDP) || defined(CONFIG_4430PANDA)
+#define DIE_ID_REG_BASE (OMAP44XX_L4_IO_BASE + 0x2000)
+#define DIE_ID_REG_OFFSET 0x200
+#define MAX_USB_SERIAL_NUM 17
+#endif
+
/* String 0 is the language id */
#define DEVICE_STRING_PRODUCT_INDEX 1
#define DEVICE_STRING_SERIAL_NUMBER_INDEX 2
@@ -1192,8 +1199,26 @@ int fastboot_init(struct cmd_fastboot_interface *interface)
#error "Need a product name for fastboot"
#endif
+
+#if defined(CONFIG_4430SDP) || defined(CONFIG_4430PANDA)
+ unsigned int val[4] = { 0 };
+ unsigned int reg;
+ static char device_serial[MAX_USB_SERIAL_NUM];
+
+ reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET;
+
+ val[0] = __raw_readl(reg);
+ val[1] = __raw_readl(reg + 0x8);
+ val[2] = __raw_readl(reg + 0xC);
+ val[3] = __raw_readl(reg + 0x10);
+ printf("Device Serial Number: %08X%08X\n", val[3], val[2]);
+ sprintf(device_serial, "%08X%08X", val[3], val[2]);
+
+ device_strings[DEVICE_STRING_SERIAL_NUMBER_INDEX] = device_serial;
+#else
/* These are just made up */
device_strings[DEVICE_STRING_SERIAL_NUMBER_INDEX] = "00123";
+#endif
device_strings[DEVICE_STRING_CONFIG_INDEX] = "Android Fastboot";
device_strings[DEVICE_STRING_INTERFACE_INDEX] = "Android Fastboot";