Advertisement
Guest User

Openwrt Patch Comfast

a guest
Oct 3rd, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.29 KB | None | 0 0
  1. From 22178392df8d1cb9c959dfbc1c20f28b24551250 Mon Sep 17 00:00:00 2001
  2. Date: Sat, 3 Oct 2015 08:31:13 -0300
  3. Subject: [PATCH] Add Comfast compatibility
  4.  
  5. ---
  6. .../ar71xx/base-files/etc/uci-defaults/01_leds | 31 ++
  7. .../ar71xx/base-files/etc/uci-defaults/02_network | 49 +++
  8. target/linux/ar71xx/base-files/lib/ar71xx.sh | 12 +
  9. .../ar71xx/base-files/lib/upgrade/platform.sh | 8 +
  10. target/linux/ar71xx/config-3.18 | 5 +
  11. .../ar71xx/files/arch/mips/ath79/mach-comfast.c | 485 +++++++++++++++++++++
  12. target/linux/ar71xx/generic/profiles/comfast.mk | 49 +++
  13. target/linux/ar71xx/image/Makefile | 102 +++++
  14. .../610-MIPS-ath79-openwrt-machines.patch | 32 +-
  15. .../patches-3.18/614-MIPS-ath79-wdt-timeout.patch | 54 +++
  16. 10 files changed, 821 insertions(+), 6 deletions(-)
  17. create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
  18. create mode 100644 target/linux/ar71xx/generic/profiles/comfast.mk
  19. create mode 100644 target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch
  20.  
  21. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  22. index d628f1a..969b97a 100644
  23. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  24. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  25. @@ -50,6 +50,37 @@ bsb)
  26. ucidef_set_led_default "sys" "SYS" "bsb:red:sys" "1"
  27. ;;
  28.  
  29. +ap9341fe)
  30. + ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
  31. + ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
  32. + ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
  33. + ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
  34. + ;;
  35. +
  36. +cf-e316nv2)
  37. + ucidef_set_led_netdev "wan" "WAN" "comfast:white:wan" "eth1"
  38. + ucidef_set_led_netdev "lan" "LAN" "comfast:white:lan" "eth0"
  39. + ucidef_set_led_wlan "wlan" "WLAN" "comfast:white:wifi" "phy0tpt"
  40. + ;;
  41. +
  42. +cf-e325n)
  43. + ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
  44. + ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
  45. + ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
  46. + ;;
  47. +
  48. +cf-wr600n)
  49. + ucidef_set_led_netdev "wan1" "WAN1" "cf_wr600n:green:wan1" "eth0"
  50. + ucidef_set_led_switch "lan1" "LAN1" "cf_wr600n:green:lan1" "switch0" "0x04"
  51. + ucidef_set_led_switch "lan2" "LAN2" "cf_wr600n:green:lan2" "switch0" "0x08"
  52. + ucidef_set_led_switch "lan3" "LAN3" "cf_wr600n:green:lan3" "switch0" "0x10"
  53. +# ucidef_set_led_switch "lan4" "LAN4" "cf_wr600n:green:lan4" "switch0" "0x02"
  54. +# ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
  55. + ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth0"
  56. + ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth1"
  57. + ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
  58. + ;;
  59. +
  60. bullet-m | \
  61. nanostation-m | \
  62. rocket-m | \
  63. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  64. index 7e26886..2fb753e 100644
  65. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  66. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  67. @@ -55,6 +55,55 @@ wzr-450hp2)
  68. ucidef_add_switch_vlan "switch0" "2" "5 6"
  69. ;;
  70.  
  71. +ap9341fe)
  72. + ucidef_set_interfaces_lan_wan "eth0" "eth1"
  73. + ucidef_add_switch "switch0" "1" "1"
  74. + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
  75. + lan_mac=$(cat /sys/class/net/eth0/address)
  76. + wlan_mac=$(macaddr_add "$lan_mac" 1)
  77. + wan_mac=$(macaddr_add "$lan_mac" 2)
  78. + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
  79. + [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
  80. + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
  81. + ;;
  82. +
  83. +cf-e316nv2)
  84. + ucidef_set_interfaces_lan_wan "eth0" "eth1"
  85. + ucidef_add_switch "switch0" "1" "1"
  86. + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
  87. + lan_mac=$(cat /sys/class/net/eth0/address)
  88. + wlan_mac=$(macaddr_add "$lan_mac" 1)
  89. + wan_mac=$(macaddr_add "$lan_mac" 2)
  90. + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
  91. + [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
  92. + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
  93. + ;;
  94. +
  95. +cf-e325n)
  96. + ucidef_set_interfaces_lan_wan "eth0" "eth1"
  97. + ucidef_add_switch "switch0" "1" "1"
  98. + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
  99. + lan_mac=$(cat /sys/class/net/eth0/address)
  100. + wlan_mac=$(macaddr_add "$lan_mac" 1)
  101. + wan_mac=$(macaddr_add "$lan_mac" 2)
  102. + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
  103. + [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
  104. + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
  105. + ;;
  106. +
  107. +cf-wr600n)
  108. + ucidef_set_interfaces_lan_wan "eth1" "eth0"
  109. + ucidef_add_switch "switch0" "1" "1"
  110. + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
  111. + lan_mac=$(cat /sys/class/net/eth1/address)
  112. + wlan_mac=$(macaddr_add "$lan_mac" 1)
  113. + wan_mac=$(macaddr_add "$lan_mac" 2)
  114. + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
  115. + [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
  116. + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
  117. + ;;
  118. +
  119. +
  120. archer-c5 |\
  121. archer-c7 |\
  122. tl-wdr4900-v2)
  123. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  124. index cacf362..32fdbfc 100755
  125. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  126. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  127. @@ -380,6 +380,18 @@ ar71xx_board_detect() {
  128. *AW-NR580)
  129. name="aw-nr580"
  130. ;;
  131. + *AP9341FE)
  132. + name="ap9341fe"
  133. + ;;
  134. + *CF-E316NV2)
  135. + name="cf-e316nv2"
  136. + ;;
  137. + *CF-E325N)
  138. + name="cf-e325n"
  139. + ;;
  140. + *CF-WR600N)
  141. + name="cf-wr600n"
  142. + ;;
  143. *CAP4200AG)
  144. name="cap4200ag"
  145. ;;
  146. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  147. index e5376ef..22cae6b 100755
  148. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  149. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  150. @@ -387,6 +387,10 @@ platform_check_image() {
  151. return 1
  152. ;;
  153.  
  154. + ap9341fe | \
  155. + cf-e316nv2 | \
  156. + cf-e325n | \
  157. + cf-wr600n | \
  158. unifi-outdoor-plus | \
  159. uap-pro)
  160. [ "$magic_long" != "19852003" ] && {
  161. @@ -518,6 +522,10 @@ platform_do_upgrade() {
  162. om5p-an)
  163. platform_do_upgrade_openmesh "$ARGV"
  164. ;;
  165. + ap9341fe | \
  166. + cf-e316nv2 | \
  167. + cf-e325n | \
  168. + cf-wr600n | \
  169. unifi-outdoor-plus | \
  170. uap-pro)
  171. MTD_CONFIG_ARGS="-s 0x180000"
  172. diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
  173. index d661aa7..ea3ff09 100644
  174. --- a/target/linux/ar71xx/config-3.18
  175. +++ b/target/linux/ar71xx/config-3.18
  176. @@ -46,6 +46,11 @@ CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
  177. CONFIG_ATH79_MACH_BSB=y
  178. CONFIG_ATH79_MACH_CAP4200AG=y
  179. CONFIG_ATH79_MACH_CARAMBOLA2=y
  180. +CONFIG_ATH79_MACH_COMFAST=y
  181. +CONFIG_ATH79_MACH_COMFAST_AP9341FE=y
  182. +CONFIG_ATH79_MACH_COMFAST_CF_E316NV2=y
  183. +CONFIG_ATH79_MACH_COMFAST_CF_E325N=y
  184. +CONFIG_ATH79_MACH_COMFAST_CF_WR600N=y
  185. CONFIG_ATH79_MACH_CPE510=y
  186. CONFIG_ATH79_MACH_DB120=y
  187. CONFIG_ATH79_MACH_DGL_5500_A1=y
  188. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
  189. new file mode 100644
  190. index 0000000..d5d8b8b
  191. --- /dev/null
  192. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
  193. @@ -0,0 +1,485 @@
  194. +#include <linux/init.h>
  195. +#include <linux/pci.h>
  196. +#include <linux/platform_device.h>
  197. +#include <linux/ath9k_platform.h>
  198. +#include <linux/etherdevice.h>
  199. +#include <linux/ar8216_platform.h>
  200. +
  201. +#include <asm/mach-ath79/irq.h>
  202. +#include <asm/mach-ath79/ar71xx_regs.h>
  203. +
  204. +#include "common.h"
  205. +#include "dev-ap9x-pci.h"
  206. +#include "dev-eth.h"
  207. +#include "dev-gpio-buttons.h"
  208. +#include "dev-leds-gpio.h"
  209. +#include "dev-m25p80.h"
  210. +#include "dev-usb.h"
  211. +#include "dev-wmac.h"
  212. +#include "dev-nfc.h"
  213. +#include "gpio.h"
  214. +#include "machtypes.h"
  215. +
  216. +#define COMFAST_KEYS_POLL_INTERVAL 20
  217. +#define COMFAST_KEYS_DEBOUNCE_INTERVAL (3 * COMFAST_KEYS_POLL_INTERVAL)
  218. +
  219. +#define AP9341FE_GPIO_XWDT_TRIGGER 16
  220. +
  221. +#define XWDT_AUTOFEED_DURATION (HZ / 3)
  222. +static int gpio_external_wdt = -1;
  223. +static int wdt_timeout = -1, wdt_autofeed_count = 0;
  224. +
  225. +static void watchdog_fire(unsigned long);
  226. +static struct timer_list watchdog_ticktock = TIMER_INITIALIZER(watchdog_fire, 0, 0);
  227. +
  228. +static void enable_external_wdt(int gpio)
  229. +{
  230. + gpio_external_wdt = gpio;
  231. + wdt_timeout = -1;
  232. + mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
  233. +}
  234. +
  235. +static void external_wdt_toggle(void)
  236. +{
  237. + static u32 data;
  238. + data ++;
  239. + gpio_set_value(gpio_external_wdt, data & 0x01);
  240. +}
  241. +
  242. +void ath79_external_wdt_disable(void)
  243. +{
  244. + if(gpio_external_wdt >= 0) {
  245. + wdt_timeout = -1;
  246. + mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
  247. + }
  248. +}
  249. +EXPORT_SYMBOL(ath79_external_wdt_disable);
  250. +
  251. +void ath79_external_wdt_trigger(void)
  252. +{
  253. + if(gpio_external_wdt >= 0) {
  254. +// printk(KERN_ERR "XWDT TRIGGER\n");
  255. + wdt_autofeed_count = 0;
  256. + mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
  257. + }
  258. +}
  259. +EXPORT_SYMBOL(ath79_external_wdt_trigger);
  260. +
  261. +void ath79_external_wdt_set_timeout(int timeout)
  262. +{
  263. + if(gpio_external_wdt >= 0) {
  264. + wdt_timeout = timeout;
  265. + external_wdt_toggle();
  266. +// printk(KERN_ERR "XWDT SET TIMEOUT: %d\n", timeout);
  267. + }
  268. +}
  269. +EXPORT_SYMBOL(ath79_external_wdt_set_timeout);
  270. +
  271. +static void watchdog_fire(unsigned long data)
  272. +{
  273. + if(wdt_timeout > 0)
  274. + wdt_autofeed_count++;
  275. +
  276. + if((wdt_timeout < 0) || (wdt_autofeed_count < wdt_timeout)) {
  277. +// printk(KERN_ERR "XWDT AUTOFEED: %d\n", wdt_autofeed_count);
  278. + external_wdt_toggle();
  279. + mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
  280. + }
  281. +}
  282. +
  283. +static struct gpio_keys_button comfast_ap934x_gpio_keys[] __initdata = {
  284. + {
  285. + .desc = "reset",
  286. + .type = EV_KEY,
  287. + .code = KEY_RESTART,
  288. + .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
  289. + .gpio = 20,
  290. + .active_low = 1,
  291. + }
  292. +};
  293. +
  294. +static struct gpio_led comfast_ap934x_gpio_leds[] __initdata = {
  295. + {
  296. + .name = "comfast:red",
  297. + .gpio = 2,
  298. + }, {
  299. + .name = "comfast:green",
  300. + .gpio = 3,
  301. + }, {
  302. + .name = "comfast:blue",
  303. + .gpio = 0,
  304. + }
  305. +};
  306. +
  307. +static void ext_lna_control_gpio_setup(int gpio_rx0, int gpio_rx1)
  308. +{
  309. + ath79_gpio_output_select(gpio_rx0, AR934X_GPIO_OUT_EXT_LNA0);
  310. + ath79_gpio_output_select(gpio_rx1, AR934X_GPIO_OUT_EXT_LNA1);
  311. +}
  312. +
  313. +
  314. +static void __init comfast_ap9341fe_setup(void)
  315. +{
  316. + u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
  317. + u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
  318. +
  319. + /* Disable JTAG, enabling GPIOs 0-3 */
  320. + /* Configure OBS4 line, for GPIO 4*/
  321. + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, AR934X_GPIO_FUNC_CLK_OBS4_EN);
  322. +
  323. + ath79_gpio_output_select(AP9341FE_GPIO_XWDT_TRIGGER, 0);
  324. + enable_external_wdt(AP9341FE_GPIO_XWDT_TRIGGER);
  325. +
  326. + ath79_register_m25p80(NULL);
  327. +
  328. + ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_ap934x_gpio_leds),
  329. + comfast_ap934x_gpio_leds);
  330. + ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
  331. + ARRAY_SIZE(comfast_ap934x_gpio_keys),
  332. + comfast_ap934x_gpio_keys);
  333. +
  334. + ext_lna_control_gpio_setup(13, 14);
  335. +
  336. + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
  337. +
  338. + ath79_register_mdio(1, 0x0);
  339. +
  340. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  341. + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
  342. +
  343. + /* GMAC0 is connected to the PHY0 of the internal switch */
  344. + ath79_switch_data.phy4_mii_en = 1;
  345. + ath79_switch_data.phy_poll_mask = BIT(0);
  346. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  347. + ath79_eth0_data.phy_mask = BIT(0);
  348. + ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
  349. + ath79_register_eth(0);
  350. +
  351. + /* GMAC1 is connected to the internal switch */
  352. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  353. +
  354. + ath79_register_eth(1);
  355. +
  356. + ath79_register_usb();
  357. +
  358. + ath79_register_wmac(art, NULL);
  359. +}
  360. +MIPS_MACHINE(ATH79_MACH_COMFAST_AP9341FE, "COMFAST-AP9341FE", "COMFAST AP9341FE", comfast_ap9341fe_setup);
  361. +
  362. +#define CF_WR600N_GPIO_LED_LAN1 22
  363. +#define CF_WR600N_GPIO_LED_LAN2 11
  364. +#define CF_WR600N_GPIO_LED_LAN3 19
  365. +#define CF_WR600N_GPIO_LED_WAN1 18
  366. +
  367. +#define CF_WR600N_GPIO_XWDT_TRIGGER 20
  368. +
  369. +static struct gpio_keys_button comfast_cf_wr600n_gpio_keys[] __initdata = {
  370. + {
  371. + .desc = "reset",
  372. + .type = EV_KEY,
  373. + .code = KEY_RESTART,
  374. + .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
  375. + .gpio = 16,
  376. + .active_low = 1,
  377. + }
  378. +};
  379. +
  380. +static struct gpio_led comfast_cf_wr600n_gpio_leds[] __initdata = {
  381. + {
  382. + .name = "comfast:red",
  383. + .gpio = 2,
  384. + }, {
  385. + .name = "comfast:green",
  386. + .gpio = 3,
  387. + }, {
  388. + .name = "comfast:blue",
  389. + .gpio = 0,
  390. + }, {
  391. + .name = "cf_wr600n:green:lan1",
  392. + .gpio = CF_WR600N_GPIO_LED_LAN1,
  393. + .active_low = 1,
  394. + }, {
  395. + .name = "cf_wr600n:green:lan2",
  396. + .gpio = CF_WR600N_GPIO_LED_LAN2,
  397. + .active_low = 1,
  398. + }, {
  399. + .name = "cf_wr600n:green:lan3",
  400. + .gpio = CF_WR600N_GPIO_LED_LAN3,
  401. + .active_low = 1,
  402. + }, {
  403. + .name = "cf_wr600n:green:wan1",
  404. + .gpio = CF_WR600N_GPIO_LED_WAN1,
  405. + .active_low = 1,
  406. + },
  407. +};
  408. +
  409. +
  410. +static void __init comfast_cf_wr600n_setup(void)
  411. +{
  412. + u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
  413. + u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
  414. +
  415. + /* Disable JTAG, enabling GPIOs 0-3 */
  416. + /* Configure OBS4 line, for GPIO 4*/
  417. + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, AR934X_GPIO_FUNC_CLK_OBS4_EN);
  418. +
  419. +// ath79_gpio_output_select(CF_WR600N_GPIO_XWDT_TRIGGER, 0);
  420. +// enable_external_wdt(CF_WR600N_GPIO_XWDT_TRIGGER);
  421. +
  422. + ath79_register_m25p80(NULL);
  423. +
  424. + ath79_gpio_output_select(CF_WR600N_GPIO_LED_LAN2, 0);
  425. +
  426. + ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_cf_wr600n_gpio_leds),
  427. + comfast_cf_wr600n_gpio_leds);
  428. + ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
  429. + ARRAY_SIZE(comfast_cf_wr600n_gpio_keys),
  430. + comfast_cf_wr600n_gpio_keys);
  431. +
  432. + ext_lna_control_gpio_setup(13, 14);
  433. +
  434. + ath79_register_mdio(1, 0x0);
  435. +
  436. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  437. + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
  438. +
  439. + /* GMAC0 is connected to the PHY0 of the internal switch */
  440. + ath79_switch_data.phy4_mii_en = 1;
  441. + ath79_switch_data.phy_poll_mask = BIT(4);
  442. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  443. + ath79_eth0_data.phy_mask = BIT(4);
  444. + ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
  445. + ath79_register_eth(0);
  446. +
  447. + /* GMAC1 is connected to the internal switch */
  448. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  449. +
  450. + ath79_register_eth(1);
  451. +
  452. + ath79_register_usb();
  453. +
  454. + ath79_register_wmac(art, NULL);
  455. +}
  456. +
  457. +MIPS_MACHINE(ATH79_MACH_COMFAST_CF_WR600N, "COMFAST-CF-WR600N", "COMFAST CF-WR600N", comfast_cf_wr600n_setup);
  458. +
  459. +#define CF_E316NV2_GPIO_XWDT_TRIGGER 16
  460. +
  461. +static struct gpio_keys_button comfast_cf_e316nv2_gpio_keys[] __initdata = {
  462. + {
  463. + .desc = "reset",
  464. + .type = EV_KEY,
  465. + .code = KEY_RESTART,
  466. + .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
  467. + .gpio = 20,
  468. + .active_low = 1,
  469. + }
  470. +};
  471. +
  472. +static struct gpio_led comfast_cf_e316nv2_gpio_leds[] __initdata = {
  473. + {
  474. + .name = "comfast:white:wifi",
  475. + .gpio = 12,
  476. + .active_low = 1,
  477. + }, {
  478. + .name = "comfast:white:lan",
  479. + .gpio = 19,
  480. + .active_low = 1,
  481. + }, {
  482. + .name = "comfast:white:wan",
  483. + .gpio = 17,
  484. + .active_low = 1,
  485. + }, {
  486. + .name = "comfast:green",
  487. + .gpio = 3,
  488. + }
  489. +};
  490. +
  491. +static void __init comfast_cf_e316nv2_setup(void)
  492. +{
  493. + u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
  494. + u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
  495. +
  496. + /* Disable JTAG, enabling GPIOs 0-3 */
  497. + /* Configure OBS4 line, for GPIO 4*/
  498. + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, AR934X_GPIO_FUNC_CLK_OBS4_EN);
  499. +
  500. + ath79_gpio_output_select(CF_E316NV2_GPIO_XWDT_TRIGGER, 0);
  501. + enable_external_wdt(CF_E316NV2_GPIO_XWDT_TRIGGER);
  502. +
  503. + ath79_register_m25p80(NULL);
  504. +
  505. + ath79_gpio_output_select(12, 0);
  506. + ath79_gpio_output_select(17, 0);
  507. + ath79_gpio_output_select(19, 0);
  508. +
  509. + ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_cf_e316nv2_gpio_leds),
  510. + comfast_cf_e316nv2_gpio_leds);
  511. + ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
  512. + ARRAY_SIZE(comfast_cf_e316nv2_gpio_keys),
  513. + comfast_cf_e316nv2_gpio_keys);
  514. +
  515. + ext_lna_control_gpio_setup(13, 14);
  516. +
  517. + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
  518. +
  519. + ath79_register_mdio(1, 0x0);
  520. +
  521. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  522. + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
  523. +
  524. + /* GMAC0 is connected to the PHY0 of the internal switch */
  525. + ath79_switch_data.phy4_mii_en = 1;
  526. + ath79_switch_data.phy_poll_mask = BIT(0);
  527. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  528. + ath79_eth0_data.phy_mask = BIT(0);
  529. + ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
  530. + ath79_register_eth(0);
  531. +
  532. + /* GMAC1 is connected to the internal switch */
  533. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  534. +
  535. + ath79_register_eth(1);
  536. +
  537. + ath79_register_usb();
  538. +
  539. + ath79_register_wmac(art, NULL);
  540. +}
  541. +MIPS_MACHINE(ATH79_MACH_COMFAST_CF_E316NV2, "COMFAST-CF-E316NV2", "COMFAST CF-E316NV2", comfast_cf_e316nv2_setup);
  542. +
  543. +#define CF_E325N_GPIO_XWDT_TRIGGER 16
  544. +
  545. +static struct gpio_keys_button comfast_cf_e325n_gpio_keys[] __initdata = {
  546. + {
  547. + .desc = "reset",
  548. + .type = EV_KEY,
  549. + .code = KEY_RESTART,
  550. + .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
  551. + .gpio = 20,
  552. + .active_low = 1,
  553. + }
  554. +};
  555. +
  556. +static struct gpio_led comfast_cf_e325n_gpio_leds[] __initdata = {
  557. + {
  558. + .name = "comfast:red",
  559. + .gpio = 2,
  560. + }, {
  561. + .name = "comfast:green",
  562. + .gpio = 3,
  563. + }, {
  564. + .name = "comfast:blue",
  565. + .gpio = 0,
  566. + }
  567. +};
  568. +
  569. +static void __init comfast_cf_e325n_setup(void)
  570. +{
  571. + u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
  572. + u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
  573. +
  574. + /* Disable JTAG, enabling GPIOs 0-3 */
  575. + /* Configure OBS4 line, for GPIO 4*/
  576. + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, AR934X_GPIO_FUNC_CLK_OBS4_EN);
  577. +
  578. + ath79_gpio_output_select(CF_E325N_GPIO_XWDT_TRIGGER, 0);
  579. + enable_external_wdt(CF_E325N_GPIO_XWDT_TRIGGER);
  580. +
  581. + ath79_register_m25p80(NULL);
  582. +
  583. + ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_cf_e325n_gpio_leds),
  584. + comfast_cf_e325n_gpio_leds);
  585. + ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
  586. + ARRAY_SIZE(comfast_cf_e325n_gpio_keys),
  587. + comfast_cf_e325n_gpio_keys);
  588. +
  589. + ext_lna_control_gpio_setup(13, 14);
  590. +
  591. + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
  592. +
  593. + ath79_register_mdio(1, 0x0);
  594. +
  595. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  596. + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
  597. +
  598. + /* GMAC0 is connected to the PHY0 of the internal switch */
  599. + ath79_switch_data.phy4_mii_en = 1;
  600. + ath79_switch_data.phy_poll_mask = BIT(0);
  601. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  602. + ath79_eth0_data.phy_mask = BIT(0);
  603. + ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
  604. + ath79_register_eth(0);
  605. +
  606. + /* GMAC1 is connected to the internal switch */
  607. + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  608. +
  609. + ath79_register_eth(1);
  610. +
  611. + ath79_register_usb();
  612. +
  613. + ath79_register_wmac(art, NULL);
  614. +}
  615. +MIPS_MACHINE(ATH79_MACH_COMFAST_CF_E325N, "COMFAST-CF-E325N", "COMFAST CF-E325N", comfast_cf_e325n_setup);
  616. +#if 0
  617. +#define DBDC9344GE_PHYMASK BIT(0)
  618. +#define DBDC9344GE_WMAC_CALDATA_OFFSET 0x1000
  619. +#define DBDC9344GE_PCI_CALDATA_OFFSET 0x5000
  620. +
  621. +#define DBDC9344GE_GPIO_EXTPHY_RESET 11
  622. +
  623. +static struct gpio_keys_button comfast_dbdc9344ge_gpio_keys[] __initdata = {
  624. + {
  625. + .desc = "reset",
  626. + .type = EV_KEY,
  627. + .code = KEY_RESTART,
  628. + .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
  629. + .gpio = 22,
  630. + .active_low = 1,
  631. + }
  632. +};
  633. +
  634. +static struct gpio_led comfast_dbdc9344ge_gpio_leds[] __initdata = {
  635. + {
  636. + .name = "comfast:red",
  637. + .gpio = 2,
  638. + }, {
  639. + .name = "comfast:green",
  640. + .gpio = 3,
  641. + }, {
  642. + .name = "comfast:blue",
  643. + .gpio = 0,
  644. + }
  645. +};
  646. +
  647. +static void __init comfast_dbdc9344ge_setup(void)
  648. +{
  649. + u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
  650. +
  651. + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, AR934X_GPIO_FUNC_CLK_OBS4_EN);
  652. +
  653. + ath79_register_m25p80(NULL);
  654. +
  655. + ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_dbdc9344ge_gpio_leds),
  656. + comfast_dbdc9344ge_gpio_leds);
  657. +
  658. + ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
  659. + ARRAY_SIZE(comfast_dbdc9344ge_gpio_keys),
  660. + comfast_dbdc9344ge_gpio_keys);
  661. +
  662. + ext_lna_control_gpio_setup(18, 19);
  663. +
  664. + ath79_register_mdio(0, 0x00);
  665. +
  666. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  667. +
  668. + /* GMAC0 is connected to GE-PHY by RGMII */
  669. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  670. + ath79_eth0_data.phy_mask = DBDC9344GE_PHYMASK;
  671. + ath79_register_eth(0);
  672. +
  673. + ath79_register_wmac(mac + DBDC9344GE_WMAC_CALDATA_OFFSET, NULL);
  674. + ap91_pci_init(mac + DBDC9344GE_PCI_CALDATA_OFFSET, NULL);
  675. +}
  676. +
  677. +MIPS_MACHINE(ATH79_MACH_COMFAST_DBDC9344GE, "COMFAST-DBDC9344GE", "COMFAST DBDC9344GE", comfast_dbdc9344ge_setup);
  678. +#endif
  679. diff --git a/target/linux/ar71xx/generic/profiles/comfast.mk b/target/linux/ar71xx/generic/profiles/comfast.mk
  680. new file mode 100644
  681. index 0000000..09612af
  682. --- /dev/null
  683. +++ b/target/linux/ar71xx/generic/profiles/comfast.mk
  684. @@ -0,0 +1,49 @@
  685. +#
  686. +# Copyright (C) 2009 OpenWrt.org
  687. +#
  688. +# This is free software, licensed under the GNU General Public License v2.
  689. +# See /LICENSE for more information.
  690. +#
  691. +define Profile/COMFASTAP9341FE
  692. + NAME:=COMFAST AP9341FE
  693. + PACKAGES:=
  694. +endef
  695. +
  696. +define Profile/COMFASTAP9341FE/Description
  697. + Package set optimized for the COMFAST AP9341FE.
  698. +endef
  699. +
  700. +$(eval $(call Profile,COMFASTAP9341FE))
  701. +
  702. +define Profile/COMFASTCFWR600N
  703. + NAME:=COMFAST CF-WR600N
  704. + PACKAGES:=
  705. +endef
  706. +
  707. +define Profile/COMFASTCFWR600N/Description
  708. + Package set optimized for the COMFAST CF-WR600N.
  709. +endef
  710. +
  711. +$(eval $(call Profile,COMFASTCFWR600N))
  712. +
  713. +define Profile/COMFASTCFE316NV2
  714. + NAME:=COMFAST CF-E316NV2
  715. + PACKAGES:=
  716. +endef
  717. +
  718. +define Profile/COMFASTCFE316NV2/Description
  719. + Package set optimized for the COMFAST CF-E316NV2.
  720. +endef
  721. +
  722. +$(eval $(call Profile,COMFASTCFE316NV2))
  723. +
  724. +define Profile/COMFASTCFE325N
  725. + NAME:=COMFAST CF-E325N
  726. + PACKAGES:=
  727. +endef
  728. +
  729. +define Profile/COMFASTCFE325N/Description
  730. + Package set optimized for the COMFAST CF-E325N.
  731. +endef
  732. +
  733. +$(eval $(call Profile,COMFASTCFE325N))
  734. \ No newline at end of file
  735. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  736. index bb5de17..118adb3 100644
  737. --- a/target/linux/ar71xx/image/Makefile
  738. +++ b/target/linux/ar71xx/image/Makefile
  739. @@ -971,6 +971,10 @@ pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),89
  740. planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),128k(art)ro
  741. ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  742. uap_pro_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
  743. +comfast_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k@0x20000(firmware)
  744. +ar9341_cf_wr600n_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k@0x20000(firmware)
  745. +ar9341_cf_e316nv2_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k@0x20000(firmware)
  746. +ar9341_cf_e325n_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k@0x20000(firmware)
  747. ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
  748. whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro
  749. wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k@0x40000(firmware)
  750. @@ -1320,6 +1324,99 @@ define Image/Build/UAPPRO
  751. -o $(call factoryname,$(1),$(2))
  752. endef
  753.  
  754. +Image/Build/COMFAST/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(comfast_mtdlayout))
  755. +define Image/Build/COMFAST/buildkernel
  756. + $(call MkuImageLzma,$(2),$(3) $(comfast_mtdlayout))
  757. + -rm -rf $(KDIR_TMP)/$(2)
  758. + mkdir -p $(KDIR_TMP)/$(2)/image
  759. + cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
  760. + $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
  761. + --pad --big-endian --squash-uids -v -e 64KiB \
  762. + -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
  763. + -d $(KDIR_TMP)/$(2)/image \
  764. + 2>&1 1>/dev/null | awk '/^.+$$$$/'
  765. + -rm -rf $(KDIR_TMP)/$(2)
  766. + $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
  767. +endef
  768. +
  769. +define Image/Build/COMFAST
  770. + $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call sysupname,$(1),$(2)))
  771. + -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  772. + -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
  773. + -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
  774. + -o $(call factoryname,$(1),$(2))
  775. +endef
  776. +
  777. +Image/Build/COMFAST_CF_WR600N/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) (ar9341_cf_wr600n_mtdlayout))
  778. +define Image/Build/COMFAST_CF_WR600N/buildkernel
  779. + $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_wr600n_mtdlayout))
  780. + -rm -rf $(KDIR_TMP)/$(2)
  781. + mkdir -p $(KDIR_TMP)/$(2)/image
  782. + cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
  783. + $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
  784. + --pad --big-endian --squash-uids -v -e 64KiB \
  785. + -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
  786. + -d $(KDIR_TMP)/$(2)/image \
  787. + 2>&1 1>/dev/null | awk '/^.+$$$$/'
  788. + -rm -rf $(KDIR_TMP)/$(2)
  789. + $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
  790. +endef
  791. +
  792. +define Image/Build/COMFAST_CF_WR600N
  793. + $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call sysupname,$(1),$(2)))
  794. + -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  795. + -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
  796. + -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
  797. + -o $(call factoryname,$(1),$(2))
  798. +endef
  799. +
  800. +Image/Build/COMFAST_CF_E316NV2/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(ar9341_cf_e316nv2_mtdlayout))
  801. +define Image/Build/COMFAST_CF_E316NV2/buildkernel
  802. + $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_e316nv2_mtdlayout))
  803. + -rm -rf $(KDIR_TMP)/$(2)
  804. + mkdir -p $(KDIR_TMP)/$(2)/image
  805. + cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
  806. + $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
  807. + --pad --big-endian --squash-uids -v -e 64KiB \
  808. + -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
  809. + -d $(KDIR_TMP)/$(2)/image \
  810. + 2>&1 1>/dev/null | awk '/^.+$$$$/'
  811. + -rm -rf $(KDIR_TMP)/$(2)
  812. + $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
  813. +endef
  814. +
  815. +define Image/Build/COMFAST_CF_E316NV2
  816. + $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call sysupname,$(1),$(2)))
  817. + -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  818. + -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
  819. + -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
  820. + -o $(call factoryname,$(1),$(2))
  821. +endef
  822. +
  823. +Image/Build/COMFAST_CF_E325N/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(ar9341_cf_e325n_mtdlayout))
  824. +define Image/Build/COMFAST_CF_E325N/buildkernel
  825. + $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_e325n_mtdlayout))
  826. + -rm -rf $(KDIR_TMP)/$(2)
  827. + mkdir -p $(KDIR_TMP)/$(2)/image
  828. + cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
  829. + $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
  830. + --pad --big-endian --squash-uids -v -e 64KiB \
  831. + -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
  832. + -d $(KDIR_TMP)/$(2)/image \
  833. + 2>&1 1>/dev/null | awk '/^.+$$$$/'
  834. + -rm -rf $(KDIR_TMP)/$(2)
  835. + $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
  836. +endef
  837. +
  838. +define Image/Build/COMFAST_CF_E325N
  839. + $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call sysupname,$(1),$(2)))
  840. + -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  841. + -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
  842. + -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
  843. + -o $(call factoryname,$(1),$(2))
  844. +endef
  845. +
  846. +
  847. # $(4) = board (XS2, XS5, RS, XM)
  848. # $(5) = series (BZ, XM, XW)
  849. # $(6) = chip (ar7240, ar934x)
  850. @@ -1982,6 +2079,11 @@ $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,C
  851. $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x))
  852. $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240))
  853.  
  854. +$(eval $(call SingleProfile,COMFAST,64k,COMFASTAP9341FE,comfast-ap9341fe,COMFAST-AP9341FE,ttyS0,115200,AP9341FE,AP9341FE,ar934x))
  855. +$(eval $(call SingleProfile,COMFAST,64k,COMFASTCFWR600N,comfast-cf-wr600n,COMFAST-CF-WR600N,ttyS0,115200,CF-WR600N,CF-WR600N,ar934x))
  856. +$(eval $(call SingleProfile,COMFAST,64k,COMFASTCFE316NV2,comfast-cf-e316nv2,COMFAST-CF-E316NV2,ttyS0,115200,CF-E316NV2,CF-E316NV2,ar934x))
  857. +$(eval $(call SingleProfile,COMFAST,64k,COMFASTCFE325N,comfast-cf-e325n,COMFAST-CF-E325N,ttyS0,115200,CF-E325N,CF-E325N,ar934x))
  858. +
  859. $(eval $(call SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,XM,XM,ar7240))
  860.  
  861. $(eval $(call SingleProfile,UBNT,64k,UBNTRS,ubnt-rs,UBNT-RS,ttyS0,115200,RS,RSx,ar7100))
  862. diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  863. index 941cb49..a3875cd 100644
  864. --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  865. +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  866. @@ -1,6 +1,6 @@
  867. --- a/arch/mips/ath79/machtypes.h
  868. +++ b/arch/mips/ath79/machtypes.h
  869. -@@ -16,22 +16,195 @@
  870. +@@ -16,22 +16,199 @@
  871.  
  872. enum ath79_mach_type {
  873. ATH79_MACH_GENERIC = 0,
  874. @@ -25,6 +25,10 @@
  875. + ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */
  876. + ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */
  877. + ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */
  878. ++ ATH79_MACH_COMFAST_AP9341FE, /* COMFAST AP9341FE */
  879. ++ ATH79_MACH_COMFAST_CF_E316NV2, /* COMFAST CF-E316NV2 */
  880. ++ ATH79_MACH_COMFAST_CF_E325N, /* COMFAST CF-E325N */
  881. ++ ATH79_MACH_COMFAST_CF_WR600N, /* COMFAST CF-WR600N */
  882. + ATH79_MACH_CPE510, /* TP-LINK CPE510 */
  883. ATH79_MACH_DB120, /* Atheros DB120 reference board */
  884. ATH79_MACH_PB44, /* Atheros PB44 reference board */
  885. @@ -269,7 +273,7 @@
  886. config ATH79_MACH_AP121
  887. bool "Atheros AP121 reference board"
  888. select SOC_AR933X
  889. -@@ -11,62 +75,1030 @@ config ATH79_MACH_AP121
  890. +@@ -11,62 +75,1045 @@ config ATH79_MACH_AP121
  891. select ATH79_DEV_M25P80
  892. select ATH79_DEV_USB
  893. select ATH79_DEV_WMAC
  894. @@ -336,6 +340,21 @@
  895. + select ATH79_DEV_M25P80
  896. + select ATH79_DEV_USB
  897. +
  898. ++config ATH79_MACH_COMFAST
  899. ++ bool "COMFAST reference board"
  900. ++ select SOC_AR934X
  901. ++ select ATH79_DEV_AP9X_PCI if PCI
  902. ++ select ATH79_DEV_ETH
  903. ++ select ATH79_DEV_GPIO_BUTTONS
  904. ++ select ATH79_DEV_LEDS_GPIO
  905. ++ select ATH79_DEV_M25P80
  906. ++ select ATH79_DEV_NFC
  907. ++ select ATH79_DEV_USB
  908. ++ select ATH79_DEV_WMAC
  909. ++ help
  910. ++ Say 'Y' here if you want your kernel to support the
  911. ++ Comfast reference board.
  912. ++
  913. +config ATH79_MACH_DB120
  914. + bool "Atheros DB120 reference board"
  915. + select SOC_AR934X
  916. @@ -1328,7 +1347,7 @@
  917.  
  918. config ATH79_MACH_UBNT_XM
  919. bool "Ubiquiti Networks XM/UniFi boards"
  920. -@@ -83,6 +1115,97 @@ config ATH79_MACH_UBNT_XM
  921. +@@ -83,6 +1130,97 @@ config ATH79_MACH_UBNT_XM
  922. Say 'Y' here if you want your kernel to support the
  923. Ubiquiti Networks XM (rev 1.0) board.
  924.  
  925. @@ -1426,7 +1445,7 @@
  926. endmenu
  927.  
  928. config SOC_AR71XX
  929. -@@ -124,7 +1247,10 @@ config ATH79_DEV_DSA
  930. +@@ -124,7 +1262,10 @@ config ATH79_DEV_DSA
  931. config ATH79_DEV_ETH
  932. def_bool n
  933.  
  934. @@ -1438,7 +1457,7 @@
  935. def_bool n
  936.  
  937. config ATH79_DEV_GPIO_BUTTONS
  938. -@@ -154,6 +1280,11 @@ config ATH79_PCI_ATH9K_FIXUP
  939. +@@ -154,6 +1295,11 @@ config ATH79_PCI_ATH9K_FIXUP
  940. def_bool n
  941.  
  942. config ATH79_ROUTERBOOT
  943. @@ -1452,7 +1471,7 @@
  944. endif
  945. --- a/arch/mips/ath79/Makefile
  946. +++ b/arch/mips/ath79/Makefile
  947. -@@ -38,9 +38,124 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
  948. +@@ -38,9 +38,125 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
  949. #
  950. # Machines
  951. #
  952. @@ -1471,6 +1490,7 @@
  953. +obj-$(CONFIG_ATH79_MACH_AW_NR580) += mach-aw-nr580.o
  954. +obj-$(CONFIG_ATH79_MACH_BHU_BXU2000N2_A)+= mach-bhu-bxu2000n2-a.o
  955. +obj-$(CONFIG_ATH79_MACH_CAP4200AG) += mach-cap4200ag.o
  956. ++obj-$(CONFIG_ATH79_MACH_COMFAST) += mach-comfast.o
  957. +obj-$(CONFIG_ATH79_MACH_CPE510) += mach-cpe510.o
  958. obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o
  959. +obj-$(CONFIG_ATH79_MACH_DLAN_PRO_500_WP) += mach-dlan-pro-500-wp.o
  960. diff --git a/target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch b/target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch
  961. new file mode 100644
  962. index 0000000..6d45e9f
  963. --- /dev/null
  964. +++ b/target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch
  965. @@ -0,0 +1,54 @@
  966. +--- a/drivers/watchdog/ath79_wdt.c 2014-06-23 23:35:55.747047338 -0400
  967. ++++ b/drivers/watchdog/ath79_wdt.c 2014-06-23 21:29:47.793775345 -0400
  968. +@@ -38,6 +38,12 @@
  969. +
  970. + #define DRIVER_NAME "ath79-wdt"
  971. +
  972. ++#ifdef CONFIG_ATH79_MACH_COMFAST
  973. ++void ath79_external_wdt_trigger(void);
  974. ++void ath79_external_wdt_set_timeout(int timeout);
  975. ++void ath79_external_wdt_disable(void);
  976. ++#endif
  977. ++
  978. + #define WDT_TIMEOUT 15 /* seconds */
  979. +
  980. + #define WDOG_REG_CTRL 0x00
  981. +@@ -86,6 +92,9 @@
  982. + ath79_wdt_wr(WDOG_REG_TIMER, wdt_freq * timeout);
  983. + /* flush write */
  984. + ath79_wdt_rr(WDOG_REG_TIMER);
  985. ++#ifdef CONFIG_ATH79_MACH_COMFAST
  986. ++ ath79_external_wdt_trigger();
  987. ++#endif
  988. + }
  989. +
  990. + static inline void ath79_wdt_enable(void)
  991. +@@ -101,6 +110,9 @@
  992. + ath79_wdt_wr(WDOG_REG_CTRL, WDOG_CTRL_ACTION_NONE);
  993. + /* flush write */
  994. + ath79_wdt_rr(WDOG_REG_CTRL);
  995. ++#ifdef CONFIG_ATH79_MACH_COMFAST
  996. ++ ath79_external_wdt_disable();
  997. ++#endif
  998. + }
  999. +
  1000. + static int ath79_wdt_set_timeout(int val)
  1001. +@@ -108,11 +120,17 @@
  1002. + if (val < 1)
  1003. + return -EINVAL;
  1004. +
  1005. +- if (val > max_timeout)
  1006. ++ if (val > max_timeout) {
  1007. ++ printk(KERN_ERR "Watchdog timeout exceeds, using %d\n", max_timeout);
  1008. + timeout = max_timeout;
  1009. ++ }
  1010. + else
  1011. + timeout = val;
  1012. +
  1013. ++#ifdef CONFIG_ATH79_MACH_COMFAST
  1014. ++ ath79_external_wdt_set_timeout(timeout);
  1015. ++#endif
  1016. ++
  1017. + ath79_wdt_keepalive();
  1018. +
  1019. + return 0;
  1020. --
  1021. 2.5.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement