2 * Onion Omega board support
4 * Copyright (C) 2015 Boken Lin <bl@onion.io>
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.
11 #include <linux/gpio.h>
13 #include <asm/mach-ath79/ath79.h>
16 #include "dev-gpio-buttons.h"
17 #include "dev-leds-gpio.h"
18 #include "dev-m25p80.h"
21 #include "machtypes.h"
23 #define OMEGA_GPIO_LED_SYSTEM 27
24 #define OMEGA_GPIO_BTN_RESET 11
26 #define OMEGA_GPIO_USB_POWER 8
28 #define OMEGA_KEYS_POLL_INTERVAL 20 /* msecs */
29 #define OMEGA_KEYS_DEBOUNCE_INTERVAL (3 * OMEGA_KEYS_POLL_INTERVAL)
31 static const char *omega_part_probes
[] = {
36 static struct flash_platform_data omega_flash_data
= {
37 .part_probes
= omega_part_probes
,
40 static struct gpio_led omega_leds_gpio
[] __initdata
= {
42 .name
= "onion:amber:system",
43 .gpio
= OMEGA_GPIO_LED_SYSTEM
,
48 static struct gpio_keys_button omega_gpio_keys
[] __initdata
= {
53 .debounce_interval
= OMEGA_KEYS_DEBOUNCE_INTERVAL
,
54 .gpio
= OMEGA_GPIO_BTN_RESET
,
59 static void __init
onion_omega_setup(void)
61 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
62 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
64 ath79_register_m25p80(&omega_flash_data
);
65 ath79_register_leds_gpio(-1, ARRAY_SIZE(omega_leds_gpio
),
67 ath79_register_gpio_keys_polled(-1, OMEGA_KEYS_POLL_INTERVAL
,
68 ARRAY_SIZE(omega_gpio_keys
),
71 gpio_request_one(OMEGA_GPIO_USB_POWER
,
72 GPIOF_OUT_INIT_HIGH
| GPIOF_EXPORT_DIR_FIXED
,
76 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, -1);
78 ath79_register_mdio(0, 0x0);
79 ath79_register_eth(0);
81 ath79_register_wmac(ee
, mac
);
84 MIPS_MACHINE(ATH79_MACH_ONION_OMEGA
, "ONION-OMEGA", "Onion Omega", onion_omega_setup
);