From 48eddab640b4afb9d266b29ce5bb9472b0650620 Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Fri, 19 Jul 2013 13:34:06 -0400 Subject: LogicPD Support for OMAP3/DM3/AM3 boards 2.4 Update Release 2 --- board/ti/logic/logic-data.c | 19 +++++++++---------- board/ti/logic/logic-display.c | 4 ++++ board/ti/logic/logic-product-id.c | 18 +++++++++++++++++- board/ti/logic/logic.c | 3 ++- board/ti/logic/prod-id/query.c | 10 ++++++++++ board/ti/logic/prod-id/startup.c | 7 ++++--- common/cmd_fastboot.c | 35 +++++++++++++++++++++++++++++++---- drivers/mtd/nand/nand_util.c | 35 +++++++++++++++++++++++++++++------ fs/fat/fat.c | 18 ++++++++++++++++++ include/configs/omap3logic.h | 4 ++-- 10 files changed, 126 insertions(+), 27 deletions(-) diff --git a/board/ti/logic/logic-data.c b/board/ti/logic/logic-data.c index dfcfb61cba..9149de6fd6 100644 --- a/board/ti/logic/logic-data.c +++ b/board/ti/logic/logic-data.c @@ -499,41 +499,37 @@ int _fetch_production_data(void) gpio_i2c_set_pin_level(GPIO_I2C_SCLK, 1); } - printf("Read production data: "); - if (identify_device()) { - printf("failed to identify device!\n"); + printf("failed to identify ID device!\n"); err = -1; goto out; } if (read_user_zone(0, 0, (unsigned char *)&product_id_data.d.u_zone0, sizeof(product_id_data.d.u_zone0))) { - printf("failed!\n"); + printf("failed to read ID device!\n"); err = -1; goto out; } /* If the header doesn't match, we can't map any of the data */ if (extract_header_version(&product_id_data, &header_version)) { - printf("failed - invalid header version %d!\n", header_version); + printf("ID device read failed - invalid header version %d!\n", header_version); err = -2; goto out; } if (read_user_zone(0, 32, (unsigned char *)&product_id_data.d.zone1, sizeof(product_id_data.d.zone1))) { - printf("failed reading zone1 data!\n"); + printf("failed reading ID device zone1 data!\n"); err = -3; goto out; } if (read_user_zone(0, 64, (unsigned char *)&product_id_data.d.zone2, sizeof(product_id_data.d.zone2))) { - printf("failed reading zone2 data!\n"); + printf("failed reading ID device zone2 data!\n"); err = -4; goto out; } - printf("done\n"); - production_data_valid = 1; /* Correct endianess issues */ product_id_data.d.zone2.pz_2r0.processor_type = le16_to_cpu(product_id_data.d.zone2.pz_2r0.processor_type); @@ -547,7 +543,7 @@ int _fetch_production_data(void) reading it if we know it can't fit in the productID chip */ if (2 + sizeof(product_id_data.d.wifi_config_data.data) / devptr->zonesize < devptr->zones) { if (read_user_zone(2, 0, (unsigned char *)&product_id_data.d.wifi_config_data.data, sizeof(product_id_data.d.wifi_config_data.data))) { - printf("failed reading wifi_config data!\n"); + printf("failed reading wifi_config data from ID device!\n"); } else product_id_data.d.wifi_config_data.valid = 1; } @@ -583,6 +579,8 @@ void _dump_production_data(void) if (!production_data_valid) return; + printf("\nID data ROM : Gen 1\n"); + /* Print out the name, model number, and set MAC addresses */ extract_product_id_part_number(&product_id_data, buf, sizeof(buf)); printf("Part Number : %s\n", buf); @@ -609,6 +607,7 @@ void _dump_production_data(void) printf("LAN[%d] = %02x:%02x:%02x:%02x:%02x:%02x\n", i, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } + printf("\n"); } #ifdef CONFIG_OMAP3_LOGIC_USE_NEW_PRODUCT_ID diff --git a/board/ti/logic/logic-display.c b/board/ti/logic/logic-display.c index 8f684aae69..875b7e8087 100644 --- a/board/ti/logic/logic-display.c +++ b/board/ti/logic/logic-display.c @@ -30,6 +30,8 @@ #include "splash-332x57.h" #include "logic-proto.h" +#ifdef CONFIG_LCD + DECLARE_GLOBAL_DATA_PTR; /* LCD-required members */ @@ -932,3 +934,5 @@ U_BOOT_CMD(dump_video, 1, 1, do_info_video, " - Displays information on video parameters", "" ); + +#endif // #ifdef CONFIG_LCD \ No newline at end of file diff --git a/board/ti/logic/logic-product-id.c b/board/ti/logic/logic-product-id.c index dba8c197ee..8c84a8741d 100644 --- a/board/ti/logic/logic-product-id.c +++ b/board/ti/logic/logic-product-id.c @@ -188,7 +188,7 @@ int logic_dump_serialization_info(void) { int ret; struct id_cookie cookie; - int part_number, speed, model_number; + int part_number, speed, model_number, version_code; u8 model_name[33]; u8 model_type[11]; u8 model_grade[11]; @@ -248,6 +248,19 @@ int logic_dump_serialization_info(void) return ret; } + /* Find version code */ + ret = id_find_number(&cookie, ID_KEY_version_code, &version_code); +//printf("%s[%u] cookie.mem_ptr: 0x%08x, cookie.offset: %u, val: %02x %02x %02x %02x\n", __FILE__, __LINE__, cookie.mem_ptr, cookie.offset, +// *(unsigned char*)((unsigned int)cookie.mem_ptr + cookie.offset + 0), +// *(unsigned char*)((unsigned int)cookie.mem_ptr + cookie.offset + 1), +// *(unsigned char*)((unsigned int)cookie.mem_ptr + cookie.offset + 2), +// *(unsigned char*)((unsigned int)cookie.mem_ptr + cookie.offset + 3) +// ); + if (ret != ID_EOK) { + printf("%s:%d ret %d\n", __FUNCTION__, __LINE__, ret); + return ret; + } + /* Find model name */ model_name_size = sizeof(model_name) - 1; ret = id_find_string(&cookie, ID_KEY_model_name, model_name, &model_name_size); @@ -321,6 +334,7 @@ int logic_dump_serialization_info(void) hardware_platform[model_hardware_platform_size] = '\0'; serial_number[serial_number_size] = '\0'; + printf("\nID data ROM : Gen 2\n"); printf("Model : %.*s%u ", model_type_size, model_type, model_number); if (!strncmp(hardware_platform, "t", 2)) printf("Torpedo"); @@ -329,6 +343,7 @@ int logic_dump_serialization_info(void) else if (!strncmp(hardware_platform, "m2", 2)) printf("SOM-M2"); printf("\n"); + printf("Version Code : -%u\n", version_code); printf("Temp Grade : "); if (!strncmp(model_grade, "i", 1)) printf("Industrial"); @@ -341,6 +356,7 @@ int logic_dump_serialization_info(void) printf("Part Number : %u\n", part_number); printf("Model Name : %.*s\n", model_name_size, model_name); printf("Serial Number: %.*s\n", serial_number_size, serial_number); + printf("\n"); return 0; } diff --git a/board/ti/logic/logic.c b/board/ti/logic/logic.c index d3bff273aa..84a04de04c 100644 --- a/board/ti/logic/logic.c +++ b/board/ti/logic/logic.c @@ -257,8 +257,9 @@ void touchup_env(int initial_env) setenv("defaultecc", "soft"); /* touchup the display environment variable(s) */ +#ifdef CONFIG_LCD touchup_display_env(); - +#endif if (initial_env) { /* Need to set mdtids/mtdparts to computed defaults */ setenv("mtdparts", get_mtdparts_default()); diff --git a/board/ti/logic/prod-id/query.c b/board/ti/logic/prod-id/query.c index 69a2e2b3ca..031d7b9832 100644 --- a/board/ti/logic/prod-id/query.c +++ b/board/ti/logic/prod-id/query.c @@ -2,6 +2,9 @@ #include "internals.h" #include "id-errno.h" +// This is only for debugging purposes. Set to zero to deactivate. +#define SPOOF_VERSION_CODE 0 + static int id_extract_key(struct id_cookie *cookie, id_keys_t *key) { int err; @@ -156,6 +159,13 @@ int id_find_number(struct id_cookie *cookie, id_keys_t key, int *num) if (err != ID_EOK) return err; /* Extract the number size */ +#if SPOOF_VERSION_CODE + if ((cookie->offset == 509) && (key == ID_KEY_version_code)) + { + *num = SPOOF_VERSION_CODE; + return ID_EOK; + } +#endif l_num = extract_unsigned_pnum(&d_cookie, 5, &err); if (err != ID_EOK) return err; diff --git a/board/ti/logic/prod-id/startup.c b/board/ti/logic/prod-id/startup.c index d87836ccd1..56b30e8ea9 100644 --- a/board/ti/logic/prod-id/startup.c +++ b/board/ti/logic/prod-id/startup.c @@ -201,7 +201,7 @@ int id_startup(struct id_data *data, int (*setup_id_chip)(void), int (*shutdown_ ret = _id_startup(data, 1); data->mem_ptr = mem_ptr; if (!ret) { - id_printf("Found new Product ID data at %p\n", mem_ptr); + printf("Product ID data cached to: %p\n", mem_ptr); return ret; } } @@ -212,9 +212,10 @@ int id_startup(struct id_data *data, int (*setup_id_chip)(void), int (*shutdown_ id_error("%s: setup_id_chip failed!", __FUNCTION__); return ret; } - ret = _id_startup(data, 0); if (!ret) - id_printf("Cache new Product ID data from AT24 to %p\n", mem_ptr); + printf("Product ID data cached to: %p\n", mem_ptr); + + ret = _id_startup(data, 0); ret2 = (*shutdown_id_chip)(); if (ret2) id_error("%s: shutdown_id_chip failed!", __FUNCTION__); diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index 97d1c23217..bdb7658451 100644 --- a/common/cmd_fastboot.c +++ b/common/cmd_fastboot.c @@ -66,8 +66,9 @@ #define WARN #define INFO //#define DEBUG - +#ifdef CONFIG_LCD void output_lcd_string(char *p); +#endif #ifdef DEBUG #define FBTDBG(fmt,args...)\ @@ -348,7 +349,9 @@ static void fbt_event_handler (struct usb_device_instance *device, switch (event) { case DEVICE_RESET: case DEVICE_BUS_INACTIVE: +#ifdef CONFIG_LCD output_lcd_string("/pAA/kFastboot is waiting for connection from PC/pBA/k/pCA/k"); +#endif priv.configured = 0; @@ -364,8 +367,10 @@ static void fbt_event_handler (struct usb_device_instance *device, break; case DEVICE_ADDRESS_ASSIGNED: +#ifdef CONFIG_LCD output_lcd_string("/pAA/kFastboot is connected to PC"); - +#endif + fbt_init_endpoints (); default: @@ -565,9 +570,11 @@ int do_lcd_percent (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]); void set_lcd_percent_string(char *string) { +#ifdef CONFIG_LCD char *lcd_percent[] = { "lcd_percent", string}; do_lcd_percent (NULL, 0, ARRAY_SIZE(lcd_percent), lcd_percent); +#endif } static void set_serial_number(void) @@ -772,7 +779,9 @@ static int fbt_handle_boot(char *cmdbuf) sprintf(priv.response, "OKAY"); priv.flag |= FASTBOOT_FLAG_RESPONSE; fbt_handle_response(); +#ifdef CONFIG_LCD output_lcd_string("/pCA/k/pBA/kFastboot is booting uploaded image"); +#endif udelay (1000000); /* 1 sec */ udc_disconnect(); @@ -813,11 +822,12 @@ static int fbt_rx_process(unsigned char *buffer, int length) char *cmdbuf = (char *) buffer; FBTDBG("command\n"); +#ifdef CONFIG_LCD output_lcd_string("/pCA/k/pBA/kFastboot is processing command "); output_lcd_string(cmdbuf); set_lcd_percent_string(""); - +#endif if(memcmp(cmdbuf, "getvar:", 7) == 0) { FBTDBG("getvar\n"); fbt_handle_getvar(cmdbuf); @@ -849,7 +859,9 @@ static int fbt_rx_process(unsigned char *buffer, int length) if(memcmp(cmdbuf, "boot", 4) == 0) { FBTDBG("boot\n"); +#ifdef CONFIG_LCD output_lcd_string("/pAA/kFastboot is continuing boot (timeout)/pBA/k/pCA/k"); +#endif fbt_handle_boot(cmdbuf); } @@ -874,8 +886,10 @@ static int fbt_rx_process(unsigned char *buffer, int length) sprintf(priv.response, "DATA%08x", priv.d_size); } +#ifdef CONFIG_LCD set_lcd_percent_string("/pCA/kDownload /P% done"); lcd_percent_init(priv.d_size); +#endif } if((memcmp(cmdbuf, "upload:", 7) == 0) || @@ -897,8 +911,9 @@ static int fbt_rx_process(unsigned char *buffer, int length) buffer, xfr_size); priv.d_bytes += xfr_size; +#ifdef CONFIG_LCD lcd_percent_update(priv.d_bytes); - +#endif #ifdef INFO /* Inform via prompt that download is happening */ if (! (priv.d_bytes % (16 * 0x1000))) @@ -974,11 +989,15 @@ static int fbt_handle_response(void) if (priv.flag & FASTBOOT_FLAG_RESPONSE) { if(!strncmp(priv.response, "FAIL", 4)) { +#ifdef CONFIG_LCD output_lcd_string("/pCA/kCommand failed"); +#endif } else if(!strncmp(priv.response, "OKAY", 4)) { +#ifdef CONFIG_LCD output_lcd_string("/pCA/k/pBA/kFastboot is idle"); +#endif } fbt_response_process(); priv.flag &= ~FASTBOOT_FLAG_RESPONSE; @@ -1029,7 +1048,9 @@ static int fbt_handle_tx(void) */ priv.u_bytes += bytes_written; +#ifdef CONFIG_LCD lcd_percent_update(priv.u_bytes); +#endif #ifdef INFO /* Inform via prompt that upload is happening */ if (! (priv.d_bytes % (16 * 0x1000))) @@ -1074,7 +1095,9 @@ int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) udc_connect(); FBTINFO("fastboot initialized\n"); +#ifdef CONFIG_LCD output_lcd_string("/pAA/kFastboot is waiting for connection from PC"); +#endif if(argc > 1) { @@ -1092,14 +1115,18 @@ int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } priv.exit |= ctrlc(); if (priv.exit) { +#ifdef CONFIG_LCD output_lcd_string("/pAA/kFastboot is continuing boot/pBA/k/pCA/k"); +#endif set_lcd_percent_string(""); FBTINFO("fastboot end\n"); break; } if(timeout && fbt_getidle() > timeout) { +#ifdef CONFIG_LCD output_lcd_string("/pAA/kFastboot is continuing boot (timeout)/pBA/k/pCA/k"); +#endif FBTINFO("Timed out\n"); break; } diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c index c9f1283fa0..1b8e819046 100644 --- a/drivers/mtd/nand/nand_util.c +++ b/drivers/mtd/nand/nand_util.c @@ -120,8 +120,9 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts) priv_nand->bbt = NULL; } +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_init(erase_length); - +#endif for (erased_length = 0; erased_length < erase_length; erase.addr += meminfo->erasesize) { @@ -140,8 +141,10 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts) if (!opts->spread) erased_length++; - lcd_percent_update(erased_length); +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_update(erased_length); +#endif continue; } else if (ret < 0) { @@ -202,9 +205,15 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts) erase.addr); } } +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_update(erased_length); +#endif } +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_update(erased_length); +#endif if (!opts->quiet) printf("\n"); @@ -523,8 +532,10 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length, } total_to_write = left_to_write; - lcd_percent_init(total_to_write); +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_init(total_to_write); +#endif while (left_to_write > 0) { size_t block_offset = offset & (nand->erasesize - 1); size_t write_size; @@ -586,11 +597,16 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length, } left_to_write -= write_size; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_update(total_to_write - left_to_write); +#endif } - lcd_percent_update(total_to_write); +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_update(total_to_write); +#endif return 0; } @@ -641,8 +657,10 @@ int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length, } total_to_read = left_to_read; - lcd_percent_init(total_to_read); +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_init(total_to_read); +#endif while (left_to_read > 0) { size_t block_offset = offset & (nand->erasesize - 1); size_t read_length; @@ -673,10 +691,15 @@ int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length, offset += read_length; p_buffer += read_length; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_update(total_to_read - left_to_read); +#endif } - lcd_percent_update(total_to_read); +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) + lcd_percent_update(total_to_read); +#endif return 0; } diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 5b312993c3..c50b1b5ff8 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -300,7 +300,9 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer, buffer += FS_BLOCK_SIZE; startsect++; size -= FS_BLOCK_SIZE; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(buffer - start_buffer); +#endif } if (size % FS_BLOCK_SIZE) { __u8 tmpbuf[FS_BLOCK_SIZE]; @@ -313,7 +315,9 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer, memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE); buffer += size % FS_BLOCK_SIZE; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(buffer - start_buffer); +#endif return 0; } } else { @@ -321,7 +325,9 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer, debug("Error reading data\n"); return -1; } +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(buffer + (size & ~FS_BLOCK_SIZE) - start_buffer); +#endif if (size % FS_BLOCK_SIZE) { __u8 tmpbuf[FS_BLOCK_SIZE]; @@ -333,7 +339,9 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer, buffer += idx * FS_BLOCK_SIZE; memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE); +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(buffer + size - start_buffer); +#endif return 0; } } @@ -356,7 +364,9 @@ get_contents (fsdata *mydata, dir_entry *dentptr, __u8 *buffer, unsigned long actsize; __u8 *start_buffer = buffer; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_init(filesize); +#endif debug("Filesize: %ld bytes\n", filesize); if (maxsize > 0 && filesize > maxsize) @@ -378,7 +388,9 @@ get_contents (fsdata *mydata, dir_entry *dentptr, __u8 *buffer, debug("Invalid FAT entry\n"); return gotsize; } +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(actsize); +#endif endclust = newclust; actsize += bytesperclust; } @@ -397,13 +409,17 @@ get_contents (fsdata *mydata, dir_entry *dentptr, __u8 *buffer, filesize -= actsize; buffer += actsize; actsize = filesize; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(gotsize); +#endif if (get_cluster(mydata, endclust, buffer, (int)actsize, start_buffer) != 0) { printf("Error reading cluster\n"); return -1; } gotsize += actsize; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(gotsize); +#endif return gotsize; getit: if (get_cluster(mydata, curclust, buffer, (int)actsize, start_buffer) != 0) { @@ -413,7 +429,9 @@ getit: gotsize += (int)actsize; filesize -= actsize; buffer += actsize; +#if (defined CONFIG_LCD && defined CONFIG_LCD_PERCENT) lcd_percent_update(gotsize); +#endif curclust = get_fatent(mydata, endclust); if (CHECK_CLUST(curclust, mydata->fatsize)) { diff --git a/include/configs/omap3logic.h b/include/configs/omap3logic.h index cae4399da6..7df501f472 100644 --- a/include/configs/omap3logic.h +++ b/include/configs/omap3logic.h @@ -233,10 +233,10 @@ #define CONFIG_CMD_CACHE /* Cache control */ #define CONFIG_CMD_TIME /* time command */ -#if 0 +#if 1 /* L2 was disabled since observed that large displays (720p) weren't working * Verify can boot kernel using either XGA or 720p HDMI displays settings */ -#define CONFIG_L2_OFF 1 /* Keep L2 Cache Disabled */ +#define CONFIG_L2_OFF /* Keep L2 Cache Disabled */ #endif #define BOARD_LATE_INIT -- cgit v1.2.3