2 * jjPlus JA76PF board support
6 #include <linux/i2c-gpio.h>
7 #include <linux/platform_device.h>
9 #include <asm/mach-ath79/ath79.h>
12 #include "dev-gpio-buttons.h"
13 #include "dev-leds-gpio.h"
14 #include "dev-m25p80.h"
16 #include "machtypes.h"
19 #define JA76PF_KEYS_POLL_INTERVAL 20 /* msecs */
20 #define JA76PF_KEYS_DEBOUNCE_INTERVAL (3 * JA76PF_KEYS_POLL_INTERVAL)
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
29 static struct gpio_led ja76pf_leds_gpio
[] __initdata
= {
31 .name
= "ja76pf:green:led1",
32 .gpio
= JA76PF_GPIO_LED_1
,
35 .name
= "ja76pf:green:led2",
36 .gpio
= JA76PF_GPIO_LED_2
,
39 .name
= "ja76pf:green:led3",
40 .gpio
= JA76PF_GPIO_LED_3
,
45 static struct gpio_keys_button ja76pf_gpio_keys
[] __initdata
= {
50 .debounce_interval
= JA76PF_KEYS_DEBOUNCE_INTERVAL
,
51 .gpio
= JA76PF_GPIO_BTN_RESET
,
56 static struct i2c_gpio_platform_data ja76pf_i2c_gpio_data
= {
57 .sda_pin
= JA76PF_GPIO_I2C_SDA
,
58 .scl_pin
= JA76PF_GPIO_I2C_SCL
,
61 static struct platform_device ja76pf_i2c_gpio_device
= {
65 .platform_data
= &ja76pf_i2c_gpio_data
,
69 static const char *ja76pf_part_probes
[] = {
74 static struct flash_platform_data ja76pf_flash_data
= {
75 .part_probes
= ja76pf_part_probes
,
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)
82 static void __init
ja76pf_init(void)
84 ath79_register_m25p80(&ja76pf_flash_data
);
86 ath79_register_mdio(0, ~JA76PF_MDIO_PHYMASK
);
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
;
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
;
98 ath79_register_eth(0);
99 ath79_register_eth(1);
101 platform_device_register(&ja76pf_i2c_gpio_device
);
103 ath79_register_leds_gpio(-1, ARRAY_SIZE(ja76pf_leds_gpio
),
106 ath79_register_gpio_keys_polled(-1, JA76PF_KEYS_POLL_INTERVAL
,
107 ARRAY_SIZE(ja76pf_gpio_keys
),
110 ath79_register_usb();
111 ath79_register_pci();
114 MIPS_MACHINE(ATH79_MACH_JA76PF
, "JA76PF", "jjPlus JA76PF", ja76pf_init
);