Commit e84b8f6ce0e7daf4e9781172c4ffd74d7d525dbb
Committed by
Tom Rini
1 parent
b0c3b1195a
Exists in
master
and in
53 other branches
ARM: omap4-panda: Add MAC address creation for panda
Add a MAC address create based on the OMAP die ID registers. Then poplulate the ethaddr enviroment variable so that the device tree alias can be updated prior to boot. Signed-off-by: Dan Murphy <dmurphy@ti.com>
Showing 2 changed files with 20 additions and 0 deletions Side-by-side Diff
arch/arm/include/asm/arch-omap4/omap.h
... | ... | @@ -33,6 +33,10 @@ |
33 | 33 | |
34 | 34 | /* CONTROL_ID_CODE */ |
35 | 35 | #define CONTROL_ID_CODE 0x4A002204 |
36 | +#define STD_FUSE_DIE_ID_0 0x4A002200 | |
37 | +#define STD_FUSE_DIE_ID_1 0x4A002208 | |
38 | +#define STD_FUSE_DIE_ID_2 0x4A00220c | |
39 | +#define STD_FUSE_DIE_ID_3 0x4A002210 | |
36 | 40 | |
37 | 41 | #define OMAP4_CONTROL_ID_CODE_ES1_0 0x0B85202F |
38 | 42 | #define OMAP4_CONTROL_ID_CODE_ES2_0 0x1B85202F |
board/ti/panda/panda.c
... | ... | @@ -133,6 +133,7 @@ |
133 | 133 | { |
134 | 134 | int phy_type; |
135 | 135 | u32 auxclk, altclksrc; |
136 | + uint8_t device_mac[6]; | |
136 | 137 | |
137 | 138 | /* EHCI is not supported on ES1.0 */ |
138 | 139 | if (omap_revision() == OMAP4430_ES1_0) |
... | ... | @@ -185,6 +186,21 @@ |
185 | 186 | altclksrc |= ALTCLKSRC_ENABLE_INT_MASK | ALTCLKSRC_ENABLE_EXT_MASK; |
186 | 187 | |
187 | 188 | writel(altclksrc, &scrm->altclksrc); |
189 | + | |
190 | + if (!getenv("usbethaddr")) { | |
191 | + /* | |
192 | + * create a fake MAC address from the processor ID code. | |
193 | + * first byte is 0x02 to signify locally administered. | |
194 | + */ | |
195 | + device_mac[0] = 0x02; | |
196 | + device_mac[1] = readl(STD_FUSE_DIE_ID_3) & 0xff; | |
197 | + device_mac[2] = readl(STD_FUSE_DIE_ID_2) & 0xff; | |
198 | + device_mac[3] = readl(STD_FUSE_DIE_ID_1) & 0xff; | |
199 | + device_mac[4] = readl(STD_FUSE_DIE_ID_0) & 0xff; | |
200 | + device_mac[5] = (readl(STD_FUSE_DIE_ID_0) >> 8) & 0xff; | |
201 | + | |
202 | + eth_setenv_enetaddr("usbethaddr", device_mac); | |
203 | + } | |
188 | 204 | |
189 | 205 | return 0; |
190 | 206 | } |