From patchwork Tue Jun 16 21:06:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drasko DRASKOVIC X-Patchwork-Id: 485180 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C8DCD1402AA for ; Wed, 17 Jun 2015 07:07:16 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=sb+Pkoz9; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id DD7F028BDA9; Tue, 16 Jun 2015 23:07:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 7D6BF28BC4A for ; Tue, 16 Jun 2015 23:06:56 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Tue, 16 Jun 2015 23:06:56 +0200 (CEST) Received: by wiwd19 with SMTP id d19so114559261wiw.0 for ; Tue, 16 Jun 2015 14:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=nLOScmVhKg2W4hnTbKDmNb9+edThOjo3sHRO/lWG6WQ=; b=sb+Pkoz9q0dqoLhdlWFsxGcD3ZKueJIVrZo0sF0b9F49jxoHijh6SNoOEerGZQWKTt Xsvd4MXfaRvtOt5vVQSj1cq18Mzfxgem1YqixEPJUhbBx1a+mVTerot7HKjxkKgDCo5Z KExWk4xtCqA9FTNJzYQBpLzgKsxG8jDeWg4DK4DXjHwXb6O4hn27ON5Pjo7LyYgtm0sw p9mqqj4bwGgR0kHpG8ZfPprXXME9ivkf1qeROAP9itg0m7INBf22v1KkFxhTR71rCdGT 3i6DsJcUfMhhErKrqnQRdtT4SpWA61QS488x6/czTHXZe6HqJW3A4x4yJdTzMMrpAoZ3 gsaQ== X-Received: by 10.180.81.106 with SMTP id z10mr46593111wix.22.1434488818771; Tue, 16 Jun 2015 14:06:58 -0700 (PDT) Received: from localhost.localdomain (pla75-4-88-190-40-78.fbxo.proxad.net. [88.190.40.78]) by mx.google.com with ESMTPSA id v3sm22598191wiz.14.2015.06.16.14.06.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jun 2015 14:06:58 -0700 (PDT) From: Drasko DRASKOVIC To: openwrt-devel@lists.openwrt.org Date: Tue, 16 Jun 2015 23:06:53 +0200 Message-Id: <1434488813-21753-1-git-send-email-drasko.draskovic@gmail.com> X-Mailer: git-send-email 2.1.4 Subject: [OpenWrt-Devel] [PATCH] Add support for WeIO board X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 3 +- target/linux/ar71xx/config-3.18 | 1 + .../linux/ar71xx/files/arch/mips/ath79/mach-weio.c | 162 +++++++++++++++++++++ target/linux/ar71xx/generic/profiles/weio.mk | 17 +++ target/linux/ar71xx/image/Makefile | 8 + .../610-MIPS-ath79-openwrt-machines.patch | 21 ++- 7 files changed, 209 insertions(+), 6 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c create mode 100644 target/linux/ar71xx/generic/profiles/weio.mk diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index b13be1e..fe7478c 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -892,6 +892,9 @@ ar71xx_board_detect() { "8devices Carambola2"*) name="carambola2" ;; + *"WeIO") + name="weio" + ;; *"Sitecom WLR-8100") name="wlr8100" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 3dbd91c..0f2920b 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -243,7 +243,8 @@ platform_check_image() { nbg460n_550n_550nh | \ unifi | \ unifi-outdoor | \ - carambola2 ) + carambola2 | \ + weio ) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 index 543b77e..e81ba51 100644 --- a/target/linux/ar71xx/config-3.18 +++ b/target/linux/ar71xx/config-3.18 @@ -126,6 +126,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y CONFIG_ATH79_MACH_TUBE2H=y CONFIG_ATH79_MACH_UBNT=y CONFIG_ATH79_MACH_UBNT_XM=y +CONFIG_ATH79_MACH_WEIO=y CONFIG_ATH79_MACH_WHR_HP_G300N=y CONFIG_ATH79_MACH_WLAE_AG300N=y CONFIG_ATH79_MACH_WLR8100=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c new file mode 100644 index 0000000..2ac4f92 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c @@ -0,0 +1,162 @@ +/** + * 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 + * Uros PETREVSKI + */ + +#include +#include +#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" +#include "linux/i2c-gpio.h" +#include "linux/platform_device.h" + +#define WEIO_GPIO_LED_STA 1 +#define WEIO_GPIO_LED_AP 16 +//#define WEIO_GPIO_LED_ETH0 13 + +#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 struct platform_device *weio_devices[] __initdata = { + &weio_i2c_gpio +}; + +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); + + /** WeIO does not use ETH - only WiFi by default */ +#if 0 + ath79_setup_ar933x_phy4_switch(true, true); + + ath79_init_mac(ath79_eth0_data.mac_addr, art + WEIO_MAC0_OFFSET, 0); + ath79_init_mac(ath79_eth1_data.mac_addr, art + WEIO_MAC1_OFFSET, 0); + + ath79_register_mdio(0, 0x0); + + /* LAN ports */ + ath79_register_eth(1); + + /* WAN port */ + ath79_register_eth(0); +#endif /** commented out ETH */ +} + +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_add_devices(weio_devices, ARRAY_SIZE(weio_devices)); + + 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 from Drasko DRASKOVIC and Uros PETREVSKI", + weio_setup); diff --git a/target/linux/ar71xx/generic/profiles/weio.mk b/target/linux/ar71xx/generic/profiles/weio.mk new file mode 100644 index 0000000..227cec9 --- /dev/null +++ b/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)) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 21d0d66..1f08ca0 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -179,6 +179,14 @@ define Device/carambola2 endef TARGET_DEVICES += carambola2 +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 BOARDNAME = WNDR3700 NETGEAR_KERNEL_MAGIC = 0x33373030 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 index f8a561c..e8c8d5a 100644 --- 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 @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -16,22 +16,191 @@ +@@ -16,22 +16,192 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, @@ -25,6 +25,7 @@ + ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */ + ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */ + ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */ ++ ATH79_MACH_WEIO, /* WeIO board */ + ATH79_MACH_CPE510, /* TP-LINK CPE510 */ ATH79_MACH_DB120, /* Atheros DB120 reference board */ ATH79_MACH_PB44, /* Atheros PB44 reference board */ @@ -1280,7 +1281,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM/UniFi boards" -@@ -83,6 +1071,97 @@ config ATH79_MACH_UBNT_XM +@@ -83,6 +1071,106 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -1354,6 +1355,15 @@ + select ATH79_DEV_USB + select ATH79_DEV_WMAC + ++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_BHU_BXU2000N2_A + bool "BHU BXU2000n-2 rev. A support" + select SOC_AR934X @@ -1378,7 +1388,7 @@ endmenu config SOC_AR71XX -@@ -124,7 +1203,10 @@ config ATH79_DEV_DSA +@@ -124,7 +1212,10 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -1390,7 +1400,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -154,6 +1236,11 @@ config ATH79_PCI_ATH9K_FIXUP +@@ -154,6 +1245,11 @@ config ATH79_PCI_ATH9K_FIXUP def_bool n config ATH79_ROUTERBOOT @@ -1404,7 +1414,7 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -38,9 +38,120 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route +@@ -38,9 +38,121 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route # # Machines # @@ -1524,6 +1534,7 @@ +obj-$(CONFIG_ATH79_MACH_WZR_450HP2) += mach-wzr-450hp2.o +obj-$(CONFIG_ATH79_MACH_ZCN_1523H) += mach-zcn-1523h.o +obj-$(CONFIG_ATH79_MACH_CARAMBOLA2) += mach-carambola2.o ++obj-$(CONFIG_ATH79_MACH_WEIO) += mach-weio.o +obj-$(CONFIG_ATH79_MACH_NBG6716) += mach-nbg6716.o --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c