Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with 8devices NUY #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .config
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ CONFIG_TARGET_ar71xx_generic=y
# CONFIG_TARGET_ar71xx_generic_JA76PF is not set
# CONFIG_TARGET_ar71xx_generic_JA76PF2 is not set
# CONFIG_TARGET_ar71xx_generic_JWAP003 is not set
CONFIG_TARGET_ar71xx_generic_Yun=y
# CONFIG_TARGET_ar71xx_generic_Yun is not set
# CONFIG_TARGET_ar71xx_generic_NUY is not set
CONFIG_TARGET_ar71xx_generic_Yun_compat=y
# CONFIG_TARGET_ar71xx_generic_WRT160NL is not set
# CONFIG_TARGET_ar71xx_generic_WRT400N is not set
# CONFIG_TARGET_ar71xx_generic_WNDR3700 is not set
Expand Down Expand Up @@ -4366,6 +4368,7 @@ CONFIG_PACKAGE_bluez-utils=m
CONFIG_PACKAGE_boblight-client=m
CONFIG_PACKAGE_boblight-daemon=m
CONFIG_PACKAGE_bonniexx=m
CONFIG_PACKAGE_bossa=y
CONFIG_PACKAGE_bsdiff=m
CONFIG_PACKAGE_byobu=m
CONFIG_PACKAGE_bzip2=m
Expand Down
23 changes: 23 additions & 0 deletions package/busybox/patches/960-init-block-askfirst.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/init/init.c
+++ b/init/init.c
@@ -476,6 +476,7 @@ static pid_t run(const struct init_actio
#endif
"\nPlease press Enter to activate this console. ";
char c;
+ char c2;
/*
* Save memory by not exec-ing anything large (like a shell)
* before the user wants it. This is critical if swap is not
@@ -488,8 +489,12 @@ static pid_t run(const struct init_actio
"(pid %d, tty '%s')\n",
a->command, getpid(), a->terminal);
full_write(STDOUT_FILENO, press_enter, sizeof(press_enter) - 1);
+
+ while (open_read_close("/tmp/block_init_askfirst", &c2, 1) >= 0)
+ sleep(1);
+
while (safe_read(STDIN_FILENO, &c, 1) == 1 && c != '\n')
continue;
}

/*
5 changes: 5 additions & 0 deletions target/linux/ar71xx/base-files/etc/uci-defaults/leds
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ nbg460n_550n_550nh)
ucidef_set_led_wlan "wlan" "WLAN" "nbg460n:green:wlan" "phy0tpt"
;;

nuy)
ucidef_set_led_netdev "wan" "WAN" "ds:green:wan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "ds:green:wlan" "phy0tpt"
;;

om2p | \
om2p-hs | \
om2p-lc)
Expand Down
3 changes: 3 additions & 0 deletions target/linux/ar71xx/base-files/lib/ar71xx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ ar71xx_board_detect() {
*"Arduino Yun")
name="yun"
;;
*"8devices NUY")
name="nuy"
;;
esac

case "$machine" in
Expand Down
1 change: 1 addition & 0 deletions target/linux/ar71xx/base-files/lib/upgrade/platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ platform_check_image() {
airrouter | \
bullet-m | \
nanostation-m | \
nuy | \
rocket-m | \
rw2458n | \
wzr-hp-g300nh2 | \
Expand Down
1 change: 1 addition & 0 deletions target/linux/ar71xx/config-3.3
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CONFIG_ATH79_DEV_WMAC=y
# CONFIG_ATH79_MACH_MZK_W04NU is not set
# CONFIG_ATH79_MACH_MZK_W300NH is not set
# CONFIG_ATH79_MACH_NBG460N is not set
CONFIG_ATH79_MACH_NUY=y
# CONFIG_ATH79_MACH_OM2P is not set
# CONFIG_ATH79_MACH_PB42 is not set
# CONFIG_ATH79_MACH_PB44 is not set
Expand Down
135 changes: 135 additions & 0 deletions target/linux/ar71xx/files/arch/mips/ath79/mach-nuy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
* 8devices NUY support
*
* Copyright (C) 2011-2012 Gabor Juhos <[email protected]>
*
* 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"

#define DS_GPIO_LED_WLAN 13
#define DS_GPIO_LED_WAN 1
#define DS_GPIO_LED_USB 0

#define DS_GPIO_OE 22 /*SPI*/
#define DS_GPIO_AVR_RESET 12
#define DS_GPIO_OE2 16 /*HANDSHAKE */
#define DS_GPIO_UART_ENA 17
#define DS_GPIO_CONF_BTN 11

#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 = "ds:green:usb",
.gpio = DS_GPIO_LED_USB,
.active_low = 1,
},
{
.name = "ds:green:wlan",
.gpio = DS_GPIO_LED_WLAN,
.active_low = 1,
},
{
.name = "ds:green:wan",
.gpio = DS_GPIO_LED_WAN,
.active_low = 1,
},
};

