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