summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ungar <david.ungar@timesys.com>2010-10-11 14:25:22 -0400
committerDavid Ungar <david.ungar@timesys.com>2010-10-11 14:39:34 -0400
commite1e13454669f4bc3756f80a216bf418ed0692215 (patch)
treee983f86131217e90cf55a7e8705699f2b80af3c7
parenta718de3f42a6280fefd8b60b3e4733e015b0f637 (diff)
NOR flash fix
-rw-r--r--board/omap3/logic/logic-data.c54
-rw-r--r--board/omap3/logic/logic.c18
-rw-r--r--board/omap3/logic/product_id.h2
3 files changed, 54 insertions, 20 deletions
diff --git a/board/omap3/logic/logic-data.c b/board/omap3/logic/logic-data.c
index b6720ce1fc..3d8f98b1ab 100644
--- a/board/omap3/logic/logic-data.c
+++ b/board/omap3/logic/logic-data.c
@@ -651,10 +651,24 @@ static void extract_model_number_revision(struct product_id_data *p, char *buf,
}
}
-int fetch_production_data(void)
+/* Return positive non-zero if productID indicates there's
+ * NOR flash on the device - return is size of flash as log2 in bytes */
+int productID_has_NOR_flash(void)
{
- DECLARE_GLOBAL_DATA_PTR;
+ if (!production_data_valid)
+ return -1;
+ /* Flash exists if its size is non-zero, but 0xff is known to be
+ * a non-programmed value */
+ if (product_id_data.d.zone2.nor0_size == 0x00
+ || product_id_data.d.zone2.nor0_size == 0xff)
+ return 0;
+
+ return product_id_data.d.zone2.nor0_size;
+}
+
+int fetch_production_data(void)
+{
int err = 0;
char buf[36];
int header_version;
@@ -714,6 +728,28 @@ int fetch_production_data(void)
product_id_data.d.zone2.features = le32_to_cpu(product_id_data.d.zone2.features);
product_id_data.d.zone2.platform_bits = le32_to_cpu(product_id_data.d.zone2.platform_bits);
+ out:
+ production_data_valid = !err;
+
+ // Restore pins back to their intended use
+ gpio_i2c_restore_pins();
+
+ // Clone the production data into SRAM
+ checksum = calculate_checksum(&product_id_data.d, sizeof(product_id_data.d));
+ product_id_data.checksum = checksum;
+ *(struct product_id_data *)(SRAM_BASE) = product_id_data;
+
+ return err;
+}
+
+void dump_production_data(void)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ char buf[36];
+
+ if (!production_data_valid)
+ return;
+
// Print out the name, model number, and set MAC addresses
extract_product_id_part_number(&product_id_data, buf, sizeof(buf));
@@ -733,18 +769,4 @@ int fetch_production_data(void)
product_id_data.d.zone2.mac[1][0],
product_id_data.d.zone2.mac[1][1],
product_id_data.d.zone2.mac[1][2]);
-
- out:
- production_data_valid = !err;
-
- // Restore pins back to their intended use
- gpio_i2c_restore_pins();
-
- // Clone the production data into SRAM
- checksum = calculate_checksum(&product_id_data.d, sizeof(product_id_data.d));
- product_id_data.checksum = checksum;
- *(struct product_id_data *)(SRAM_BASE) = product_id_data;
-
- return err;
}
-
diff --git a/board/omap3/logic/logic.c b/board/omap3/logic/logic.c
index 77d5e21bbb..601f1f9c9f 100644
--- a/board/omap3/logic/logic.c
+++ b/board/omap3/logic/logic.c
@@ -171,6 +171,12 @@ int misc_init_r(void)
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif
+ /* Turn on vaux1 to make sure voltage is to the product ID chip.
+ * Extract production data from ID chip, used to selectively
+ * initialize portions of the system */
+ init_vaux1_voltage();
+ fetch_production_data();
+
#if defined(CONFIG_CMD_NET)
setup_net_chip();
#endif
@@ -178,7 +184,6 @@ int misc_init_r(void)
/* Setup access to the isp1760 chip on CS6 */
setup_isp1760_chip();
- /* Fix the flash sync */
twl4030_power_init();
twl4030_led_init();
@@ -195,6 +200,7 @@ int misc_init_r(void)
gd->bd->bi_arch_number = logic_identify();
+ /* Fix the flash sync */
fix_flash_sync();
dieid_num_r();
@@ -243,9 +249,7 @@ int board_late_init(void)
// DECLARE_GLOBAL_DATA_PTR;
- // Turn on vaux1 to make sure voltage is to the product ID chip
- init_vaux1_voltage();
- fetch_production_data(); // Extract production data
+ dump_production_data(); // Dump production data
// Fetch the ethaddr of the LAN
board_get_nth_enetaddr(enetaddr, 0, 0);
@@ -387,6 +391,12 @@ static void fix_flash_sync(void)
if (arch_number == MACH_TYPE_OMAP3_TORPEDO)
return;
+ /* If no NOR in product, then return */
+ if (productID_has_NOR_flash() <= 0) {
+ printf("NOR: None installed\n");
+ return;
+ }
+
/* Check CS2 config, if its already in sync, then return */
if (!(readl(&gpmc_cfg->cs[2].config1) & TYPE_READTYPE)) {
puts("NOR: initialize in sync mode\n");
diff --git a/board/omap3/logic/product_id.h b/board/omap3/logic/product_id.h
index 77ee9d7d0e..2937e5bbe6 100644
--- a/board/omap3/logic/product_id.h
+++ b/board/omap3/logic/product_id.h
@@ -87,4 +87,6 @@ static inline int calculate_checksum(void *p, int len)
}
extern int fetch_production_data(void);
+extern void dump_production_data(void);
extern void board_get_nth_enetaddr (unsigned char *enetaddr, int which, int position);
+extern int productID_has_NOR_flash(void);