static struct gpio_keys_button ds_gpio_keys[] __initdata = {
{
.desc = "configuration button",
.type = EV_KEY,
.code = KEY_WPS_BUTTON,
.debounce_interval = DS_KEYS_DEBOUNCE_INTERVAL,
.gpio = DS_GPIO_CONF_BTN,
.active_low = 1,
},
};

static void __init ds_common_setup(void)
{
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
ath79_register_m25p80(NULL);

ath79_register_wmac(art + DS_CALDATA_OFFSET,
art + DS_WMAC_MAC_OFFSET);
ath79_init_mac(ath79_eth0_data.mac_addr, art + DS_MAC0_OFFSET, 0);
ath79_init_mac(ath79_eth1_data.mac_addr, art + DS_MAC1_OFFSET, 0);

ath79_register_mdio(0, 0x0);

/* LAN ports */
ath79_register_eth(0);

/* WAN port */
ath79_register_eth(1);
}

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_gpio_keys_polled(-1, DS_KEYS_POLL_INTERVAL,
ARRAY_SIZE(ds_gpio_keys),
ds_gpio_keys);
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|
AR933X_GPIO_FUNC2_WPS_DISABLE, 0);

printk("Setting NUY GPIO\n");

t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN;
ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);

// 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_HIGH | 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_NUY, "NUY", "8devices NUY",
ds_setup);
22 changes: 22 additions & 0 deletions target/linux/ar71xx/generic/profiles/linino.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,25 @@ endef

$(eval $(call Profile,Yun))

define Profile/NUY
NAME:=8devices NUY
PACKAGES:=kmod-usb-core kmod-usb2
endef

define Profile/NUY/Description
Package set optimized for the 8devices NUY.
endef

$(eval $(call Profile,NUY))


define Profile/Yun_compat
NAME:=All Arduino Yun compatible boards
PACKAGES:=kmod-usb-core kmod-usb2
endef

define Profile/Yun/Description
Packages for the Arduino Yun, 8devices NUY.
endef

$(eval $(call Profile,Yun_compat))
4 changes: 4 additions & 0 deletions target/linux/ar71xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ endef

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)
nuy_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1280k(kernel),14720k(rootfs),64k(art)ro,16000k@0x50000(firmware)
alfa_ap96_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13312k(rootfs),2048k(kernel),512k(caldata)ro,15360k@0x80000(firmware)
alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),1024k(kernel),5248k(rootfs),1536k(failsafe),64k(art),6272k@0x50000(firmware)
Expand Down Expand Up @@ -796,6 +797,8 @@ endef
$(eval $(call SingleProfile,YunLzma,$(fs_64k),YUN_8M,yun-8M,Yun,ttyATH0,250000,$$(yun_mtdlayout_8M),1310720,6619136,RKuImage))
$(eval $(call SingleProfile,YunLzma,$(fs_64k),YUN_16M,yun-16M,Yun,ttyATH0,250000,$$(yun_mtdlayout_16M),1310720,15007744,RKuImage))

$(eval $(call SingleProfile,AthLzma,$(fs_64k),NUY,nuy-16M,NUY,ttyATH0,250000,$$(nuy_mtdlayout_16M),1310720,15073280,KRuImage))

$(eval $(call SingleProfile,ALFA,$(fs_64k),ALFANX,alfa-nx,ALFA-NX,ttyS0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,vmlinux.gz.uImage,pb9x-2.6.31-jffs2))
$(eval $(call SingleProfile,ALFA,$(fs_64k),HORNETUB,hornet-ub,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel_image,rootfs_image))

