-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi.
This patch adds support for DRAGINO2 board (used by Meshpotato v2). Most of the files included can be found in the official svn repository provided by the company [1]. I have just adapt it to the last OpenWrt trunk revision (Fri Oct 4 10:49:47 2013). Thank you. [1] http://svn.dragino.com/dragino2 - -- ./p4u -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (GNU/Linux) iQEcBAEBAgAGBQJSTyYiAAoJEAX7rWpc+YnNBy8H/0JaNJ6OWmDT85g6e5GWZWfY 45biq+t7gAdY7CJS98vSEyf2ZmE/fMkC4tN0tToTSr2qL9+qNRoO0sSJ+Bt7A/KC QJJMQchC1tJI+jxG/1BUQRggckmf/EDE17Gi+q9lDy9ddx7aIJYMAy+/MNj3h96T +KGzZMYlkYfDu3Eu28bBTFJu/nfFCX5QUEBaRv38QLacVnGkt9EfGvZWRIbLfUG8 icdpTEXpAulRLoB9kFeqt/M0mY0Mbe91rp/gaVcXtjl7Qm2oOENmuz1P4055eKXd LSkRZwGxsHxnUo9ZCBE4z2OyOk1UGVhTVypKxKKTHv60rx5QeV7Dw+IsV8TsvWI= =7iu6 -----END PGP SIGNATURE-----
>From be2c2fbd99a9eeb08c1135a19489c842f9ae6fc1 Mon Sep 17 00:00:00 2001 From: p4u <p...@dabax.net> Date: Fri, 4 Oct 2013 19:36:42 +0200 Subject: [PATCH] Add support for DRAGINO2 Signed-off-by: Pau Escrich <p...@dabax.net> --- target/linux/ar71xx/config-3.10 | 2 +- .../ar71xx/files/arch/mips/ath79/mach-dragino2.c | 135 +++++++++++++++++++++ target/linux/ar71xx/generic/profiles/dragino.mk | 17 +++ target/linux/ar71xx/image/Makefile | 3 + .../700-MIPS-ath79-dragino2.machine.patch | 39 ++++++ 5 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c create mode 100644 target/linux/ar71xx/generic/profiles/dragino.mk create mode 100644 target/linux/ar71xx/patches-3.10/700-MIPS-ath79-dragino2.machine.patch diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10 index f88d008..ca8ea6c 100644 --- a/target/linux/ar71xx/config-3.10 +++ b/target/linux/ar71xx/config-3.10 @@ -43,6 +43,7 @@ CONFIG_ATH79_MACH_DIR_600_A1=y CONFIG_ATH79_MACH_DIR_615_C1=y CONFIG_ATH79_MACH_DIR_825_B1=y CONFIG_ATH79_MACH_DIR_825_C1=y +CONFIG_ATH79_MACH_DRAGINO2=y CONFIG_ATH79_MACH_EAP7660D=y CONFIG_ATH79_MACH_EW_DORIN=y CONFIG_ATH79_MACH_HORNET_UB=y @@ -207,7 +208,6 @@ CONFIG_MTD_M25P80=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set # CONFIG_MTD_MAP_BANK_WIDTH_4 is not set CONFIG_MTD_MYLOADER_PARTS=y -# CONFIG_MTD_NAND_AR934X_HW_ECC is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_PARTS=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c new file mode 100644 index 0000000..45a0eb3 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c @@ -0,0 +1,135 @@ +/* + * DRAGINO V2 board support, based on Atheros AP121 board support + * + * Copyright (C) 2011-2012 Gabor Juhos <juh...@openwrt.org> + * Copyright (C) 2012 Elektra Wagenrad <elek...@villagetelco.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/gpio.h> +#include <asm/mach-ath79/ath79.h> +#include <asm/mach-ath79/ar71xx_regs.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 DRAGINO2_GPIO_LED_WLAN 0 +#define DRAGINO2_GPIO_LED_LAN 13 +#define DRAGINO2_GPIO_LED_WAN 17 + +/* The following GPIO is actually named "Router" on the board. + * However, since the "Router" feature is not supported as of yet + * we use it to display USB activity. + */ + +#define DRAGINO2_GPIO_LED_USB 28 +#define DRAGINO2_GPIO_BTN_JUMPSTART 11 +#define DRAGINO2_GPIO_BTN_RESET 12 + +#define DRAGINO2_KEYS_POLL_INTERVAL 20 /* msecs */ +#define DRAGINO2_KEYS_DEBOUNCE_INTERVAL (3 * DRAGINO2_KEYS_POLL_INTERVAL) + +#define DRAGINO2_MAC0_OFFSET 0x0000 +#define DRAGINO2_MAC1_OFFSET 0x0006 +#define DRAGINO2_CALDATA_OFFSET 0x1000 +#define DRAGINO2_WMAC_MAC_OFFSET 0x1002 + +static struct gpio_led dragino2_leds_gpio[] __initdata = { + { + .name = "dragino2:red:lan", + .gpio = DRAGINO2_GPIO_LED_LAN, + .active_low = 0, + }, + { + .name = "dragino2:red:wlan", + .gpio = DRAGINO2_GPIO_LED_WLAN, + .active_low = 0, + }, + { + .name = "dragino2:red:wan", + .gpio = DRAGINO2_GPIO_LED_WAN, + .active_low = 0, + }, + { + .name = "dragino2:red:usb", + .gpio = DRAGINO2_GPIO_LED_USB, + .active_low = 0, + }, + + +}; + +static struct gpio_keys_button dragino2_gpio_keys[] __initdata = { + { + .desc = "jumpstart button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = DRAGINO2_KEYS_DEBOUNCE_INTERVAL, + .gpio = DRAGINO2_GPIO_BTN_JUMPSTART, + .active_low = 1, + }, + { + .desc = "reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = DRAGINO2_KEYS_DEBOUNCE_INTERVAL, + .gpio = DRAGINO2_GPIO_BTN_RESET, + .active_low = 1, + } +}; + + + +static void __init dragino2_common_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(NULL); + ath79_register_wmac(art + DRAGINO2_CALDATA_OFFSET, + art + DRAGINO2_WMAC_MAC_OFFSET); + + ath79_init_mac(ath79_eth0_data.mac_addr, art + DRAGINO2_MAC0_OFFSET, 0); + ath79_init_mac(ath79_eth1_data.mac_addr, art + DRAGINO2_MAC1_OFFSET, 0); + + ath79_register_mdio(0, 0x0); + + //Enable GPIO15 and GPIO16 and possibly GPIO26 and GPIO27 + ath79_gpio_function_disable( + AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | + AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN + ); +// AR933X_BOOTSTRAP_MDIO_GPIO_EN + + /* LAN ports */ + ath79_register_eth(1); + + /* WAN port */ + ath79_register_eth(0); +} + +static void __init dragino2_setup(void) +{ + dragino2_common_setup(); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(dragino2_leds_gpio), + dragino2_leds_gpio); + ath79_register_gpio_keys_polled(-1, DRAGINO2_KEYS_POLL_INTERVAL, + ARRAY_SIZE(dragino2_gpio_keys), + dragino2_gpio_keys); + ath79_register_usb(); + +} + + +MIPS_MACHINE(ATH79_MACH_DRAGINO2, "DRAGINO2", "Dragino Dragino v2", + dragino2_setup); + diff --git a/target/linux/ar71xx/generic/profiles/dragino.mk b/target/linux/ar71xx/generic/profiles/dragino.mk new file mode 100644 index 0000000..ff222c1 --- /dev/null +++ b/target/linux/ar71xx/generic/profiles/dragino.mk @@ -0,0 +1,17 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/DRAGINO2 + NAME:=DRAGINO2 + PACKAGES:=kmod-ath9k kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev +endef + +define Profile/DRAGINO2/Description + Package set optimized for the DRAGINO v2. +endef + +$(eval $(call Profile,DRAGINO2)) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 1b276c5..2fce6b0 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -187,6 +187,7 @@ cameo_ap94_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7808k(firmw ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),3712k(firmware),64k(art) dlrtdev_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,640k(certs),960k(unknown)ro,64k@0x7f0000(caldata_copy) dlrtdev_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7168k(firmware),640k(certs),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig) +dragino2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,1024k(kernel),14976k(rootfs),64k(config)ro,64k(art)ro,16000k@0x40000(firmware) pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware) planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),128k(art)ro ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro @@ -816,6 +817,8 @@ $(eval $(call SingleProfile,AthLzma,64k,EWDORINRT,ew-dorin-router,EW-DORIN-ROUTE $(eval $(call SingleProfile,AthLzma,64k,HORNETUBx2,hornet-ub-x2,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_16M),65536,16318464,KRuImage)) $(eval $(call SingleProfile,AthLzma,64k,PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdlayout),917504,2818048,KRuImage)) +$(eval $(call SingleProfile,AthLzma,64k,DRAGINO2,dragino2,DRAGINO2,ttyATH0,115200,$$(dragino2_mtdlayout),1048576,15335424,KRuImage)) + $(eval $(call SingleProfile,CameoAP91,64kraw,DIR600A1,dir-600-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-00")) $(eval $(call SingleProfile,CameoAP91,64kraw,DIR601A1,dir-601-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-02")) $(eval $(call SingleProfile,CameoAP91,64kraw,FR54RTR,fr-54rtr,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-01")) diff --git a/target/linux/ar71xx/patches-3.10/700-MIPS-ath79-dragino2.machine.patch b/target/linux/ar71xx/patches-3.10/700-MIPS-ath79-dragino2.machine.patch new file mode 100644 index 0000000..2fe6801 --- /dev/null +++ b/target/linux/ar71xx/patches-3.10/700-MIPS-ath79-dragino2.machine.patch @@ -0,0 +1,39 @@ +--- a/arch/mips/ath79/Kconfig ++++ b/arch/mips/ath79/Kconfig +@@ -270,6 +270,16 @@ config ATH79_MACH_DIR_825_B1 + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + ++config ATH79_MACH_DRAGINO2 ++ bool "DRAGINO V2 support" ++ select SOC_AR933X ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_WMAC ++ select ATH79_DEV_ETH ++ select ATH79_DEV_USB ++ + config ATH79_MACH_EW_DORIN + bool "embedded wireless Dorin Platform support" + select SOC_AR933X +--- a/arch/mips/ath79/Makefile ++++ b/arch/mips/ath79/Makefile +@@ -56,6 +56,7 @@ + obj-$(CONFIG_ATH79_MACH_DIR_615_C1) += mach-dir-615-c1.o + obj-$(CONFIG_ATH79_MACH_DIR_825_B1) += mach-dir-825-b1.o + obj-$(CONFIG_ATH79_MACH_DIR_825_C1) += mach-dir-825-c1.o ++obj-$(CONFIG_ATH79_MACH_DRAGINO2) += mach-dragino2.o + obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o + obj-$(CONFIG_ATH79_MACH_EAP7660D) += mach-eap7660d.o + obj-$(CONFIG_ATH79_MACH_JA76PF) += mach-ja76pf.o@@ -56,6 +56,7 @@ +--- a/arch/mips/ath79/machtypes.h ++++ b/arch/mips/ath79/machtypes.h +@@ -44,6 +44,7 @@ + ATH79_MACH_DIR_825_B1, /* D-Link DIR-825 rev. B1 */ + ATH79_MACH_DIR_825_C1, /* D-Link DIR-825 rev. C1 */ + ATH79_MACH_DIR_835_A1, /* D-Link DIR-835 rev. A1 */ ++ ATH79_MACH_DRAGINO2, /* Dragino Version 2 */ + ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */ + ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */ + ATH79_MACH_EAP7660D, /* Senao EAP7660D */ -- 1.8.4
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel