2016-10-03 15:35:45

by Neil Armstrong

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

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 <[email protected]>
---
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 <[email protected]>
+ * Copyright (C) 2016 Neil Armstrong <[email protected]>
+ *
+ * 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


2016-10-04 09:10:12

by Alban

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

On Mon, 3 Oct 2016 17:35:31 +0200
Neil Armstrong <[email protected]> wrote:

> 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 <[email protected]>

Please use device tree instead of adding another board file.

Alban


Attachments:
signature.asc (819.00 B)

2016-10-04 09:40:38

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

On 10/04/2016 11:09 AM, Alban wrote:
> On Mon, 3 Oct 2016 17:35:31 +0200
> Neil Armstrong <[email protected]> wrote:
>
>> 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 <[email protected]>
>
> Please use device tree instead of adding another board file.
>
> Alban
>

Hi Alban,

I'm quite surprised since it seems no device tree support is available for ath79,
I would really like to have device tree for this board, but this is only a copy/paste of
the mach-ap121 with button/leds gpio differences.

Could it be possible to merge it ? I would be happy to support this board once device tree
support is landed on the mips tree !

Thanks,
Neil


Attachments:
signature.asc (836.00 B)
OpenPGP digital signature

2016-10-04 10:09:22

by Yegor Yefremov

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

Hi Neil,

On Tue, Oct 4, 2016 at 11:40 AM, Neil Armstrong <[email protected]> wrote:
> On 10/04/2016 11:09 AM, Alban wrote:
>> On Mon, 3 Oct 2016 17:35:31 +0200
>> Neil Armstrong <[email protected]> wrote:
>>
>>> 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 <[email protected]>
>>
>> Please use device tree instead of adding another board file.
>>
>> Alban
>>
>
> Hi Alban,
>
> I'm quite surprised since it seems no device tree support is available for ath79,
> I would really like to have device tree for this board, but this is only a copy/paste of
> the mach-ap121 with button/leds gpio differences.
>
> Could it be possible to merge it ? I would be happy to support this board once device tree
> support is landed on the mips tree !

Take a look at these DTS files from the current Linux tree:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts

etc.

Regards,
Yegor

2016-10-04 10:11:19

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

On 10/04/2016 12:09 PM, Yegor Yefremov wrote:
> Hi Neil,
>
> On Tue, Oct 4, 2016 at 11:40 AM, Neil Armstrong <[email protected]> wrote:
>> On 10/04/2016 11:09 AM, Alban wrote:
>>> On Mon, 3 Oct 2016 17:35:31 +0200
>>> Neil Armstrong <[email protected]> wrote:
>>>
>>>> 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 <[email protected]>
>>>
>>> Please use device tree instead of adding another board file.
>>>
>>> Alban
>>>
>>
>> Hi Alban,
>>
>> I'm quite surprised since it seems no device tree support is available for ath79,
>> I would really like to have device tree for this board, but this is only a copy/paste of
>> the mach-ap121 with button/leds gpio differences.
>>
>> Could it be possible to merge it ? I would be happy to support this board once device tree
>> support is landed on the mips tree !
>
> Take a look at these DTS files from the current Linux tree:
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
>
> etc.
>
> Regards,
> Yegor
>

My bad, the qca naming is really disturbing.

I will push a dts instead.

Thanks,
Neil

2016-10-04 10:14:41

by Yegor Yefremov

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

On Tue, Oct 4, 2016 at 12:11 PM, Neil Armstrong <[email protected]> wrote:
> On 10/04/2016 12:09 PM, Yegor Yefremov wrote:
>> Hi Neil,
>>
>> On Tue, Oct 4, 2016 at 11:40 AM, Neil Armstrong <[email protected]> wrote:
>>> On 10/04/2016 11:09 AM, Alban wrote:
>>>> On Mon, 3 Oct 2016 17:35:31 +0200
>>>> Neil Armstrong <[email protected]> wrote:
>>>>
>>>>> 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 <[email protected]>
>>>>
>>>> Please use device tree instead of adding another board file.
>>>>
>>>> Alban
>>>>
>>>
>>> Hi Alban,
>>>
>>> I'm quite surprised since it seems no device tree support is available for ath79,
>>> I would really like to have device tree for this board, but this is only a copy/paste of
>>> the mach-ap121 with button/leds gpio differences.
>>>
>>> Could it be possible to merge it ? I would be happy to support this board once device tree
>>> support is landed on the mips tree !
>>
>> Take a look at these DTS files from the current Linux tree:
>>
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
>>
>> etc.
>>
>> Regards,
>> Yegor
>>
>
> My bad, the qca naming is really disturbing.
>
> I will push a dts instead.

Are you also going to submit driver for the network controller? This
is almost the last missing component for this SoC.

Yegor

2016-10-04 10:21:19

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

