aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-01-04 21:13:54 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-01-04 21:13:54 +0000
commit2d696ce97ee23a478e8cdc7cac94d40fc76d1d96 (patch)
treeaf768a94ed18e2eefb806e8ac9134a4ed81bc9aa /target
parent5c8819fc34f1811e9d3c4e0f73877668eb78be7d (diff)
downloadmaster-187ad058-2d696ce97ee23a478e8cdc7cac94d40fc76d1d96.tar.gz
master-187ad058-2d696ce97ee23a478e8cdc7cac94d40fc76d1d96.tar.bz2
master-187ad058-2d696ce97ee23a478e8cdc7cac94d40fc76d1d96.zip
ar71xx: add inital support for the ALFA Network AP96 board
The microSD slot and the Real Time Clock is not working yet. The miniPCIe interface is not tested due to the lack of a suitable card. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29662 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/network1
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh5
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh1
-rw-r--r--target/linux/ar71xx/config-2.6.391
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig7
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Makefile1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-alfa-ap96.c156
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h1
8 files changed, 172 insertions, 1 deletions
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/network
index d51660368c..38c7214a07 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/network
@@ -111,6 +111,7 @@ wp543)
ucidef_set_interface_lan "eth0"
;;
+alfa-ap96 |\
alfa-nx |\
ap83 |\
jwap003 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 218f934229..cc0b0b4d32 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -124,6 +124,9 @@ ar71xx_board_detect() {
*"AirRouter")
name="airrouter"
;;
+ *"ALFA Network AP96")
+ name="alfa-ap96"
+ ;;
*"ALFA Network N2/N5")
name="alfa-nx"
;;
@@ -142,7 +145,7 @@ ar71xx_board_detect() {
*AP83)
name="ap83"
;;
- *AP96)
+ *"Atheros AP96")
name="ap96"
;;
*AW-NR580)
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index c2bfa08dbb..14af3bfc36 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -77,6 +77,7 @@ platform_check_image() {
platform_check_image_all0258n "$1" && return 0
return 1
;;
+ alfa-ap96 | \
alfa-nx | \
ap121 | \
ap121-mini | \
diff --git a/target/linux/ar71xx/config-2.6.39 b/target/linux/ar71xx/config-2.6.39
index 8cc92aba3e..14b6287904 100644
--- a/target/linux/ar71xx/config-2.6.39
+++ b/target/linux/ar71xx/config-2.6.39
@@ -13,6 +13,7 @@ CONFIG_AR71XX_DEV_M25P80=y
CONFIG_AR71XX_DEV_PB42_PCI=y
CONFIG_AR71XX_DEV_PB9X_PCI=y
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_AP121=y
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
index 90c7b69a6d..8979fdf826 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
@@ -1,6 +1,13 @@
if ATHEROS_AR71XX
menu "Atheros AR71xx machine selection"
+config AR71XX_MACH_ALFA_AP96
+ bool "ALFA Network AP96 board support"
+ select SOC_AR71XX
+ select AR71XX_DEV_PB42_PCI if PCI
+ select AR71XX_DEV_GPIO_BUTTONS
+ select AR71XX_DEV_USB
+
config AR71XX_MACH_HORNET_UB
bool "Alfa Networks Hornet-UB board support"
select SOC_AR933X
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
index 0cb277e828..42c268026b 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_AR71XX_DEV_USB) += dev-usb.o
obj-$(CONFIG_AR71XX_NVRAM) += nvram.o
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_AP121) += mach-ap121.o
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-alfa-ap96.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-alfa-ap96.c
new file mode 100644
index 0000000000..f22db50a55
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-alfa-ap96.c
@@ -0,0 +1,156 @@
+/*
+ * ALFA Network AP96 board support
+ *
+ * Copyright (C) 2012 Gabor Juhos <juhosg@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/init.h>
+#include <linux/bitops.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/mmc/host.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/mmc_spi.h>
+
+#include <asm/mach-ar71xx/ar71xx.h>
+
+#include "machtype.h"
+#include "devices.h"
+#include "dev-pb42-pci.h"
+#include "dev-gpio-buttons.h"
+#include "dev-usb.h"
+
+#define ALFA_AP96_GPIO_MICROSD_CS 0
+#define ALFA_AP96_GPIO_RTC_CS 1
+#define ALFA_AP96_GPIO_PCIE_RESET 2
+#define ALFA_AP96_GPIO_SIM_DETECT 3
+#define ALFA_AP96_GPIO_MICROSD_CD 4
+#define ALFA_AP96_GPIO_PCIE_W_DISABLE 5
+
+#define ALFA_AP96_GPIO_BUTTON_RESET 11
+
+#define ALFA_AP96_KEYS_POLL_INTERVAL 20 /* msecs */
+#define ALFA_AP96_KEYS_DEBOUNCE_INTERVAL (3 * ALFA_AP96_KEYS_POLL_INTERVAL)
+
+static struct gpio_keys_button alfa_ap96_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ALFA_AP96_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ALFA_AP96_GPIO_BUTTON_RESET,
+ .active_low = 1,
+ }
+};
+
+static int alfa_ap96_mmc_get_cd(struct device *dev)
+{
+ return !gpio_get_value(ALFA_AP96_GPIO_MICROSD_CD);
+}
+
+static struct mmc_spi_platform_data alfa_ap96_mmc_data = {
+ .get_cd = alfa_ap96_mmc_get_cd,
+ .caps = MMC_CAP_NEEDS_POLL,
+ .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
+};
+
+static struct spi_board_info alfa_ap96_spi_info[] = {
+ {
+ .bus_num = 0,
+ .chip_select = 0,
+ .max_speed_hz = 25000000,
+ .modalias = "m25p80",
+ }, {
+ .bus_num = 0,
+ .chip_select = 1,
+ .max_speed_hz = 25000000,
+ .modalias = "mmc_spi",
+ .platform_data = &alfa_ap96_mmc_data,
+ .controller_data = (void *) ALFA_AP96_GPIO_MICROSD_CS,
+ }, {
+ .bus_num = 0,
+ .chip_select = 2,
+ .max_speed_hz = 6250000,
+ .modalias = "rtc-pcf2123",
+ .controller_data = (void *) ALFA_AP96_GPIO_RTC_CS,
+ },
+};
+
+static struct resource alfa_ap96_spi_resources[] = {
+ [0] = {
+ .start = AR71XX_SPI_BASE,
+ .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct ar71xx_spi_platform_data alfa_ap96_spi_data = {
+ .bus_num = 0,
+ .num_chipselect = 3,
+};
+
+static struct platform_device alfa_ap96_spi_device = {
+ .name = "pb44-spi",
+ .id = -1,
+ .resource = alfa_ap96_spi_resources,
+ .num_resources = ARRAY_SIZE(alfa_ap96_spi_resources),
+ .dev = {
+ .platform_data = &alfa_ap96_spi_data,
+ },
+};
+
+static void __init alfa_ap96_gpio_setup(void)
+{
+ ar71xx_gpio_function_disable(AR71XX_GPIO_FUNC_SPI_CS1_EN |
+ AR71XX_GPIO_FUNC_SPI_CS2_EN);
+
+ gpio_request(ALFA_AP96_GPIO_MICROSD_CD, "microSD CD");
+ gpio_direction_input(ALFA_AP96_GPIO_MICROSD_CD);
+ gpio_request(ALFA_AP96_GPIO_PCIE_RESET, "PCIe reset");
+ gpio_direction_output(ALFA_AP96_GPIO_PCIE_RESET, 1);
+ gpio_request(ALFA_AP96_GPIO_PCIE_W_DISABLE, "PCIe write disable");
+ gpio_direction_output(ALFA_AP96_GPIO_PCIE_W_DISABLE, 1);
+}
+
+#define ALFA_AP96_WAN_PHYMASK BIT(4)
+#define ALFA_AP96_LAN_PHYMASK BIT(5)
+#define ALFA_AP96_MDIO_PHYMASK (ALFA_AP96_LAN_PHYMASK | ALFA_AP96_WAN_PHYMASK)
+
+static void __init alfa_ap96_init(void)
+{
+ alfa_ap96_gpio_setup();
+
+ ar71xx_add_device_mdio(0, ~ALFA_AP96_MDIO_PHYMASK);
+
+ ar71xx_init_mac(ar71xx_eth0_data.mac_addr, ar71xx_mac_base, 0);
+ ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ar71xx_eth0_data.phy_mask = ALFA_AP96_WAN_PHYMASK;
+ ar71xx_eth1_pll_data.pll_1000 = 0x110000;
+
+ ar71xx_add_device_eth(0);
+
+ ar71xx_init_mac(ar71xx_eth1_data.mac_addr, ar71xx_mac_base, 1);
+ ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ar71xx_eth1_data.phy_mask = ALFA_AP96_LAN_PHYMASK;
+ ar71xx_eth1_pll_data.pll_1000 = 0x110000;
+
+ ar71xx_add_device_eth(1);
+
+ pb42_pci_init();
+
+ spi_register_board_info(alfa_ap96_spi_info,
+ ARRAY_SIZE(alfa_ap96_spi_info));
+ platform_device_register(&alfa_ap96_spi_device);
+
+ ar71xx_register_gpio_keys_polled(-1, ALFA_AP96_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(alfa_ap96_gpio_keys),
+ alfa_ap96_gpio_keys);
+ ar71xx_add_device_usb();
+}
+
+MIPS_MACHINE(AR71XX_MACH_ALFA_AP96, "ALFA-AP96", "ALFA Network AP96",
+ alfa_ap96_init);
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
index a2aa0359f7..522b0acdef 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
@@ -16,6 +16,7 @@
enum ar71xx_mach_type {
AR71XX_MACH_GENERIC = 0,
+ AR71XX_MACH_ALFA_AP96, /* ALFA Network AP96 board */
AR71XX_MACH_ALFA_NX, /* ALFA Network N2/N5 board */
AR71XX_MACH_ALL0258N, /* Allnet ALL0258N */
AR71XX_MACH_AP121, /* Atheros AP121 */