1 --- a/arch/arm/mach-cns21xx/Kconfig
2 +++ b/arch/arm/mach-cns21xx/Kconfig
6 menu "Cavium Networks CNS21xx based machines"
10 + select CNS21XX_DEV_GEC
11 + select CNS21XX_DEV_SPI_MASTER
12 + select CNS21XX_DEV_USB
14 + Say Y here if you intend to run this kernel on the
19 config CNS21XX_DEV_GEC
21 +++ b/arch/arm/mach-cns21xx/mach-ns-k330.c
24 + * NS-K330 NAS board support
26 + * Copyright (c) 2010 Gabor Juhos <juhosg@openwrt.org>
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.
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>
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>
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
63 +#define NS_K330_GPIO_BTN_RESET 13
64 +#define NS_K330_GPIO_BTN_USB1 14
65 +#define NS_K330_GPIO_BTN_USB2 15
67 +static struct mtd_partition ns_k330_partitions[] = {
72 + .mask_flags = MTD_WRITEABLE,
77 + .mask_flags = MTD_WRITEABLE,
93 +static struct flash_platform_data ns_k330_flash_data = {
94 + .parts = ns_k330_partitions,
95 + .nr_parts = ARRAY_SIZE(ns_k330_partitions),
98 +static struct spi_board_info ns_k330_spi_board_info[] = {
102 + .max_speed_hz = 25000000,
103 + .modalias = "m25p80",
104 + .platform_data = &ns_k330_flash_data,
108 +static struct gpio_led ns_k330_gpio_leds[] = {
110 + .name = "ns-k330:red:link",
111 + .gpio = NS_K330_GPIO_LED_LINK,
114 + .name = "ns-k330:green:usb1",
115 + .gpio = NS_K330_GPIO_LED_USB1,
118 + .name = "ns-k330:green:usb2",
119 + .gpio = NS_K330_GPIO_LED_USB2,
122 + .name = "ns-k330:green:eth",
123 + .gpio = NS_K330_GPIO_LED_ETH_GREEN,
126 + .name = "ns-k330:orange:eth",
127 + .gpio = NS_K330_GPIO_LED_ETH_ORANGE,
132 +static struct gpio_led_platform_data ns_k330_gpio_leds_data = {
133 + .num_leds = ARRAY_SIZE(ns_k330_gpio_leds),
134 + .leds = ns_k330_gpio_leds,
137 +static struct platform_device ns_k330_gpio_leds_device = {
138 + .name = "leds-gpio",
140 + .dev.platform_data = &ns_k330_gpio_leds_data,
143 +static struct gpio_keys_button ns_k330_gpio_keys[] = {
145 + .code = KEY_RESTART,
146 + .gpio = NS_K330_GPIO_BTN_RESET,
147 + .desc = "Reset Button",
152 + .gpio = NS_K330_GPIO_BTN_USB1,
153 + .desc = "USB1 Button",
158 + .gpio = NS_K330_GPIO_BTN_USB2,
159 + .desc = "USB2 Button",
164 +static struct gpio_keys_platform_data ns_k330_gpio_keys_data = {
165 + .buttons = ns_k330_gpio_keys,
166 + .nbuttons = ARRAY_SIZE(ns_k330_gpio_keys),
169 +static struct platform_device ns_k330_gpio_keys_device = {
170 + .name = "gpio-keys",
172 + .num_resources = 0,
174 + .platform_data = &ns_k330_gpio_keys_data,
178 +static void __init ns_k330_fixup(struct tag *tags, char **cmdline,
179 + struct meminfo *mi)
183 + /* The board has 32MB of RAM mapped at 0. */
185 + mi->bank[0].start = 0;
186 + mi->bank[0].size = SZ_32M;
188 + for (t = tags; t->hdr.size; t = tag_next(t)) {
189 + switch (t->hdr.tag) {
191 + if (t->u.core.rootdev == 255)
192 + t->u.core.rootdev = 0;
198 +static void __init ns_k330_init(void)
200 + cns21xx_gpio_init();
202 + HAL_MISC_DISABLE_LED012_PINS();
203 + HAL_MISC_DISABLE_I2C_PINS();
204 + HAL_MISC_DISABLE_I2S_PINS();
206 + cns21xx_register_uart0();
207 + cns21xx_register_wdt();
208 + cns21xx_register_usb();
209 + cns21xx_register_spi_master(-1, ns_k330_spi_board_info,
210 + ARRAY_SIZE(ns_k330_spi_board_info));
212 + cns21xx_gec_data.phy_type = CNS21XX_GEC_PHY_TYPE_INTERNAL;
213 + cns21xx_register_gec();
215 + platform_device_register(&ns_k330_gpio_leds_device);
216 + platform_device_register(&ns_k330_gpio_keys_device);
219 +MACHINE_START(NS_K330, "NS-K330 NAS")
220 + .fixup = ns_k330_fixup,
221 + .map_io = cns21xx_map_io,
222 + .init_irq = cns21xx_init_irq,
223 + .timer = &cns21xx_timer,
224 + .init_machine = ns_k330_init,
226 --- a/arch/arm/mach-cns21xx/Makefile
227 +++ b/arch/arm/mach-cns21xx/Makefile
228 @@ -12,4 +12,4 @@ obj-$(CONFIG_CNS21XX_DEV_USB) += dev-us
229 obj-$(CONFIG_CNS21XX_DEV_SPI_MASTER) += dev-spi-master.o
231 # machine specific files
233 +obj-$(CONFIG_MACH_NS_K330) += mach-ns-k330.o