Bläddra i källkod

ar71xx: Add WeIO Board Support

Add support for WeIO board (http://we-io.net).
This board is based on Carambola2 board form 8Devices.

Signed-off-by: Drasko DRASKOVIC <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]> [some cleanups]

SVN-Revision: 47036
Felix Fietkau 10 år sedan
förälder
incheckning
896d3e3e13

+ 3 - 0
target/linux/ar71xx/base-files/lib/ar71xx.sh

@@ -850,6 +850,9 @@ ar71xx_board_detect() {
 	*"UniFi AP Pro")
 	*"UniFi AP Pro")
 		name="uap-pro"
 		name="uap-pro"
 		;;
 		;;
+	*"WeIO")
+		name="weio"
+		;;
 	*WHR-G301N)
 	*WHR-G301N)
 		name="whr-g301n"
 		name="whr-g301n"
 		;;
 		;;

+ 2 - 1
target/linux/ar71xx/base-files/lib/upgrade/platform.sh

@@ -252,7 +252,8 @@ platform_check_image() {
 	nbg460n_550n_550nh | \
 	nbg460n_550n_550nh | \
 	unifi | \
 	unifi | \
 	unifi-outdoor | \
 	unifi-outdoor | \
-	carambola2 )
+	carambola2 | \
+	weio )
 		[ "$magic" != "2705" ] && {
 		[ "$magic" != "2705" ] && {
 			echo "Invalid image type."
 			echo "Invalid image type."
 			return 1
 			return 1

+ 1 - 0
target/linux/ar71xx/config-4.1

@@ -143,6 +143,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y
 CONFIG_ATH79_MACH_TUBE2H=y
 CONFIG_ATH79_MACH_TUBE2H=y
 CONFIG_ATH79_MACH_UBNT=y
 CONFIG_ATH79_MACH_UBNT=y
 CONFIG_ATH79_MACH_UBNT_XM=y
 CONFIG_ATH79_MACH_UBNT_XM=y
+CONFIG_ATH79_MACH_WEIO=y
 CONFIG_ATH79_MACH_WHR_HP_G300N=y
 CONFIG_ATH79_MACH_WHR_HP_G300N=y
 CONFIG_ATH79_MACH_WLAE_AG300N=y
 CONFIG_ATH79_MACH_WLAE_AG300N=y
 CONFIG_ATH79_MACH_WLR8100=y
 CONFIG_ATH79_MACH_WLR8100=y

+ 140 - 0
target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c

@@ -0,0 +1,140 @@
+/**
+ * WEIO Web Of Things Platform
+ *
+ * Copyright (C) 2013 Drasko DRASKOVIC and Uros PETREVSKI
+ *
+ *              ##      ## ######## ####  #######  
+ *              ##  ##  ## ##        ##  ##     ## 
+ *              ##  ##  ## ##        ##  ##     ## 
+ *              ##  ##  ## ######    ##  ##     ## 
+ *              ##  ##  ## ##        ##  ##     ## 
+ *              ##  ##  ## ##        ##  ##     ## 
+ *               ###  ###  ######## ####  #######
+ *
+ *                   Web Of Things Platform
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors : 
+ * Drasko DRASKOVIC <[email protected]>
+ * Uros PETREVSKI <[email protected]>
+ */
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/i2c-gpio.h>
+#include <linux/platform_device.h>
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define WEIO_GPIO_LED_STA		1
+#define WEIO_GPIO_LED_AP		16
+
+#define WEIO_GPIO_BTN_AP		20
+#define WEIO_GPIO_BTN_RESET		23
+
+#define WEIO_KEYS_POLL_INTERVAL		20	/* msecs */
+#define WEIO_KEYS_DEBOUNCE_INTERVAL	(3 * WEIO_KEYS_POLL_INTERVAL)
+
+#define WEIO_MAC0_OFFSET			0x0000
+#define WEIO_MAC1_OFFSET			0x0006
+#define WEIO_CALDATA_OFFSET			0x1000
+#define WEIO_WMAC_MAC_OFFSET		0x1002
+
+static struct gpio_led weio_leds_gpio[] __initdata = {
+	{
+		.name		= "weio:green:sta",
+		.gpio		= WEIO_GPIO_LED_STA,
+		.active_low	= 1,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name		= "weio:green:ap",
+		.gpio		= WEIO_GPIO_LED_AP,
+		.active_low	= 1,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	}
+};
+
+static struct gpio_keys_button weio_gpio_keys[] __initdata = {
+	{
+		.desc		= "ap button",
+		.type		= EV_KEY,
+		.code		= BTN_0,
+		.debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= WEIO_GPIO_BTN_AP,
+		.active_low	= 1,
+	},
+	{
+		.desc		= "soft-reset button",
+		.type		= EV_KEY,
+		.code		= BTN_1,
+		.debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= WEIO_GPIO_BTN_RESET,
+		.active_low	= 1,
+	}
+};
+
+static struct i2c_gpio_platform_data weio_i2c_gpio_data = {
+	.sda_pin        = 18,
+	.scl_pin        = 19,
+};
+
+static struct platform_device weio_i2c_gpio = {
+	.name           = "i2c-gpio",
+	.id             = 0,
+	.dev            = {
+		.platform_data  = &weio_i2c_gpio_data,
+	},
+};
+
+static void __init weio_common_setup(void)
+{
+	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+	ath79_register_m25p80(NULL);
+	ath79_register_wmac(art + WEIO_CALDATA_OFFSET, art + WEIO_WMAC_MAC_OFFSET);
+}
+
+static void __init weio_setup(void)
+{
+	weio_common_setup();
+
+	ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	platform_device_register(&weio_i2c_gpio);
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(weio_leds_gpio),
+				weio_leds_gpio);
+
+	ath79_register_gpio_keys_polled(-1, WEIO_KEYS_POLL_INTERVAL,
+				ARRAY_SIZE(weio_gpio_keys),
+				weio_gpio_keys);
+
+	ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_WEIO, "WEIO", "WeIO board", weio_setup);

+ 17 - 0
target/linux/ar71xx/generic/profiles/weio.mk

@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/WEIO
+        NAME:=WeIO
+        PACKAGES:=kmod-usb-core kmod-usb2
+endef
+
+define Profile/WEIO/Description
+        Package set optimized for the WeIO board.
+endef
+
+$(eval $(call Profile,WEIO))

+ 8 - 0
target/linux/ar71xx/image/Makefile

@@ -208,6 +208,14 @@ define Device/cf-e316n-v2
 endef
 endef
 TARGET_DEVICES += cf-e316n-v2
 TARGET_DEVICES += cf-e316n-v2
 
 
+define Device/weio
+  BOARDNAME = WEIO
+  IMAGE_SIZE = 16000k
+  CONSOLE = ttyATH0,115200
+  MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
+endef
+TARGET_DEVICES += weio
+
 define Device/wndr3700
 define Device/wndr3700
   BOARDNAME = WNDR3700
   BOARDNAME = WNDR3700
   NETGEAR_KERNEL_MAGIC = 0x33373030
   NETGEAR_KERNEL_MAGIC = 0x33373030

+ 16 - 5
target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch

@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/machtypes.h
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,24 +16,209 @@
+@@ -16,24 +16,210 @@
  
  
  enum ath79_mach_type {
  enum ath79_mach_type {
  	ATH79_MACH_GENERIC = 0,
  	ATH79_MACH_GENERIC = 0,
@@ -178,6 +178,7 @@
  	ATH79_MACH_UBNT_UNIFI_OUTDOOR,	/* Ubiquiti UnifiAP Outdoor */
  	ATH79_MACH_UBNT_UNIFI_OUTDOOR,	/* Ubiquiti UnifiAP Outdoor */
 +	ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
 +	ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
  	ATH79_MACH_UBNT_XM,		/* Ubiquiti Networks XM board rev 1.0 */
  	ATH79_MACH_UBNT_XM,		/* Ubiquiti Networks XM board rev 1.0 */
++	ATH79_MACH_WEIO,			/* WeIO board */
 +	ATH79_MACH_WHR_G301N,		/* Buffalo WHR-G301N */
 +	ATH79_MACH_WHR_G301N,		/* Buffalo WHR-G301N */
 +	ATH79_MACH_WHR_HP_G300N,	/* Buffalo WHR-HP-G300N */
 +	ATH79_MACH_WHR_HP_G300N,	/* Buffalo WHR-HP-G300N */
 +	ATH79_MACH_WHR_HP_GN,		/* Buffalo WHR-HP-GN */
 +	ATH79_MACH_WHR_HP_GN,		/* Buffalo WHR-HP-GN */
@@ -1439,10 +1440,19 @@
  
  
  config ATH79_MACH_UBNT_XM
  config ATH79_MACH_UBNT_XM
  	bool "Ubiquiti Networks XM/UniFi boards"
  	bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1212,107 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1212,116 @@ config ATH79_MACH_UBNT_XM
  	  Say 'Y' here if you want your kernel to support the
  	  Say 'Y' here if you want your kernel to support the
  	  Ubiquiti Networks XM (rev 1.0) board.
  	  Ubiquiti Networks XM (rev 1.0) board.
  
  
++config ATH79_MACH_WEIO
++	bool "WeIO board"
++	select SOC_AR933X
++	select ATH79_DEV_GPIO_BUTTONS
++	select ATH79_DEV_LEDS_GPIO
++	select ATH79_DEV_M25P80
++	select ATH79_DEV_USB
++	select ATH79_DEV_WMAC
++
 +config ATH79_MACH_MYNET_N600
 +config ATH79_MACH_MYNET_N600
 +	bool "WD My Net N600 board support"
 +	bool "WD My Net N600 board support"
 +	select SOC_AR934X
 +	select SOC_AR934X
@@ -1547,7 +1557,7 @@
  endmenu
  endmenu
  
  
  config SOC_AR71XX
  config SOC_AR71XX
-@@ -134,7 +1364,10 @@ config ATH79_DEV_DSA
+@@ -134,7 +1373,10 @@ config ATH79_DEV_DSA
  config ATH79_DEV_ETH
  config ATH79_DEV_ETH
  	def_bool n
  	def_bool n
  
  
@@ -1559,7 +1569,7 @@
  	def_bool n
  	def_bool n
  
  
  config ATH79_DEV_GPIO_BUTTONS
  config ATH79_DEV_GPIO_BUTTONS
-@@ -164,6 +1397,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -164,6 +1406,11 @@ config ATH79_PCI_ATH9K_FIXUP
  	def_bool n
  	def_bool n
  
  
  config ATH79_ROUTERBOOT
  config ATH79_ROUTERBOOT
@@ -1573,7 +1583,7 @@
  endif
  endif
 --- a/arch/mips/ath79/Makefile
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,134 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
+@@ -38,9 +38,135 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
  #
  #
  # Machines
  # Machines
  #
  #
@@ -1683,6 +1693,7 @@
 +obj-$(CONFIG_ATH79_MACH_TUBE2H)		+= mach-tube2h.o
 +obj-$(CONFIG_ATH79_MACH_TUBE2H)		+= mach-tube2h.o
 +obj-$(CONFIG_ATH79_MACH_UBNT)		+= mach-ubnt.o
 +obj-$(CONFIG_ATH79_MACH_UBNT)		+= mach-ubnt.o
  obj-$(CONFIG_ATH79_MACH_UBNT_XM)	+= mach-ubnt-xm.o
  obj-$(CONFIG_ATH79_MACH_UBNT_XM)	+= mach-ubnt-xm.o
++obj-$(CONFIG_ATH79_MACH_WEIO)		+= mach-weio.o
 +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N)	+= mach-whr-hp-g300n.o
 +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N)	+= mach-whr-hp-g300n.o
 +obj-$(CONFIG_ATH79_MACH_WLAE_AG300N)	+= mach-wlae-ag300n.o
 +obj-$(CONFIG_ATH79_MACH_WLAE_AG300N)	+= mach-wlae-ag300n.o
 +obj-$(CONFIG_ATH79_MACH_WLR8100)	+= mach-wlr8100.o
 +obj-$(CONFIG_ATH79_MACH_WLR8100)	+= mach-wlr8100.o