7ddf77ab21bcc30f5be380b6d4b4dda75cc1c87d
[openwrt.git] / target / linux / lantiq / patches-3.0 / 150-falcon-easy98020.patch
1 --- /dev/null
2 +++ b/arch/mips/lantiq/falcon/mach-easy98020.c
3 @@ -0,0 +1,113 @@
4 +#include <linux/init.h>
5 +#include <linux/platform_device.h>
6 +#include <linux/leds.h>
7 +#include <linux/gpio.h>
8 +#include <linux/gpio_buttons.h>
9 +#include <linux/mtd/mtd.h>
10 +#include <linux/mtd/partitions.h>
11 +#include <linux/input.h>
12 +#include <linux/interrupt.h>
13 +#include <linux/spi/spi.h>
14 +#include <linux/spi/flash.h>
15 +#include "../machtypes.h"
16 +
17 +#include "devices.h"
18 +#include "dev-leds-gpio.h"
19 +
20 +#define EASY98020_GPIO_LED_0 9
21 +#define EASY98020_GPIO_LED_1 10
22 +#define EASY98020_GPIO_LED_2 11
23 +#define EASY98020_GPIO_LED_3 12
24 +#define EASY98020_GPIO_LED_GE0_ACT 110
25 +#define EASY98020_GPIO_LED_GE0_LINK 109
26 +#define EASY98020_GPIO_LED_GE1_ACT 106
27 +#define EASY98020_GPIO_LED_GE1_LINK 105
28 +
29 +extern unsigned char ltq_ethaddr[6];
30 +
31 +static struct mtd_partition easy98020_spi_partitions[] =
32 +{
33 +       {
34 +               .name   = "uboot",
35 +               .offset = 0x0,
36 +               .size   = 0x40000,
37 +       },
38 +       {
39 +               .name   = "uboot_env",
40 +               .offset = 0x40000,
41 +               .size   = 0x40000,      /* 2 sectors for redundant env. */
42 +       },
43 +       {
44 +               .name   = "linux",
45 +               .offset = 0x80000,
46 +               .size   = 0xF80000,     /* map only 16 MiB */
47 +       },
48 +};
49 +
50 +static struct flash_platform_data easy98020_spi_flash_platform_data = {
51 +       .name = "sflash",
52 +       .parts = easy98020_spi_partitions,
53 +       .nr_parts = ARRAY_SIZE(easy98020_spi_partitions)
54 +};
55 +
56 +static struct spi_board_info easy98020_spi_flash_data __initdata = {
57 +       .modalias               = "m25p80",
58 +       .bus_num                = 0,
59 +       .chip_select            = 0,
60 +       .max_speed_hz           = 10 * 1000 * 1000,
61 +       .mode                   = SPI_MODE_3,
62 +       .platform_data          = &easy98020_spi_flash_platform_data
63 +};
64 +
65 +static struct gpio_led easy98020_leds_gpio[] __initdata = {
66 +       {
67 +               .name           = "easy98020:green:0",
68 +               .gpio           = EASY98020_GPIO_LED_0,
69 +               .active_low     = 0,
70 +       }, {
71 +               .name           = "easy98020:green:1",
72 +               .gpio           = EASY98020_GPIO_LED_1,
73 +               .active_low     = 0,
74 +       }, {
75 +               .name           = "easy98020:green:2",
76 +               .gpio           = EASY98020_GPIO_LED_2,
77 +               .active_low     = 0,
78 +       }, {
79 +               .name           = "easy98020:green:3",
80 +               .gpio           = EASY98020_GPIO_LED_3,
81 +               .active_low     = 0,
82 +       }, {
83 +               .name           = "easy98020:ge0_act",
84 +               .gpio           = EASY98020_GPIO_LED_GE0_ACT,
85 +               .active_low     = 0,
86 +       }, {
87 +               .name           = "easy98020:ge0_link",
88 +               .gpio           = EASY98020_GPIO_LED_GE0_LINK,
89 +               .active_low     = 0,
90 +       }, {
91 +               .name           = "easy98020:ge1_act",
92 +               .gpio           = EASY98020_GPIO_LED_GE1_ACT,
93 +               .active_low     = 0,
94 +       }, {
95 +               .name           = "easy98020:ge1_link",
96 +               .gpio           = EASY98020_GPIO_LED_GE1_LINK,
97 +               .active_low     = 0,
98 +       }
99 +};
100 +
101 +static void __init easy98020_init(void)
102 +{
103 +       falcon_register_asc(0);
104 +       falcon_register_gpio();
105 +       falcon_register_wdt();
106 +       falcon_register_i2c();
107 +       falcon_register_spi_flash(&easy98020_spi_flash_data);
108 +       ltq_add_device_leds_gpio(-1, ARRAY_SIZE(easy98020_leds_gpio),
109 +                                       easy98020_leds_gpio);
110 +       falcon_register_crypto();
111 +}
112 +
113 +MIPS_MACHINE(LANTIQ_MACH_EASY98020,
114 +                       "EASY98020",
115 +                       "EASY98020 Eval Board",
116 +                       easy98020_init);
117 --- a/arch/mips/lantiq/falcon/Kconfig
118 +++ b/arch/mips/lantiq/falcon/Kconfig
119 @@ -6,6 +6,10 @@ config LANTIQ_MACH_EASY98000
120         bool "Easy98000"
121         default y
122  
123 +config LANTIQ_MACH_EASY98020
124 +       bool "Easy98020"
125 +       default y
126 +
127  endmenu
128  
129  endif
130 --- a/arch/mips/lantiq/falcon/Makefile
131 +++ b/arch/mips/lantiq/falcon/Makefile
132 @@ -3,3 +3,4 @@ obj-y += softdog_vpe.o
133  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
134  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
135  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
136 +obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o