aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/gemini/patches-4.1/121-arm-gemini-register-ethernet.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/gemini/patches-4.1/121-arm-gemini-register-ethernet.patch')
-rw-r--r--target/linux/gemini/patches-4.1/121-arm-gemini-register-ethernet.patch209
1 files changed, 209 insertions, 0 deletions
diff --git a/target/linux/gemini/patches-4.1/121-arm-gemini-register-ethernet.patch b/target/linux/gemini/patches-4.1/121-arm-gemini-register-ethernet.patch
new file mode 100644
index 0000000..5ae896c
--- /dev/null
+++ b/target/linux/gemini/patches-4.1/121-arm-gemini-register-ethernet.patch
@@ -0,0 +1,209 @@
+--- a/arch/arm/mach-gemini/board-nas4220b.c
++++ b/arch/arm/mach-gemini/board-nas4220b.c
+@@ -28,9 +28,27 @@
+
+ #include <mach/hardware.h>
+ #include <mach/global_reg.h>
++#include <mach/gmac.h>
+
+ #include "common.h"
+
++static struct mdio_gpio_platform_data ib4220b_mdio = {
++ .mdc = 22,
++ .mdio = 21,
++ .phy_mask = ~(1 << 1),
++};
++
++static struct platform_device ib4220b_phy_device = {
++ .name = "mdio-gpio",
++ .id = 0,
++ .dev = { .platform_data = &ib4220b_mdio, },
++};
++
++static struct gemini_gmac_platform_data ib4220b_gmac_data = {
++ .bus_id[0] = "gpio-0:01",
++ .interface[0] = PHY_INTERFACE_MODE_RGMII,
++};
++
+ static struct gpio_led ib4220b_leds[] = {
+ {
+ .name = "nas4220b:orange:hdd",
+@@ -87,15 +105,47 @@ static struct platform_device ib4220b_ke
+ },
+ };
+
++static void __init ib4220b_gmac_init(void)
++{
++ unsigned int val;
++
++ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
++ GLOBAL_IO_DRIVING_CTRL));
++ val |= (0x3 << GMAC0_PADS_SHIFT) | (0x3 << GMAC1_PADS_SHIFT);
++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
++ GLOBAL_IO_DRIVING_CTRL));
++
++ val = (0x0 << GMAC0_RXDV_SKEW_SHIFT) | (0xf << GMAC0_RXC_SKEW_SHIFT) |
++ (0x7 << GMAC0_TXEN_SKEW_SHIFT) | (0xb << GMAC0_TXC_SKEW_SHIFT) |
++ (0x0 << GMAC1_RXDV_SKEW_SHIFT) | (0xf << GMAC1_RXC_SKEW_SHIFT) |
++ (0x7 << GMAC1_TXEN_SKEW_SHIFT) | (0xa << GMAC1_TXC_SKEW_SHIFT);
++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
++ GLOBAL_GMAC_CTRL_SKEW_CTRL));
++
++ writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
++ GLOBAL_GMAC0_DATA_SKEW_CTRL));
++ writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
++ GLOBAL_GMAC1_DATA_SKEW_CTRL));
++
++ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
++ GLOBAL_ARBITRATION1_CTRL)) & ~BURST_LENGTH_MASK;
++ val |= (0x20 << BURST_LENGTH_SHIFT) | GMAC0_HIGH_PRIO | GMAC1_HIGH_PRIO;
++ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
++ GLOBAL_ARBITRATION1_CTRL));
++}
++
+ static void __init ib4220b_init(void)
+ {
+ gemini_gpio_init();
++ ib4220b_gmac_init();
+ platform_register_uart();
+ platform_register_pflash(SZ_16M, NULL, 0);
+ platform_device_register(&ib4220b_led_device);
+ platform_device_register(&ib4220b_key_device);
+ platform_register_rtc();
+ platform_register_watchdog();
++ platform_device_register(&ib4220b_phy_device);
++ platform_register_ethernet(&ib4220b_gmac_data);
+ }
+
+ MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
+--- a/arch/arm/mach-gemini/board-wbd111.c
++++ b/arch/arm/mach-gemini/board-wbd111.c
+@@ -22,9 +22,29 @@
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+
++#include <mach/gmac.h>
+
+ #include "common.h"
+
++static struct mdio_gpio_platform_data wbd111_mdio = {
++ .mdc = 22,
++ .mdio = 21,
++ .phy_mask = ~(1 << 1),
++};
++
++static struct platform_device wbd111_phy_device = {
++ .name = "mdio-gpio",
++ .id = 0,
++ .dev = {
++ .platform_data = &wbd111_mdio,
++ },
++};
++
++static struct gemini_gmac_platform_data gmac_data = {
++ .bus_id[0] = "gpio-0:01",
++ .interface[0] = PHY_INTERFACE_MODE_MII,
++};
++
+ static struct gpio_keys_button wbd111_keys[] = {
+ {
+ .code = KEY_SETUP,
+@@ -123,6 +143,8 @@ static void __init wbd111_init(void)
+ platform_device_register(&wbd111_keys_device);
+ platform_register_rtc();
+ platform_register_watchdog();
++ platform_device_register(&wbd111_phy_device);
++ platform_register_ethernet(&gmac_data);
+ }
+
+ MACHINE_START(WBD111, "Wiliboard WBD-111")
+--- a/arch/arm/mach-gemini/board-wbd222.c
++++ b/arch/arm/mach-gemini/board-wbd222.c
+@@ -22,9 +22,31 @@
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+
++#include <mach/gmac.h>
+
+ #include "common.h"
+
++static struct mdio_gpio_platform_data wbd222_mdio = {
++ .mdc = 22,
++ .mdio = 21,
++ .phy_mask = ~((1 << 1) | (1 << 3)),
++};
++
++static struct platform_device wbd222_phy_device = {
++ .name = "mdio-gpio",
++ .id = 0,
++ .dev = {
++ .platform_data = &wbd222_mdio,
++ },
++};
++
++static struct gemini_gmac_platform_data gmac_data = {
++ .bus_id[0] = "gpio-0:01",
++ .interface[0] = PHY_INTERFACE_MODE_MII,
++ .bus_id[1] = "gpio-0:03",
++ .interface[1] = PHY_INTERFACE_MODE_MII,
++};
++
+ static struct gpio_keys_button wbd222_keys[] = {
+ {
+ .code = KEY_SETUP,
+@@ -123,6 +145,8 @@ static void __init wbd222_init(void)
+ platform_device_register(&wbd222_keys_device);
+ platform_register_rtc();
+ platform_register_watchdog();
++ platform_device_register(&wbd222_phy_device);
++ platform_register_ethernet(&gmac_data);
+ }
+
+ MACHINE_START(WBD222, "Wiliboard WBD-222")
+--- a/arch/arm/mach-gemini/board-rut1xx.c
++++ b/arch/arm/mach-gemini/board-rut1xx.c
+@@ -15,13 +15,35 @@
+ #include <linux/input.h>
+ #include <linux/gpio_keys.h>
+ #include <linux/sizes.h>
++#include <linux/mdio-gpio.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+
++#include <mach/gmac.h>
++
+ #include "common.h"
+
++static struct mdio_gpio_platform_data rut1xx_mdio = {
++ .mdc = 22,
++ .mdio = 21,
++ .phy_mask = ~(1 << 1),
++};
++
++static struct platform_device rut1xx_phy_device = {
++ .name = "mdio-gpio",
++ .id = 0,
++ .dev = {
++ .platform_data = &rut1xx_mdio,
++ },
++};
++
++static struct gemini_gmac_platform_data gmac_data = {
++ .bus_id[0] = "gpio-0:01",
++ .interface[0] = PHY_INTERFACE_MODE_MII,
++};
++
+ static struct gpio_keys_button rut1xx_keys[] = {
+ {
+ .code = KEY_SETUP,
+@@ -81,6 +103,8 @@ static void __init rut1xx_init(void)
+ platform_device_register(&rut1xx_keys_device);
+ platform_register_rtc();
+ platform_register_watchdog();
++ platform_device_register(&rut1xx_phy_device);
++ platform_register_ethernet(&gmac_data);
+ }
+
+ MACHINE_START(RUT100, "Teltonika RUT100")