Advertisement
Squonk42

OpenWrt HAME MPR-A1 Patch

Dec 17th, 2012
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 11.04 KB | None | 0 0
  1. Index: target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
  2. ===================================================================
  3. --- target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom  (revision 34872)
  4. +++ target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom  (working copy)
  5. @@ -67,6 +67,7 @@
  6.     freestation5 | \
  7.     hw550-3g | \
  8.     mofi3500-3gn | \
  9. +   mpr-a1 | \
  10.     pwh2004 | \
  11.     nbg-419n | \
  12.     nw718 | \
  13. Index: target/linux/ramips/base-files/etc/uci-defaults/leds
  14. ===================================================================
  15. --- target/linux/ramips/base-files/etc/uci-defaults/leds    (revision 34872)
  16. +++ target/linux/ramips/base-files/etc/uci-defaults/leds    (working copy)
  17. @@ -65,6 +65,9 @@
  18.     mofi3500-3gn)
  19.         set_usb_led "mofi3500-3gn:green:usb"
  20.         ;;
  21. +   mpr-a1)
  22. +       set_wifi_led "mpr-a1:blue:system"
  23. +       ;;
  24.     nw718)
  25.         set_usb_led "nw718:amber:usb"
  26.         ;;
  27. Index: target/linux/ramips/base-files/etc/uci-defaults/network
  28. ===================================================================
  29. --- target/linux/ramips/base-files/etc/uci-defaults/network (revision 34872)
  30. +++ target/linux/ramips/base-files/etc/uci-defaults/network (working copy)
  31. @@ -144,6 +144,7 @@
  32.     bc2 | \
  33.     broadway | \
  34.     f5d8235-v1 | \
  35. +   mpr-a1 | \
  36.     nw718 | \
  37.     psr-680w | \
  38.     rt-n15 | \
  39. Index: target/linux/ramips/base-files/etc/diag.sh
  40. ===================================================================
  41. --- target/linux/ramips/base-files/etc/diag.sh  (revision 34872)
  42. +++ target/linux/ramips/base-files/etc/diag.sh  (working copy)
  43. @@ -64,6 +64,9 @@
  44.     mofi3500-3gn)
  45.         status_led="mofi3500-3gn:green:status"
  46.         ;;
  47. +   mpr-a1)
  48. +       status_led="mpr-a1:red:power"
  49. +       ;;
  50.     nbg-419n)
  51.         status_led="nbg-419n:green:power"
  52.         ;;
  53. Index: target/linux/ramips/base-files/lib/ramips.sh
  54. ===================================================================
  55. --- target/linux/ramips/base-files/lib/ramips.sh    (revision 34872)
  56. +++ target/linux/ramips/base-files/lib/ramips.sh    (working copy)
  57. @@ -122,6 +122,9 @@
  58.     *"MoFi Network MOFI3500-3GN")
  59.         name="mofi3500-3gn"
  60.         ;;
  61. +   *"MPR-A1")
  62. +       name="mpr-a1"
  63. +       ;;
  64.     *"NBG-419N")
  65.         name="nbg-419n"
  66.         ;;
  67. Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
  68. ===================================================================
  69. --- target/linux/ramips/base-files/lib/upgrade/platform.sh  (revision 34872)
  70. +++ target/linux/ramips/base-files/lib/upgrade/platform.sh  (working copy)
  71. @@ -34,6 +34,7 @@
  72.     freestation5 | \
  73.     hw550-3g | \
  74.     mofi3500-3gn | \
  75. +   mpr-a1 | \
  76.     nbg-419n | \
  77.     nw718 | \
  78.     omni-emb | \
  79. Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
  80. ===================================================================
  81. --- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (revision 34872)
  82. +++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy)
  83. @@ -17,6 +17,7 @@
  84.     dir-620-a1 |\
  85.     esr-9753 |\
  86.     freestation5 |\
  87. +   mpr-a1 | \
  88.     nw718 |\
  89.     psr-680w |\
  90.     rt-n56u |\
  91. Index: target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
  92. ===================================================================
  93. --- target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h   (revision 34872)
  94. +++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h   (working copy)
  95. @@ -75,5 +75,8 @@
  96.  
  97.     /* RT3883 based machines */
  98.     RAMIPS_MACH_TEW_691GR,      /* TRENDnet TEW-691GR */
  99. -   RAMIPS_MACH_TEW_692GR       /* TRENDnet TEW-692GR */
  100. +   RAMIPS_MACH_TEW_692GR,      /* TRENDnet TEW-692GR */
  101. +
  102. +   /* RT5350 based machines */
  103. +   RAMIPS_MACH_MPR_A1      /* HAME MPR-A1 */
  104.  };
  105. Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
  106. ===================================================================
  107. --- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile  (revision 34872)
  108. +++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile  (working copy)
  109. @@ -28,6 +28,7 @@
  110.  obj-$(CONFIG_RT305X_MACH_FREESTATION5)  += mach-freestation5.o
  111.  obj-$(CONFIG_RT305X_MACH_HW550_3G) += mach-hw550-3g.o
  112.  obj-$(CONFIG_RT305X_MACH_MOFI3500_3GN) += mach-mofi3500-3gn.o
  113. +obj-$(CONFIG_RT305X_MACH_MPR_A1)   += mach-mpr-a1.o
  114.  obj-$(CONFIG_RT305X_MACH_NBG_419N) += mach-nbg-419n.o
  115.  obj-$(CONFIG_RT305X_MACH_NW718)        += mach-nw718.o
  116.  obj-$(CONFIG_RT305X_MACH_OMNI_EMB) += mach-omni-emb.o
  117. Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
  118. ===================================================================
  119. --- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig   (revision 34872)
  120. +++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig   (working copy)
  121. @@ -114,6 +114,11 @@
  122.     select RALINK_DEV_GPIO_BUTTONS
  123.     select RALINK_DEV_GPIO_LEDS
  124.  
  125. +config RT305X_MACH_MPR_A1
  126. +   bool "HAME MPR-A1 board support"
  127. +   select RALINK_DEV_GPIO_BUTTONS
  128. +   select RALINK_DEV_GPIO_LEDS
  129. +
  130.  config RT305X_MACH_WR512_3GN
  131.     bool "SH-WR512NU/WS-WR512N1-like 3GN router"
  132.     select RALINK_DEV_GPIO_BUTTONS
  133. Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mpr-a1.c
  134. ===================================================================
  135. --- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mpr-a1.c (revision 0)
  136. +++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mpr-a1.c (revision 0)
  137. @@ -0,0 +1,108 @@
  138. +/*
  139. + *  HAME MPR-A1 board support by Michel Stempin <michel.stempin@wanadoo.fr>
  140. + *  Based on previous work by arpunk, arteq, Heffer & p1vo from OpenWrt forum.
  141. + *
  142. + *
  143. + *  This program is free software; you can redistribute it and/or modify it
  144. + *  under the terms of the GNU General Public License version 2 as published
  145. + *  by the Free Software Foundation.
  146. + */
  147. +
  148. +#include <linux/init.h>
  149. +#include <linux/platform_device.h>
  150. +#include <linux/spi/spi.h>
  151. +#include <linux/spi/flash.h>
  152. +#include <linux/gpio.h>
  153. +
  154. +#include <asm/mach-ralink/machine.h>
  155. +#include <asm/mach-ralink/dev-gpio-buttons.h>
  156. +#include <asm/mach-ralink/dev-gpio-leds.h>*/
  157. +#include <asm/mach-ralink/rt305x.h>
  158. +#include <asm/mach-ralink/rt305x_regs.h>
  159. +
  160. +#include "devices.h"
  161. +
  162. +#define MPR_A1_GPIO_BUTTON_RESET   0
  163. +#define MPR_A1_GPIO_USB_POWER      7
  164. +#define MPR_A1_GPIO_ROOT_HUB_POWER 12
  165. +#define MPR_A1_GPIO_LED_POWER      17
  166. +#define MPR_A1_GPIO_LED_SYSTEM     20
  167. +
  168. +#define MPR_A1_KEYS_POLL_INTERVAL  20
  169. +#define MPR_A1_KEYS_DEBOUNCE_INTERVAL  (3 * MPR_A1_KEYS_POLL_INTERVAL)
  170. +
  171. +const struct flash_platform_data mpr_a1_flash = {
  172. +        .type           = "pm25lq032",
  173. +};
  174. +
  175. +struct spi_board_info mpr_a1_spi_slave_info[] __initdata = {
  176. +        {
  177. +                .modalias       = "m25p80",
  178. +                .platform_data  = &mpr_a1_flash,
  179. +                .irq            = -1,
  180. +                .max_speed_hz   = 10000000,
  181. +                .bus_num        = 0,
  182. +                .chip_select    = 0,
  183. +        }
  184. +};
  185. +
  186. +static struct gpio_led mpr_a1_leds_gpio[] __initdata = {
  187. +        {
  188. +                .name           = "mpr-a1:blue:system",
  189. +                .gpio           = MPR_A1_GPIO_LED_SYSTEM,
  190. +                .active_low     = 1,
  191. +        },
  192. +        {
  193. +                .name           = "mpr-a1:red:power",
  194. +                .gpio           = MPR_A1_GPIO_LED_POWER,
  195. +                .active_low     = 1,
  196. +                .default_state  = LEDS_GPIO_DEFSTATE_ON,
  197. +        }
  198. +};
  199. +
  200. +static struct gpio_keys_button mpr_a1_gpio_buttons[] __initdata = {
  201. +        {
  202. +                .desc           = "reset",
  203. +                .type           = EV_KEY,
  204. +                .code           = KEY_RESTART,
  205. +                .debounce_interval = MPR_A1_KEYS_DEBOUNCE_INTERVAL,
  206. +                .gpio           = MPR_A1_GPIO_BUTTON_RESET,
  207. +                .active_low     = 1,
  208. +        }
  209. +};
  210. +
  211. +static void __init mpr_a1_init(void)
  212. +{
  213. +        // JTAG is required for LED control
  214. +        rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
  215. +                          RT305X_GPIO_MODE_UART0_SHIFT) |
  216. +                         RT305X_GPIO_MODE_JTAG);
  217. +
  218. +        rt305x_register_spi(mpr_a1_spi_slave_info,
  219. +                            ARRAY_SIZE(mpr_a1_spi_slave_info));
  220. +
  221. +        ramips_register_gpio_leds(-1, ARRAY_SIZE(mpr_a1_leds_gpio),
  222. +                                  mpr_a1_leds_gpio);
  223. +
  224. +        ramips_register_gpio_buttons(-1, MPR_A1_KEYS_POLL_INTERVAL,
  225. +                                     ARRAY_SIZE(mpr_a1_gpio_buttons),
  226. +                                     mpr_a1_gpio_buttons);
  227. +
  228. +        rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
  229. +        rt305x_register_ethernet();
  230. +
  231. +        rt305x_register_wifi();
  232. +
  233. +        rt305x_register_wdt();
  234. +
  235. +        gpio_request_one(MPR_A1_GPIO_USB_POWER,
  236. +                         GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
  237. +                         "USB power");
  238. +        gpio_request_one(MPR_A1_GPIO_ROOT_HUB_POWER,
  239. +                         GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
  240. +                         "USB root hub power");
  241. +        rt305x_register_usb();
  242. +}
  243. +
  244. +MIPS_MACHINE(RAMIPS_MACH_MPR_A1, "MPR-A1", "HAME MPR-A1",
  245. +             mpr_a1_init);
  246. Index: target/linux/ramips/image/Makefile
  247. ===================================================================
  248. --- target/linux/ramips/image/Makefile  (revision 34872)
  249. +++ target/linux/ramips/image/Makefile  (working copy)
  250. @@ -529,6 +529,10 @@
  251.     $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_8M,mofi3500-3gn,MOFI3500-3GN,ttyS1,57600,phys)
  252.  endef
  253.  
  254. +define Image/Build/Profile/MPR_A1
  255. +   $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,mpr-a1,MPR-A1,ttyS1,57600,spi)
  256. +endef
  257. +
  258.  define Image/Build/Profile/NBG419N
  259.     $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,nbg-419n,NBG-419N,ttyS1,57600,phys)
  260.  endef
  261. @@ -637,6 +641,7 @@
  262.     $(call Image/Build/Profile/FREESTATION5,$(1))
  263.     $(call Image/Build/Profile/HW5503G,$(1))
  264.     $(call Image/Build/Profile/MOFI35003GN,$(1))
  265. +   $(call Image/Build/Profile/MPR_A1,$(1))
  266.     $(call Image/Build/Profile/NBG419N,$(1))
  267.     $(call Image/Build/Profile/NW718,$(1))
  268.     $(call Image/Build/Profile/OMNIEMB,$(1))
  269. Index: target/linux/ramips/rt305x/profiles/hame.mk
  270. ===================================================================
  271. --- target/linux/ramips/rt305x/profiles/hame.mk (revision 0)
  272. +++ target/linux/ramips/rt305x/profiles/hame.mk (revision 0)
  273. @@ -0,0 +1,17 @@
  274. +#
  275. +# Copyright (C) 2012 Michel Stempin <michel.stempin@wanadoo.fr>
  276. +#
  277. +# This is free software, licensed under the GNU General Public License v2.
  278. +# See /LICENSE for more information.
  279. +#
  280. +
  281. +define Profile/MPR_A1
  282. +   NAME:=HAME MPR-A1
  283. +   PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer
  284. +endef
  285. +
  286. +define Profile/MPR_A1/Description
  287. +   Package set for HAME MPR-A1 board
  288. +endef
  289. +
  290. +$(eval $(call Profile,MPR_A1))
  291. Index: target/linux/ramips/rt305x/config-3.6
  292. ===================================================================
  293. --- target/linux/ramips/rt305x/config-3.6   (revision 34872)
  294. +++ target/linux/ramips/rt305x/config-3.6   (working copy)
  295. @@ -108,6 +108,7 @@
  296.  CONFIG_RT305X_MACH_FREESTATION5=y
  297.  CONFIG_RT305X_MACH_HW550_3G=y
  298.  CONFIG_RT305X_MACH_MOFI3500_3GN=y
  299. +CONFIG_RT305X_MACH_MPR_A1=y
  300.  CONFIG_RT305X_MACH_NBG_419N=y
  301.  CONFIG_RT305X_MACH_NW718=y
  302.  CONFIG_RT305X_MACH_OMNI_EMB=y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement