OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * 8devices Lima board support |
||
3 | * |
||
4 | * Copyright (C) 2016 Mantas Pucka <mantas@8devices.com> |
||
5 | * Copyright (C) 2017 Karol Dudek <karoiz@sli.pl> |
||
6 | * |
||
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. |
||
10 | */ |
||
11 | |||
12 | #include <linux/platform_device.h> |
||
13 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
14 | #include <asm/mach-ath79/ath79.h> |
||
15 | |||
16 | #include "common.h" |
||
17 | #include "dev-ap9x-pci.h" |
||
18 | #include "dev-eth.h" |
||
19 | #include "dev-gpio-buttons.h" |
||
20 | #include "dev-leds-gpio.h" |
||
21 | #include "dev-m25p80.h" |
||
22 | #include "dev-spi.h" |
||
23 | #include "dev-usb.h" |
||
24 | #include "dev-wmac.h" |
||
25 | #include "machtypes.h" |
||
26 | #include "pci.h" |
||
27 | |||
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) |
||
31 | |||
32 | #define LIMA_ETH_PHYS (BIT(0) | BIT(1)) |
||
33 | |||
34 | #define LIMA_MAC0_OFFSET 0x0000 |
||
35 | #define LIMA_MAC1_OFFSET 0x0006 |
||
36 | |||
37 | #define LIMA_CALDATA_OFFSET 0x1000 |
||
38 | |||
39 | static struct gpio_keys_button lima_gpio_keys[] __initdata = { |
||
40 | { |
||
41 | .desc = "button1", |
||
42 | .type = EV_KEY, |
||
43 | .code = BTN_1, |
||
44 | .debounce_interval = LIMA_KEYS_DEBOUNCE_INTERVAL, |
||
45 | .gpio = LIMA_GPIO_BTN_1_DEFAULT, |
||
46 | .active_low = 1, |
||
47 | } |
||
48 | }; |
||
49 | |||
50 | static void __init lima_setup(void) |
||
51 | { |
||
52 | u8 *art = (u8 *) KSEG1ADDR(0x1f080000); |
||
53 | |||
54 | ath79_register_m25p80(NULL); |
||
55 | |||
56 | ath79_register_gpio_keys_polled(-1, LIMA_KEYS_POLL_INTERVAL, |
||
57 | ARRAY_SIZE(lima_gpio_keys), |
||
58 | lima_gpio_keys); |
||
59 | |||
60 | ath79_setup_ar933x_phy4_switch(true, true); |
||
61 | |||
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); |
||
64 | |||
65 | ath79_register_mdio(0, ~LIMA_ETH_PHYS); |
||
66 | |||
67 | ath79_switch_data.phy4_mii_en = 1; |
||
68 | |||
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); |
||
74 | |||
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); |
||
80 | |||
81 | ath79_register_wmac(art + LIMA_CALDATA_OFFSET, NULL); |
||
82 | ath79_register_usb(); |
||
83 | ath79_register_pci(); |
||
84 | } |
||
85 | |||
86 | MIPS_MACHINE(ATH79_MACH_LIMA, "LIMA", "8devices Lima board", lima_setup); |