1 --- a/arch/arm/mach-gemini/common.h
2 +++ b/arch/arm/mach-gemini/common.h
4 #define __GEMINI_COMMON_H__
7 +struct gemini_gmac_platform_data;
9 extern void gemini_map_io(void);
10 extern void gemini_init_irq(void);
11 @@ -26,6 +27,7 @@ extern int platform_register_pflash(unsi
12 struct mtd_partition *parts,
13 unsigned int nr_parts);
14 extern int platform_register_watchdog(void);
15 +extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata);
17 extern void gemini_restart(char mode, const char *cmd);
19 --- a/arch/arm/mach-gemini/devices.c
20 +++ b/arch/arm/mach-gemini/devices.c
22 #include <mach/irqs.h>
23 #include <mach/hardware.h>
24 #include <mach/global_reg.h>
25 +#include <mach/gmac.h>
28 static struct plat_serial8250_port serial_platform_data[] = {
29 @@ -134,3 +135,53 @@ int __init platform_register_watchdog(vo
31 return platform_device_register(&wdt_device);
34 +static struct resource gmac_resources[] = {
36 + .start = 0x60000000,
38 + .flags = IORESOURCE_MEM,
43 + .flags = IORESOURCE_IRQ,
48 + .flags = IORESOURCE_IRQ,
52 +static u64 gmac_dmamask = 0xffffffffUL;
54 +static struct platform_device ethernet_device = {
55 + .name = "gemini-gmac",
58 + .dma_mask = &gmac_dmamask,
59 + .coherent_dma_mask = DMA_BIT_MASK(32),
61 + .num_resources = ARRAY_SIZE(gmac_resources),
62 + .resource = gmac_resources,
65 +int __init platform_register_ethernet(struct gemini_gmac_platform_data *pdata)
69 + reg = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);
70 + reg &= ~(GMAC_GMII | GMAC_1_ENABLE);
72 + if (pdata->bus_id[1])
73 + reg |= GMAC_1_ENABLE;
74 + else if (pdata->interface[0] == PHY_INTERFACE_MODE_GMII)
77 + __raw_writel(reg, IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);
79 + ethernet_device.dev.platform_data = pdata;
81 + return platform_device_register(ðernet_device);