[generic] add some missing 2.6.39 kernel symbols observed on x86/generic builds
[openwrt.git] / target / linux / cns21xx / patches-2.6.36 / 301-cns21xx-mach-ns-k330.patch
1 --- a/arch/arm/mach-cns21xx/Kconfig
2 +++ b/arch/arm/mach-cns21xx/Kconfig
3 @@ -1,6 +1,16 @@
4 if ARCH_CNS21XX
5
6 menu "Cavium Networks CNS21xx based machines"
7 +
8 +config MACH_NS_K330
9 + bool "NS-K330 NAS"
10 + select CNS21XX_DEV_GEC
11 + select CNS21XX_DEV_SPI_MASTER
12 + select CNS21XX_DEV_USB
13 + help
14 + Say Y here if you intend to run this kernel on the
15 + NS-K330 NAS board.
16 +
17 endmenu
18
19 config CNS21XX_DEV_GEC
20 --- /dev/null
21 +++ b/arch/arm/mach-cns21xx/mach-ns-k330.c
22 @@ -0,0 +1,212 @@
23 +/*
24 + * NS-K330 NAS board support
25 + *
26 + * Copyright (c) 2010 Gabor Juhos <juhosg@openwrt.org>
27 + *
28 + * This file is free software; you can redistribute it and/or modify
29 + * it under the terms of the GNU General Public License, Version 2, as
30 + * published by the Free Software Foundation.
31 + */
32 +
33 +#include <linux/kernel.h>
34 +#include <linux/init.h>
35 +#include <linux/mtd/mtd.h>
36 +#include <linux/mtd/map.h>
37 +#include <linux/mtd/partitions.h>
38 +#include <linux/spi/spi.h>
39 +#include <linux/spi/flash.h>
40 +#include <linux/platform_device.h>
41 +#include <linux/gpio.h>
42 +#include <linux/leds.h>
43 +#include <linux/gpio_keys.h>
44 +#include <linux/input.h>
45 +
46 +#include <asm/setup.h>
47 +#include <asm/mach-types.h>
48 +#include <asm/mach/arch.h>
49 +#include <asm/mach/time.h>
50 +#include <mach/hardware.h>
51 +#include <mach/cns21xx.h>
52 +#include <mach/cns21xx_misc.h>
53 +
54 +#include "common.h"
55 +#include "dev-gec.h"
56 +
57 +#define NS_K330_GPIO_LED_LINK 1
58 +#define NS_K330_GPIO_LED_USB1 16
59 +#define NS_K330_GPIO_LED_USB2 17
60 +#define NS_K330_GPIO_LED_ETH_GREEN 22
61 +#define NS_K330_GPIO_LED_ETH_ORANGE 23
62 +
63 +#define NS_K330_GPIO_BTN_RESET 13
64 +#define NS_K330_GPIO_BTN_USB1 14
65 +#define NS_K330_GPIO_BTN_USB2 15
66 +
67 +#ifdef CONFIG_MTD_PARTITIONS
68 +static struct mtd_partition ns_k330_partitions[] = {
69 + {
70 + .name = "boot",
71 + .offset = 0x0,
72 + .size = 0x040000,
73 + .mask_flags = MTD_WRITEABLE,
74 + }, {
75 + .name = "config",
76 + .offset = 0x040000,
77 + .size = 0x020000,
78 + .mask_flags = MTD_WRITEABLE,
79 + }, {
80 + .name = "kernel",
81 + .offset = 0x060000,
82 + .size = 0x100000,
83 + }, {
84 + .name = "rootfs",
85 + .offset = 0x160000,
86 + .size = 0x290000,
87 + }, {
88 + .name = "firmware",
89 + .offset = 0x060000,
90 + .size = 0x390000,
91 + },
92 +};
93 +#else
94 +#define ns_k330_partitions NULL
95 +#define ns_k330_num_partitions 0
96 +#endif /* CONFIG_MTD_PARTITIONS */
97 +
98 +static struct flash_platform_data ns_k330_flash_data = {
99 + .parts = ns_k330_partitions,
100 + .nr_parts = ARRAY_SIZE(ns_k330_partitions),
101 +};
102 +
103 +static struct spi_board_info ns_k330_spi_board_info[] = {
104 + {
105 + .bus_num = 0,
106 + .chip_select = 0,
107 + .max_speed_hz = 25000000,
108 + .modalias = "m25p80",
109 + .platform_data = &ns_k330_flash_data,
110 + }
111 +};
112 +
113 +static struct gpio_led ns_k330_gpio_leds[] = {
114 + {
115 + .name = "ns-k330:red:link",
116 + .gpio = NS_K330_GPIO_LED_LINK,
117 + .active_low = 1,
118 + }, {
119 + .name = "ns-k330:green:usb1",
120 + .gpio = NS_K330_GPIO_LED_USB1,
121 + .active_low = 1,
122 + }, {
123 + .name = "ns-k330:green:usb2",
124 + .gpio = NS_K330_GPIO_LED_USB2,
125 + .active_low = 1,
126 + }, {
127 + .name = "ns-k330:green:eth",
128 + .gpio = NS_K330_GPIO_LED_ETH_GREEN,
129 + .active_low = 1,
130 + }, {
131 + .name = "ns-k330:orange:eth",
132 + .gpio = NS_K330_GPIO_LED_ETH_ORANGE,
133 + .active_low = 1,
134 + }
135 +};
136 +
137 +static struct gpio_led_platform_data ns_k330_gpio_leds_data = {
138 + .num_leds = ARRAY_SIZE(ns_k330_gpio_leds),
139 + .leds = ns_k330_gpio_leds,
140 +};
141 +
142 +static struct platform_device ns_k330_gpio_leds_device = {
143 + .name = "leds-gpio",
144 + .id = -1,
145 + .dev.platform_data = &ns_k330_gpio_leds_data,
146 +};
147 +
148 +static struct gpio_keys_button ns_k330_gpio_keys[] = {
149 + {
150 + .code = KEY_RESTART,
151 + .gpio = NS_K330_GPIO_BTN_RESET,
152 + .desc = "Reset Button",
153 + .active_low = 1,
154 + },
155 + {
156 + .code = BTN_0,
157 + .gpio = NS_K330_GPIO_BTN_USB1,
158 + .desc = "USB1 Button",
159 + .active_low = 1,
160 + },
161 + {
162 + .code = BTN_1,
163 + .gpio = NS_K330_GPIO_BTN_USB2,
164 + .desc = "USB2 Button",
165 + .active_low = 0,
166 + },
167 +};
168 +
169 +static struct gpio_keys_platform_data ns_k330_gpio_keys_data = {
170 + .buttons = ns_k330_gpio_keys,
171 + .nbuttons = ARRAY_SIZE(ns_k330_gpio_keys),
172 +};
173 +
174 +static struct platform_device ns_k330_gpio_keys_device = {
175 + .name = "gpio-keys",
176 + .id = -1,
177 + .num_resources = 0,
178 + .dev = {
179 + .platform_data = &ns_k330_gpio_keys_data,
180 + },
181 +};
182 +
183 +static void __init ns_k330_fixup(struct machine_desc *desc,
184 + struct tag *tags, char **cmdline,
185 + struct meminfo *mi)
186 +{
187 + struct tag *t;
188 +
189 + /* The board has 32MB of RAM mapped at 0. */
190 + mi->nr_banks = 1;
191 + mi->bank[0].start = 0;
192 + mi->bank[0].size = SZ_32M;
193 +
194 + for (t = tags; t->hdr.size; t = tag_next(t)) {
195 + switch (t->hdr.tag) {
196 + case ATAG_CORE:
197 + if (t->u.core.rootdev == 255)
198 + t->u.core.rootdev = 0;
199 + break;
200 + }
201 + }
202 +}
203 +
204 +static void __init ns_k330_init(void)
205 +{
206 + cns21xx_gpio_init();
207 +
208 + HAL_MISC_DISABLE_LED012_PINS();
209 + HAL_MISC_DISABLE_I2C_PINS();
210 + HAL_MISC_DISABLE_I2S_PINS();
211 +
212 + cns21xx_register_uart0();
213 + cns21xx_register_wdt();
214 + cns21xx_register_usb();
215 + cns21xx_register_spi_master(-1, ns_k330_spi_board_info,
216 + ARRAY_SIZE(ns_k330_spi_board_info));
217 +
218 + cns21xx_gec_data.phy_type = CNS21XX_GEC_PHY_TYPE_INTERNAL;
219 + cns21xx_register_gec();
220 +
221 + platform_device_register(&ns_k330_gpio_leds_device);
222 + platform_device_register(&ns_k330_gpio_keys_device);
223 +}
224 +
225 +MACHINE_START(NS_K330, "NS-K330 NAS")
226 + .phys_io = CNS21XX_PHYS_IO,
227 + .io_pg_offst = CNS21XX_IO_PAGE_OFFSET,
228 + .boot_params = 0x100,
229 + .fixup = ns_k330_fixup,
230 + .map_io = cns21xx_map_io,
231 + .init_irq = cns21xx_init_irq,
232 + .timer = &cns21xx_timer,
233 + .init_machine = ns_k330_init,
234 +MACHINE_END
235 --- a/arch/arm/mach-cns21xx/Makefile
236 +++ b/arch/arm/mach-cns21xx/Makefile
237 @@ -12,4 +12,4 @@ obj-$(CONFIG_CNS21XX_DEV_USB) += dev-us
238 obj-$(CONFIG_CNS21XX_DEV_SPI_MASTER) += dev-spi-master.o
239
240 # machine specific files
241 -
242 +obj-$(CONFIG_MACH_NS_K330) += mach-ns-k330.o
This page took 0.05759 seconds and 5 git commands to generate.