mirror of https://github.com/hak5/openwrt-owl.git
ar71xx: add Arduino Yun
This is based on patches from Federico Fissore <f.fissore@arduino.cc>
especially this one:
7e2976fa83
The console is running with 250000 baud which is a non standard baud
rate and needs an extra patch to be applied, I will try to get this
patch upstream or something else which accomplish the same.
Some upstream code looks like there are many different versions of this
SoC, are these only internal versions and all versions on the consumer
market are the same? I saw different GPIO configuration and flash sizes
of 8MB and 16MB?
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
SVN-Revision: 47451
owl
parent
1bfbf2de6d
commit
fa137d51f5
|
@ -43,6 +43,11 @@ antminer-s3)
|
||||||
ucidef_set_led_default "lan" "LAN" "antminer-s3:yellow:lan" "0"
|
ucidef_set_led_default "lan" "LAN" "antminer-s3:yellow:lan" "0"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
arduino-yun)
|
||||||
|
ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
|
||||||
|
ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1"
|
||||||
|
;;
|
||||||
|
|
||||||
ap113)
|
ap113)
|
||||||
ucidef_set_led_usbdev "usb" "USB" "ap113:green:usb" "1-1"
|
ucidef_set_led_usbdev "usb" "USB" "ap113:green:usb" "1-1"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -388,6 +388,7 @@ wp543)
|
||||||
ucidef_set_interface_lan "eth0"
|
ucidef_set_interface_lan "eth0"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
arduino-yun | \
|
||||||
dir-505-a1)
|
dir-505-a1)
|
||||||
ucidef_set_interface_lan "eth1"
|
ucidef_set_interface_lan "eth1"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -359,6 +359,9 @@ ar71xx_board_detect() {
|
||||||
*Antminer-S3)
|
*Antminer-S3)
|
||||||
name="antminer-s3"
|
name="antminer-s3"
|
||||||
;;
|
;;
|
||||||
|
*"Arduino Yun")
|
||||||
|
name="arduino-yun"
|
||||||
|
;;
|
||||||
*AP113)
|
*AP113)
|
||||||
name="ap113"
|
name="ap113"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -173,6 +173,7 @@ platform_check_image() {
|
||||||
;;
|
;;
|
||||||
alfa-ap96 | \
|
alfa-ap96 | \
|
||||||
alfa-nx | \
|
alfa-nx | \
|
||||||
|
arduino-yun | \
|
||||||
ap113 | \
|
ap113 | \
|
||||||
ap121 | \
|
ap121 | \
|
||||||
ap121-mini | \
|
ap121-mini | \
|
||||||
|
|
|
@ -46,6 +46,7 @@ CONFIG_ATH79_MACH_AP81=y
|
||||||
CONFIG_ATH79_MACH_AP83=y
|
CONFIG_ATH79_MACH_AP83=y
|
||||||
CONFIG_ATH79_MACH_AP96=y
|
CONFIG_ATH79_MACH_AP96=y
|
||||||
CONFIG_ATH79_MACH_ARCHER_C7=y
|
CONFIG_ATH79_MACH_ARCHER_C7=y
|
||||||
|
CONFIG_ATH79_MACH_ARDUINO_YUN=y
|
||||||
CONFIG_ATH79_MACH_AW_NR580=y
|
CONFIG_ATH79_MACH_AW_NR580=y
|
||||||
CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
|
CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
|
||||||
CONFIG_ATH79_MACH_BSB=y
|
CONFIG_ATH79_MACH_BSB=y
|
||||||
|
@ -193,6 +194,8 @@ CONFIG_CPU_R4K_FPU=y
|
||||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||||
CONFIG_CPU_SUPPORTS_MSA=y
|
CONFIG_CPU_SUPPORTS_MSA=y
|
||||||
|
CONFIG_CRYPTO_RNG2=y
|
||||||
|
CONFIG_CRYPTO_WORKQUEUE=y
|
||||||
CONFIG_CSRC_R4K=y
|
CONFIG_CSRC_R4K=y
|
||||||
CONFIG_DMA_NONCOHERENT=y
|
CONFIG_DMA_NONCOHERENT=y
|
||||||
CONFIG_EARLY_PRINTK=y
|
CONFIG_EARLY_PRINTK=y
|
||||||
|
@ -334,7 +337,7 @@ CONFIG_SOC_AR933X=y
|
||||||
CONFIG_SOC_AR934X=y
|
CONFIG_SOC_AR934X=y
|
||||||
CONFIG_SOC_QCA953X=y
|
CONFIG_SOC_QCA953X=y
|
||||||
CONFIG_SOC_QCA955X=y
|
CONFIG_SOC_QCA955X=y
|
||||||
# CONFIG_SOC_QCA956X is not set
|
CONFIG_SOC_QCA956X=y
|
||||||
CONFIG_SPI=y
|
CONFIG_SPI=y
|
||||||
CONFIG_SPI_AP83=y
|
CONFIG_SPI_AP83=y
|
||||||
CONFIG_SPI_ATH79=y
|
CONFIG_SPI_ATH79=y
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*
|
||||||
|
* Arduino Yun support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
* Copyright (C) 2015 Hauke Mehrtens <hauke@hauke-m.de>
|
||||||
|
*
|
||||||
|
* 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 "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 <asm/mach-ath79/ar71xx_regs.h>
|
||||||
|
#include <asm/mach-ath79/ath79.h>
|
||||||
|
#include "common.h"
|
||||||
|
#include "gpio.h"
|
||||||
|
#include "linux/gpio.h"
|
||||||
|
|
||||||
|
// Uncomment to have reset on gpio18 instead of gipo7
|
||||||
|
#define DS2_B
|
||||||
|
|
||||||
|
#define DS_GPIO_LED_WLAN 0
|
||||||
|
#define DS_GPIO_LED_USB 1
|
||||||
|
|
||||||
|
#define DS_GPIO_OE 21
|
||||||
|
#define DS_GPIO_AVR_RESET 18
|
||||||
|
|
||||||
|
// Maintained to have the console in the previous version of DS2 working
|
||||||
|
#define DS_GPIO_AVR_RESET_DS2 7
|
||||||
|
|
||||||
|
#define DS_GPIO_OE2 22
|
||||||
|
#define DS_GPIO_UART_ENA 23
|
||||||
|
#define DS_GPIO_CONF_BTN 20
|
||||||
|
|
||||||
|
#define DS_KEYS_POLL_INTERVAL 20 /* msecs */
|
||||||
|
#define DS_KEYS_DEBOUNCE_INTERVAL (3 * DS_KEYS_POLL_INTERVAL)
|
||||||
|
|
||||||
|
#define DS_MAC0_OFFSET 0x0000
|
||||||
|
#define DS_MAC1_OFFSET 0x0006
|
||||||
|
#define DS_CALDATA_OFFSET 0x1000
|
||||||
|
#define DS_WMAC_MAC_OFFSET 0x1002
|
||||||
|
|
||||||
|
|
||||||
|
static struct gpio_led ds_leds_gpio[] __initdata = {
|
||||||
|
{
|
||||||
|
.name = "arduino:white:usb",
|
||||||
|
.gpio = DS_GPIO_LED_USB,
|
||||||
|
.active_low = 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "arduino:blue:wlan",
|
||||||
|
.gpio = DS_GPIO_LED_WLAN,
|
||||||
|
.active_low = 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static void __init ds_common_setup(void)
|
||||||
|
{
|
||||||
|
static u8 mac[6];
|
||||||
|
|
||||||
|
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
|
||||||
|
ath79_register_m25p80(NULL);
|
||||||
|
|
||||||
|
if (ar93xx_wmac_read_mac_address(mac)) {
|
||||||
|
ath79_register_wmac(NULL, NULL);
|
||||||
|
} else {
|
||||||
|
ath79_register_wmac(art + DS_CALDATA_OFFSET,
|
||||||
|
art + DS_WMAC_MAC_OFFSET);
|
||||||
|
memcpy(mac, art + DS_WMAC_MAC_OFFSET, sizeof(mac));
|
||||||
|
}
|
||||||
|
|
||||||
|
mac[3] |= 0x08;
|
||||||
|
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
|
||||||
|
|
||||||
|
mac[3] &= 0xF7;
|
||||||
|
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
|
||||||
|
ath79_register_mdio(0, 0x0);
|
||||||
|
|
||||||
|
/* LAN ports */
|
||||||
|
ath79_register_eth(1);
|
||||||
|
|
||||||
|
/* WAN port */
|
||||||
|
ath79_register_eth(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __init ds_setup(void)
|
||||||
|
{
|
||||||
|
u32 t;
|
||||||
|
|
||||||
|
ds_common_setup();
|
||||||
|
|
||||||
|
ath79_register_leds_gpio(-1, ARRAY_SIZE(ds_leds_gpio),
|
||||||
|
ds_leds_gpio);
|
||||||
|
ath79_register_usb();
|
||||||
|
|
||||||
|
//Disable the Function for some pins to have GPIO functionality active
|
||||||
|
// GPIO6-7-8 and GPIO11
|
||||||
|
ath79_gpio_function_setup(AR933X_GPIO_FUNC_JTAG_DISABLE | AR933X_GPIO_FUNC_I2S_MCK_EN, 0);
|
||||||
|
|
||||||
|
ath79_gpio_function2_setup(AR933X_GPIO_FUNC2_JUMPSTART_DISABLE, 0);
|
||||||
|
|
||||||
|
printk("Setting DogStick2 GPIO\n");
|
||||||
|
|
||||||
|
t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
|
||||||
|
t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN;
|
||||||
|
ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
|
||||||
|
|
||||||
|
// Put the avr reset to high
|
||||||
|
if (gpio_request_one(DS_GPIO_AVR_RESET_DS2,
|
||||||
|
GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-1") != 0)
|
||||||
|
printk("Error setting GPIO OE\n");
|
||||||
|
gpio_unexport(DS_GPIO_AVR_RESET_DS2);
|
||||||
|
gpio_free(DS_GPIO_AVR_RESET_DS2);
|
||||||
|
|
||||||
|
// enable OE of level shifter
|
||||||
|
if (gpio_request_one(DS_GPIO_OE,
|
||||||
|
GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-1") != 0)
|
||||||
|
printk("Error setting GPIO OE\n");
|
||||||
|
|
||||||
|
if (gpio_request_one(DS_GPIO_UART_ENA,
|
||||||
|
GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "UART-ENA") != 0)
|
||||||
|
printk("Error setting GPIO Uart Enable\n");
|
||||||
|
|
||||||
|
// enable OE of level shifter
|
||||||
|
if (gpio_request_one(DS_GPIO_OE2,
|
||||||
|
GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-2") != 0)
|
||||||
|
printk("Error setting GPIO OE2\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
MIPS_MACHINE(ATH79_MACH_ARDUINO_YUN, "Yun", "Arduino Yun", ds_setup);
|
|
@ -0,0 +1,19 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009-2010 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
define Profile/Yun
|
||||||
|
NAME:=Arduino Yun based on Atheros AR9331
|
||||||
|
PACKAGES:=kmod-usb-core kmod-usb2
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Profile/Yun/Description
|
||||||
|
Package set optimized for the Arduino Yun.
|
||||||
|
This is sometimes also named Genuino Yun or Linino Yun.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call Profile,Yun))
|
||||||
|
|
|
@ -1489,6 +1489,8 @@ mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdat
|
||||||
mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
|
mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
|
||||||
zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
|
zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
|
||||||
qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
|
qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
|
||||||
|
yun_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6464k(rootfs),1280k(kernel),64k(nvram),64k(art),7744k@0x50000(firmware)
|
||||||
|
yun_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware)
|
||||||
|
|
||||||
|
|
||||||
define Image/BuildKernel
|
define Image/BuildKernel
|
||||||
|
@ -2249,6 +2251,8 @@ $(eval $(call SingleProfile,AthLzma,64k,WLR8100,wlr8100,WLR8100,ttyS0,115200,$$(
|
||||||
$(eval $(call SingleProfile,AthLzma,64k,WPJ344_16M,wpj344-16M,WPJ344,ttyS0,115200,$$(wpj344_mtdlayout_16M),KRuImage,65536))
|
$(eval $(call SingleProfile,AthLzma,64k,WPJ344_16M,wpj344-16M,WPJ344,ttyS0,115200,$$(wpj344_mtdlayout_16M),KRuImage,65536))
|
||||||
$(eval $(call SingleProfile,AthLzma,64k,WPJ531_16M,wpj531-16M,WPJ531,ttyS0,115200,$$(wpj531_mtdlayout_16M),KRuImage,65536))
|
$(eval $(call SingleProfile,AthLzma,64k,WPJ531_16M,wpj531-16M,WPJ531,ttyS0,115200,$$(wpj531_mtdlayout_16M),KRuImage,65536))
|
||||||
$(eval $(call SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,115200,$$(wpj558_mtdlayout_16M),KRuImage,65536))
|
$(eval $(call SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,115200,$$(wpj558_mtdlayout_16M),KRuImage,65536))
|
||||||
|
$(eval $(call SingleProfile,AthLzma,64k,YUN_8M,yun-8M,Yun,ttyATH0,250000,$$(yun_mtdlayout_8M),RKuImage))
|
||||||
|
$(eval $(call SingleProfile,AthLzma,64k,YUN_16M,yun-16M,Yun,ttyATH0,250000,$$(yun_mtdlayout_16M),RKuImage))
|
||||||
|
|
||||||
$(eval $(call SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))
|
$(eval $(call SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))
|
||||||
|
|
||||||
|
@ -2375,6 +2379,7 @@ $(eval $(call MultiProfile,WPE72,WPE72_4M WPE72_8M WPE72_16M))
|
||||||
$(eval $(call MultiProfile,WPJ344,WPJ344_16M))
|
$(eval $(call MultiProfile,WPJ344,WPJ344_16M))
|
||||||
$(eval $(call MultiProfile,WPJ531,WPJ531_16M))
|
$(eval $(call MultiProfile,WPJ531,WPJ531_16M))
|
||||||
$(eval $(call MultiProfile,WPJ558,WPJ558_16M))
|
$(eval $(call MultiProfile,WPJ558,WPJ558_16M))
|
||||||
|
$(eval $(call MultiProfile,Yun,YUN_16M YUN_8M))
|
||||||
|
|
||||||
$(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
|
$(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
|
||||||
$(eval $(call MultiProfile,Madwifi,EAP7660D WP543))
|
$(eval $(call MultiProfile,Madwifi,EAP7660D WP543))
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
--- a/arch/mips/ath79/Kconfig
|
||||||
|
+++ b/arch/mips/ath79/Kconfig
|
||||||
|
@@ -76,6 +76,19 @@ config ATH79_MACH_ANTMINER_S3
|
||||||
|
select ATH79_DEV_USB
|
||||||
|
select ATH79_DEV_WMAC
|
||||||
|
|
||||||
|
+config ATH79_MACH_ARDUINO_YUN
|
||||||
|
+ bool "Arduino Yun"
|
||||||
|
+ select SOC_AR933X
|
||||||
|
+ select ATH79_DEV_ETH
|
||||||
|
+ select ATH79_DEV_GPIO_BUTTONS
|
||||||
|
+ select ATH79_DEV_LEDS_GPIO
|
||||||
|
+ select ATH79_DEV_M25P80
|
||||||
|
+ select ATH79_DEV_USB
|
||||||
|
+ select ATH79_DEV_WMAC
|
||||||
|
+ help
|
||||||
|
+ Say 'Y' here if you want your kernel to support the
|
||||||
|
+ Arduino Yun.
|
||||||
|
+
|
||||||
|
config ATH79_MACH_AP113
|
||||||
|
bool "Atheros AP113 board support"
|
||||||
|
select SOC_AR724X
|
||||||
|
--- a/arch/mips/ath79/machtypes.h
|
||||||
|
+++ b/arch/mips/ath79/machtypes.h
|
||||||
|
@@ -23,6 +23,7 @@ enum ath79_mach_type {
|
||||||
|
ATH79_MACH_ALL0315N, /* Allnet ALL0315N */
|
||||||
|
ATH79_MACH_ANTMINER_S1, /* Antminer S1 */
|
||||||
|
ATH79_MACH_ANTMINER_S3, /* Antminer S3 */
|
||||||
|
+ ATH79_MACH_ARDUINO_YUN, /* Yun */
|
||||||
|
ATH79_MACH_AP113, /* Atheros AP113 reference board */
|
||||||
|
ATH79_MACH_AP121, /* Atheros AP121 reference board */
|
||||||
|
ATH79_MACH_AP121_MINI, /* Atheros AP121-MINI reference board */
|
||||||
|
--- a/arch/mips/ath79/Makefile
|
||||||
|
+++ b/arch/mips/ath79/Makefile
|
||||||
|
@@ -44,6 +44,7 @@ obj-$(CONFIG_ATH79_MACH_ALL0258N) += mac
|
||||||
|
obj-$(CONFIG_ATH79_MACH_ALL0315N) += mach-all0315n.o
|
||||||
|
obj-$(CONFIG_ATH79_MACH_ANTMINER_S1)+= mach-antminer-s1.o
|
||||||
|
obj-$(CONFIG_ATH79_MACH_ANTMINER_S3)+= mach-antminer-s3.o
|
||||||
|
+obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN) += mach-arduino-yun.o
|
||||||
|
obj-$(CONFIG_ATH79_MACH_AP113) += mach-ap113.o
|
||||||
|
obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o
|
||||||
|
obj-$(CONFIG_ATH79_MACH_AP132) += mach-ap132.o
|
Loading…
Reference in New Issue