e9593c58c964a9cf875f6c0414a30f316acc2d85
[openwrt/openwrt.git] / target / linux / lantiq / patches-2.6.39 / 150-falcon-easy98020.patch
1 --- /dev/null
2 +++ b/arch/mips/lantiq/falcon/mach-easy98020.c
3 @@ -0,0 +1,97 @@
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 +
25 +extern unsigned char ltq_ethaddr[6];
26 +
27 +#ifdef CONFIG_MTD_PARTITIONS
28 +static struct mtd_partition easy98020_spi_partitions[] =
29 +{
30 + {
31 + .name = "uboot",
32 + .offset = 0x0,
33 + .size = 0x40000,
34 + },
35 + {
36 + .name = "uboot_env",
37 + .offset = 0x40000,
38 + .size = 0x40000, /* 2 sectors for redundant env. */
39 + },
40 + {
41 + .name = "linux",
42 + .offset = 0x80000,
43 + .size = 0xF80000, /* map only 16 MiB */
44 + },
45 +};
46 +
47 +static struct flash_platform_data easy98020_spi_flash_platform_data = {
48 + .name = "sflash",
49 + .parts = easy98020_spi_partitions,
50 + .nr_parts = ARRAY_SIZE(easy98020_spi_partitions)
51 +};
52 +#endif
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 +#ifdef CONFIG_MTD_PARTITIONS
61 + .platform_data = &easy98020_spi_flash_platform_data
62 +#endif
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 +};
84 +
85 +static void __init easy98020_init(void)
86 +{
87 + falcon_register_asc(0);
88 + falcon_register_gpio();
89 + falcon_register_wdt();
90 + falcon_register_i2c();
91 + falcon_register_spi_flash(&easy98020_spi_flash_data);
92 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(easy98020_leds_gpio),
93 + easy98020_leds_gpio);
94 + falcon_register_crypto();
95 +}
96 +
97 +MIPS_MACHINE(LANTIQ_MACH_EASY98020,
98 + "EASY98020",
99 + "EASY98020 Eval Board",
100 + easy98020_init);
101 --- a/arch/mips/lantiq/falcon/Kconfig
102 +++ b/arch/mips/lantiq/falcon/Kconfig
103 @@ -6,6 +6,10 @@
104 bool "Easy98000"
105 default y
106
107 +config LANTIQ_MACH_EASY98020
108 + bool "Easy98020"
109 + default y
110 +
111 endmenu
112
113 endif
114 --- a/arch/mips/lantiq/falcon/Makefile
115 +++ b/arch/mips/lantiq/falcon/Makefile
116 @@ -2,3 +2,4 @@
117 obj-y += softdog_vpe.o
118 obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
119 obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
120 +obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o