add support for the Atheros AP113 reference board
authorFlorian Fainelli <florian@openwrt.org>
Sat, 28 Jan 2012 13:19:49 +0000 (13:19 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sat, 28 Jan 2012 13:19:49 +0000 (13:19 +0000)
This reference board is equipped with:
- AR7242 SoC
- AR9580 on-board Wi-Fi
- AR8316 switch

SVN-Revision: 29935

14 files changed:
target/linux/ar71xx/base-files/etc/uci-defaults/leds
target/linux/ar71xx/base-files/etc/uci-defaults/network
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-2.6.39
target/linux/ar71xx/config-3.2
target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Kconfig
target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/Makefile
target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/mach-ap113.c [new file with mode: 0644]
target/linux/ar71xx/files-2.6.39/arch/mips/ar71xx/machtype.h
target/linux/ar71xx/files-3.2/arch/mips/ath79/mach-ap113.c [new file with mode: 0644]
target/linux/ar71xx/generic/profiles/atheros.mk
target/linux/ar71xx/image/Makefile
target/linux/ar71xx/patches-3.2/610-MIPS-ath79-openwrt-machines.patch

index f65af4a41273aa3d5ff1585dc2a0736671cf6dfc..ae75f78c32bdd2fd3a75cf5e0afa33c406e61bea 100755 (executable)
@@ -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"
index e6461819e2e36a13697149974147f2922b88ace8..4d6a68b73a263c0bca51dc6a1bf00317295a9f53 100755 (executable)
@@ -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"
index c2fa462a1a7bb82ae42827e3d8011fe2ed9f1685..6761382743ec08c8343e5c1c04fe8b5e086d0f62 100755 (executable)
@@ -136,6 +136,9 @@ ar71xx_board_detect() {
        *ALL0258N)
                name="all0258n"
                ;;
+       *AP113)
+               name="ap113"
+               ;;
        *AP121)
                name="ap121"
                ;;
index ae68db6fc0e9dc158dc517f182183458dfb6c23c..d07b7823ad45e01e9a5e68bad54219d5d7e78802 100755 (executable)
@@ -79,6 +79,7 @@ platform_check_image() {
                ;;
        alfa-ap96 | \
        alfa-nx | \
+       ap113 | \
        ap121 | \
        ap121-mini | \
        ap96 | \
index 60020d27cf242302cec9080e7db39d0bbae817a4..2b1662a745e8cb77b31b225e6ec8da164f29a2f5 100644 (file)
@@ -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
index a735c6f38d9a5a99d918246f1eac605373bb197c..6d2f6b815b5bb561bf01530249d99e8f03a3caac 100644 (file)
@@ -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
index 5abe999b2d9e2142b24a67a775d6c1a7ceb9c107..cf1664e76e066b57474e120760fe5cd0937b44cc 100644 (file)
@@ -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
index efd8bd2772b5576de874c20ea04cfdff87c809c7..9b36bcfbbad67289e52a1530323216b6532e854d 100644 (file)
@@ -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 (file)
index 0000000..2ece398
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ *  Atheros AP113 board support
+ *
+ *  Copyright (C) 2011 Florian Fainelli <florian@openwrt.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/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/spi/flash.h>
+
+#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);
index 83038c64ce784fc08ec82e4028b7e561e06cf84a..1be8dbbf3401021eb1ee181d938131f1f56d428e 100644 (file)
@@ -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 (file)
index 0000000..178815c
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ *  Atheros AP113 board support
+ *
+ *  Copyright (C) 2011 Florian Fainelli <florian@openwrt.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/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/spi/flash.h>
+
+#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);
index f26d7a788a7eddbc8c1ae5e38dcc9cd029a707bd..4ce4cd5129b38ccb15670640f05d00f65062b488 100644 (file)
@@ -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
index 02eb9b76b762e5748a8e4856f191e21dad1d1fbe..43e74b243eca762bfbba45c3ea97255f1ffb1b5f 100644 (file)
@@ -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))
index 91916e6387a9fc2c22068e9ef3fd1f09e060db97..9927f6d73a96855d9bb36690bbf18a9ba2ff26e7 100644 (file)
@@ -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"
  
 +      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.
  
  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.
  
  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.
  
  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.
  
  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
  
  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
  
        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
  
  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