2 * 8devices Lima board support
4 * Copyright (C) 2016 Mantas Pucka <mantas@8devices.com>
5 * Copyright (C) 2017 Karol Dudek <karoiz@sli.pl>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/platform_device.h>
13 #include <asm/mach-ath79/ar71xx_regs.h>
14 #include <asm/mach-ath79/ath79.h>
17 #include "dev-ap9x-pci.h"
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
25 #include "machtypes.h"
28 #define LIMA_GPIO_BTN_1_DEFAULT 16
29 #define LIMA_KEYS_POLL_INTERVAL 20 /* msecs */
30 #define LIMA_KEYS_DEBOUNCE_INTERVAL (3 * LIMA_KEYS_POLL_INTERVAL)
32 #define LIMA_ETH_PHYS (BIT(0) | BIT(1))
34 #define LIMA_MAC0_OFFSET 0x0000
35 #define LIMA_MAC1_OFFSET 0x0006
37 #define LIMA_CALDATA_OFFSET 0x1000
39 static struct gpio_keys_button lima_gpio_keys
[] __initdata
= {
44 .debounce_interval
= LIMA_KEYS_DEBOUNCE_INTERVAL
,
45 .gpio
= LIMA_GPIO_BTN_1_DEFAULT
,
50 static void __init
lima_setup(void)
52 u8
*art
= (u8
*) KSEG1ADDR(0x1f080000);
54 ath79_register_m25p80(NULL
);
56 ath79_register_gpio_keys_polled(-1, LIMA_KEYS_POLL_INTERVAL
,
57 ARRAY_SIZE(lima_gpio_keys
),
60 ath79_setup_ar933x_phy4_switch(true, true);
62 ath79_init_mac(ath79_eth0_data
.mac_addr
, art
+ LIMA_MAC0_OFFSET
, 0);
63 ath79_init_mac(ath79_eth1_data
.mac_addr
, art
+ LIMA_MAC1_OFFSET
, 0);
65 ath79_register_mdio(0, ~LIMA_ETH_PHYS
);
67 ath79_switch_data
.phy4_mii_en
= 1;
69 ath79_switch_data
.phy_poll_mask
|= BIT(0);
70 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
71 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
72 ath79_eth1_data
.phy_mask
= BIT(1);
73 ath79_register_eth(1);
75 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
76 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
77 ath79_eth0_data
.speed
= SPEED_100
;
78 ath79_eth0_data
.phy_mask
= BIT(0);
79 ath79_register_eth(0);
81 ath79_register_wmac(art
+ LIMA_CALDATA_OFFSET
, NULL
);
86 MIPS_MACHINE(ATH79_MACH_LIMA
, "LIMA", "8devices Lima board", lima_setup
);