[PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

From: Neil Armstrong
Date: Mon Oct 03 2016 - 11:35:50 EST


The HAPROXY Aloha pocket board is a Load Balancer demo board based on the
Atheros AR9331 SoC with 64Mbytes DDR and 16Mbytes on-board SPI Flash.

Signed-off-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
---
arch/mips/ath79/Kconfig | 12 ++++++
arch/mips/ath79/Makefile | 1 +
arch/mips/ath79/mach-aloha-pocket.c | 86 +++++++++++++++++++++++++++++++++++++
arch/mips/ath79/machtypes.h | 1 +
4 files changed, 100 insertions(+)
create mode 100644 arch/mips/ath79/mach-aloha-pocket.c

diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig
index dfc6020..937cede 100644
--- a/arch/mips/ath79/Kconfig
+++ b/arch/mips/ath79/Kconfig
@@ -71,6 +71,18 @@ config ATH79_MACH_UBNT_XM
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.

+config ATH79_MACH_ALOHA_POCKET
+ bool "HAPROXY Aloha Pocket board"
+ select SOC_AR933X
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_SPI
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+ help
+ Say 'Y' here if you want your kernel to support the
+ HAPROXY Aloha Pocket board.
+
endmenu

config SOC_AR71XX
diff --git a/arch/mips/ath79/Makefile b/arch/mips/ath79/Makefile
index fcc382c..a87c4ee 100644
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
@@ -32,3 +32,4 @@ obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o
obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o
+obj-$(CONFIG_ATH79_MACH_ALOHA_POCKET) += mach-aloha-pocket.o
diff --git a/arch/mips/ath79/mach-aloha-pocket.c b/arch/mips/ath79/mach-aloha-pocket.c
new file mode 100644
index 0000000..2beb068
--- /dev/null
+++ b/arch/mips/ath79/mach-aloha-pocket.c
@@ -0,0 +1,86 @@
+/*
+ * HAPROXY Aloha Pocket board support
+ *
+ * Copyright (C) 2011 Gabor Juhos <juhosg@xxxxxxxxxxx>
+ * Copyright (C) 2016 Neil Armstrong <narmstrong@xxxxxxxxxxxx>
+ *
+ * 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 "machtypes.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+
+#define ALOHA_POCKET_GPIO_LED_WLAN 0
+#define ALOHA_POCKET_GPIO_LED_LAN 13
+
+#define ALOHA_POCKET_GPIO_BTN_RESET 11
+
+#define ALOHA_POCKET_KEYS_POLL_INTERVAL 20 /* msecs */
+#define ALOHA_POCKET_KEYS_DEBOUNCE_INTERVAL \
+ (3 * ALOHA_POCKET_KEYS_POLL_INTERVAL)
+
+#define ALOHA_POCKET_CAL_DATA_ADDR 0x1fff1000
+
+static struct gpio_led aloha_pocket_leds_gpio[] __initdata = {
+ {
+ .name = "aloha-pocket:red:wlan",
+ .gpio = ALOHA_POCKET_GPIO_LED_WLAN,
+ .active_low = 0,
+ },
+ {
+ .name = "aloha-pocket:green:lan",
+ .gpio = ALOHA_POCKET_GPIO_LED_LAN,
+ .active_low = 0,
+ .default_state = 1,
+ },
+};
+
+static struct gpio_keys_button aloha_pocket_gpio_keys[] __initdata = {
+ {
+ .desc = "reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ALOHA_POCKET_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ALOHA_POCKET_GPIO_BTN_RESET,
+ .active_low = 0,
+ }
+};
+
+static struct spi_board_info aloha_pocket_spi_info[] = {
+ {
+ .bus_num = 0,
+ .chip_select = 0,
+ .max_speed_hz = 25000000,
+ .modalias = "mx25l1606e",
+ }
+};
+
+static struct ath79_spi_platform_data aloha_pocket_spi_data = {
+ .bus_num = 0,
+ .num_chipselect = 1,
+};
+
+static void __init aloha_pocket_setup(void)
+{
+ u8 *cal_data = (u8 *) KSEG1ADDR(ALOHA_POCKET_CAL_DATA_ADDR);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(aloha_pocket_leds_gpio),
+ aloha_pocket_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, ALOHA_POCKET_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(aloha_pocket_gpio_keys),
+ aloha_pocket_gpio_keys);
+
+ ath79_register_spi(&aloha_pocket_spi_data, aloha_pocket_spi_info,
+ ARRAY_SIZE(aloha_pocket_spi_info));
+ ath79_register_usb();
+ ath79_register_wmac(cal_data);
+}
+
+MIPS_MACHINE(ATH79_MACH_ALOHA_POCKET, "ALOHA-Pocket",
+ "HAPROXY ALOHA Pocket board", aloha_pocket_setup);
diff --git a/arch/mips/ath79/machtypes.h b/arch/mips/ath79/machtypes.h
index a13db3d..9c63895 100644
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
@@ -23,6 +23,7 @@ enum ath79_mach_type {
ATH79_MACH_DB120, /* Atheros DB120 reference board */
ATH79_MACH_PB44, /* Atheros PB44 reference board */
ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
+ ATH79_MACH_ALOHA_POCKET, /* HAPROXY Aloha Pocket board */
};

#endif /* _ATH79_MACHTYPE_H */
--
1.9.1