[package] base-files: now that the initial password is completely empty (and not...
[openwrt.git] / target / linux / lantiq / files-3.1 / arch / mips / lantiq / falcon / mach-easy98020.c
1 #include <linux/init.h>
2 #include <linux/platform_device.h>
3 #include <linux/leds.h>
4 #include <linux/gpio.h>
5 #include <linux/gpio_buttons.h>
6 #include <linux/mtd/mtd.h>
7 #include <linux/mtd/partitions.h>
8 #include <linux/input.h>
9 #include <linux/interrupt.h>
10 #include <linux/spi/spi.h>
11 #include <linux/spi/flash.h>
12
13 #include <dev-gpio-leds.h>
14
15 #include "../machtypes.h"
16 #include "devices.h"
17
18 #define EASY98020_GPIO_LED_0 9
19 #define EASY98020_GPIO_LED_1 10
20 #define EASY98020_GPIO_LED_2 11
21 #define EASY98020_GPIO_LED_3 12
22 #define EASY98020_GPIO_LED_GE0_ACT 110
23 #define EASY98020_GPIO_LED_GE0_LINK 109
24 #define EASY98020_GPIO_LED_GE1_ACT 106
25 #define EASY98020_GPIO_LED_GE1_LINK 105
26
27 extern unsigned char ltq_ethaddr[6];
28
29 static struct mtd_partition easy98020_spi_partitions[] =
30 {
31 {
32 .name = "uboot",
33 .offset = 0x0,
34 .size = 0x40000,
35 },
36 {
37 .name = "uboot_env",
38 .offset = 0x40000,
39 .size = 0x40000, /* 2 sectors for redundant env. */
40 },
41 {
42 .name = "linux",
43 .offset = 0x80000,
44 .size = 0xF80000, /* map only 16 MiB */
45 },
46 };
47
48 static struct flash_platform_data easy98020_spi_flash_platform_data = {
49 .name = "sflash",
50 .parts = easy98020_spi_partitions,
51 .nr_parts = ARRAY_SIZE(easy98020_spi_partitions)
52 };
53
54 static struct spi_board_info easy98020_spi_flash_data __initdata = {
55 .modalias = "m25p80",
56 .bus_num = 0,
57 .chip_select = 0,
58 .max_speed_hz = 10 * 1000 * 1000,
59 .mode = SPI_MODE_3,
60 .platform_data = &easy98020_spi_flash_platform_data
61 };
62
63 static struct gpio_led easy98020_gpio_leds[] __initdata = {
64 {
65 .name = "easy98020:green:0",
66 .gpio = EASY98020_GPIO_LED_0,
67 .active_low = 0,
68 }, {
69 .name = "easy98020:green:1",
70 .gpio = EASY98020_GPIO_LED_1,
71 .active_low = 0,
72 }, {
73 .name = "easy98020:green:2",
74 .gpio = EASY98020_GPIO_LED_2,
75 .active_low = 0,
76 }, {
77 .name = "easy98020:green:3",
78 .gpio = EASY98020_GPIO_LED_3,
79 .active_low = 0,
80 }, {
81 .name = "easy98020:ge0_act",
82 .gpio = EASY98020_GPIO_LED_GE0_ACT,
83 .active_low = 0,
84 }, {
85 .name = "easy98020:ge0_link",
86 .gpio = EASY98020_GPIO_LED_GE0_LINK,
87 .active_low = 0,
88 }, {
89 .name = "easy98020:ge1_act",
90 .gpio = EASY98020_GPIO_LED_GE1_ACT,
91 .active_low = 0,
92 }, {
93 .name = "easy98020:ge1_link",
94 .gpio = EASY98020_GPIO_LED_GE1_LINK,
95 .active_low = 0,
96 }
97 };
98
99 static void __init easy98020_init(void)
100 {
101 falcon_register_i2c();
102 falcon_register_spi_flash(&easy98020_spi_flash_data);
103 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(easy98020_gpio_leds),
104 easy98020_gpio_leds);
105 }
106
107 MIPS_MACHINE(LANTIQ_MACH_EASY98020,
108 "EASY98020",
109 "EASY98020 Eval Board",
110 easy98020_init);
111
112 MIPS_MACHINE(LANTIQ_MACH_EASY98020_1LAN,
113 "EASY98020_1LAN",
114 "EASY98020 Eval Board (1 LAN port)",
115 easy98020_init);
116
117 MIPS_MACHINE(LANTIQ_MACH_EASY98020_2LAN,
118 "EASY98020_2LAN",
119 "EASY98020 Eval Board (2 LAN ports)",
120 easy98020_init);
This page took 0.057106 seconds and 5 git commands to generate.