diff options
Diffstat (limited to 'arch/mips/alchemy/common/platform.c')
-rw-r--r-- | arch/mips/alchemy/common/platform.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index f9e5622ebc9..1dc55ee2681 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/etherdevice.h> | ||
15 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
16 | #include <linux/serial_8250.h> | 17 | #include <linux/serial_8250.h> |
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
@@ -21,6 +22,8 @@ | |||
21 | #include <asm/mach-au1x00/au1100_mmc.h> | 22 | #include <asm/mach-au1x00/au1100_mmc.h> |
22 | #include <asm/mach-au1x00/au1xxx_eth.h> | 23 | #include <asm/mach-au1x00/au1xxx_eth.h> |
23 | 24 | ||
25 | #include <prom.h> | ||
26 | |||
24 | #define PORT(_base, _irq) \ | 27 | #define PORT(_base, _irq) \ |
25 | { \ | 28 | { \ |
26 | .mapbase = _base, \ | 29 | .mapbase = _base, \ |
@@ -33,7 +36,6 @@ | |||
33 | } | 36 | } |
34 | 37 | ||
35 | static struct plat_serial8250_port au1x00_uart_data[] = { | 38 | static struct plat_serial8250_port au1x00_uart_data[] = { |
36 | #if defined(CONFIG_SERIAL_8250_AU1X00) | ||
37 | #if defined(CONFIG_SOC_AU1000) | 39 | #if defined(CONFIG_SOC_AU1000) |
38 | PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), | 40 | PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), |
39 | PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), | 41 | PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), |
@@ -54,7 +56,6 @@ static struct plat_serial8250_port au1x00_uart_data[] = { | |||
54 | PORT(UART0_PHYS_ADDR, AU1200_UART0_INT), | 56 | PORT(UART0_PHYS_ADDR, AU1200_UART0_INT), |
55 | PORT(UART1_PHYS_ADDR, AU1200_UART1_INT), | 57 | PORT(UART1_PHYS_ADDR, AU1200_UART1_INT), |
56 | #endif | 58 | #endif |
57 | #endif /* CONFIG_SERIAL_8250_AU1X00 */ | ||
58 | { }, | 59 | { }, |
59 | }; | 60 | }; |
60 | 61 | ||
@@ -436,17 +437,27 @@ static int __init au1xxx_platform_init(void) | |||
436 | { | 437 | { |
437 | unsigned int uartclk = get_au1x00_uart_baud_base() * 16; | 438 | unsigned int uartclk = get_au1x00_uart_baud_base() * 16; |
438 | int err, i; | 439 | int err, i; |
440 | unsigned char ethaddr[6]; | ||
439 | 441 | ||
440 | /* Fill up uartclk. */ | 442 | /* Fill up uartclk. */ |
441 | for (i = 0; au1x00_uart_data[i].flags; i++) | 443 | for (i = 0; au1x00_uart_data[i].flags; i++) |
442 | au1x00_uart_data[i].uartclk = uartclk; | 444 | au1x00_uart_data[i].uartclk = uartclk; |
443 | 445 | ||
446 | /* use firmware-provided mac addr if available and necessary */ | ||
447 | i = prom_get_ethernet_addr(ethaddr); | ||
448 | if (!i && !is_valid_ether_addr(au1xxx_eth0_platform_data.mac)) | ||
449 | memcpy(au1xxx_eth0_platform_data.mac, ethaddr, 6); | ||
450 | |||
444 | err = platform_add_devices(au1xxx_platform_devices, | 451 | err = platform_add_devices(au1xxx_platform_devices, |
445 | ARRAY_SIZE(au1xxx_platform_devices)); | 452 | ARRAY_SIZE(au1xxx_platform_devices)); |
446 | #ifndef CONFIG_SOC_AU1100 | 453 | #ifndef CONFIG_SOC_AU1100 |
454 | ethaddr[5] += 1; /* next addr for 2nd MAC */ | ||
455 | if (!i && !is_valid_ether_addr(au1xxx_eth1_platform_data.mac)) | ||
456 | memcpy(au1xxx_eth1_platform_data.mac, ethaddr, 6); | ||
457 | |||
447 | /* Register second MAC if enabled in pinfunc */ | 458 | /* Register second MAC if enabled in pinfunc */ |
448 | if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) | 459 | if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) |
449 | platform_device_register(&au1xxx_eth1_device); | 460 | err = platform_device_register(&au1xxx_eth1_device); |
450 | #endif | 461 | #endif |
451 | 462 | ||
452 | return err; | 463 | return err; |