Expand Down Expand Up @@ -934,6 +937,7 @@ $(eval $(call SingleProfile,ZyXEL,$(fs_64k),NBG_460N_550N_550NH,nbg460n_550n_550


$(eval $(call MultiProfile,Yun,YUN_16M YUN_8M))
$(eval $(call MultiProfile,Yun_compat,YUN_16M YUN_8M NUY))
$(eval $(call MultiProfile,AP121,AP121_8M AP121_4M))
$(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT))
$(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ Index: linux-3.8.3/arch/mips/include/asm/mach-ath79/ar71xx_regs.h

#define AR934X_GPIO_REG_OUT_FUNC0 0x2c
#define AR934X_GPIO_REG_OUT_FUNC1 0x30
@@ -690,6 +691,8 @@
@@ -690,6 +691,9 @@
#define AR724X_GPIO_FUNC_UART_EN BIT(1)
#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0)

+#define AR933X_GPIO_FUNC2_WPS_DISABLE BIT(8)
+#define AR933X_GPIO_FUNC2_JUMPSTART_DISABLE BIT(9)
+
#define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- ./drivers/tty/serial/ar933x_uart.c.ori 2013-06-27 13:57:53.251438941 +0200
+++ ./drivers/tty/serial/ar933x_uart.c 2013-06-27 13:56:16.271442407 +0200
@@ -191,6 +191,8 @@
--- a/drivers/tty/serial/ar933x_uart.c
+++ b/drivers/tty/serial/ar933x_uart.c
@@ -191,6 +191,8 @@ static unsigned long ar933x_uart_get_bau
return t;
}

Expand All @@ -9,26 +9,35 @@
static void ar933x_uart_get_scale_step(unsigned int clk,
unsigned int baud,
unsigned int *scale,
@@ -199,6 +201,25 @@
@@ -199,6 +201,34 @@ static void ar933x_uart_get_scale_step(u
unsigned int tscale;
long min_diff;

+#ifdef UART_BAUDRATE_COMP_MEGA32U4
+ /* Fix timing issues on Atmega32U4 w/16Mhz oscillator */
+ if (baud == 115200) {
+ *scale = 0x000C;
+ *step = 0x2000;
+ return;
+ if (clk == 25000000) {
+ if (baud == 115200) {
+ *scale = 0x000C;
+ *step = 0x2000;
+ return;
+ }
+ if (baud == 250000 || baud == 230400) {
+ *scale = 0x0017;
+ *step = 0x7AE0;
+ return;
+ }
+ if (baud == 500000) {
+ *scale = 0x000B;
+ *step = 0x7AE0;
+ return;
+ }
+ }
+ if (baud == 250000 || baud == 230400) {
+ *scale = 0x0017;
+ *step = 0x7AE0;
+ return;
+ }
+ if (baud == 500000) {
+ *scale = 0x000B;
+ *step = 0x7AE0;
+ return;
+ else if (clk == 40000000) {
+ if (baud == 250000 || baud == 230400) {
+ *scale = 0x0004;
+ *step = 0x1000;
+ return;
+ }
+ }
+#endif
+
Expand Down
40 changes: 40 additions & 0 deletions target/linux/ar71xx/patches-3.3/622-MIPS-ath79-NUY-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--- a/arch/mips/ath79/Kconfig
+++ b/arch/mips/ath79/Kconfig
@@ -660,6 +660,19 @@ config ATH79_MACH_Yun
help
Say 'Y' here if you want your kernel to support the
Arduino Yun.
+
+config ATH79_MACH_NUY
+ bool "8devices NUY"
+ 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
+ 8devices NUY.
endmenu

config SOC_AR71XX
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
@@ -105,4 +105,5 @@ obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH2)
obj-$(CONFIG_ATH79_MACH_WZR_HP_AG300H) += mach-wzr-hp-ag300h.o
obj-$(CONFIG_ATH79_MACH_WZR_HP_G450H) += mach-wzr-hp-g450h.o
obj-$(CONFIG_ATH79_MACH_ZCN_1523H) += mach-zcn-1523h.o
+obj-$(CONFIG_ATH79_MACH_NUY) += mach-nuy.o

--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
@@ -118,6 +118,7 @@ enum ath79_mach_type {
ATH79_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */
ATH79_MACH_ZCN_1523H_5, /* Zcomax ZCN-1523H-5-xx */
ATH79_MACH_Yun, /* Yun */
+ ATH79_MACH_NUY, /* 8devices NUY */
};

#endif /* _ATH79_MACHTYPE_H */