The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: ralf@linux-mips.org, albeu@free.fr
Cc: Neil Armstrong <narmstrong@baylibre.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board
Date: Mon,  3 Oct 2016 17:35:31 +0200	[thread overview]
Message-ID: <1475508931-16800-1-git-send-email-narmstrong@baylibre.com> (raw)

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@baylibre.com>
---
 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@openwrt.org>
+ *  Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
+ *
+ *  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

             reply	other threads:[~2016-10-03 15:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-03 15:35 Neil Armstrong [this message]
2016-10-04  9:09 ` [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board Alban
2016-10-04  9:40   ` Neil Armstrong
2016-10-04 10:09     ` Yegor Yefremov
2016-10-04 10:11       ` Neil Armstrong
2016-10-04 10:14         ` Yegor Yefremov
2016-10-04 10:21           ` Neil Armstrong
2016-10-05  6:59             ` Yegor Yefremov
2016-10-04 11:26         ` Antony Pavlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475508931-16800-1-git-send-email-narmstrong@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=albeu@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox