This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Add d-link dir-620d1 to OpenWrt Attitude Adjustment

By: a guest on Apr 18th, 2013  |  syntax: None  |  size: 7.38 KB  |  views: 2,974  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-615-h1.c
  2. ===================================================================
  3. --- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-615-h1.c (revision 36354)
  4. +++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-615-h1.c (working copy)
  5. @@ -110,3 +110,70 @@
  6.  
  7.  MIPS_MACHINE(RAMIPS_MACH_DIR_615_H1, "DIR-615-H1", "D-Link DIR-615 H1",
  8.              dir615h1_init);
  9. +
  10. +#define DIR_620_D1_GPIO_LED_STATUS_GREEN 9
  11. +#define DIR_620_D1_GPIO_LED_WIFI_GREEN 17
  12. +#define DIR_620_D1_GPIO_BUTTON_WPS     7  /* active low */
  13. +
  14. +#define DIR_620_D1_KEYS_POLL_INTERVAL  20
  15. +#define DIR_620_D1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_620_D1_KEYS_POLL_INTERVAL)
  16. +
  17. +static struct gpio_led dir_620_d1_leds_gpio[] __initdata = {
  18. +       {
  19. +               .name           = "d-link:green:status",
  20. +               .gpio           = DIR_620_D1_GPIO_LED_STATUS_GREEN,
  21. +               .active_low     = 1,
  22. +       }, {
  23. +               .name           = "d-link:green:wifi",
  24. +               .gpio           = DIR_620_D1_GPIO_LED_WIFI_GREEN,
  25. +               .active_low     = 1,
  26. +       }
  27. +};
  28. +
  29. +static struct gpio_keys_button dir_620_d1_gpio_buttons[] __initdata = {
  30. +       {
  31. +               .desc           = "wps",
  32. +               .type           = EV_KEY,
  33. +               .code           = KEY_RESTART,
  34. +               .debounce_interval = DIR_615_H1_KEYS_DEBOUNCE_INTERVAL,
  35. +               .gpio           = DIR_620_D1_GPIO_BUTTON_WPS,
  36. +               .active_low     = 1,
  37. +       }
  38. +};
  39. +
  40. +const struct flash_platform_data dir620d1_flash = {
  41. +       .type           = "mx25l6405d",
  42. +};
  43. +
  44. +struct spi_board_info dir620d1_spi_slave_info[] __initdata = {
  45. +       {
  46. +               .modalias       = "m25p80",
  47. +               .platform_data  = &dir620d1_flash,
  48. +               .irq            = -1,
  49. +               .max_speed_hz   = 10000000,
  50. +               .bus_num        = 0,
  51. +               .chip_select    = 0,
  52. +       },
  53. +};
  54. +
  55. +static void __init dir620d1_init(void)
  56. +{
  57. +       rt305x_gpio_init( (RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) |
  58. +                          RT305X_GPIO_MODE_JTAG
  59. +                       );
  60. +       rt305x_register_spi(dir620d1_spi_slave_info,
  61. +                           ARRAY_SIZE(dir620d1_spi_slave_info));
  62. +       rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
  63. +       rt305x_register_ethernet();
  64. +       ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_620_d1_leds_gpio),
  65. +                                 dir_620_d1_leds_gpio);
  66. +       ramips_register_gpio_buttons(-1, DIR_620_D1_KEYS_POLL_INTERVAL,
  67. +                                    ARRAY_SIZE(dir_620_d1_gpio_buttons),
  68. +                                    dir_620_d1_gpio_buttons);
  69. +       rt305x_register_wifi();
  70. +       rt305x_register_wdt();
  71. +       rt305x_register_usb();
  72. +}
  73. +
  74. +MIPS_MACHINE(RAMIPS_MACH_DIR_620_D1, "DIR-620-D1", "D-Link DIR-620 D1",
  75. +            dir620d1_init);
  76. Index: target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
  77. ===================================================================
  78. --- target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h       (revision 36354)
  79. +++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h       (working copy)
  80. @@ -66,6 +66,7 @@
  81.         /* RT3352 based machines */
  82.         RAMIPS_MACH_ALL5002,            /* Allnet ALL5002 */
  83.         RAMIPS_MACH_DIR_615_H1,
  84. +       RAMIPS_MACH_DIR_620_D1,
  85.  
  86.         /* RT3662 based machines */
  87.         RAMIPS_MACH_DIR_645,            /* D-Link DIR-645 */
  88. Index: target/linux/ramips/base-files/lib/ramips.sh
  89. ===================================================================
  90. --- target/linux/ramips/base-files/lib/ramips.sh        (revision 36354)
  91. +++ target/linux/ramips/base-files/lib/ramips.sh        (working copy)
  92. @@ -89,6 +89,9 @@
  93.         *"DIR-620 A1")
  94.                 name="dir-620-a1"
  95.                 ;;
  96. +       *"DIR-620 D1")
  97. +               name="dir-620-d1"
  98. +               ;;
  99.         *"DIR-615 H1")
  100.                 name="dir-615-h1"
  101.                 ;;
  102. Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
  103. ===================================================================
  104. --- target/linux/ramips/base-files/lib/upgrade/platform.sh      (revision 36354)
  105. +++ target/linux/ramips/base-files/lib/upgrade/platform.sh      (working copy)
  106. @@ -26,6 +26,7 @@
  107.         dir-615-h1 | \
  108.         dir-615-d | \
  109.         dir-620-a1 | \
  110. +       dir-620-d1 | \
  111.         dap-1350 | \
  112.         esr-9753 | \
  113.         fonera20n | \
  114. Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
  115. ===================================================================
  116. --- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (revision 36354)
  117. +++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy)
  118. @@ -9,6 +9,7 @@
  119.  
  120.         case $(ramips_board_name) in
  121.         3g-6200n |\
  122. +       dir-620-d1 |\
  123.         wl-330n |\
  124.         wl-330n3g)
  125.                 mac=$(ramips_get_mac_binary factory 4)
  126. Index: target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
  127. ===================================================================
  128. --- target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom      (revision 36354)
  129. +++ target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom      (working copy)
  130. @@ -62,6 +62,7 @@
  131.         carambola | \
  132.         dir-615-h1 | \
  133.         dir-620-a1 | \
  134. +       dir-620-d1 | \
  135.         esr-9753 | \
  136.         fonera20n | \
  137.         freestation5 | \
  138. Index: target/linux/ramips/base-files/etc/uci-defaults/leds
  139. ===================================================================
  140. --- target/linux/ramips/base-files/etc/uci-defaults/leds        (revision 36354)
  141. +++ target/linux/ramips/base-files/etc/uci-defaults/leds        (working copy)
  142. @@ -41,6 +41,9 @@
  143.                 ucidef_set_led_default "status" "Status LED (amber)" "d-link:amber:status" "0"
  144.                 set_wifi_led "rt2800pci-phy0::radio"
  145.                 ;;
  146. +       dir-620-d1)
  147. +               set_wifi_led "d-link:green:wifi"
  148. +               ;;
  149.         esr-9753)
  150.                 set_wifi_led "rt2800pci-phy0::radio"
  151.                 ;;
  152. Index: target/linux/ramips/base-files/etc/uci-defaults/network
  153. ===================================================================
  154. --- target/linux/ramips/base-files/etc/uci-defaults/network     (revision 36354)
  155. +++ target/linux/ramips/base-files/etc/uci-defaults/network     (working copy)
  156. @@ -141,6 +141,7 @@
  157.         3g-6200n | \
  158.         argus-atp52b | \
  159.         bc2 | \
  160. +       dir-620-d1 |\
  161.         f5d8235-v1 | \
  162.         nw718 | \
  163.         psr-680w | \
  164. Index: target/linux/ramips/base-files/etc/diag.sh
  165. ===================================================================
  166. --- target/linux/ramips/base-files/etc/diag.sh  (revision 36354)
  167. +++ target/linux/ramips/base-files/etc/diag.sh  (working copy)
  168. @@ -36,7 +36,7 @@
  169.         argus-atp52b)
  170.                 status_led="argus-atp52b:green:run"
  171.                 ;;
  172. -       dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-615-h1 | dir-615-d | dir-620-a1)
  173. +       dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-615-h1 | dir-615-d | dir-620-a1 | dir-620-d1)
  174.                 status_led="d-link:green:status"
  175.                 ;;
  176.         dir-645)
  177. Index: target/linux/ramips/base-files/lib/ramips.sh
  178. ===================================================================
  179. --- target/linux/ramips/image/Makefile  (revision 36354)
  180. +++ target/linux/ramips/image/Makefile  (working copy)
  181. @@ -231,6 +231,10 @@
  182.         $(call BuildFirmware/Generic,$(1),$(2),$(call mkcmdline,$(3),ttyS1,57600) $(call mkmtd/phys,$(mtdlayout_dir620a1)),$(kernel_size_dir620a1),$(rootfs_size_dir620a1),DIR_620)
  183.  endef
  184.  
  185. +define BuildFirmware/DIR620D1
  186. +       $(call BuildFirmware/Generic,$(1),$(2),$(call mkcmdline,$(3),ttyS1,57600) $(call mkmtd/spi,$(mtdlayout_dir620a1)),$(kernel_size_dir620a1),$(rootfs_size_dir620a1),DIR_620D1)
  187. +endef
  188. +
  189.  define BuildFirmware/DIR620A1/initramfs
  190.         $(call BuildFirmware/Generic/initramfs,$(1),$(2),$(call mkcmdline,$(3),ttyS1,57600) $(call mkmtd/phys,$(mtdlayout_dir620a1)),$(kernel_size_dir620a1),$(rootfs_size_dir620a1))
  191.  endef
  192. @@ -470,7 +474,8 @@
  193.  endef
  194.  
  195.  define Image/Build/Profile/DIR615H1
  196. -        $(call Image/Build/Template/$(fs_squash)/$(1),DIR615H1,dir-615-h1,DIR-615-H1,ttyS1,57600,spi)
  197. +       $(call Image/Build/Template/$(fs_squash)/$(1),DIR615H1,dir-615-h1,DIR-615-H1,ttyS1,57600,spi)
  198. +       $(call Image/Build/Template/$(fs_squash)/$(1),DIR620D1,dir-620-d1,DIR-620-D1,ttyS1,57600,spi)
  199.  endef
  200.  
  201.  define Image/Build/Profile/DAP1350
clone this paste RAW Paste Data