[lantiq]
[openwrt/svn-archive/archive.git] / target / linux / lantiq / files-3.0 / arch / mips / lantiq / falcon / mach-95C3AM1.c
1 #include <linux/init.h>
2 #include <linux/platform_device.h>
3 #include <linux/i2c-gpio.h>
4 #include "../machtypes.h"
5
6 #include "devices.h"
7 #include "dev-leds-gpio.h"
8
9 #define BOARD_95C3AM1_GPIO_LED_0 10
10 #define BOARD_95C3AM1_GPIO_LED_1 11
11 #define BOARD_95C3AM1_GPIO_LED_2 12
12 #define BOARD_95C3AM1_GPIO_LED_3 13
13
14 extern unsigned char ltq_ethaddr[6];
15
16 static struct mtd_partition board_95C3AM1_partitions[] =
17 {
18 {
19 .name = "uboot",
20 .offset = 0x0,
21 .size = 0x40000,
22 },
23 {
24 .name = "uboot_env",
25 .offset = 0x40000,
26 .size = 0x40000, /* 2 sectors for redundant env. */
27 },
28 {
29 .name = "linux",
30 .offset = 0x80000,
31 .size = 0xF80000, /* map only 16 MiB */
32 },
33 };
34
35 static struct flash_platform_data board_95C3AM1_flash_platform_data = {
36 .name = "sflash",
37 .parts = board_95C3AM1_partitions,
38 .nr_parts = ARRAY_SIZE(board_95C3AM1_partitions)
39 };
40
41 static struct spi_board_info board_95C3AM1_flash_data __initdata = {
42 .modalias = "m25p80",
43 .bus_num = 0,
44 .chip_select = 0,
45 .max_speed_hz = 10 * 1000 * 1000,
46 .mode = SPI_MODE_3,
47 .platform_data = &board_95C3AM1_flash_platform_data
48 };
49
50 static struct gpio_led board_95C3AM1_leds_gpio[] __initdata = {
51 {
52 .name = "power",
53 .gpio = BOARD_95C3AM1_GPIO_LED_0,
54 .active_low = 0,
55 }, {
56 .name = "optical",
57 .gpio = BOARD_95C3AM1_GPIO_LED_1,
58 .active_low = 0,
59 }, {
60 .name = "lan",
61 .gpio = BOARD_95C3AM1_GPIO_LED_2,
62 .active_low = 0,
63 }, {
64 .name = "update",
65 .gpio = BOARD_95C3AM1_GPIO_LED_3,
66 .active_low = 0,
67 }
68 };
69
70 static struct i2c_gpio_platform_data board_95C3AM1_i2c_gpio_data = {
71 .sda_pin = 107,
72 .scl_pin = 108,
73 };
74
75 static struct platform_device board_95C3AM1_i2c_gpio_device = {
76 .name = "i2c-gpio",
77 .id = 0,
78 .dev = {
79 .platform_data = &board_95C3AM1_i2c_gpio_data,
80 }
81 };
82
83 static void __init board_95C3AM1_init(void)
84 {
85 falcon_register_i2c();
86 falcon_register_spi_flash(&board_95C3AM1_flash_data);
87 platform_device_register(&board_95C3AM1_i2c_gpio_device);
88 ltq_add_device_leds_gpio(-1, ARRAY_SIZE(board_95C3AM1_leds_gpio),
89 board_95C3AM1_leds_gpio);
90 }
91
92 MIPS_MACHINE(LANTIQ_MACH_95C3AM1,
93 "95C3AM1",
94 "95C3AM1 Board",
95 board_95C3AM1_init);