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,5 +27,6 @@ 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 #endif /* __GEMINI_COMMON_H__ */
18 --- a/arch/arm/mach-gemini/devices.c
19 +++ b/arch/arm/mach-gemini/devices.c
21 #include <mach/irqs.h>
22 #include <mach/hardware.h>
23 #include <mach/global_reg.h>
24 +#include <mach/gmac.h>
27 static struct plat_serial8250_port serial_platform_data[] = {
28 @@ -134,3 +135,53 @@ int __init platform_register_watchdog(vo
30 return platform_device_register(&wdt_device);
33 +static struct resource gmac_resources[] = {
35 + .start = 0x60000000,
37 + .flags = IORESOURCE_MEM,
42 + .flags = IORESOURCE_IRQ,
47 + .flags = IORESOURCE_IRQ,
51 +static u64 gmac_dmamask = 0xffffffffUL;
53 +static struct platform_device ethernet_device = {
54 + .name = "gemini-gmac",
57 + .dma_mask = &gmac_dmamask,
58 + .coherent_dma_mask = DMA_BIT_MASK(32),
60 + .num_resources = ARRAY_SIZE(gmac_resources),
61 + .resource = gmac_resources,
64 +int __init platform_register_ethernet(struct gemini_gmac_platform_data *pdata)
68 + reg = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);
69 + reg &= ~(GMAC_GMII | GMAC_1_ENABLE);
71 + if (pdata->bus_id[1])
72 + reg |= GMAC_1_ENABLE;
73 + else if (pdata->interface[0] == PHY_INTERFACE_MODE_GMII)
76 + __raw_writel(reg, IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);
78 + ethernet_device.dev.platform_data = pdata;
80 + return platform_device_register(ðernet_device);