From a7bb7dd99ebe9fcdcc6fb3152eaa830a302d5028 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 27 Sep 2010 08:59:53 +0000 Subject: Add support for Atheros AP96 reference board This is still preliminary and not really tested much. Anyway, this version seems to be enough to get both wired and wireless interfaces working. Buttons and leds are also working. mach-ap96.c is based on mach-wndr3700.c. Signed-off-by: Jouni Malinen SVN-Revision: 23125 --- .../ar71xx/base-files/etc/defconfig/ap96/network | 16 ++ target/linux/ar71xx/base-files/etc/diag.sh | 3 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + target/linux/ar71xx/config-2.6.32 | 1 + target/linux/ar71xx/config-2.6.33 | 1 + target/linux/ar71xx/config-2.6.34 | 1 + target/linux/ar71xx/config-2.6.35 | 1 + target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig | 9 ++ .../linux/ar71xx/files/arch/mips/ar71xx/Makefile | 1 + .../ar71xx/files/arch/mips/ar71xx/mach-ap96.c | 175 +++++++++++++++++++++ .../linux/ar71xx/files/arch/mips/ar71xx/machtype.h | 1 + target/linux/ar71xx/generic/profiles/atheros.mk | 11 ++ target/linux/ar71xx/image/Makefile | 5 + 13 files changed, 228 insertions(+) create mode 100644 target/linux/ar71xx/base-files/etc/defconfig/ap96/network create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c diff --git a/target/linux/ar71xx/base-files/etc/defconfig/ap96/network b/target/linux/ar71xx/base-files/etc/defconfig/ap96/network new file mode 100644 index 0000000000..2d4d8e0121 --- /dev/null +++ b/target/linux/ar71xx/base-files/etc/defconfig/ap96/network @@ -0,0 +1,16 @@ +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option type bridge + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + +config interface wan + option ifname eth1 + option proto dhcp diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index b1e1d2312b..a26a4cbdad 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -36,6 +36,9 @@ get_status_led() { ap83) status_led="ap83:green:power" ;; + ap96) + status_led="ap96:green:led2" + ;; aw-nr580) status_led="aw-nr580:green:ready" ;; diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 4b08e93c18..877bab2533 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -16,6 +16,9 @@ ar71xx_board_name() { *AP83) name="ap83" ;; + *AP96) + name="ap96" + ;; *AW-NR580) name="aw-nr580" ;; diff --git a/target/linux/ar71xx/config-2.6.32 b/target/linux/ar71xx/config-2.6.32 index b3ed8917a3..1c464f8458 100644 --- a/target/linux/ar71xx/config-2.6.32 +++ b/target/linux/ar71xx/config-2.6.32 @@ -19,6 +19,7 @@ CONFIG_AR71XX_DEV_PB9X_PCI=y CONFIG_AR71XX_DEV_USB=y CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y +CONFIG_AR71XX_MACH_AP96=y CONFIG_AR71XX_MACH_AW_NR580=y CONFIG_AR71XX_MACH_DIR_600_A1=y CONFIG_AR71XX_MACH_DIR_615_C1=y diff --git a/target/linux/ar71xx/config-2.6.33 b/target/linux/ar71xx/config-2.6.33 index e27fb2a251..ea56d706e9 100644 --- a/target/linux/ar71xx/config-2.6.33 +++ b/target/linux/ar71xx/config-2.6.33 @@ -19,6 +19,7 @@ CONFIG_AR71XX_DEV_PB9X_PCI=y CONFIG_AR71XX_DEV_USB=y CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y +CONFIG_AR71XX_MACH_AP96=y CONFIG_AR71XX_MACH_AW_NR580=y CONFIG_AR71XX_MACH_DIR_600_A1=y CONFIG_AR71XX_MACH_DIR_615_C1=y diff --git a/target/linux/ar71xx/config-2.6.34 b/target/linux/ar71xx/config-2.6.34 index 6632d501df..81ccd6ba67 100644 --- a/target/linux/ar71xx/config-2.6.34 +++ b/target/linux/ar71xx/config-2.6.34 @@ -19,6 +19,7 @@ CONFIG_AR71XX_DEV_PB9X_PCI=y CONFIG_AR71XX_DEV_USB=y CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y +CONFIG_AR71XX_MACH_AP96=y CONFIG_AR71XX_MACH_AW_NR580=y CONFIG_AR71XX_MACH_DIR_600_A1=y CONFIG_AR71XX_MACH_DIR_615_C1=y diff --git a/target/linux/ar71xx/config-2.6.35 b/target/linux/ar71xx/config-2.6.35 index 6632d501df..81ccd6ba67 100644 --- a/target/linux/ar71xx/config-2.6.35 +++ b/target/linux/ar71xx/config-2.6.35 @@ -19,6 +19,7 @@ CONFIG_AR71XX_DEV_PB9X_PCI=y CONFIG_AR71XX_DEV_USB=y CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y +CONFIG_AR71XX_MACH_AP96=y CONFIG_AR71XX_MACH_AW_NR580=y CONFIG_AR71XX_MACH_DIR_600_A1=y CONFIG_AR71XX_MACH_DIR_615_C1=y diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig index 1657ffa0a8..2b4c3bdcf0 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig @@ -19,6 +19,15 @@ config AR71XX_MACH_AP83 select AR71XX_DEV_USB default n +config AR71XX_MACH_AP96 + bool "Atheros AP96 board support" + select AR71XX_DEV_M25P80 + select AR71XX_DEV_AP94_PCI if PCI + select AR71XX_DEV_GPIO_BUTTONS + select AR71XX_DEV_LEDS_GPIO + select AR71XX_DEV_USB + default n + config AR71XX_MACH_DIR_600_A1 bool "D-Link DIR-600 rev. A1 support" select AR71XX_DEV_AP91_ETH diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile index b9c368e1ab..81dab7c711 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_AR71XX_NVRAM) += nvram.o obj-$(CONFIG_AR71XX_MACH_AP81) += mach-ap81.o obj-$(CONFIG_AR71XX_MACH_AP83) += mach-ap83.o +obj-$(CONFIG_AR71XX_MACH_AP96) += mach-ap96.o obj-$(CONFIG_AR71XX_MACH_AW_NR580) += mach-aw-nr580.o obj-$(CONFIG_AR71XX_MACH_DIR_600_A1) += mach-dir-600-a1.o obj-$(CONFIG_AR71XX_MACH_DIR_615_C1) += mach-dir-615-c1.o diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c new file mode 100644 index 0000000000..6a7b6ff1cb --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c @@ -0,0 +1,175 @@ +/* + * Atheros AP96 board support + * + * Copyright (C) 2009 Marco Porsch + * Copyright (C) 2009-2010 Gabor Juhos + * Copyright (C) 2010 Atheros Communications + * + * 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 +#include +#include +#include + +#include + +#include "machtype.h" +#include "devices.h" +#include "dev-m25p80.h" +#include "dev-ap94-pci.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-usb.h" + +#define AP96_GPIO_LED_12_GREEN 0 +#define AP96_GPIO_LED_3_GREEN 1 +#define AP96_GPIO_LED_2_GREEN 2 +#define AP96_GPIO_LED_WPS_GREEN 4 +#define AP96_GPIO_LED_5_GREEN 5 +#define AP96_GPIO_LED_4_ORANGE 6 + +/* Reset button - next to the power connector */ +#define AP96_GPIO_BTN_RESET 3 +/* WPS button - next to a led on right */ +#define AP96_GPIO_BTN_WPS 8 + +#define AP96_BUTTONS_POLL_INTERVAL 20 + +#define AP96_WMAC0_MAC_OFFSET 0x120c +#define AP96_WMAC1_MAC_OFFSET 0x520c +#define AP96_CALDATA0_OFFSET 0x1000 +#define AP96_CALDATA1_OFFSET 0x5000 + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition ap96_partitions[] = { + { + .name = "uboot", + .offset = 0, + .size = 0x030000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "env", + .offset = 0x030000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "rootfs", + .offset = 0x040000, + .size = 0x600000, + } , { + .name = "uImage", + .offset = 0x640000, + .size = 0x1b0000, + } , { + .name = "caldata", + .offset = 0x7f0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } +}; +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct flash_platform_data ap96_flash_data = { +#ifdef CONFIG_MTD_PARTITIONS + .parts = ap96_partitions, + .nr_parts = ARRAY_SIZE(ap96_partitions), +#endif +}; + +/* + * AP96 has 12 unlabeled leds in the front; these are numbered from 1 to 12 + * below (from left to right on the board). Led 1 seems to be on whenever the + * board is powered. Led 11 shows LAN link activity actity. Led 3 is orange; + * others are green. + * + * In addition, there is one led next to a button on the right side for WPS. + */ +static struct gpio_led ap96_leds_gpio[] __initdata = { + { + .name = "ap96:green:led2", + .gpio = AP96_GPIO_LED_2_GREEN, + .active_low = 1, + }, { + .name = "ap96:green:led3", + .gpio = AP96_GPIO_LED_3_GREEN, + .active_low = 1, + }, { + .name = "ap96:orange:led4", + .gpio = AP96_GPIO_LED_4_ORANGE, + .active_low = 1, + }, { + .name = "ap96:green:led5", + .gpio = AP96_GPIO_LED_5_GREEN, + .active_low = 1, + }, { + .name = "ap96:green:led12", + .gpio = AP96_GPIO_LED_12_GREEN, + .active_low = 1, + }, { /* next to a button on right */ + .name = "ap96:green:wps", + .gpio = AP96_GPIO_LED_WPS_GREEN, + .active_low = 1, + } +}; + +static struct gpio_button ap96_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .threshold = 3, + .gpio = AP96_GPIO_BTN_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .threshold = 3, + .gpio = AP96_GPIO_BTN_WPS, + .active_low = 1, + } +}; + +static void __init ap96_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ar71xx_add_device_mdio(0xfffffffe); + + ar71xx_init_mac(ar71xx_eth0_data.mac_addr, art, 0); + ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ar71xx_eth0_data.phy_mask = 0x1; + + ar71xx_add_device_eth(0); + + ar71xx_init_mac(ar71xx_eth1_data.mac_addr, art, 1); + ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ar71xx_eth1_data.speed = SPEED_1000; + ar71xx_eth1_data.duplex = DUPLEX_FULL; + + ar71xx_eth1_pll_data.pll_1000 = 0x1f000000; + + ar71xx_add_device_eth(1); + + ar71xx_add_device_usb(); + + ar71xx_add_device_m25p80(&ap96_flash_data); + + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap96_leds_gpio), + ap96_leds_gpio); + + ar71xx_add_device_gpio_buttons(-1, AP96_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(ap96_gpio_buttons), + ap96_gpio_buttons); + + ap94_pci_init(art + AP96_CALDATA0_OFFSET, + art + AP96_WMAC0_MAC_OFFSET, + art + AP96_CALDATA1_OFFSET, + art + AP96_WMAC1_MAC_OFFSET); +} + +MIPS_MACHINE(AR71XX_MACH_AP96, "AP96", "Atheros AP96", ap96_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h index b530abfe41..fde4717a95 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h @@ -58,6 +58,7 @@ enum ar71xx_mach_type { AR71XX_MACH_EAP7660D, /* Senao EAP7660D */ AR71XX_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */ AR71XX_MACH_ZCN_1523H_5, /* Zcomax ZCN-1523H-5-xx */ + AR71XX_MACH_AP96, /* Atheros AP96 */ }; #endif /* _AR71XX_MACHTYPE_H */ diff --git a/target/linux/ar71xx/generic/profiles/atheros.mk b/target/linux/ar71xx/generic/profiles/atheros.mk index 4ce0e605c6..97d5032574 100644 --- a/target/linux/ar71xx/generic/profiles/atheros.mk +++ b/target/linux/ar71xx/generic/profiles/atheros.mk @@ -28,6 +28,17 @@ endef $(eval $(call Profile,AP83)) +define Profile/AP96 + NAME:=Atheros AP96 reference board + PACKAGES:=wpad-mini kmod-ath9k kmod-usb-core kmod-usb2 +endef + +define Profile/AP96/Description + Package set optimized for the Atheros AP96 reference board. +endef + +$(eval $(call Profile,AP96)) + define Profile/PB42 NAME:=Atheros PB42 reference board PACKAGES:=wpad-mini kmod-ath9k kmod-usb-core kmod-usb-ohci kmod-usb2 diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 718b7e3ad1..3fa49ba36e 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -571,6 +571,10 @@ define Image/Build/Profile/WNDR3700 $(call Image/Build/Template/$(fs_64k)/$(1),WNDR3700,wndr3700,board=WNDR3700) endef +define Image/Build/Profile/AP96 + $(call Image/Build/Template/$(fs_64k)/$(1),AP83,ap96,board=AP96) +endef + define Image/Build/Profile/WRT400N $(call Image/Build/Template/$(fs_64k)/$(1),WRT400N,wrt400n,board=WRT400N) endef @@ -623,6 +627,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/UBNT,$(1)) $(call Image/Build/Profile/WP543,$(1)) $(call Image/Build/Profile/WNDR3700,$(1)) + $(call Image/Build/Profile/AP96,$(1)) $(call Image/Build/Profile/WRT400N,$(1)) $(call Image/Build/Profile/WRT160NL,$(1)) $(call Image/Build/Profile/WZRHPG300NH,$(1)) -- cgit v1.2.3