2 * GainStrong Oolite V5.2 module and development board support
4 * Copyright (C) 2018 Piotr Dymacz <pepe2k@gmail.com>
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>
12 #include <linux/platform_device.h>
14 #include <asm/mach-ath79/ath79.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
24 #include "machtypes.h"
27 #define GS_OOLITE_V5_2_DEV_GPIO_BTN_RESET 17
28 #define GS_OOLITE_V5_2_DEV_GPIO_LED_SYSTEM 13
30 #define GS_KEYS_POLL_INTERVAL 20 /* msec */
31 #define GS_KEYS_DEBOUNCE_INTERVAL (3 * GS_KEYS_POLL_INTERVAL)
33 #define GS_OOLITE_V5_2_WMAC_CALDATA_OFFSET 0x1000
35 static const char *gs_oolite_v5_2_part_probes[] = {
40 static struct flash_platform_data gs_oolite_v5_2_flash_data = {
41 .part_probes = gs_oolite_v5_2_part_probes,
44 static struct gpio_led gs_oolite_v5_2_dev_gpio_leds[] __initdata = {
46 .name = "oolite-v5.2-dev:blue:system",
47 .gpio = GS_OOLITE_V5_2_DEV_GPIO_LED_SYSTEM,
52 static struct gpio_keys_button gs_oolite_v5_2_dev_gpio_keys[] __initdata = {
57 .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL,
58 .gpio = GS_OOLITE_V5_2_DEV_GPIO_BTN_RESET,
63 static void __init gs_oolite_v5_2_setup(void)
65 u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
67 ath79_register_m25p80(&gs_oolite_v5_2_flash_data);
69 ath79_setup_ar933x_phy4_switch(false, false);
71 ath79_register_mdio(0, 0x0);
73 ath79_switch_data.phy4_mii_en = 1;
74 ath79_switch_data.phy_poll_mask |= BIT(4);
77 ath79_eth1_data.duplex = DUPLEX_FULL;
78 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
79 ath79_init_mac(ath79_eth1_data.mac_addr, art + 6, 0);
80 ath79_register_eth(1);
83 ath79_eth0_data.duplex = DUPLEX_FULL;
84 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
85 ath79_eth0_data.phy_mask = BIT(4);
86 ath79_eth0_data.speed = SPEED_100;
87 ath79_init_mac(ath79_eth0_data.mac_addr, art, 0);
88 ath79_register_eth(0);
92 ath79_register_wmac(art + GS_OOLITE_V5_2_WMAC_CALDATA_OFFSET, NULL);
95 static void __init gs_oolite_v5_2_dev_setup(void)
97 gs_oolite_v5_2_setup();
99 ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_oolite_v5_2_dev_gpio_leds),
100 gs_oolite_v5_2_dev_gpio_leds);
102 ath79_register_gpio_keys_polled(-1, GS_KEYS_POLL_INTERVAL,
103 ARRAY_SIZE(gs_oolite_v5_2_dev_gpio_keys),
104 gs_oolite_v5_2_dev_gpio_keys);
107 MIPS_MACHINE(ATH79_MACH_GS_OOLITE_V5_2, "OOLITE-V5-2",
108 "GainStrong Oolite V5.2", gs_oolite_v5_2_setup);
110 MIPS_MACHINE(ATH79_MACH_GS_OOLITE_V5_2_DEV, "OOLITE-V5-2-DEV",
111 "GainStrong Oolite V5.2-Dev", gs_oolite_v5_2_dev_setup);