1 From d7b27740e8376c1c147297b526f9a8e330c1fe17 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Mon, 20 Jun 2011 19:26:13 +0200
4 Subject: [PATCH 16/27] MIPS: ath79: Add initial support for the Atheros AP121 reference board
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
7 Cc: linux-mips@linux-mips.org
8 Cc: Kathy Giori <kgiori@qca.qualcomm.com>
9 Cc: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>
10 Patchwork: https://patchwork.linux-mips.org/patch/2531/
11 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 arch/mips/ath79/Kconfig | 11 +++++
14 arch/mips/ath79/Makefile | 1 +
15 arch/mips/ath79/mach-ap121.c | 88 ++++++++++++++++++++++++++++++++++++++++++
16 arch/mips/ath79/machtypes.h | 1 +
17 4 files changed, 101 insertions(+), 0 deletions(-)
18 create mode 100644 arch/mips/ath79/mach-ap121.c
20 --- a/arch/mips/ath79/Kconfig
21 +++ b/arch/mips/ath79/Kconfig
22 @@ -2,6 +2,17 @@ if ATH79
24 menu "Atheros AR71XX/AR724X/AR913X machine selection"
26 +config ATH79_MACH_AP121
27 + bool "Atheros AP121 reference board"
29 + select ATH79_DEV_GPIO_BUTTONS
30 + select ATH79_DEV_LEDS_GPIO
31 + select ATH79_DEV_SPI
32 + select ATH79_DEV_USB
34 + Say 'Y' here if you want your kernel to support the
35 + Atheros AP121 reference board.
37 config ATH79_MACH_AP81
38 bool "Atheros AP81 reference board"
40 --- a/arch/mips/ath79/Makefile
41 +++ b/arch/mips/ath79/Makefile
42 @@ -25,5 +25,6 @@ obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.
46 +obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o
47 obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
48 obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
50 +++ b/arch/mips/ath79/mach-ap121.c
53 + * Atheros AP121 board support
55 + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
57 + * This program is free software; you can redistribute it and/or modify it
58 + * under the terms of the GNU General Public License version 2 as published
59 + * by the Free Software Foundation.
62 +#include "machtypes.h"
63 +#include "dev-gpio-buttons.h"
64 +#include "dev-leds-gpio.h"
68 +#define AP121_GPIO_LED_WLAN 0
69 +#define AP121_GPIO_LED_USB 1
71 +#define AP121_GPIO_BTN_JUMPSTART 11
72 +#define AP121_GPIO_BTN_RESET 12
74 +#define AP121_KEYS_POLL_INTERVAL 20 /* msecs */
75 +#define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL)
77 +#define AP121_CAL_DATA_ADDR 0x1fff1000
79 +static struct gpio_led ap121_leds_gpio[] __initdata = {
81 + .name = "ap121:green:usb",
82 + .gpio = AP121_GPIO_LED_USB,
86 + .name = "ap121:green:wlan",
87 + .gpio = AP121_GPIO_LED_WLAN,
92 +static struct gpio_keys_button ap121_gpio_keys[] __initdata = {
94 + .desc = "jumpstart button",
96 + .code = KEY_WPS_BUTTON,
97 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
98 + .gpio = AP121_GPIO_BTN_JUMPSTART,
102 + .desc = "reset button",
104 + .code = KEY_RESTART,
105 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
106 + .gpio = AP121_GPIO_BTN_RESET,
111 +static struct spi_board_info ap121_spi_info[] = {
115 + .max_speed_hz = 25000000,
116 + .modalias = "mx25l1606e",
120 +static struct ath79_spi_platform_data ap121_spi_data = {
122 + .num_chipselect = 1,
125 +static void __init ap121_setup(void)
127 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio),
129 + ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL,
130 + ARRAY_SIZE(ap121_gpio_keys),
133 + ath79_register_spi(&ap121_spi_data, ap121_spi_info,
134 + ARRAY_SIZE(ap121_spi_info));
135 + ath79_register_usb();
138 +MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",
140 --- a/arch/mips/ath79/machtypes.h
141 +++ b/arch/mips/ath79/machtypes.h
144 enum ath79_mach_type {
145 ATH79_MACH_GENERIC = 0,
146 + ATH79_MACH_AP121, /* Atheros AP121 reference board */
147 ATH79_MACH_AP81, /* Atheros AP81 reference board */
148 ATH79_MACH_PB44, /* Atheros PB44 reference board */