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
38 #define LIMA_WMAC_MAC_OFFSET 0x0800
40 static struct gpio_keys_button lima_gpio_keys
[] __initdata
= {
45 .debounce_interval
= LIMA_KEYS_DEBOUNCE_INTERVAL
,
46 .gpio
= LIMA_GPIO_BTN_1_DEFAULT
,
51 static void __init
lima_setup(void)
53 u8
*art
= (u8
*) KSEG1ADDR(0x1f080000);
55 ath79_register_m25p80(NULL
);
57 ath79_register_gpio_keys_polled(-1, LIMA_KEYS_POLL_INTERVAL
,
58 ARRAY_SIZE(lima_gpio_keys
),
61 ath79_setup_ar933x_phy4_switch(true, true);
63 ath79_init_mac(ath79_eth0_data
.mac_addr
, art
+ LIMA_MAC0_OFFSET
, 0);
64 ath79_init_mac(ath79_eth1_data
.mac_addr
, art
+ LIMA_MAC1_OFFSET
, 0);
66 ath79_register_mdio(0, ~LIMA_ETH_PHYS
);
68 ath79_switch_data
.phy4_mii_en
= 1;
70 ath79_switch_data
.phy_poll_mask
|= BIT(0);
71 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
72 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
73 ath79_eth1_data
.phy_mask
= BIT(1);
74 ath79_register_eth(1);
76 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
77 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
78 ath79_eth0_data
.speed
= SPEED_100
;
79 ath79_eth0_data
.phy_mask
= BIT(0);
80 ath79_register_eth(0);
82 ath79_register_wmac(art
+ LIMA_CALDATA_OFFSET
,
83 art
+ LIMA_WMAC_MAC_OFFSET
);
88 MIPS_MACHINE(ATH79_MACH_LIMA
, "LIMA", "8devices Lima board", lima_setup
);