Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: ath79: Add initial support for the Atheros AP121 reference board

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: Kathy Giori <kgiori@qca.qualcomm.com>
Cc: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>
Patchwork: https://patchwork.linux-mips.org/patch/2531/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Gabor Juhos and committed by
Ralf Baechle
7e0dde17 13051c5c

+101
+11
arch/mips/ath79/Kconfig
··· 2 2 3 3 menu "Atheros AR71XX/AR724X/AR913X machine selection" 4 4 5 + config ATH79_MACH_AP121 6 + bool "Atheros AP121 reference board" 7 + select SOC_AR933X 8 + select ATH79_DEV_GPIO_BUTTONS 9 + select ATH79_DEV_LEDS_GPIO 10 + select ATH79_DEV_SPI 11 + select ATH79_DEV_USB 12 + help 13 + Say 'Y' here if you want your kernel to support the 14 + Atheros AP121 reference board. 15 + 5 16 config ATH79_MACH_AP81 6 17 bool "Atheros AP81 reference board" 7 18 select SOC_AR913X
+1
arch/mips/ath79/Makefile
··· 25 25 # 26 26 # Machines 27 27 # 28 + obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o 28 29 obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o 29 30 obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
+88
arch/mips/ath79/mach-ap121.c
··· 1 + /* 2 + * Atheros AP121 board support 3 + * 4 + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License version 2 as published 8 + * by the Free Software Foundation. 9 + */ 10 + 11 + #include "machtypes.h" 12 + #include "dev-gpio-buttons.h" 13 + #include "dev-leds-gpio.h" 14 + #include "dev-spi.h" 15 + #include "dev-usb.h" 16 + 17 + #define AP121_GPIO_LED_WLAN 0 18 + #define AP121_GPIO_LED_USB 1 19 + 20 + #define AP121_GPIO_BTN_JUMPSTART 11 21 + #define AP121_GPIO_BTN_RESET 12 22 + 23 + #define AP121_KEYS_POLL_INTERVAL 20 /* msecs */ 24 + #define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL) 25 + 26 + #define AP121_CAL_DATA_ADDR 0x1fff1000 27 + 28 + static struct gpio_led ap121_leds_gpio[] __initdata = { 29 + { 30 + .name = "ap121:green:usb", 31 + .gpio = AP121_GPIO_LED_USB, 32 + .active_low = 0, 33 + }, 34 + { 35 + .name = "ap121:green:wlan", 36 + .gpio = AP121_GPIO_LED_WLAN, 37 + .active_low = 0, 38 + }, 39 + }; 40 + 41 + static struct gpio_keys_button ap121_gpio_keys[] __initdata = { 42 + { 43 + .desc = "jumpstart button", 44 + .type = EV_KEY, 45 + .code = KEY_WPS_BUTTON, 46 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, 47 + .gpio = AP121_GPIO_BTN_JUMPSTART, 48 + .active_low = 1, 49 + }, 50 + { 51 + .desc = "reset button", 52 + .type = EV_KEY, 53 + .code = KEY_RESTART, 54 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, 55 + .gpio = AP121_GPIO_BTN_RESET, 56 + .active_low = 1, 57 + } 58 + }; 59 + 60 + static struct spi_board_info ap121_spi_info[] = { 61 + { 62 + .bus_num = 0, 63 + .chip_select = 0, 64 + .max_speed_hz = 25000000, 65 + .modalias = "mx25l1606e", 66 + } 67 + }; 68 + 69 + static struct ath79_spi_platform_data ap121_spi_data = { 70 + .bus_num = 0, 71 + .num_chipselect = 1, 72 + }; 73 + 74 + static void __init ap121_setup(void) 75 + { 76 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio), 77 + ap121_leds_gpio); 78 + ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL, 79 + ARRAY_SIZE(ap121_gpio_keys), 80 + ap121_gpio_keys); 81 + 82 + ath79_register_spi(&ap121_spi_data, ap121_spi_info, 83 + ARRAY_SIZE(ap121_spi_info)); 84 + ath79_register_usb(); 85 + } 86 + 87 + MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board", 88 + ap121_setup);
+1
arch/mips/ath79/machtypes.h
··· 16 16 17 17 enum ath79_mach_type { 18 18 ATH79_MACH_GENERIC = 0, 19 + ATH79_MACH_AP121, /* Atheros AP121 reference board */ 19 20 ATH79_MACH_AP81, /* Atheros AP81 reference board */ 20 21 ATH79_MACH_PB44, /* Atheros PB44 reference board */ 21 22 };