608-MIPS-ath79-ubnt-xm-add-more-boards.patch 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. --- a/arch/mips/ath79/mach-ubnt-xm.c
  2. +++ b/arch/mips/ath79/mach-ubnt-xm.c
  3. @@ -12,16 +12,26 @@
  4. #include <linux/init.h>
  5. #include <linux/pci.h>
  6. +#include <linux/platform_device.h>
  7. #include <linux/ath9k_platform.h>
  8. +#include <linux/etherdevice.h>
  9. +#include <linux/ar8216_platform.h>
  10. +#include <asm/mach-ath79/ath79.h>
  11. #include <asm/mach-ath79/irq.h>
  12. +#include <asm/mach-ath79/ar71xx_regs.h>
  13. +#include <linux/platform_data/phy-at803x.h>
  14. +
  15. +#include "common.h"
  16. #include "dev-ap9x-pci.h"
  17. +#include "dev-eth.h"
  18. #include "dev-gpio-buttons.h"
  19. #include "dev-leds-gpio.h"
  20. #include "dev-m25p80.h"
  21. +#include "dev-usb.h"
  22. +#include "dev-wmac.h"
  23. #include "machtypes.h"
  24. -#include "pci.h"
  25. #define UBNT_XM_GPIO_LED_L1 0
  26. #define UBNT_XM_GPIO_LED_L2 1
  27. @@ -37,19 +47,19 @@
  28. static struct gpio_led ubnt_xm_leds_gpio[] __initdata = {
  29. {
  30. - .name = "ubnt-xm:red:link1",
  31. + .name = "ubnt:red:link1",
  32. .gpio = UBNT_XM_GPIO_LED_L1,
  33. .active_low = 0,
  34. }, {
  35. - .name = "ubnt-xm:orange:link2",
  36. + .name = "ubnt:orange:link2",
  37. .gpio = UBNT_XM_GPIO_LED_L2,
  38. .active_low = 0,
  39. }, {
  40. - .name = "ubnt-xm:green:link3",
  41. + .name = "ubnt:green:link3",
  42. .gpio = UBNT_XM_GPIO_LED_L3,
  43. .active_low = 0,
  44. }, {
  45. - .name = "ubnt-xm:green:link4",
  46. + .name = "ubnt:green:link4",
  47. .gpio = UBNT_XM_GPIO_LED_L4,
  48. .active_low = 0,
  49. },
  50. @@ -66,9 +76,13 @@ static struct gpio_keys_button ubnt_xm_g
  51. }
  52. };
  53. +#define UBNT_M_WAN_PHYMASK BIT(4)
  54. +
  55. static void __init ubnt_xm_init(void)
  56. {
  57. u8 *eeprom = (u8 *) KSEG1ADDR(UBNT_XM_EEPROM_ADDR);
  58. + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
  59. + u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
  60. ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio),
  61. ubnt_xm_leds_gpio);
  62. @@ -79,9 +93,552 @@ static void __init ubnt_xm_init(void)
  63. ath79_register_m25p80(NULL);
  64. ap91_pci_init(eeprom, NULL);
  65. +
  66. + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
  67. + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
  68. + ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
  69. + ath79_register_eth(0);
  70. }
  71. MIPS_MACHINE(ATH79_MACH_UBNT_XM,
  72. "UBNT-XM",
  73. "Ubiquiti Networks XM (rev 1.0) board",
  74. ubnt_xm_init);
  75. +
  76. +MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M, "UBNT-BM", "Ubiquiti Bullet M",
  77. + ubnt_xm_init);
  78. +
  79. +static void __init ubnt_rocket_m_setup(void)
  80. +{
  81. + ubnt_xm_init();
  82. + ath79_register_usb();
  83. +}
  84. +
  85. +MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M, "UBNT-RM", "Ubiquiti Rocket M",
  86. + ubnt_rocket_m_setup);
  87. +
  88. +static void __init ubnt_nano_m_setup(void)
  89. +{
  90. + ubnt_xm_init();
  91. + ath79_register_eth(1);
  92. +}
  93. +
  94. +MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M, "UBNT-NM", "Ubiquiti Nanostation M",
  95. + ubnt_nano_m_setup);
  96. +
  97. +static struct gpio_led ubnt_airrouter_leds_gpio[] __initdata = {
  98. + {
  99. + .name = "ubnt:green:globe",
  100. + .gpio = 0,
  101. + .active_low = 1,
  102. + }, {
  103. + .name = "ubnt:green:power",
  104. + .gpio = 11,
  105. + .active_low = 1,
  106. + .default_state = LEDS_GPIO_DEFSTATE_ON,
  107. + }
  108. +};
  109. +
  110. +static void __init ubnt_airrouter_setup(void)
  111. +{
  112. + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
  113. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  114. +
  115. + ath79_register_m25p80(NULL);
  116. + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
  117. +
  118. + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
  119. + ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1);
  120. +
  121. + ath79_register_eth(1);
  122. + ath79_register_eth(0);
  123. + ath79_register_usb();
  124. +
  125. + ap91_pci_init(ee, NULL);
  126. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio),
  127. + ubnt_airrouter_leds_gpio);
  128. +
  129. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  130. + ARRAY_SIZE(ubnt_xm_gpio_keys),
  131. + ubnt_xm_gpio_keys);
  132. +}
  133. +
  134. +MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter",
  135. + ubnt_airrouter_setup);
  136. +
  137. +static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = {
  138. + {
  139. + .name = "ubnt:orange:dome",
  140. + .gpio = 1,
  141. + .active_low = 0,
  142. + }, {
  143. + .name = "ubnt:green:dome",
  144. + .gpio = 0,
  145. + .active_low = 0,
  146. + }
  147. +};
  148. +
  149. +static struct gpio_led ubnt_unifi_outdoor_leds_gpio[] __initdata = {
  150. + {
  151. + .name = "ubnt:orange:front",
  152. + .gpio = 1,
  153. + .active_low = 0,
  154. + }, {
  155. + .name = "ubnt:green:front",
  156. + .gpio = 0,
  157. + .active_low = 0,
  158. + }
  159. +};
  160. +
  161. +static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio[] __initdata = {
  162. + {
  163. + .name = "ubnt:white:front",
  164. + .gpio = 1,
  165. + .active_low = 0,
  166. + }, {
  167. + .name = "ubnt:blue:front",
  168. + .gpio = 0,
  169. + .active_low = 0,
  170. + }
  171. +};
  172. +
  173. +
  174. +static void __init ubnt_unifi_setup(void)
  175. +{
  176. + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
  177. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  178. +
  179. + ath79_register_m25p80(NULL);
  180. +
  181. + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
  182. +
  183. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  184. + ath79_register_eth(0);
  185. +
  186. + ap91_pci_init(ee, NULL);
  187. +
  188. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio),
  189. + ubnt_unifi_leds_gpio);
  190. +
  191. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  192. + ARRAY_SIZE(ubnt_xm_gpio_keys),
  193. + ubnt_xm_gpio_keys);
  194. +}
  195. +
  196. +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi",
  197. + ubnt_unifi_setup);
  198. +
  199. +
  200. +#define UBNT_UNIFIOD_PRI_PHYMASK BIT(4)
  201. +#define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
  202. +
  203. +static void __init ubnt_unifi_outdoor_setup(void)
  204. +{
  205. + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
  206. + u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
  207. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  208. +
  209. + ath79_register_m25p80(NULL);
  210. +
  211. + ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK |
  212. + UBNT_UNIFIOD_2ND_PHYMASK));
  213. +
  214. + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
  215. + ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
  216. + ath79_register_eth(0);
  217. + ath79_register_eth(1);
  218. +
  219. + ap91_pci_init(ee, NULL);
  220. +
  221. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio),
  222. + ubnt_unifi_outdoor_leds_gpio);
  223. +
  224. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  225. + ARRAY_SIZE(ubnt_xm_gpio_keys),
  226. + ubnt_xm_gpio_keys);
  227. +}
  228. +
  229. +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR, "UBNT-U20",
  230. + "Ubiquiti UniFiAP Outdoor",
  231. + ubnt_unifi_outdoor_setup);
  232. +
  233. +
  234. +static void __init ubnt_unifi_outdoor_plus_setup(void)
  235. +{
  236. + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
  237. + u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
  238. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  239. +
  240. + ath79_register_m25p80(NULL);
  241. +
  242. + ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK |
  243. + UBNT_UNIFIOD_2ND_PHYMASK));
  244. +
  245. + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
  246. + ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
  247. + ath79_register_eth(0);
  248. + ath79_register_eth(1);
  249. +
  250. + ap91_pci_init(ee, NULL);
  251. +
  252. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio),
  253. + ubnt_unifi_outdoor_plus_leds_gpio);
  254. +
  255. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  256. + ARRAY_SIZE(ubnt_xm_gpio_keys),
  257. + ubnt_xm_gpio_keys);
  258. +}
  259. +
  260. +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, "UBNT-UOP",
  261. + "Ubiquiti UniFiAP Outdoor+",
  262. + ubnt_unifi_outdoor_plus_setup);
  263. +
  264. +
  265. +static struct gpio_led ubnt_uap_pro_gpio_leds[] __initdata = {
  266. + {
  267. + .name = "ubnt:white:dome",
  268. + .gpio = 12,
  269. + }, {
  270. + .name = "ubnt:blue:dome",
  271. + .gpio = 13,
  272. + }
  273. +};
  274. +
  275. +static struct gpio_keys_button uap_pro_gpio_keys[] __initdata = {
  276. + {
  277. + .desc = "reset",
  278. + .type = EV_KEY,
  279. + .code = KEY_RESTART,
  280. + .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
  281. + .gpio = 17,
  282. + .active_low = 1,
  283. + }
  284. +};
  285. +
  286. +static struct ar8327_pad_cfg uap_pro_ar8327_pad0_cfg = {
  287. + .mode = AR8327_PAD_MAC_RGMII,
  288. + .txclk_delay_en = true,
  289. + .rxclk_delay_en = true,
  290. + .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
  291. + .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
  292. +};
  293. +
  294. +static struct ar8327_platform_data uap_pro_ar8327_data = {
  295. + .pad0_cfg = &uap_pro_ar8327_pad0_cfg,
  296. + .port0_cfg = {
  297. + .force_link = 1,
  298. + .speed = AR8327_PORT_SPEED_1000,
  299. + .duplex = 1,
  300. + .txpause = 1,
  301. + .rxpause = 1,
  302. + },
  303. +};
  304. +
  305. +static struct mdio_board_info uap_pro_mdio0_info[] = {
  306. + {
  307. + .bus_id = "ag71xx-mdio.0",
  308. + .phy_addr = 0,
  309. + .platform_data = &uap_pro_ar8327_data,
  310. + },
  311. +};
  312. +
  313. +#define UAP_PRO_MAC0_OFFSET 0x0000
  314. +#define UAP_PRO_MAC1_OFFSET 0x0006
  315. +#define UAP_PRO_WMAC_CALDATA_OFFSET 0x1000
  316. +#define UAP_PRO_PCI_CALDATA_OFFSET 0x5000
  317. +
  318. +static void __init ubnt_uap_pro_setup(void)
  319. +{
  320. + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
  321. +
  322. + ath79_register_m25p80(NULL);
  323. +
  324. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_uap_pro_gpio_leds),
  325. + ubnt_uap_pro_gpio_leds);
  326. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  327. + ARRAY_SIZE(uap_pro_gpio_keys),
  328. + uap_pro_gpio_keys);
  329. +
  330. + ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
  331. + ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
  332. +
  333. + ath79_register_mdio(0, 0x0);
  334. + mdiobus_register_board_info(uap_pro_mdio0_info,
  335. + ARRAY_SIZE(uap_pro_mdio0_info));
  336. +
  337. + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0);
  338. + ath79_init_mac(ath79_eth0_data.mac_addr,
  339. + eeprom + UAP_PRO_MAC0_OFFSET, 0);
  340. +
  341. + /* GMAC0 is connected to an AR8327 switch */
  342. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  343. + ath79_eth0_data.phy_mask = BIT(0);
  344. + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
  345. + ath79_eth0_pll_data.pll_1000 = 0x06000000;
  346. + ath79_register_eth(0);
  347. +}
  348. +
  349. +MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO, "UAP-PRO", "Ubiquiti UniFi AP Pro",
  350. + ubnt_uap_pro_setup);
  351. +
  352. +#define UBNT_XW_GPIO_LED_L1 11
  353. +#define UBNT_XW_GPIO_LED_L2 16
  354. +#define UBNT_XW_GPIO_LED_L3 13
  355. +#define UBNT_XW_GPIO_LED_L4 14
  356. +
  357. +static struct gpio_led ubnt_xw_leds_gpio[] __initdata = {
  358. + {
  359. + .name = "ubnt:red:link1",
  360. + .gpio = UBNT_XW_GPIO_LED_L1,
  361. + .active_low = 1,
  362. + }, {
  363. + .name = "ubnt:orange:link2",
  364. + .gpio = UBNT_XW_GPIO_LED_L2,
  365. + .active_low = 1,
  366. + }, {
  367. + .name = "ubnt:green:link3",
  368. + .gpio = UBNT_XW_GPIO_LED_L3,
  369. + .active_low = 1,
  370. + }, {
  371. + .name = "ubnt:green:link4",
  372. + .gpio = UBNT_XW_GPIO_LED_L4,
  373. + .active_low = 1,
  374. + },
  375. +};
  376. +
  377. +#define UBNT_ROCKET_TI_GPIO_LED_L1 16
  378. +#define UBNT_ROCKET_TI_GPIO_LED_L2 17
  379. +#define UBNT_ROCKET_TI_GPIO_LED_L3 18
  380. +#define UBNT_ROCKET_TI_GPIO_LED_L4 19
  381. +#define UBNT_ROCKET_TI_GPIO_LED_L5 20
  382. +#define UBNT_ROCKET_TI_GPIO_LED_L6 21
  383. +static struct gpio_led ubnt_rocket_ti_leds_gpio[] __initdata = {
  384. + {
  385. + .name = "ubnt:green:link1",
  386. + .gpio = UBNT_ROCKET_TI_GPIO_LED_L1,
  387. + .active_low = 1,
  388. + }, {
  389. + .name = "ubnt:green:link2",
  390. + .gpio = UBNT_ROCKET_TI_GPIO_LED_L2,
  391. + .active_low = 1,
  392. + }, {
  393. + .name = "ubnt:green:link3",
  394. + .gpio = UBNT_ROCKET_TI_GPIO_LED_L3,
  395. + .active_low = 1,
  396. + }, {
  397. + .name = "ubnt:green:link4",
  398. + .gpio = UBNT_ROCKET_TI_GPIO_LED_L4,
  399. + .active_low = 0,
  400. + }, {
  401. + .name = "ubnt:green:link5",
  402. + .gpio = UBNT_ROCKET_TI_GPIO_LED_L5,
  403. + .active_low = 0,
  404. + }, {
  405. + .name = "ubnt:green:link6",
  406. + .gpio = UBNT_ROCKET_TI_GPIO_LED_L6,
  407. + .active_low = 0,
  408. + },
  409. +};
  410. +
  411. +static void __init ubnt_xw_init(void)
  412. +{
  413. + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
  414. +
  415. + ath79_register_m25p80(NULL);
  416. +
  417. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio),
  418. + ubnt_xw_leds_gpio);
  419. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  420. + ARRAY_SIZE(ubnt_xm_gpio_keys),
  421. + ubnt_xm_gpio_keys);
  422. +
  423. + ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
  424. + ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
  425. +
  426. +
  427. + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | AR934X_ETH_CFG_MII_GMAC0_SLAVE);
  428. + ath79_init_mac(ath79_eth0_data.mac_addr,
  429. + eeprom + UAP_PRO_MAC0_OFFSET, 0);
  430. +
  431. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  432. + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
  433. +}
  434. +
  435. +static void __init ubnt_nano_m_xw_setup(void)
  436. +{
  437. + ubnt_xw_init();
  438. +
  439. + /* GMAC0 is connected to an AR8326 switch */
  440. + ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5)));
  441. + ath79_eth0_data.phy_mask = (BIT(0) | BIT(1) | BIT(5));
  442. + ath79_eth0_data.speed = SPEED_100;
  443. + ath79_eth0_data.duplex = DUPLEX_FULL;
  444. + ath79_register_eth(0);
  445. +}
  446. +
  447. +static void __init ubnt_loco_m_xw_setup(void)
  448. +{
  449. + ubnt_xw_init();
  450. +
  451. + ath79_register_mdio(0, ~BIT(1));
  452. + ath79_eth0_data.phy_mask = BIT(1);
  453. + ath79_register_eth(0);
  454. +}
  455. +
  456. +static void __init ubnt_rocket_m_xw_setup(void)
  457. +{
  458. + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
  459. +
  460. + ath79_register_m25p80(NULL);
  461. +
  462. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio),
  463. + ubnt_xw_leds_gpio);
  464. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  465. + ARRAY_SIZE(ubnt_xm_gpio_keys),
  466. + ubnt_xm_gpio_keys);
  467. +
  468. + ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
  469. + ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
  470. +
  471. + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0);
  472. + ath79_init_mac(ath79_eth0_data.mac_addr,
  473. + eeprom + UAP_PRO_MAC0_OFFSET, 0);
  474. +
  475. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  476. + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
  477. +
  478. + ath79_register_mdio(0, ~BIT(4));
  479. + ath79_eth0_data.phy_mask = BIT(4);
  480. + ath79_eth0_pll_data.pll_1000 = 0x06000000;
  481. + ath79_register_eth(0);
  482. +}
  483. +
  484. +static struct at803x_platform_data ubnt_rocket_m_ti_at803_data = {
  485. + .disable_smarteee = 1,
  486. + .enable_rgmii_rx_delay = 1,
  487. + .enable_rgmii_tx_delay = 1,
  488. +};
  489. +static struct mdio_board_info ubnt_rocket_m_ti_mdio_info[] = {
  490. + {
  491. + .bus_id = "ag71xx-mdio.0",
  492. + .phy_addr = 4,
  493. + .platform_data = &ubnt_rocket_m_ti_at803_data,
  494. + },
  495. +};
  496. +
  497. +static void __init ubnt_rocket_m_ti_setup(void)
  498. +{
  499. + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
  500. +
  501. + ath79_register_m25p80(NULL);
  502. +
  503. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rocket_ti_leds_gpio),
  504. + ubnt_rocket_ti_leds_gpio);
  505. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  506. + ARRAY_SIZE(ubnt_xm_gpio_keys),
  507. + ubnt_xm_gpio_keys);
  508. +
  509. + ap91_pci_init(eeprom + 0x1000, NULL);
  510. +
  511. + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0);
  512. + ath79_setup_ar934x_eth_rx_delay(3, 3);
  513. + ath79_init_mac(ath79_eth0_data.mac_addr,
  514. + eeprom + UAP_PRO_MAC0_OFFSET, 0);
  515. + ath79_init_mac(ath79_eth1_data.mac_addr,
  516. + eeprom + UAP_PRO_MAC1_OFFSET, 0);
  517. +
  518. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  519. + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
  520. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  521. + ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev;
  522. +
  523. + mdiobus_register_board_info(ubnt_rocket_m_ti_mdio_info,
  524. + ARRAY_SIZE(ubnt_rocket_m_ti_mdio_info));
  525. + ath79_register_mdio(0, 0x0);
  526. +
  527. +
  528. + ath79_eth0_data.phy_mask = BIT(4);
  529. + /* read out from vendor */
  530. + ath79_eth0_pll_data.pll_1000 = 0x2000000;
  531. + ath79_eth0_pll_data.pll_10 = 0x1313;
  532. + ath79_register_eth(0);
  533. +
  534. + ath79_register_mdio(1, 0x0);
  535. + ath79_eth1_data.phy_mask = BIT(3);
  536. + ath79_register_eth(1);
  537. +}
  538. +
  539. +
  540. +MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
  541. + ubnt_nano_m_xw_setup);
  542. +
  543. +MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
  544. + ubnt_loco_m_xw_setup);
  545. +
  546. +MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
  547. + ubnt_rocket_m_xw_setup);
  548. +
  549. +MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI, "UBNT-RM-TI", "Ubiquiti Rocket M TI",
  550. + ubnt_rocket_m_ti_setup);
  551. +
  552. +static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = {
  553. + {
  554. + .name = "ubnt:blue:wlan",
  555. + .gpio = 0,
  556. + }, {
  557. + .name = "ubnt:white:status",
  558. + .gpio = 1,
  559. + },
  560. +};
  561. +
  562. +static struct gpio_keys_button airgateway_gpio_keys[] __initdata = {
  563. + {
  564. + .desc = "reset",
  565. + .type = EV_KEY,
  566. + .code = KEY_RESTART,
  567. + .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
  568. + .gpio = 12,
  569. + .active_low = 1,
  570. + }
  571. +};
  572. +
  573. +static void __init ubnt_airgateway_setup(void)
  574. +{
  575. + u32 t;
  576. + u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
  577. + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
  578. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  579. +
  580. +
  581. + ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
  582. + AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
  583. + AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
  584. + AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
  585. + AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
  586. +
  587. + t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
  588. + t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN;
  589. + ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
  590. +
  591. + ath79_register_m25p80(NULL);
  592. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds),
  593. + ubnt_airgateway_gpio_leds);
  594. +
  595. + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
  596. + ARRAY_SIZE(airgateway_gpio_keys),
  597. + airgateway_gpio_keys);
  598. +
  599. + ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
  600. + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
  601. +
  602. + ath79_register_mdio(0, 0x0);
  603. +
  604. + ath79_register_eth(1);
  605. + ath79_register_eth(0);
  606. +
  607. + ath79_register_wmac(ee, NULL);
  608. +}
  609. +
  610. +MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway",
  611. + ubnt_airgateway_setup);
  612. +
  613. --- a/arch/mips/ath79/Kconfig
  614. +++ b/arch/mips/ath79/Kconfig
  615. @@ -68,12 +68,16 @@ config ATH79_MACH_PB44
  616. Atheros PB44 reference board.
  617. config ATH79_MACH_UBNT_XM
  618. - bool "Ubiquiti Networks XM (rev 1.0) board"
  619. + bool "Ubiquiti Networks XM/UniFi boards"
  620. select SOC_AR724X
  621. + select SOC_AR934X
  622. select ATH79_DEV_AP9X_PCI if PCI
  623. + select ATH79_DEV_ETH
  624. select ATH79_DEV_GPIO_BUTTONS
  625. select ATH79_DEV_LEDS_GPIO
  626. select ATH79_DEV_M25P80
  627. + select ATH79_DEV_USB
  628. + select ATH79_DEV_WMAC
  629. help
  630. Say 'Y' here if you want your kernel to support the
  631. Ubiquiti Networks XM (rev 1.0) board.