Advertisement
VecH

Patch add support 16 mb flash Nexx WT3020 (Openwrt 18.06.2)

Feb 19th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.90 KB | None | 0 0
  1. From a7340d61cfa8bc5a00794344f551972110c38263 Mon Sep 17 00:00:00 2001
  2. From: VecH <vech2k@gmail.com>
  3. Date: Sun, 17 Feb 2019 20:56:31 +0900
  4. Subject: [PATCH] Add support Nexx WT3020 flash 16M
  5.  
  6. ---
  7. target/linux/ramips/base-files/lib/ramips.sh |   3 +
  8.  target/linux/ramips/dts/WT3020-16M.dts       | 102 +++++++++++++++++++
  9.  target/linux/ramips/image/mt7620.mk          |  10 ++
  10.  tools/firmware-utils/src/mkporayfw.c         |  34 ++++---
  11.  4 files changed, 134 insertions(+), 15 deletions(-)
  12.  create mode 100644 target/linux/ramips/dts/WT3020-16M.dts
  13.  
  14. diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
  15. index 5741cbd2ee..f53f28a22a 100755
  16. --- a/target/linux/ramips/base-files/lib/ramips.sh
  17. +++ b/target/linux/ramips/base-files/lib/ramips.sh
  18. @@ -658,6 +658,9 @@ ramips_board_detect() {
  19.     *"WT3020 (8M)")
  20.         name="wt3020-8M"
  21.         ;;
  22. +   *"WT3020 (16M)")
  23. +       name="wt3020-16M"
  24. +       ;;
  25.     *"WZR-AGL300NH")
  26.         name="wzr-agl300nh"
  27.         ;;
  28. diff --git a/target/linux/ramips/dts/WT3020-16M.dts b/target/linux/ramips/dts/WT3020-16M.dts
  29. new file mode 100644
  30. index 0000000000..a55bfa684a
  31. --- /dev/null
  32. +++ b/target/linux/ramips/dts/WT3020-16M.dts
  33. @@ -0,0 +1,102 @@
  34. +/dts-v1/;
  35. +
  36. +#include "mt7620n.dtsi"
  37. +
  38. +#include <dt-bindings/gpio/gpio.h>
  39. +#include <dt-bindings/input/input.h>
  40. +
  41. +/ {
  42. +   compatible = "wt3020", "ralink,mt7620n-soc";
  43. +   model = "Nexx WT3020 (16M)";
  44. +
  45. +   gpio-keys-polled {
  46. +       compatible = "gpio-keys-polled";
  47. +       #address-cells = <1>;
  48. +       #size-cells = <0>;
  49. +       poll-interval = <20>;
  50. +
  51. +       reset {
  52. +           label = "reset";
  53. +           gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
  54. +           linux,code = <KEY_RESTART>;
  55. +       };
  56. +   };
  57. +
  58. +   gpio-leds {
  59. +       compatible = "gpio-leds";
  60. +
  61. +       power {
  62. +           label = "wt3020:blue:power";
  63. +           gpios = <&gpio3 0 GPIO_ACTIVE_HIGH>;
  64. +       };
  65. +   };
  66. +};
  67. +
  68. +&gpio2 {
  69. +   status = "okay";
  70. +};
  71. +
  72. +&gpio3 {
  73. +   status = "okay";
  74. +};
  75. +
  76. +&spi0 {
  77. +   status = "okay";
  78. +
  79. +   m25p80@0 {
  80. +       #address-cells = <1>;
  81. +       #size-cells = <1>;
  82. +       compatible = "jedec,spi-nor";
  83. +       reg = <0>;
  84. +       spi-max-frequency = <10000000>;
  85. +
  86. +       partition@0 {
  87. +           label = "u-boot";
  88. +           reg = <0x0 0x30000>;
  89. +           read-only;
  90. +       };
  91. +
  92. +       partition@30000 {
  93. +           label = "u-boot-env";
  94. +           reg = <0x30000 0x10000>;
  95. +           read-only;
  96. +       };
  97. +
  98. +       factory: partition@40000 {
  99. +           label = "factory";
  100. +           reg = <0x40000 0x10000>;
  101. +           read-only;
  102. +       };
  103. +
  104. +       partition@50000 {
  105. +           label = "firmware";
  106. +           reg = <0x50000 0xfb0000>;
  107. +       };
  108. +   };
  109. +};
  110. +
  111. +&ehci {
  112. +   status = "okay";
  113. +};
  114. +
  115. +&ohci {
  116. +   status = "okay";
  117. +};
  118. +
  119. +&ethernet {
  120. +   mtd-mac-address = <&factory 0x4>;
  121. +   mediatek,portmap = "wllll";
  122. +};
  123. +
  124. +&wmac {
  125. +   ralink,mtd-eeprom = <&factory 0>;
  126. +};
  127. +
  128. +&pinctrl {
  129. +   state_default: pinctrl0 {
  130. +       default {
  131. +           ralink,group = "ephy", "wled", "pa", "i2c", "wdt", "uartf";
  132. +           ralink,function = "gpio";
  133. +       };
  134. +   };
  135. +};
  136. diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
  137. index f627627192..e6e114b9d5 100644
  138. --- a/target/linux/ramips/image/mt7620.mk
  139. +++ b/target/linux/ramips/image/mt7620.mk
  140. @@ -541,6 +541,16 @@ define Device/wn3000rpv3
  141.  endef
  142.  TARGET_DEVICES += wn3000rpv3
  143.  
  144. +define Device/wt3020-16M
  145. +  DTS := WT3020-16M
  146. +  IMAGES += factory.bin
  147. +  IMAGE_SIZE := $(ralink_default_fw_size_16M)
  148. +  IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \
  149. +   poray-header -B WT3020 -F 16M
  150. +  DEVICE_TITLE := Nexx WT3020 (16MB)
  151. +endef
  152. +TARGET_DEVICES += wt3020-16M
  153. +
  154.  define Device/wrh-300cr
  155.    DTS := WRH-300CR
  156.    IMAGE_SIZE := $(ralink_default_fw_size_16M)
  157. diff --git a/tools/firmware-utils/src/mkporayfw.c b/tools/firmware-utils/src/mkporayfw.c
  158. index 6ec4f320d9..0cb0e8b694 100644
  159. --- a/tools/firmware-utils/src/mkporayfw.c
  160. +++ b/tools/firmware-utils/src/mkporayfw.c
  161. @@ -135,6 +135,9 @@ static struct flash_layout layouts[] = {
  162.     }, {
  163.         .id     = "8M",
  164.         .fw_max_len = 0x7c0000,
  165. +   }, {
  166. +       .id     = "16M",
  167. +       .fw_max_len = 0xfc0000,
  168.     }, {
  169.         /* terminating entry */
  170.     }
  171. @@ -221,21 +224,22 @@ static struct board_info boards[] = {
  172.         .hw_id      = HWID_NEXX_WT1520,
  173.         .layout_id  = "8M",
  174.         .key        = KEY_NEXX_1,
  175. -        }, {
  176. -                .id             = "WT3020",
  177. -                .hw_id          = HWID_NEXX_WT3020,
  178. -                .layout_id      = "4M",
  179. -                .key            = KEY_NEXX_2,
  180. -        }, {
  181. -                .id             = "WT3020",
  182. -                .hw_id          = HWID_NEXX_WT3020,
  183. -                .layout_id      = "8M",
  184. -                .key            = KEY_NEXX_2,
  185. -        }, {
  186. -
  187. -
  188. -
  189. -
  190. +   }, {
  191. +       .id     = "WT3020",
  192. +       .hw_id      = HWID_NEXX_WT3020,
  193. +       .layout_id  = "4M",
  194. +       .key        = KEY_NEXX_2,
  195. +   }, {
  196. +       .id     = "WT3020",
  197. +       .hw_id      = HWID_NEXX_WT3020,
  198. +       .layout_id  = "8M",
  199. +       .key        = KEY_NEXX_2,
  200. +   }, {
  201. +       .id     = "WT3020",
  202. +       .hw_id      = HWID_NEXX_WT3020,
  203. +       .layout_id  = "16M",
  204. +       .key        = KEY_NEXX_2,
  205. +   }, {
  206.         /* terminating entry */
  207.     }
  208.  };
  209. --
  210. 2.17.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement