1
0

0023-MIPS-ath79-add-Mikrotik-rb4xx-device-support.patch 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. From 7f5193750c4fb525ab7bd0610d05631b1dfbd8bb Mon Sep 17 00:00:00 2001
  2. From: Phil Sutter <phil@nwl.cc>
  3. Date: Wed, 14 May 2014 03:10:28 +0200
  4. Subject: [PATCH] MIPS: ath79: add Mikrotik rb4xx device support
  5. ---
  6. arch/mips/ath79/Kconfig | 8 +
  7. arch/mips/ath79/Makefile | 1 +
  8. arch/mips/ath79/mach-rb4xx.c | 465 +++++++++++++++++++++++++++++++++++++++++++
  9. arch/mips/ath79/machtypes.h | 9 +
  10. 4 files changed, 483 insertions(+)
  11. create mode 100644 arch/mips/ath79/mach-rb4xx.c
  12. diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig
  13. index 52cefd7..7863079 100644
  14. --- a/arch/mips/ath79/Kconfig
  15. +++ b/arch/mips/ath79/Kconfig
  16. @@ -61,6 +61,14 @@ config ATH79_MACH_PB44
  17. Say 'Y' here if you want your kernel to support the
  18. Atheros PB44 reference board.
  19. +config ATH79_MACH_RB4XX
  20. + bool "MikroTik RouterBOARD 4xx series support"
  21. + select SOC_AR71XX
  22. + select ATH79_DEV_ETH
  23. + select ATH79_DEV_GPIO_BUTTONS
  24. + select ATH79_DEV_LEDS_GPIO
  25. + select ATH79_DEV_USB
  26. +
  27. config ATH79_MACH_UBNT_XM
  28. bool "Ubiquiti Networks XM (rev 1.0) board"
  29. select SOC_AR724X
  30. diff --git a/arch/mips/ath79/Makefile b/arch/mips/ath79/Makefile
  31. index 05485da..2b0e01b 100644
  32. --- a/arch/mips/ath79/Makefile
  33. +++ b/arch/mips/ath79/Makefile
  34. @@ -32,4 +32,5 @@ obj-$(CONFIG_ATH79_MACH_AP136) += mach-ap136.o
  35. obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
  36. obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o
  37. obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
  38. +obj-$(CONFIG_ATH79_MACH_RB4XX) += mach-rb4xx.o
  39. obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o
  40. diff --git a/arch/mips/ath79/mach-rb4xx.c b/arch/mips/ath79/mach-rb4xx.c
  41. new file mode 100644
  42. index 0000000..1a61b45
  43. --- /dev/null
  44. +++ b/arch/mips/ath79/mach-rb4xx.c
  45. @@ -0,0 +1,465 @@
  46. +/*
  47. + * MikroTik RouterBOARD 4xx series support
  48. + *
  49. + * Copyright (C) 2008-2012 Gabor Juhos <juhosg@openwrt.org>
  50. + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  51. + *
  52. + * This program is free software; you can redistribute it and/or modify it
  53. + * under the terms of the GNU General Public License version 2 as published
  54. + * by the Free Software Foundation.
  55. + */
  56. +
  57. +#include <linux/platform_device.h>
  58. +#include <linux/irq.h>
  59. +#include <linux/mdio-gpio.h>
  60. +#include <linux/mmc/host.h>
  61. +#include <linux/spi/spi.h>
  62. +#include <linux/spi/flash.h>
  63. +#include <linux/spi/mmc_spi.h>
  64. +#include <linux/mtd/mtd.h>
  65. +#include <linux/mtd/partitions.h>
  66. +
  67. +#include <asm/mach-ath79/ar71xx_regs.h>
  68. +#include <asm/mach-ath79/ath79.h>
  69. +#include <asm/mach-ath79/rb4xx_cpld.h>
  70. +
  71. +#include "common.h"
  72. +#include "dev-eth.h"
  73. +#include "dev-gpio-buttons.h"
  74. +#include "dev-leds-gpio.h"
  75. +#include "dev-usb.h"
  76. +#include "machtypes.h"
  77. +#include "pci.h"
  78. +
  79. +#define RB4XX_GPIO_USER_LED 4
  80. +#define RB4XX_GPIO_RESET_SWITCH 7
  81. +
  82. +#define RB4XX_GPIO_CPLD_BASE 32
  83. +#define RB4XX_GPIO_CPLD_LED1 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED1)
  84. +#define RB4XX_GPIO_CPLD_LED2 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED2)
  85. +#define RB4XX_GPIO_CPLD_LED3 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED3)
  86. +#define RB4XX_GPIO_CPLD_LED4 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED4)
  87. +#define RB4XX_GPIO_CPLD_LED5 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED5)
  88. +
  89. +#define RB4XX_KEYS_POLL_INTERVAL 20 /* msecs */
  90. +#define RB4XX_KEYS_DEBOUNCE_INTERVAL (3 * RB4XX_KEYS_POLL_INTERVAL)
  91. +
  92. +static struct gpio_led rb4xx_leds_gpio[] __initdata = {
  93. + {
  94. + .name = "rb4xx:yellow:user",
  95. + .gpio = RB4XX_GPIO_USER_LED,
  96. + .active_low = 0,
  97. + }, {
  98. + .name = "rb4xx:green:led1",
  99. + .gpio = RB4XX_GPIO_CPLD_LED1,
  100. + .active_low = 1,
  101. + }, {
  102. + .name = "rb4xx:green:led2",
  103. + .gpio = RB4XX_GPIO_CPLD_LED2,
  104. + .active_low = 1,
  105. + }, {
  106. + .name = "rb4xx:green:led3",
  107. + .gpio = RB4XX_GPIO_CPLD_LED3,
  108. + .active_low = 1,
  109. + }, {
  110. + .name = "rb4xx:green:led4",
  111. + .gpio = RB4XX_GPIO_CPLD_LED4,
  112. + .active_low = 1,
  113. + }, {
  114. + .name = "rb4xx:green:led5",
  115. + .gpio = RB4XX_GPIO_CPLD_LED5,
  116. + .active_low = 0,
  117. + },
  118. +};
  119. +
  120. +static struct gpio_keys_button rb4xx_gpio_keys[] __initdata = {
  121. + {
  122. + .desc = "reset_switch",
  123. + .type = EV_KEY,
  124. + .code = KEY_RESTART,
  125. + .debounce_interval = RB4XX_KEYS_DEBOUNCE_INTERVAL,
  126. + .gpio = RB4XX_GPIO_RESET_SWITCH,
  127. + .active_low = 1,
  128. + }
  129. +};
  130. +
  131. +static struct platform_device rb4xx_nand_device = {
  132. + .name = "rb4xx-nand",
  133. + .id = -1,
  134. +};
  135. +
  136. +static struct ath79_pci_irq rb4xx_pci_irqs[] __initdata = {
  137. + {
  138. + .slot = 17,
  139. + .pin = 1,
  140. + .irq = ATH79_PCI_IRQ(2),
  141. + }, {
  142. + .slot = 18,
  143. + .pin = 1,
  144. + .irq = ATH79_PCI_IRQ(0),
  145. + }, {
  146. + .slot = 18,
  147. + .pin = 2,
  148. + .irq = ATH79_PCI_IRQ(1),
  149. + }, {
  150. + .slot = 19,
  151. + .pin = 1,
  152. + .irq = ATH79_PCI_IRQ(1),
  153. + }, {
  154. + .slot = 19,
  155. + .pin = 2,
  156. + .irq = ATH79_PCI_IRQ(2),
  157. + }, {
  158. + .slot = 20,
  159. + .pin = 1,
  160. + .irq = ATH79_PCI_IRQ(2),
  161. + }, {
  162. + .slot = 20,
  163. + .pin = 2,
  164. + .irq = ATH79_PCI_IRQ(0),
  165. + }, {
  166. + .slot = 21,
  167. + .pin = 1,
  168. + .irq = ATH79_PCI_IRQ(0),
  169. + }, {
  170. + .slot = 22,
  171. + .pin = 1,
  172. + .irq = ATH79_PCI_IRQ(1),
  173. + }, {
  174. + .slot = 22,
  175. + .pin = 2,
  176. + .irq = ATH79_PCI_IRQ(2),
  177. + }, {
  178. + .slot = 23,
  179. + .pin = 1,
  180. + .irq = ATH79_PCI_IRQ(2),
  181. + }, {
  182. + .slot = 23,
  183. + .pin = 2,
  184. + .irq = ATH79_PCI_IRQ(0),
  185. + }
  186. +};
  187. +
  188. +static struct mtd_partition rb4xx_partitions[] = {
  189. + {
  190. + .name = "routerboot",
  191. + .offset = 0,
  192. + .size = 0x0b000,
  193. + .mask_flags = MTD_WRITEABLE,
  194. + }, {
  195. + .name = "hard_config",
  196. + .offset = 0x0b000,
  197. + .size = 0x01000,
  198. + .mask_flags = MTD_WRITEABLE,
  199. + }, {
  200. + .name = "bios",
  201. + .offset = 0x0d000,
  202. + .size = 0x02000,
  203. + .mask_flags = MTD_WRITEABLE,
  204. + }, {
  205. + .name = "soft_config",
  206. + .offset = 0x0f000,
  207. + .size = 0x01000,
  208. + }
  209. +};
  210. +
  211. +static struct flash_platform_data rb4xx_flash_data = {
  212. + .type = "pm25lv512",
  213. + .parts = rb4xx_partitions,
  214. + .nr_parts = ARRAY_SIZE(rb4xx_partitions),
  215. +};
  216. +
  217. +static struct rb4xx_cpld_platform_data rb4xx_cpld_data = {
  218. + .gpio_base = RB4XX_GPIO_CPLD_BASE,
  219. +};
  220. +
  221. +static struct mmc_spi_platform_data rb4xx_mmc_data = {
  222. + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  223. +};
  224. +
  225. +static struct spi_board_info rb4xx_spi_info[] = {
  226. + {
  227. + .bus_num = 0,
  228. + .chip_select = 0,
  229. + .max_speed_hz = 25000000,
  230. + .modalias = "m25p80",
  231. + .platform_data = &rb4xx_flash_data,
  232. + }, {
  233. + .bus_num = 0,
  234. + .chip_select = 1,
  235. + .max_speed_hz = 25000000,
  236. + .modalias = "spi-rb4xx-cpld",
  237. + .platform_data = &rb4xx_cpld_data,
  238. + }
  239. +};
  240. +
  241. +static struct spi_board_info rb4xx_microsd_info[] = {
  242. + {
  243. + .bus_num = 0,
  244. + .chip_select = 2,
  245. + .max_speed_hz = 25000000,
  246. + .modalias = "mmc_spi",
  247. + .platform_data = &rb4xx_mmc_data,
  248. + }
  249. +};
  250. +
  251. +
  252. +static struct resource rb4xx_spi_resources[] = {
  253. + {
  254. + .start = AR71XX_SPI_BASE,
  255. + .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
  256. + .flags = IORESOURCE_MEM,
  257. + },
  258. +};
  259. +
  260. +static struct platform_device rb4xx_spi_device = {
  261. + .name = "rb4xx-spi",
  262. + .id = -1,
  263. + .resource = rb4xx_spi_resources,
  264. + .num_resources = ARRAY_SIZE(rb4xx_spi_resources),
  265. +};
  266. +
  267. +static void __init rb4xx_generic_setup(void)
  268. +{
  269. + ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN |
  270. + AR71XX_GPIO_FUNC_SPI_CS2_EN);
  271. +
  272. + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
  273. + rb4xx_leds_gpio);
  274. +
  275. + ath79_register_gpio_keys_polled(-1, RB4XX_KEYS_POLL_INTERVAL,
  276. + ARRAY_SIZE(rb4xx_gpio_keys),
  277. + rb4xx_gpio_keys);
  278. +
  279. + spi_register_board_info(rb4xx_spi_info, ARRAY_SIZE(rb4xx_spi_info));
  280. + platform_device_register(&rb4xx_spi_device);
  281. + platform_device_register(&rb4xx_nand_device);
  282. +}
  283. +
  284. +static void __init rb411_setup(void)
  285. +{
  286. + rb4xx_generic_setup();
  287. + spi_register_board_info(rb4xx_microsd_info,
  288. + ARRAY_SIZE(rb4xx_microsd_info));
  289. +
  290. + ath79_register_mdio(0, 0xfffffffc);
  291. +
  292. + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
  293. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  294. + ath79_eth0_data.phy_mask = 0x00000003;
  295. +
  296. + ath79_register_eth(0);
  297. +
  298. + ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
  299. + ath79_register_pci();
  300. +}
  301. +
  302. +MIPS_MACHINE(ATH79_MACH_RB_411, "411", "MikroTik RouterBOARD 411/A/AH",
  303. + rb411_setup);
  304. +
  305. +static void __init rb411u_setup(void)
  306. +{
  307. + rb411_setup();
  308. + ath79_register_usb();
  309. +}
  310. +
  311. +MIPS_MACHINE(ATH79_MACH_RB_411U, "411U", "MikroTik RouterBOARD 411U",
  312. + rb411u_setup);
  313. +
  314. +#define RB433_LAN_PHYMASK BIT(0)
  315. +#define RB433_WAN_PHYMASK BIT(4)
  316. +#define RB433_MDIO_PHYMASK (RB433_LAN_PHYMASK | RB433_WAN_PHYMASK)
  317. +
  318. +static void __init rb433_setup(void)
  319. +{
  320. + rb4xx_generic_setup();
  321. + spi_register_board_info(rb4xx_microsd_info,
  322. + ARRAY_SIZE(rb4xx_microsd_info));
  323. +
  324. + ath79_register_mdio(0, ~RB433_MDIO_PHYMASK);
  325. +
  326. + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 1);
  327. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  328. + ath79_eth0_data.phy_mask = RB433_LAN_PHYMASK;
  329. +
  330. + ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0);
  331. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
  332. + ath79_eth1_data.phy_mask = RB433_WAN_PHYMASK;
  333. +
  334. + ath79_register_eth(1);
  335. + ath79_register_eth(0);
  336. +
  337. + ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
  338. + ath79_register_pci();
  339. +}
  340. +
  341. +MIPS_MACHINE(ATH79_MACH_RB_433, "433", "MikroTik RouterBOARD 433/AH",
  342. + rb433_setup);
  343. +
  344. +static void __init rb433u_setup(void)
  345. +{
  346. + rb433_setup();
  347. + ath79_register_usb();
  348. +}
  349. +
  350. +MIPS_MACHINE(ATH79_MACH_RB_433U, "433U", "MikroTik RouterBOARD 433UAH",
  351. + rb433u_setup);
  352. +
  353. +static void __init rb435g_setup(void)
  354. +{
  355. + rb4xx_generic_setup();
  356. +
  357. + spi_register_board_info(rb4xx_microsd_info,
  358. + ARRAY_SIZE(rb4xx_microsd_info));
  359. +
  360. + ath79_register_mdio(0, ~RB433_MDIO_PHYMASK);
  361. +
  362. + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 1);
  363. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  364. + ath79_eth0_data.phy_mask = RB433_LAN_PHYMASK;
  365. +
  366. + ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0);
  367. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  368. + ath79_eth1_data.phy_mask = RB433_WAN_PHYMASK;
  369. +
  370. + ath79_register_eth(1);
  371. + ath79_register_eth(0);
  372. +
  373. + ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
  374. + ath79_register_pci();
  375. +
  376. + ath79_register_usb();
  377. +}
  378. +
  379. +MIPS_MACHINE(ATH79_MACH_RB_435G, "435G", "MikroTik RouterBOARD 435G",
  380. + rb435g_setup);
  381. +
  382. +#define RB450_LAN_PHYMASK BIT(0)
  383. +#define RB450_WAN_PHYMASK BIT(4)
  384. +#define RB450_MDIO_PHYMASK (RB450_LAN_PHYMASK | RB450_WAN_PHYMASK)
  385. +
  386. +static void __init rb450_generic_setup(int gige)
  387. +{
  388. + rb4xx_generic_setup();
  389. + ath79_register_mdio(0, ~RB450_MDIO_PHYMASK);
  390. +
  391. + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 1);
  392. + ath79_eth0_data.phy_if_mode = (gige) ?
  393. + PHY_INTERFACE_MODE_RGMII : PHY_INTERFACE_MODE_MII;
  394. + ath79_eth0_data.phy_mask = RB450_LAN_PHYMASK;
  395. +
  396. + ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0);
  397. + ath79_eth1_data.phy_if_mode = (gige) ?
  398. + PHY_INTERFACE_MODE_RGMII : PHY_INTERFACE_MODE_RMII;
  399. + ath79_eth1_data.phy_mask = RB450_WAN_PHYMASK;
  400. +
  401. + ath79_register_eth(1);
  402. + ath79_register_eth(0);
  403. +}
  404. +
  405. +static void __init rb450_setup(void)
  406. +{
  407. + rb450_generic_setup(0);
  408. +}
  409. +
  410. +MIPS_MACHINE(ATH79_MACH_RB_450, "450", "MikroTik RouterBOARD 450",
  411. + rb450_setup);
  412. +
  413. +static void __init rb450g_setup(void)
  414. +{
  415. + rb450_generic_setup(1);
  416. + spi_register_board_info(rb4xx_microsd_info,
  417. + ARRAY_SIZE(rb4xx_microsd_info));
  418. +}
  419. +
  420. +MIPS_MACHINE(ATH79_MACH_RB_450G, "450G", "MikroTik RouterBOARD 450G",
  421. + rb450g_setup);
  422. +
  423. +static void __init rb493_setup(void)
  424. +{
  425. + rb4xx_generic_setup();
  426. +
  427. + ath79_register_mdio(0, 0x3fffff00);
  428. +
  429. + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
  430. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  431. + ath79_eth0_data.speed = SPEED_100;
  432. + ath79_eth0_data.duplex = DUPLEX_FULL;
  433. +
  434. + ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
  435. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
  436. + ath79_eth1_data.phy_mask = 0x00000001;
  437. +
  438. + ath79_register_eth(0);
  439. + ath79_register_eth(1);
  440. +
  441. + ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
  442. + ath79_register_pci();
  443. +}
  444. +
  445. +MIPS_MACHINE(ATH79_MACH_RB_493, "493", "MikroTik RouterBOARD 493/AH",
  446. + rb493_setup);
  447. +
  448. +#define RB493G_GPIO_MDIO_MDC 7
  449. +#define RB493G_GPIO_MDIO_DATA 8
  450. +
  451. +#define RB493G_MDIO_PHYMASK BIT(0)
  452. +
  453. +static struct mdio_gpio_platform_data rb493g_mdio_data = {
  454. + .mdc = RB493G_GPIO_MDIO_MDC,
  455. + .mdio = RB493G_GPIO_MDIO_DATA,
  456. +
  457. + .phy_mask = ~RB493G_MDIO_PHYMASK,
  458. +};
  459. +
  460. +static struct platform_device rb493g_mdio_device = {
  461. + .name = "mdio-gpio",
  462. + .id = -1,
  463. + .dev = {
  464. + .platform_data = &rb493g_mdio_data,
  465. + },
  466. +};
  467. +
  468. +static void __init rb493g_setup(void)
  469. +{
  470. + ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN |
  471. + AR71XX_GPIO_FUNC_SPI_CS2_EN);
  472. +
  473. + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
  474. + rb4xx_leds_gpio);
  475. +
  476. + spi_register_board_info(rb4xx_spi_info, ARRAY_SIZE(rb4xx_spi_info));
  477. + spi_register_board_info(rb4xx_microsd_info,
  478. + ARRAY_SIZE(rb4xx_microsd_info));
  479. +
  480. + platform_device_register(&rb4xx_spi_device);
  481. + platform_device_register(&rb4xx_nand_device);
  482. +
  483. + ath79_register_mdio(0, ~RB493G_MDIO_PHYMASK);
  484. +
  485. + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
  486. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  487. + ath79_eth0_data.phy_mask = RB493G_MDIO_PHYMASK;
  488. + ath79_eth0_data.speed = SPEED_1000;
  489. + ath79_eth0_data.duplex = DUPLEX_FULL;
  490. +
  491. + ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
  492. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  493. + ath79_eth1_data.mii_bus_dev = &rb493g_mdio_device.dev;
  494. + ath79_eth1_data.phy_mask = RB493G_MDIO_PHYMASK;
  495. + ath79_eth1_data.speed = SPEED_1000;
  496. + ath79_eth1_data.duplex = DUPLEX_FULL;
  497. +
  498. + platform_device_register(&rb493g_mdio_device);
  499. +
  500. + ath79_register_eth(1);
  501. + ath79_register_eth(0);
  502. +
  503. + ath79_register_usb();
  504. +
  505. + ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
  506. + ath79_register_pci();
  507. +}
  508. +
  509. +MIPS_MACHINE(ATH79_MACH_RB_493G, "493G", "MikroTik RouterBOARD 493G",
  510. + rb493g_setup);
  511. diff --git a/arch/mips/ath79/machtypes.h b/arch/mips/ath79/machtypes.h
  512. index 2625405..7630954 100644
  513. --- a/arch/mips/ath79/machtypes.h
  514. +++ b/arch/mips/ath79/machtypes.h
  515. @@ -21,6 +21,15 @@ enum ath79_mach_type {
  516. ATH79_MACH_AP81, /* Atheros AP81 reference board */
  517. ATH79_MACH_DB120, /* Atheros DB120 reference board */
  518. ATH79_MACH_PB44, /* Atheros PB44 reference board */
  519. + ATH79_MACH_RB_411, /* MikroTik RouterBOARD 411/411A/411AH */
  520. + ATH79_MACH_RB_411U, /* MikroTik RouterBOARD 411U */
  521. + ATH79_MACH_RB_433, /* MikroTik RouterBOARD 433/433AH */
  522. + ATH79_MACH_RB_433U, /* MikroTik RouterBOARD 433UAH */
  523. + ATH79_MACH_RB_435G, /* MikroTik RouterBOARD 435G */
  524. + ATH79_MACH_RB_450G, /* MikroTik RouterBOARD 450G */
  525. + ATH79_MACH_RB_450, /* MikroTik RouterBOARD 450 */
  526. + ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */
  527. + ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */
  528. ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
  529. };
  530. --
  531. 1.8.5.3