summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ungar <david.ungar@timesys.com>2010-10-11 14:26:53 -0400
committerDavid Ungar <david.ungar@timesys.com>2010-10-11 14:39:35 -0400
commit6b847d6684b388f4b1e41e77cdbcdff257ce8fad (patch)
treeb03c879d219b8d4025dcd502ce8bc9bb2f35adc6
parent9b83d00ca602bcfd69497a323bcc84fec4597e56 (diff)
MAC address fix
-rw-r--r--board/omap3/logic/logic-data.c37
-rw-r--r--board/omap3/logic/logic.c61
2 files changed, 56 insertions, 42 deletions
diff --git a/board/omap3/logic/logic-data.c b/board/omap3/logic/logic-data.c
index 3d8f98b1ab..2b42e48531 100644
--- a/board/omap3/logic/logic-data.c
+++ b/board/omap3/logic/logic-data.c
@@ -515,6 +515,15 @@ int production_data_valid;
struct product_id_data product_id_data;
+int valid_mac_address(unsigned char mac[3])
+{
+ if (mac[0] == 0xff && mac[1] == 0xff && mac[2] == 0xff)
+ return 0;
+ if (mac[0] == 0x00 && mac[1] == 0x00 && mac[2] == 0x00)
+ return 0;
+ return !0;
+}
+
/*
* Extract/set an ethernet address.
* Which is the address in the environment, position is which MAC address
@@ -538,15 +547,18 @@ void board_get_nth_enetaddr (unsigned char *enetaddr, int which, int position)
memset(enetaddr, '\0', 6);
if (!production_data_valid ||
- (mac[0] == 0xff && mac[1] == 0xff && mac[2] == 0xff)
- || (mac[0] == 0x00 && mac[1] == 0x00 && mac[2] == 0x00)) {
+ !valid_mac_address(mac)) {
s = getenv("ethaddr");
#ifdef CONFIG_ETHADDR
if (!s)
s = MK_STR(CONFIG_ETHADDR);
#endif
- printf("%s which %d %s\n", __FUNCTION__, which, s);
+
+ /* If no ethaddr found in productID or environment, then punt*/
+ if (!s)
+ return;
+
for (i = 0; i < 6; ++i) {
enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
if (s)
@@ -670,7 +682,6 @@ int productID_has_NOR_flash(void)
int fetch_production_data(void)
{
int err = 0;
- char buf[36];
int header_version;
int checksum;
int i;
@@ -759,14 +770,16 @@ void dump_production_data(void)
printf("Model Name : %s\n", buf);
extract_serial_number(&product_id_data, buf, sizeof(buf));
printf("Serial Number: %s\n", buf);
- printf("Wired Lan MAC: 00:08:ee:%02x:%02x:%02x\n",
- product_id_data.d.zone2.mac[0][0],
- product_id_data.d.zone2.mac[0][1],
- product_id_data.d.zone2.mac[0][2]);
+ if (valid_mac_address(product_id_data.d.zone2.mac[1]))
+ printf("Wired Lan MAC: 00:08:ee:%02x:%02x:%02x\n",
+ product_id_data.d.zone2.mac[0][0],
+ product_id_data.d.zone2.mac[0][1],
+ product_id_data.d.zone2.mac[0][2]);
if (gd->bd->bi_arch_number == MACH_TYPE_OMAP3530_LV_SOM)
- printf("Wirless MAC: 00:08:ee:%02x:%02x:%02x\n",
- product_id_data.d.zone2.mac[1][0],
- product_id_data.d.zone2.mac[1][1],
- product_id_data.d.zone2.mac[1][2]);
+ if (valid_mac_address(product_id_data.d.zone2.mac[1]))
+ printf("Wirless MAC: 00:08:ee:%02x:%02x:%02x\n",
+ product_id_data.d.zone2.mac[1][0],
+ product_id_data.d.zone2.mac[1][1],
+ product_id_data.d.zone2.mac[1][2]);
}
diff --git a/board/omap3/logic/logic.c b/board/omap3/logic/logic.c
index 601f1f9c9f..4756daee13 100644
--- a/board/omap3/logic/logic.c
+++ b/board/omap3/logic/logic.c
@@ -156,6 +156,37 @@ static void setup_net_chip(void);
static void setup_isp1760_chip(void);
static void fix_flash_sync(void);
+/* Turn on VAUX1 voltage to 3.0 volts to drive level shifters and
+ * power 3.0v parts (tsc2004 and Product ID chip) */
+#define I2C_TRITON2 0x4b /* Address of Triton power group */
+
+void init_vaux1_voltage(void)
+{
+#ifdef CONFIG_DRIVER_OMAP34XX_I2C
+ unsigned char data;
+ unsigned short msg;
+
+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+ // Select the output voltage
+ data = 0x04;
+ i2c_write(I2C_TRITON2, 0x72, 1, &data, 1);
+ // Select the Processor resource group
+ data = 0x20;
+ i2c_write(I2C_TRITON2, 0x72, 1, &data, 1);
+ // Enable I2C access to the Power bus
+ data = 0x02;
+ i2c_write(I2C_TRITON2, 0x4a, 1, &data, 1);
+ // Send message MSB
+ msg = (1<<13) | (1<<4) | (0xd<<0); // group(process_grp1):resource(vaux1):res_active;
+ data = msg >> 8;
+ i2c_write(I2C_TRITON2, 0x4b, 1, &data, 1);
+ // Send message LSB
+ data = msg & 0xff;
+ i2c_write(I2C_TRITON2, 0x4c, 1, &data, 1);
+#endif
+}
+
/*
* Routine: misc_init_r
* Description: Configure board specific parts
@@ -208,36 +239,6 @@ int misc_init_r(void)
return 0;
}
-// Turn on VAUX1 voltage to 3.0 volts to drive level shifters and
-// power 3.0v parts (tsc2004 and Product ID chip)
-#define I2C_TRITON2 0x4b /* Address of Triton power group */
-
-void init_vaux1_voltage(void)
-{
-#ifdef CONFIG_DRIVER_OMAP34XX_I2C
- unsigned char data;
- unsigned short msg;
-
- i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-
- // Select the output voltage
- data = 0x04;
- i2c_write(I2C_TRITON2, 0x72, 1, &data, 1);
- // Select the Processor resource group
- data = 0x20;
- i2c_write(I2C_TRITON2, 0x72, 1, &data, 1);
- // Enable I2C access to the Power bus
- data = 0x02;
- i2c_write(I2C_TRITON2, 0x4a, 1, &data, 1);
- // Send message MSB
- msg = (1<<13) | (1<<4) | (0xd<<0); // group(process_grp1):resource(vaux1):res_active;
- data = msg >> 8;
- i2c_write(I2C_TRITON2, 0x4b, 1, &data, 1);
- // Send message LSB
- data = msg & 0xff;
- i2c_write(I2C_TRITON2, 0x4c, 1, &data, 1);
-#endif
-}
/******************************************************************************
* Routine: late_board_init