Root/target/linux/ar71xx/files/arch/mips/ath79/mach-ja76pf.c

1/*
2 * jjPlus JA76PF board support
3 */
4
5#include <linux/i2c.h>
6#include <linux/i2c-gpio.h>
7#include <linux/platform_device.h>
8
9#include <asm/mach-ath79/ath79.h>
10
11#include "dev-eth.h"
12#include "dev-gpio-buttons.h"
13#include "dev-leds-gpio.h"
14#include "dev-m25p80.h"
15#include "dev-usb.h"
16#include "machtypes.h"
17#include "pci.h"
18
19#define JA76PF_KEYS_POLL_INTERVAL 20 /* msecs */
20#define JA76PF_KEYS_DEBOUNCE_INTERVAL (3 * JA76PF_KEYS_POLL_INTERVAL)
21
22#define JA76PF_GPIO_I2C_SCL 0
23#define JA76PF_GPIO_I2C_SDA 1
24#define JA76PF_GPIO_LED_1 5
25#define JA76PF_GPIO_LED_2 4
26#define JA76PF_GPIO_LED_3 3
27#define JA76PF_GPIO_BTN_RESET 11
28
29static struct gpio_led ja76pf_leds_gpio[] __initdata = {
30    {
31        .name = "ja76pf:green:led1",
32        .gpio = JA76PF_GPIO_LED_1,
33        .active_low = 1,
34    }, {
35        .name = "ja76pf:green:led2",
36        .gpio = JA76PF_GPIO_LED_2,
37        .active_low = 1,
38    }, {
39        .name = "ja76pf:green:led3",
40        .gpio = JA76PF_GPIO_LED_3,
41        .active_low = 1,
42    }
43};
44
45static struct gpio_keys_button ja76pf_gpio_keys[] __initdata = {
46    {
47        .desc = "reset",
48        .type = EV_KEY,
49        .code = KEY_RESTART,
50        .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL,
51        .gpio = JA76PF_GPIO_BTN_RESET,
52        .active_low = 1,
53    }
54};
55
56static struct i2c_gpio_platform_data ja76pf_i2c_gpio_data = {
57    .sda_pin = JA76PF_GPIO_I2C_SDA,
58    .scl_pin = JA76PF_GPIO_I2C_SCL,
59};
60
61static struct platform_device ja76pf_i2c_gpio_device = {
62    .name = "i2c-gpio",
63    .id = 0,
64    .dev = {
65        .platform_data = &ja76pf_i2c_gpio_data,
66    }
67};
68
69static const char *ja76pf_part_probes[] = {
70    "RedBoot",
71    NULL,
72};
73
74static struct flash_platform_data ja76pf_flash_data = {
75    .part_probes = ja76pf_part_probes,
76};
77
78#define JA76PF_WAN_PHYMASK (1 << 4)
79#define JA76PF_LAN_PHYMASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 < 3))
80#define JA76PF_MDIO_PHYMASK (JA76PF_LAN_PHYMASK | JA76PF_WAN_PHYMASK)
81
82static void __init ja76pf_init(void)
83{
84    ath79_register_m25p80(&ja76pf_flash_data);
85
86    ath79_register_mdio(0, ~JA76PF_MDIO_PHYMASK);
87
88    ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
89    ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
90    ath79_eth0_data.phy_mask = JA76PF_LAN_PHYMASK;
91
92    ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
93    ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
94    ath79_eth1_data.phy_mask = JA76PF_WAN_PHYMASK;
95    ath79_eth1_data.speed = SPEED_1000;
96    ath79_eth1_data.duplex = DUPLEX_FULL;
97
98    ath79_register_eth(0);
99    ath79_register_eth(1);
100
101    platform_device_register(&ja76pf_i2c_gpio_device);
102
103    ath79_register_leds_gpio(-1, ARRAY_SIZE(ja76pf_leds_gpio),
104                    ja76pf_leds_gpio);
105
106    ath79_register_gpio_keys_polled(-1, JA76PF_KEYS_POLL_INTERVAL,
107                     ARRAY_SIZE(ja76pf_gpio_keys),
108                     ja76pf_gpio_keys);
109
110    ath79_register_usb();
111    ath79_register_pci();
112}
113
114MIPS_MACHINE(ATH79_MACH_JA76PF, "JA76PF", "jjPlus JA76PF", ja76pf_init);
115

Archive Download this file



interactive