diff options
author | Roman Yeryomin <roman@advem.lv> | 2016-08-22 02:36:50 +0300 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2016-08-23 15:41:27 +0200 |
commit | f046737e92f9a13acbe9139e1ded83287d31eeb5 (patch) | |
tree | a99693b42935d5d4ea1addf3514003df4e7898bd /target/linux/gemini/patches-4.4/122-arm-gemini-register-ethernet.patch | |
parent | e58c20aac319e5d9722caed2d64b6338c6b04b85 (diff) | |
download | upstream-f046737e92f9a13acbe9139e1ded83287d31eeb5.tar.gz upstream-f046737e92f9a13acbe9139e1ded83287d31eeb5.tar.bz2 upstream-f046737e92f9a13acbe9139e1ded83287d31eeb5.zip |
gemini: add Linux 4.4 support
Signed-off-by: Roman Yeryomin <roman@advem.lv>
[Jo-Philipp Wich: change commit title]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'target/linux/gemini/patches-4.4/122-arm-gemini-register-ethernet.patch')
-rw-r--r-- | target/linux/gemini/patches-4.4/122-arm-gemini-register-ethernet.patch | 227 |
1 files changed, 227 insertions, 0 deletions
diff --git a/target/linux/gemini/patches-4.4/122-arm-gemini-register-ethernet.patch b/target/linux/gemini/patches-4.4/122-arm-gemini-register-ethernet.patch new file mode 100644 index 0000000000..1cd9efc20f --- /dev/null +++ b/target/linux/gemini/patches-4.4/122-arm-gemini-register-ethernet.patch @@ -0,0 +1,227 @@ +--- a/arch/arm/mach-gemini/board-nas4220b.c ++++ b/arch/arm/mach-gemini/board-nas4220b.c +@@ -19,6 +19,7 @@ + #include <linux/input.h> + #include <linux/gpio_keys.h> + #include <linux/io.h> ++#include <linux/platform_data/mdio-gpio.h> + + #include <asm/setup.h> + #include <asm/mach-types.h> +@@ -27,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", +@@ -86,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 +@@ -17,13 +17,34 @@ + #include <linux/gpio_keys.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> ++#include <linux/platform_data/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 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, +@@ -122,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 +@@ -17,13 +17,36 @@ + #include <linux/gpio_keys.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> ++#include <linux/platform_data/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 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, +@@ -122,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/platform_data/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") |