On 10/04/2016 12:14 PM, Yegor Yefremov wrote:
> On Tue, Oct 4, 2016 at 12:11 PM, Neil Armstrong <[email protected]> wrote:
>> On 10/04/2016 12:09 PM, Yegor Yefremov wrote:
>>> Hi Neil,
>>>
>>> On Tue, Oct 4, 2016 at 11:40 AM, Neil Armstrong <[email protected]> wrote:
>>>> On 10/04/2016 11:09 AM, Alban wrote:
>>>>> On Mon, 3 Oct 2016 17:35:31 +0200
>>>>> Neil Armstrong <[email protected]> wrote:
>>>>>
>>>>>> 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 <[email protected]>
>>>>>
>>>>> Please use device tree instead of adding another board file.
>>>>>
>>>>> Alban
>>>>>
>>>>
>>>> Hi Alban,
>>>>
>>>> I'm quite surprised since it seems no device tree support is available for ath79,
>>>> I would really like to have device tree for this board, but this is only a copy/paste of
>>>> the mach-ap121 with button/leds gpio differences.
>>>>
>>>> Could it be possible to merge it ? I would be happy to support this board once device tree
>>>> support is landed on the mips tree !
>>>
>>> Take a look at these DTS files from the current Linux tree:
>>>
>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
>>>
>>> etc.
>>>
>>> Regards,
>>> Yegor
>>>
>>
>> My bad, the qca naming is really disturbing.
>>
>> I will push a dts instead.
>
> Are you also going to submit driver for the network controller? This
> is almost the last missing component for this SoC.
>
> Yegor
>

Hi Yegor,

I'm not sure I have the right knowledge to push this, but what is the status of the OpenWrt driver ?

Neil

2016-10-04 11:22:10

by Antony Pavlov

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

On Tue, 4 Oct 2016 12:11:11 +0200
Neil Armstrong <[email protected]> wrote:

> On 10/04/2016 12:09 PM, Yegor Yefremov wrote:
> > Hi Neil,
> >
> > On Tue, Oct 4, 2016 at 11:40 AM, Neil Armstrong <[email protected]> wrote:
> >> On 10/04/2016 11:09 AM, Alban wrote:
> >>> On Mon, 3 Oct 2016 17:35:31 +0200
> >>> Neil Armstrong <[email protected]> wrote:
> >>>
> >>>> 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 <[email protected]>
> >>>
> >>> Please use device tree instead of adding another board file.
> >>>
> >>> Alban
> >>>
> >>
> >> Hi Alban,
> >>
> >> I'm quite surprised since it seems no device tree support is available for ath79,
> >> I would really like to have device tree for this board, but this is only a copy/paste of
> >> the mach-ap121 with button/leds gpio differences.
> >>
> >> Could it be possible to merge it ? I would be happy to support this board once device tree
> >> support is landed on the mips tree !
> >
> > Take a look at these DTS files from the current Linux tree:
> >
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
> >
> > etc.
> >
> > Regards,
> > Yegor
> >
>
> My bad, the qca naming is really disturbing.
>
> I will push a dts instead.

Please note that currently some led's names in device tree files are wrong
(e.g. dragino2 device tree https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts .
My bad! I have just copied led's names from OpenWRT platform files).

Please see the 'LED Device Naming' chapter for correct led naming scheme:

http://lxr.free-electrons.com/source/Documentation/leds/leds-class.txt#L41

--?
Best regards,
? Antony Pavlov

2016-10-05 06:59:25

by Yegor Yefremov

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ath79: Add initial support for the HAPROXY Aloha Pocket board

Hi Neil,

On Tue, Oct 4, 2016 at 12:21 PM, Neil Armstrong <[email protected]> wrote:
> On 10/04/2016 12:14 PM, Yegor Yefremov wrote:
>> On Tue, Oct 4, 2016 at 12:11 PM, Neil Armstrong <[email protected]> wrote:
>>> On 10/04/2016 12:09 PM, Yegor Yefremov wrote:
>>>> Hi Neil,
>>>>
>>>> On Tue, Oct 4, 2016 at 11:40 AM, Neil Armstrong <[email protected]> wrote:
>>>>> On 10/04/2016 11:09 AM, Alban wrote:
>>>>>> On Mon, 3 Oct 2016 17:35:31 +0200
>>>>>> Neil Armstrong <[email protected]> wrote:
>>>>>>
>>>>>>> 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 <[email protected]>
>>>>>>
>>>>>> Please use device tree instead of adding another board file.
>>>>>>
>>>>>> Alban
>>>>>>
>>>>>
>>>>> Hi Alban,
>>>>>
>>>>> I'm quite surprised since it seems no device tree support is available for ath79,
>>>>> I would really like to have device tree for this board, but this is only a copy/paste of
>>>>> the mach-ap121 with button/leds gpio differences.
>>>>>
>>>>> Could it be possible to merge it ? I would be happy to support this board once device tree
>>>>> support is landed on the mips tree !
>>>>
>>>> Take a look at these DTS files from the current Linux tree:
>>>>
>>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
>>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
>>>>
>>>> etc.
>>>>
>>>> Regards,
>>>> Yegor
>>>>
>>>
>>> My bad, the qca naming is really disturbing.
>>>
>>> I will push a dts instead.
>>
>> Are you also going to submit driver for the network controller? This
>> is almost the last missing component for this SoC.
>>
>> Yegor
>>
>
> Hi Yegor,
>
> I'm not sure I have the right knowledge to push this, but what is the status of the OpenWrt driver ?

AFAIK LEDE project is using Linux 4.4. So that ath79 based devices are
only available in the form of board files. But converting them to DTS
is on LEDE's agenda. So perhaps then the networking driver will be
converted too. See https://www.lede-project.org/todo.html

Yegor