0046-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  2. Date: Mon, 14 Sep 2015 20:10:43 +0000
  3. Subject: ar71xx: add kernel support for the OpenMesh MR1750 board
  4. Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  5. Backport of r46926
  6. Forwarded: https://patchwork.ozlabs.org/patch/624173/
  7. diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
  8. index 9a81911..c5a3c9a 100644
  9. --- a/target/linux/ar71xx/config-3.18
  10. +++ b/target/linux/ar71xx/config-3.18
  11. @@ -79,6 +79,7 @@ CONFIG_ATH79_MACH_JWAP003=y
  12. CONFIG_ATH79_MACH_MC_MAC1200R=y
  13. CONFIG_ATH79_MACH_MR16=y
  14. CONFIG_ATH79_MACH_MR12=y
  15. +CONFIG_ATH79_MACH_MR1750=y
  16. CONFIG_ATH79_MACH_MR600=y
  17. CONFIG_ATH79_MACH_MR900=y
  18. CONFIG_ATH79_MACH_MYNET_N600=y
  19. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c
  20. new file mode 100644
  21. index 0000000..8ace02f
  22. --- /dev/null
  23. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c
  24. @@ -0,0 +1,129 @@
  25. +/*
  26. + * MR1750 board support
  27. + *
  28. + * Copyright (c) 2012 Qualcomm Atheros
  29. + * Copyright (c) 2012-2013 Marek Lindner <marek@open-mesh.com>
  30. + *
  31. + * Permission to use, copy, modify, and/or distribute this software for any
  32. + * purpose with or without fee is hereby granted, provided that the above
  33. + * copyright notice and this permission notice appear in all copies.
  34. + *
  35. + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  36. + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  37. + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  38. + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  39. + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  40. + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  41. + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  42. + *
  43. + */
  44. +
  45. +#include <linux/platform_device.h>
  46. +#include <linux/ar8216_platform.h>
  47. +
  48. +#include <asm/mach-ath79/ar71xx_regs.h>
  49. +
  50. +#include "common.h"
  51. +#include "dev-ap9x-pci.h"
  52. +#include "dev-gpio-buttons.h"
  53. +#include "dev-eth.h"
  54. +#include "dev-leds-gpio.h"
  55. +#include "dev-m25p80.h"
  56. +#include "dev-wmac.h"
  57. +#include "machtypes.h"
  58. +#include "pci.h"
  59. +
  60. +#define MR1750_GPIO_LED_LAN 12
  61. +#define MR1750_GPIO_LED_WLAN_2G 13
  62. +#define MR1750_GPIO_LED_STATUS_GREEN 19
  63. +#define MR1750_GPIO_LED_STATUS_RED 21
  64. +#define MR1750_GPIO_LED_POWER 22
  65. +#define MR1750_GPIO_LED_WLAN_5G 23
  66. +
  67. +#define MR1750_GPIO_BTN_RESET 17
  68. +
  69. +#define MR1750_KEYS_POLL_INTERVAL 20 /* msecs */
  70. +#define MR1750_KEYS_DEBOUNCE_INTERVAL (3 * MR1750_KEYS_POLL_INTERVAL)
  71. +
  72. +#define MR1750_MAC0_OFFSET 0
  73. +#define MR1750_WMAC_CALDATA_OFFSET 0x1000
  74. +
  75. +static struct gpio_led mr1750_leds_gpio[] __initdata = {
  76. + {
  77. + .name = "mr1750:blue:power",
  78. + .gpio = MR1750_GPIO_LED_POWER,
  79. + .active_low = 1,
  80. + },
  81. + {
  82. + .name = "mr1750:blue:wan",
  83. + .gpio = MR1750_GPIO_LED_LAN,
  84. + .active_low = 1,
  85. + },
  86. + {
  87. + .name = "mr1750:blue:wlan24",
  88. + .gpio = MR1750_GPIO_LED_WLAN_2G,
  89. + .active_low = 1,
  90. + },
  91. + {
  92. + .name = "mr1750:blue:wlan58",
  93. + .gpio = MR1750_GPIO_LED_WLAN_5G,
  94. + .active_low = 1,
  95. + },
  96. + {
  97. + .name = "mr1750:green:status",
  98. + .gpio = MR1750_GPIO_LED_STATUS_GREEN,
  99. + .active_low = 1,
  100. + },
  101. + {
  102. + .name = "mr1750:red:status",
  103. + .gpio = MR1750_GPIO_LED_STATUS_RED,
  104. + .active_low = 1,
  105. + },
  106. +};
  107. +
  108. +static struct gpio_keys_button mr1750_gpio_keys[] __initdata = {
  109. + {
  110. + .desc = "Reset button",
  111. + .type = EV_KEY,
  112. + .code = KEY_RESTART,
  113. + .debounce_interval = MR1750_KEYS_DEBOUNCE_INTERVAL,
  114. + .gpio = MR1750_GPIO_BTN_RESET,
  115. + .active_low = 1,
  116. + },
  117. +};
  118. +
  119. +static void __init mr1750_setup(void)
  120. +{
  121. + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000);
  122. + u8 mac[6];
  123. +
  124. + ath79_eth0_pll_data.pll_1000 = 0xbe000101;
  125. + ath79_eth0_pll_data.pll_100 = 0x80000101;
  126. + ath79_eth0_pll_data.pll_10 = 0x80001313;
  127. +
  128. + ath79_register_m25p80(NULL);
  129. +
  130. + ath79_register_leds_gpio(-1, ARRAY_SIZE(mr1750_leds_gpio),
  131. + mr1750_leds_gpio);
  132. + ath79_register_gpio_keys_polled(-1, MR1750_KEYS_POLL_INTERVAL,
  133. + ARRAY_SIZE(mr1750_gpio_keys),
  134. + mr1750_gpio_keys);
  135. +
  136. + ath79_init_mac(mac, art + MR1750_MAC0_OFFSET, 1);
  137. + ath79_register_wmac(art + MR1750_WMAC_CALDATA_OFFSET, mac);
  138. + ath79_register_pci();
  139. +
  140. + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
  141. + ath79_register_mdio(0, 0x0);
  142. +
  143. + ath79_init_mac(ath79_eth0_data.mac_addr, art + MR1750_MAC0_OFFSET, 0);
  144. +
  145. + /* GMAC0 is connected to the RMGII interface */
  146. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  147. + ath79_eth0_data.phy_mask = BIT(5);
  148. + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
  149. +
  150. + ath79_register_eth(0);
  151. +}
  152. +
  153. +MIPS_MACHINE(ATH79_MACH_MR1750, "MR1750", "OpenMesh MR1750", mr1750_setup);
  154. diff --git a/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch
  155. new file mode 100644
  156. index 0000000..d802a12
  157. --- /dev/null
  158. +++ b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch
  159. @@ -0,0 +1,39 @@
  160. +--- a/arch/mips/ath79/Kconfig
  161. ++++ b/arch/mips/ath79/Kconfig
  162. +@@ -763,6 +763,16 @@ config ATH79_MACH_CAP4200AG
  163. + select ATH79_DEV_M25P80
  164. + select ATH79_DEV_WMAC
  165. +
  166. ++config ATH79_MACH_MR1750
  167. ++ bool "OpenMesh MR1750 board support"
  168. ++ select SOC_QCA955X
  169. ++ select ATH79_DEV_AP9X_PCI if PCI
  170. ++ select ATH79_DEV_ETH
  171. ++ select ATH79_DEV_GPIO_BUTTONS
  172. ++ select ATH79_DEV_LEDS_GPIO
  173. ++ select ATH79_DEV_M25P80
  174. ++ select ATH79_DEV_WMAC
  175. ++
  176. + config ATH79_MACH_MR900
  177. + bool "OpenMesh MR900 board support"
  178. + select SOC_QCA955X
  179. +--- a/arch/mips/ath79/Makefile
  180. ++++ b/arch/mips/ath79/Makefile
  181. +@@ -80,6 +80,7 @@ obj-$(CONFIG_ATH79_MACH_HORNET_UB) += ma
  182. + obj-$(CONFIG_ATH79_MACH_MC_MAC1200R) += mach-mc-mac1200r.o
  183. + obj-$(CONFIG_ATH79_MACH_MR12) += mach-mr12.o
  184. + obj-$(CONFIG_ATH79_MACH_MR16) += mach-mr16.o
  185. ++obj-$(CONFIG_ATH79_MACH_MR1750) += mach-mr1750.o
  186. + obj-$(CONFIG_ATH79_MACH_MR600) += mach-mr600.o
  187. + obj-$(CONFIG_ATH79_MACH_MR900) += mach-mr900.o
  188. + obj-$(CONFIG_ATH79_MACH_MYNET_N600) += mach-mynet-n600.o
  189. +--- a/arch/mips/ath79/machtypes.h
  190. ++++ b/arch/mips/ath79/machtypes.h
  191. +@@ -69,6 +69,7 @@ enum ath79_mach_type {
  192. + ATH79_MACH_HORNET_UB, /* ALFA Networks Hornet-UB */
  193. + ATH79_MACH_MR12, /* Cisco Meraki MR12 */
  194. + ATH79_MACH_MR16, /* Cisco Meraki MR16 */
  195. ++ ATH79_MACH_MR1750, /* OpenMesh MR1750 */
  196. + ATH79_MACH_MR600V2, /* OpenMesh MR600v2 */
  197. + ATH79_MACH_MR600, /* OpenMesh MR600 */
  198. + ATH79_MACH_MR900, /* OpenMesh MR900 */