122-arm-gemini-register-ethernet.patch 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. --- a/arch/arm/mach-gemini/board-nas4220b.c
  2. +++ b/arch/arm/mach-gemini/board-nas4220b.c
  3. @@ -19,6 +19,7 @@
  4. #include <linux/input.h>
  5. #include <linux/gpio_keys.h>
  6. #include <linux/io.h>
  7. +#include <linux/platform_data/mdio-gpio.h>
  8. #include <asm/setup.h>
  9. #include <asm/mach-types.h>
  10. @@ -27,9 +28,27 @@
  11. #include <mach/hardware.h>
  12. #include <mach/global_reg.h>
  13. +#include <mach/gmac.h>
  14. #include "common.h"
  15. +static struct mdio_gpio_platform_data ib4220b_mdio = {
  16. + .mdc = 22,
  17. + .mdio = 21,
  18. + .phy_mask = ~(1 << 1),
  19. +};
  20. +
  21. +static struct platform_device ib4220b_phy_device = {
  22. + .name = "mdio-gpio",
  23. + .id = 0,
  24. + .dev = { .platform_data = &ib4220b_mdio, },
  25. +};
  26. +
  27. +static struct gemini_gmac_platform_data ib4220b_gmac_data = {
  28. + .bus_id[0] = "gpio-0:01",
  29. + .interface[0] = PHY_INTERFACE_MODE_RGMII,
  30. +};
  31. +
  32. static struct gpio_led ib4220b_leds[] = {
  33. {
  34. .name = "nas4220b:orange:hdd",
  35. @@ -86,15 +105,47 @@ static struct platform_device ib4220b_ke
  36. },
  37. };
  38. +static void __init ib4220b_gmac_init(void)
  39. +{
  40. + unsigned int val;
  41. +
  42. + val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
  43. + GLOBAL_IO_DRIVING_CTRL));
  44. + val |= (0x3 << GMAC0_PADS_SHIFT) | (0x3 << GMAC1_PADS_SHIFT);
  45. + writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
  46. + GLOBAL_IO_DRIVING_CTRL));
  47. +
  48. + val = (0x0 << GMAC0_RXDV_SKEW_SHIFT) | (0xf << GMAC0_RXC_SKEW_SHIFT) |
  49. + (0x7 << GMAC0_TXEN_SKEW_SHIFT) | (0xb << GMAC0_TXC_SKEW_SHIFT) |
  50. + (0x0 << GMAC1_RXDV_SKEW_SHIFT) | (0xf << GMAC1_RXC_SKEW_SHIFT) |
  51. + (0x7 << GMAC1_TXEN_SKEW_SHIFT) | (0xa << GMAC1_TXC_SKEW_SHIFT);
  52. + writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
  53. + GLOBAL_GMAC_CTRL_SKEW_CTRL));
  54. +
  55. + writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
  56. + GLOBAL_GMAC0_DATA_SKEW_CTRL));
  57. + writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
  58. + GLOBAL_GMAC1_DATA_SKEW_CTRL));
  59. +
  60. + val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
  61. + GLOBAL_ARBITRATION1_CTRL)) & ~BURST_LENGTH_MASK;
  62. + val |= (0x20 << BURST_LENGTH_SHIFT) | GMAC0_HIGH_PRIO | GMAC1_HIGH_PRIO;
  63. + writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
  64. + GLOBAL_ARBITRATION1_CTRL));
  65. +}
  66. +
  67. static void __init ib4220b_init(void)
  68. {
  69. gemini_gpio_init();
  70. + ib4220b_gmac_init();
  71. platform_register_uart();
  72. platform_register_pflash(SZ_16M, NULL, 0);
  73. platform_device_register(&ib4220b_led_device);
  74. platform_device_register(&ib4220b_key_device);
  75. platform_register_rtc();
  76. platform_register_watchdog();
  77. + platform_device_register(&ib4220b_phy_device);
  78. + platform_register_ethernet(&ib4220b_gmac_data);
  79. }
  80. MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
  81. --- a/arch/arm/mach-gemini/board-wbd111.c
  82. +++ b/arch/arm/mach-gemini/board-wbd111.c
  83. @@ -17,13 +17,34 @@
  84. #include <linux/gpio_keys.h>
  85. #include <linux/mtd/mtd.h>
  86. #include <linux/mtd/partitions.h>
  87. +#include <linux/platform_data/mdio-gpio.h>
  88. #include <asm/mach-types.h>
  89. #include <asm/mach/arch.h>
  90. #include <asm/mach/time.h>
  91. +#include <mach/gmac.h>
  92. #include "common.h"
  93. +static struct mdio_gpio_platform_data wbd111_mdio = {
  94. + .mdc = 22,
  95. + .mdio = 21,
  96. + .phy_mask = ~(1 << 1),
  97. +};
  98. +
  99. +static struct platform_device wbd111_phy_device = {
  100. + .name = "mdio-gpio",
  101. + .id = 0,
  102. + .dev = {
  103. + .platform_data = &wbd111_mdio,
  104. + },
  105. +};
  106. +
  107. +static struct gemini_gmac_platform_data gmac_data = {
  108. + .bus_id[0] = "gpio-0:01",
  109. + .interface[0] = PHY_INTERFACE_MODE_MII,
  110. +};
  111. +
  112. static struct gpio_keys_button wbd111_keys[] = {
  113. {
  114. .code = KEY_SETUP,
  115. @@ -122,6 +143,8 @@ static void __init wbd111_init(void)
  116. platform_device_register(&wbd111_keys_device);
  117. platform_register_rtc();
  118. platform_register_watchdog();
  119. + platform_device_register(&wbd111_phy_device);
  120. + platform_register_ethernet(&gmac_data);
  121. }
  122. MACHINE_START(WBD111, "Wiliboard WBD-111")
  123. --- a/arch/arm/mach-gemini/board-wbd222.c
  124. +++ b/arch/arm/mach-gemini/board-wbd222.c
  125. @@ -17,13 +17,36 @@
  126. #include <linux/gpio_keys.h>
  127. #include <linux/mtd/mtd.h>
  128. #include <linux/mtd/partitions.h>
  129. +#include <linux/platform_data/mdio-gpio.h>
  130. #include <asm/mach-types.h>
  131. #include <asm/mach/arch.h>
  132. #include <asm/mach/time.h>
  133. +#include <mach/gmac.h>
  134. #include "common.h"
  135. +static struct mdio_gpio_platform_data wbd222_mdio = {
  136. + .mdc = 22,
  137. + .mdio = 21,
  138. + .phy_mask = ~((1 << 1) | (1 << 3)),
  139. +};
  140. +
  141. +static struct platform_device wbd222_phy_device = {
  142. + .name = "mdio-gpio",
  143. + .id = 0,
  144. + .dev = {
  145. + .platform_data = &wbd222_mdio,
  146. + },
  147. +};
  148. +
  149. +static struct gemini_gmac_platform_data gmac_data = {
  150. + .bus_id[0] = "gpio-0:01",
  151. + .interface[0] = PHY_INTERFACE_MODE_MII,
  152. + .bus_id[1] = "gpio-0:03",
  153. + .interface[1] = PHY_INTERFACE_MODE_MII,
  154. +};
  155. +
  156. static struct gpio_keys_button wbd222_keys[] = {
  157. {
  158. .code = KEY_SETUP,
  159. @@ -122,6 +145,8 @@ static void __init wbd222_init(void)
  160. platform_device_register(&wbd222_keys_device);
  161. platform_register_rtc();
  162. platform_register_watchdog();
  163. + platform_device_register(&wbd222_phy_device);
  164. + platform_register_ethernet(&gmac_data);
  165. }
  166. MACHINE_START(WBD222, "Wiliboard WBD-222")
  167. --- a/arch/arm/mach-gemini/board-rut1xx.c
  168. +++ b/arch/arm/mach-gemini/board-rut1xx.c
  169. @@ -15,13 +15,35 @@
  170. #include <linux/input.h>
  171. #include <linux/gpio_keys.h>
  172. #include <linux/sizes.h>
  173. +#include <linux/platform_data/mdio-gpio.h>
  174. #include <asm/mach-types.h>
  175. #include <asm/mach/arch.h>
  176. #include <asm/mach/time.h>
  177. +#include <mach/gmac.h>
  178. +
  179. #include "common.h"
  180. +static struct mdio_gpio_platform_data rut1xx_mdio = {
  181. + .mdc = 22,
  182. + .mdio = 21,
  183. + .phy_mask = ~(1 << 1),
  184. +};
  185. +
  186. +static struct platform_device rut1xx_phy_device = {
  187. + .name = "mdio-gpio",
  188. + .id = 0,
  189. + .dev = {
  190. + .platform_data = &rut1xx_mdio,
  191. + },
  192. +};
  193. +
  194. +static struct gemini_gmac_platform_data gmac_data = {
  195. + .bus_id[0] = "gpio-0:01",
  196. + .interface[0] = PHY_INTERFACE_MODE_MII,
  197. +};
  198. +
  199. static struct gpio_keys_button rut1xx_keys[] = {
  200. {
  201. .code = KEY_SETUP,
  202. @@ -81,6 +103,8 @@ static void __init rut1xx_init(void)
  203. platform_device_register(&rut1xx_keys_device);
  204. platform_register_rtc();
  205. platform_register_watchdog();
  206. + platform_device_register(&rut1xx_phy_device);
  207. + platform_register_ethernet(&gmac_data);
  208. }
  209. MACHINE_START(RUT100, "Teltonika RUT100")