From: Florian Fainelli Date: Sat, 28 Jan 2012 13:19:49 +0000 (+0000) Subject: add support for the Atheros AP113 reference board X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=eeb00634a7715204481a5fd83664a697e414bbfd;p=openwrt%2Fstaging%2Fmans0n.git add support for the Atheros AP113 reference board This reference board is equipped with: - AR7242 SoC - AR9580 on-board Wi-Fi - AR8316 switch SVN-Revision: 29935 --- diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/leds b/target/linux/ar71xx/base-files/etc/uci-defaults/leds index f65af4a412..ae75f78c32 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/leds @@ -106,7 +106,10 @@ alfa-nx) set_led_netdev "lan" "LAN" "alfa:green:led_3" "eth1" ;; -rb-750) +ap113) + set_led_usbdev "usb" "USB" "ap113:green:usb" "1-1" + ;; +rb750) set_led_default "act" "act" "rb750:green:act" "1" set_led_netdev "port1" "port1" "rb750:green:port1" "eth1" set_led_switch "port2" "port2" "rb750:green:port2" "switch0" "0x10" diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/network index e6461819e2..4d6a68b73a 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/network @@ -67,7 +67,8 @@ rb-493g) ;; wzr-hp-g300nh2 |\ -pb92) +pb92 |\ +ap113) ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_add_switch "eth0" "1" "1" ucidef_add_switch_vlan "eth0" "1" "0t 1 3 4 5" diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index c2fa462a1a..6761382743 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -136,6 +136,9 @@ ar71xx_board_detect() { *ALL0258N) name="all0258n" ;; + *AP113) + name="ap113" + ;; *AP121) name="ap121" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index ae68db6fc0..d07b7823ad 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -79,6 +79,7 @@ platform_check_image() { ;; alfa-ap96 | \ alfa-nx | \ + ap113 | \ ap121 | \ ap121-mini | \ ap96 | \ diff --git a/target/linux/ar71xx/config-2.6.39 b/target/linux/ar71xx/config-2.6.39 index 60020d27cf..2b1662a745 100644 --- a/target/linux/ar71xx/config-2.6.39 +++ b/target/linux/ar71xx/config-2.6.39 @@ -16,6 +16,7 @@ CONFIG_AR71XX_DEV_USB=y CONFIG_AR71XX_MACH_ALFA_AP96=y CONFIG_AR71XX_MACH_ALFA_NX=y CONFIG_AR71XX_MACH_ALL0258N=y +CONFIG_AR71XX_MACH_AP113=y CONFIG_AR71XX_MACH_AP121=y CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y diff --git a/target/linux/ar71xx/config-3.2 b/target/linux/ar71xx/config-3.2 index a735c6f38d..6d2f6b815b 100644 --- a/target/linux/ar71xx/config-3.2 +++ b/target/linux/ar71xx/config-3.2 @@ -25,6 +25,7 @@ CONFIG_ATH79_DEV_WMAC=y CONFIG_ATH79_MACH_ALFA_AP96=y CONFIG_ATH79_MACH_ALFA_NX=y CONFIG_ATH79_MACH_ALL0258N=y +CONFIG_ATH79_MACH_AP113=y CONFIG_ATH79_MACH_AP121=y CONFIG_ATH79_MACH_AP81=y CONFIG_ATH79_MACH_AP83=y diff --git a/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Kconfig index 5abe999b2d..cf1664e76e 100644 --- a/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Kconfig @@ -59,6 +59,15 @@ config AR71XX_MACH_AP96 select AR71XX_DEV_LEDS_GPIO select AR71XX_DEV_USB +config AR71XX_MACH_AP113 + bool "Atheros AP113 board support" + select SOC_AR724X + select AR71XX_DEV_M25P80 + select AR71XX_DEV_PB9X_PCI if PCI + select AR71XX_DEV_GPIO_BUTTONS + select AR71XX_DEV_LEDS_GPIO + select AR71XX_DEV_USB + config AR71XX_MACH_AP121 bool "Atheros AP121 board support" select AR71XX_DEV_M25P80 diff --git a/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Makefile index efd8bd2772..9b36bcfbba 100644 --- a/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_AR71XX_PCI_ATH9K_FIXUP) += pci-ath9k-fixup.o obj-$(CONFIG_AR71XX_MACH_ALFA_AP96) += mach-alfa-ap96.o obj-$(CONFIG_AR71XX_MACH_ALFA_NX) += mach-alfa-nx.o obj-$(CONFIG_AR71XX_MACH_ALL0258N) += mach-all0258n.o +obj-$(CONFIG_AR71XX_MACH_AP113) += mach-ap113.o obj-$(CONFIG_AR71XX_MACH_AP121) += mach-ap121.o obj-$(CONFIG_AR71XX_MACH_AP81) += mach-ap81.o obj-$(CONFIG_AR71XX_MACH_AP83) += mach-ap83.o diff --git a/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/mach-ap113.c b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/mach-ap113.c new file mode 100644 index 0000000000..2ece3987b2 --- /dev/null +++ b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/mach-ap113.c @@ -0,0 +1,129 @@ +/* + * Atheros AP113 board support + * + * Copyright (C) 2011 Florian Fainelli + * + * 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 "machtype.h" +#include "devices.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-pb9x-pci.h" +#include "dev-usb.h" + +#define AP113_GPIO_LED_USB 0 +#define AP113_GPIO_LED_STATUS 1 +#define AP113_GPIO_LED_ST 11 + +#define AP113_GPIO_BTN_JUMPSTART 12 + +#define AP113_KEYS_POLL_INTERVAL 20 /* msecs */ +#define AP113_KEYS_DEBOUNCE_INTERVAL (3 * AP113_KEYS_POLL_INTERVAL) + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition ap113_parts[] = { + { + .name = "u-boot", + .offset = 0, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "rootfs", + .offset = 0x010000, + .size = 0x300000, + }, + { + .name = "uImage", + .offset = 0x300000, + .size = 0x3e0000, + }, + { + .name = "NVRAM", + .offset = 0x3e0000, + .size = 0x010000, + }, + { + .name = "ART", + .offset = 0x3f0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, +}; +#define ap113_nr_parts ARRAY_SIZE(ap113_parts) +#else +#define ap113_parts NULL +#define ap113_nr_parts 0 +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct flash_platform_data ap113_flash_data = { + .parts = ap113_parts, + .nr_parts = ap113_nr_parts, +}; + +static struct gpio_led ap113_leds_gpio[] __initdata = { + { + .name = "ap113:green:usb", + .gpio = AP113_GPIO_LED_USB, + .active_low = 1, + }, + { + .name = "ap113:green:status", + .gpio = AP113_GPIO_LED_STATUS, + .active_low = 1, + }, + { + .name = "ap113:green:st", + .gpio = AP113_GPIO_LED_ST, + .active_low = 1, + } +}; + +static struct gpio_keys_button ap113_gpio_keys[] __initdata = { + { + .desc = "jumpstart button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = AP113_KEYS_DEBOUNCE_INTERVAL, + .gpio = AP113_GPIO_BTN_JUMPSTART, + .active_low = 1, + }, +}; + +static void __init ap113_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); + + ar71xx_add_device_m25p80(&ap113_flash_data); + + ar71xx_add_device_mdio(0, ~BIT(0)); + ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0); + ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ar71xx_eth0_data.speed = SPEED_1000; + ar71xx_eth0_data.duplex = DUPLEX_FULL; + ar71xx_eth0_data.phy_mask = BIT(0); + + ar71xx_add_device_eth(0); + + ar71xx_register_gpio_keys_polled(-1, AP113_KEYS_POLL_INTERVAL, + ARRAY_SIZE(ap113_gpio_keys), + ap113_gpio_keys); + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap113_leds_gpio), + ap113_leds_gpio); + + ar71xx_add_device_usb(); + + pb9x_pci_init(); +} + +MIPS_MACHINE(AR71XX_MACH_AP113, "AP113", "Atheros AP113", + ap113_setup); diff --git a/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/machtype.h index 83038c64ce..1be8dbbf34 100644 --- a/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/machtype.h +++ b/target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/machtype.h @@ -19,6 +19,7 @@ enum ar71xx_mach_type { AR71XX_MACH_ALFA_AP96, /* ALFA Network AP96 board */ AR71XX_MACH_ALFA_NX, /* ALFA Network N2/N5 board */ AR71XX_MACH_ALL0258N, /* Allnet ALL0258N */ + AR71XX_MACH_AP113, /* Atheros AP113 */ AR71XX_MACH_AP121, /* Atheros AP121 */ AR71XX_MACH_AP121_MINI, /* Atheros AP121-MINI */ AR71XX_MACH_AP81, /* Atheros AP81 */ diff --git a/target/linux/ar71xx/files-3.2/arch/mips/ath79/mach-ap113.c b/target/linux/ar71xx/files-3.2/arch/mips/ath79/mach-ap113.c new file mode 100644 index 0000000000..178815cf91 --- /dev/null +++ b/target/linux/ar71xx/files-3.2/arch/mips/ath79/mach-ap113.c @@ -0,0 +1,124 @@ +/* + * Atheros AP113 board support + * + * Copyright (C) 2011 Florian Fainelli + * + * 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 "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "pci.h" +#include "dev-usb.h" +#include "machtypes.h" + +#define AP113_GPIO_LED_USB 0 +#define AP113_GPIO_LED_STATUS 1 +#define AP113_GPIO_LED_ST 11 + +#define AP113_GPIO_BTN_JUMPSTART 12 + +#define AP113_KEYS_POLL_INTERVAL 20 /* msecs */ +#define AP113_KEYS_DEBOUNCE_INTERVAL (3 * AP113_KEYS_POLL_INTERVAL) + +static struct mtd_partition ap113_parts[] = { + { + .name = "u-boot", + .offset = 0, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "rootfs", + .offset = 0x010000, + .size = 0x300000, + }, + { + .name = "uImage", + .offset = 0x300000, + .size = 0x3e0000, + }, + { + .name = "NVRAM", + .offset = 0x3e0000, + .size = 0x010000, + }, + { + .name = "ART", + .offset = 0x3f0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, +}; +#define ap113_nr_parts ARRAY_SIZE(ap113_parts) + +static struct flash_platform_data ap113_flash_data = { + .parts = ap113_parts, + .nr_parts = ap113_nr_parts, +}; + +static struct gpio_led ap113_leds_gpio[] __initdata = { + { + .name = "ap113:green:usb", + .gpio = AP113_GPIO_LED_USB, + .active_low = 1, + }, + { + .name = "ap113:green:status", + .gpio = AP113_GPIO_LED_STATUS, + .active_low = 1, + }, + { + .name = "ap113:green:st", + .gpio = AP113_GPIO_LED_ST, + .active_low = 1, + } +}; + +static struct gpio_keys_button ap113_gpio_keys[] __initdata = { + { + .desc = "jumpstart button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = AP113_KEYS_DEBOUNCE_INTERVAL, + .gpio = AP113_GPIO_BTN_JUMPSTART, + .active_low = 1, + }, +}; + +static void __init ap113_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(&ap113_flash_data); + + ath79_register_mdio(0, ~BIT(0)); + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.speed = SPEED_1000; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.phy_mask = BIT(0); + + ath79_register_eth(0); + + ath79_register_gpio_keys_polled(-1, AP113_KEYS_POLL_INTERVAL, + ARRAY_SIZE(ap113_gpio_keys), + ap113_gpio_keys); + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap113_leds_gpio), + ap113_leds_gpio); + + ath79_register_pci(); + + ath79_register_usb(); +} + +MIPS_MACHINE(ATH79_MACH_AP113, "AP113", "Atheros AP113", + ap113_setup); diff --git a/target/linux/ar71xx/generic/profiles/atheros.mk b/target/linux/ar71xx/generic/profiles/atheros.mk index f26d7a788a..4ce4cd5129 100644 --- a/target/linux/ar71xx/generic/profiles/atheros.mk +++ b/target/linux/ar71xx/generic/profiles/atheros.mk @@ -5,6 +5,17 @@ # See /LICENSE for more information. # +define Profile/AP113 + NAME:=Atheros AP113 reference board + PACKAGES:=kmod-usb-core kmod-usb2 +endef + +define Profile/AP113/description + Package set optimized for the Atheros AP113 reference board. +endef + +$(eval $(call Profile,AP113)) + define Profile/AP121 NAME:=Atheros AP121 reference board PACKAGES:=kmod-usb-core kmod-usb2 diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 02eb9b76b7..43e74b243e 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -626,6 +626,12 @@ define Image/Build/Profile/ALFAAP96 $(call Image/Build/Template/$(fs_128k)/$(1),AthLzma,alfa-ap96,$(alfa_ap96_cmdline),alfa_ap96_mtdlayout,2097152,13631488,RKuImage) endef +ap113_mtd_layout=64k(u-boot),3008k(rootfs),896k(uImage),64k(NVRAM),64k(ART),3904k@0x10000(firmware) +ap113_cmdline=board=AP113 console=ttyS0,115200 +define Image/Build/Profile/AP113 + $(call Image/Build/Template/$(fs_64k)/$(1),AthLzma,ap113,$(ap113_cmdline),ap113_mtd_layout,917504,3080192,RK) +endef + ap121_mtdlayout_2M=mtdparts=spi0.0:64k(u-boot)ro,1216k(rootfs),704k(kernel),64k(art)ro,1920k@0x10000(firmware) ap121_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware) @@ -977,6 +983,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/ALFAAP96,$(1)) $(call Image/Build/Profile/ALFANX,$(1)) $(call Image/Build/Profile/ALL0258N,$(1)) + $(call Image/Build/Profile/AP113,$(1)) $(call Image/Build/Profile/AP121,$(1)) $(call Image/Build/Profile/AP121MINI,$(1)) $(call Image/Build/Profile/AP81,$(1)) diff --git a/target/linux/ar71xx/patches-3.2/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.2/610-MIPS-ath79-openwrt-machines.patch index 91916e6387..9927f6d73a 100644 --- a/target/linux/ar71xx/patches-3.2/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.2/610-MIPS-ath79-openwrt-machines.patch @@ -1,12 +1,13 @@ --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -16,17 +16,78 @@ +@@ -16,17 +16,79 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, + ATH79_MACH_ALFA_AP96, /* ALFA Network AP96 board */ + ATH79_MACH_ALFA_NX, /* ALFA Network N2/N5 board */ + ATH79_MACH_ALL0258N, /* Allnet ALL0258N */ ++ ATH79_MACH_AP113, /* Atheros AP113 reference board */ ATH79_MACH_AP121, /* Atheros AP121 reference board */ ATH79_MACH_AP121_MINI, /* Atheros AP121-MINI reference board */ ATH79_MACH_AP81, /* Atheros AP81 reference board */ @@ -81,7 +82,7 @@ #endif /* _ATH79_MACHTYPE_H */ --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -2,6 +2,42 @@ if ATH79 +@@ -2,6 +2,52 @@ if ATH79 menu "Atheros AR71XX/AR724X/AR913X machine selection" @@ -120,11 +121,21 @@ + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 ++ ++config ATH79_MACH_AP113 ++ bool "Atheros AP113 board support" ++ select SOC_AR724X ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_PB9X_PCI if PCI ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_USB ++ select ATH79_DEV_ETH + config ATH79_MACH_AP121 bool "Atheros AP121 reference board" select SOC_AR933X -@@ -28,6 +64,36 @@ config ATH79_MACH_AP81 +@@ -28,6 +74,36 @@ config ATH79_MACH_AP81 Say 'Y' here if you want your kernel to support the Atheros AP81 reference board. @@ -161,7 +172,7 @@ config ATH79_MACH_DB120 bool "Atheros DB120 reference board" select SOC_AR934X -@@ -42,6 +108,13 @@ config ATH79_MACH_DB120 +@@ -42,6 +118,13 @@ config ATH79_MACH_DB120 Say 'Y' here if you want your kernel to support the Atheros DB120 reference board. @@ -175,7 +186,7 @@ config ATH79_MACH_PB44 bool "Atheros PB44 reference board" select SOC_AR71XX -@@ -54,6 +127,359 @@ config ATH79_MACH_PB44 +@@ -54,6 +137,359 @@ config ATH79_MACH_PB44 Say 'Y' here if you want your kernel to support the Atheros PB44 reference board. @@ -535,7 +546,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM (rev 1.0) board" select SOC_AR724X -@@ -67,6 +483,24 @@ config ATH79_MACH_UBNT_XM +@@ -67,6 +503,24 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -560,7 +571,7 @@ endmenu config SOC_AR71XX -@@ -96,10 +530,6 @@ config SOC_AR934X +@@ -96,10 +550,6 @@ config SOC_AR934X select PCI_AR724X if PCI def_bool n @@ -571,7 +582,7 @@ config ATH79_DEV_AP9X_PCI select ATH79_PCI_ATH9K_FIXUP def_bool n -@@ -110,7 +540,14 @@ config ATH79_DEV_DSA +@@ -110,7 +560,14 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -587,7 +598,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -135,4 +572,7 @@ config ATH79_NVRAM +@@ -135,4 +592,7 @@ config ATH79_NVRAM config ATH79_PCI_ATH9K_FIXUP def_bool n @@ -597,13 +608,14 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -36,8 +36,54 @@ obj-$(CONFIG_ATH79_PCI_ATH9K_FIXUP) += p +@@ -36,8 +36,55 @@ obj-$(CONFIG_ATH79_PCI_ATH9K_FIXUP) += p # # Machines # +obj-$(CONFIG_ATH79_MACH_ALFA_AP96) += mach-alfa-ap96.o +obj-$(CONFIG_ATH79_MACH_ALFA_NX) += mach-alfa-nx.o +obj-$(CONFIG_ATH79_MACH_ALL0258N) += mach-all0258n.o ++obj-$(CONFIG_ATH79_MACH_AP113) += mach-ap113.o obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o +obj-$(CONFIG_ATH79_MACH_AP83) += mach-ap83.o