gemini: update ethernet driver, register ethernet on nas4220 board
[openwrt/openwrt.git] / target / linux / gemini / patches-3.10 / 121-arm-gemini-nas4220-register-ethernet.patch
1 --- a/arch/arm/mach-gemini/board-nas4220b.c 2011-04-21 13:19:09.878432930 +0200
2 +++ b/arch/arm/mach-gemini/board-nas4220b.c 2011-04-21 13:30:37.555082365 +0200
3 @@ -28,9 +28,27 @@
4
5 #include <mach/hardware.h>
6 #include <mach/global_reg.h>
7 +#include <mach/gmac.h>
8
9 #include "common.h"
10
11 +static struct mdio_gpio_platform_data ib4220b_mdio = {
12 + .mdc = 22,
13 + .mdio = 21,
14 + .phy_mask = ~(1 << 1),
15 +};
16 +
17 +static struct platform_device ib4220b_phy_device = {
18 + .name = "mdio-gpio",
19 + .id = 0,
20 + .dev = { .platform_data = &ib4220b_mdio, },
21 +};
22 +
23 +static struct gemini_gmac_platform_data ib4220b_gmac_data = {
24 + .bus_id[0] = "gpio-0:01",
25 + .interface[0] = PHY_INTERFACE_MODE_RGMII,
26 +};
27 +
28 static struct gpio_led ib4220b_leds[] = {
29 {
30 .name = "nas4220b:orange:hdd",
31 @@ -107,9 +125,39 @@
32 },
33 };
34
35 +static void __init ib4220b_gmac_init(void)
36 +{
37 + unsigned int val;
38 +
39 + val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
40 + GLOBAL_IO_DRIVING_CTRL));
41 + val |= (0x3 << GMAC0_PADS_SHIFT) | (0x3 << GMAC1_PADS_SHIFT);
42 + writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
43 + GLOBAL_IO_DRIVING_CTRL));
44 +
45 + val = (0x0 << GMAC0_RXDV_SKEW_SHIFT) | (0xf << GMAC0_RXC_SKEW_SHIFT) |
46 + (0x7 << GMAC0_TXEN_SKEW_SHIFT) | (0xb << GMAC0_TXC_SKEW_SHIFT) |
47 + (0x0 << GMAC1_RXDV_SKEW_SHIFT) | (0xf << GMAC1_RXC_SKEW_SHIFT) |
48 + (0x7 << GMAC1_TXEN_SKEW_SHIFT) | (0xa << GMAC1_TXC_SKEW_SHIFT);
49 + writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
50 + GLOBAL_GMAC_CTRL_SKEW_CTRL));
51 +
52 + writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
53 + GLOBAL_GMAC0_DATA_SKEW_CTRL));
54 + writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
55 + GLOBAL_GMAC1_DATA_SKEW_CTRL));
56 +
57 + val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
58 + GLOBAL_ARBITRATION1_CTRL)) & ~BURST_LENGTH_MASK;
59 + val |= (0x20 << BURST_LENGTH_SHIFT) | GMAC0_HIGH_PRIO | GMAC1_HIGH_PRIO;
60 + writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
61 + GLOBAL_ARBITRATION1_CTRL));
62 +}
63 +
64 static void __init ib4220b_init(void)
65 {
66 gemini_gpio_init();
67 + ib4220b_gmac_init();
68 platform_register_uart();
69 platform_register_pflash(SZ_16M, NULL, 0);
70 platform_device_register(&ib4220b_led_device);
71 @@ -96,6 +144,8 @@
72 platform_device_register(&ib4220b_key_device);
73 platform_register_rtc();
74 platform_register_watchdog();
75 + platform_device_register(&ib4220b_phy_device);
76 + platform_register_ethernet(&ib4220b_gmac_data);
77 }
78
79 MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")