Commit 04025b42dc32b0f6437c24743b1c88b8ec43995a
Committed by
Marek Vasut
1 parent
5e5cfaf997
Exists in
master
and in
56 other branches
ARM: OMAP5-uevm: Add USB MAC ethernet address
Set the usbethaddr based on the OMAP DIE_ID registers which should be unique for each processor. Then set this as the usb ethernet MAC address. Signed-off-by: Dan Murphy <dmurphy@ti.com>
Showing 1 changed file with 23 additions and 0 deletions Side-by-side Diff
board/ti/omap5_uevm/evm.c
| ... | ... | @@ -19,6 +19,10 @@ |
| 19 | 19 | #include <asm/arch/clock.h> |
| 20 | 20 | #include <asm/arch/ehci.h> |
| 21 | 21 | #include <asm/ehci-omap.h> |
| 22 | + | |
| 23 | +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000) | |
| 24 | +#define DIE_ID_REG_OFFSET 0x200 | |
| 25 | + | |
| 22 | 26 | #endif |
| 23 | 27 | |
| 24 | 28 | DECLARE_GLOBAL_DATA_PTR; |
| 25 | 29 | |
| ... | ... | @@ -144,8 +148,27 @@ |
| 144 | 148 | { |
| 145 | 149 | int ret; |
| 146 | 150 | int auxclk; |
| 151 | + int reg; | |
| 152 | + uint8_t device_mac[6]; | |
| 147 | 153 | |
| 148 | 154 | enable_host_clocks(); |
| 155 | + | |
| 156 | + if (!getenv("usbethaddr")) { | |
| 157 | + reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET; | |
| 158 | + | |
| 159 | + /* | |
| 160 | + * create a fake MAC address from the processor ID code. | |
| 161 | + * first byte is 0x02 to signify locally administered. | |
| 162 | + */ | |
| 163 | + device_mac[0] = 0x02; | |
| 164 | + device_mac[1] = readl(reg + 0x10) & 0xff; | |
| 165 | + device_mac[2] = readl(reg + 0xC) & 0xff; | |
| 166 | + device_mac[3] = readl(reg + 0x8) & 0xff; | |
| 167 | + device_mac[4] = readl(reg) & 0xff; | |
| 168 | + device_mac[5] = (readl(reg) >> 8) & 0xff; | |
| 169 | + | |
| 170 | + eth_setenv_enetaddr("usbethaddr", device_mac); | |
| 171 | + } | |
| 149 | 172 | |
| 150 | 173 | auxclk = readl((*prcm)->scrm_auxclk1); |
| 151 | 174 | /* Request auxilary clock */ |