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 +#ifdef CONFIG_MTD_PARTITIONS
68 +static struct mtd_partition ns_k330_partitions[] = {
73 + .mask_flags = MTD_WRITEABLE,
78 + .mask_flags = MTD_WRITEABLE,
94 +#define ns_k330_partitions NULL
95 +#define ns_k330_num_partitions 0
96 +#endif /* CONFIG_MTD_PARTITIONS */
98 +static struct flash_platform_data ns_k330_flash_data = {
99 + .parts = ns_k330_partitions,
100 + .nr_parts = ARRAY_SIZE(ns_k330_partitions),
103 +static struct spi_board_info ns_k330_spi_board_info[] = {
107 + .max_speed_hz = 25000000,
108 + .modalias = "m25p80",
109 + .platform_data = &ns_k330_flash_data,
113 +static struct gpio_led ns_k330_gpio_leds[] = {
115 + .name = "ns-k330:red:link",
116 + .gpio = NS_K330_GPIO_LED_LINK,
119 + .name = "ns-k330:green:usb1",
120 + .gpio = NS_K330_GPIO_LED_USB1,
123 + .name = "ns-k330:green:usb2",
124 + .gpio = NS_K330_GPIO_LED_USB2,
127 + .name = "ns-k330:green:eth",
128 + .gpio = NS_K330_GPIO_LED_ETH_GREEN,
131 + .name = "ns-k330:orange:eth",
132 + .gpio = NS_K330_GPIO_LED_ETH_ORANGE,
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,
142 +static struct platform_device ns_k330_gpio_leds_device = {
143 + .name = "leds-gpio",
145 + .dev.platform_data = &ns_k330_gpio_leds_data,
148 +static struct gpio_keys_button ns_k330_gpio_keys[] = {
150 + .code = KEY_RESTART,
151 + .gpio = NS_K330_GPIO_BTN_RESET,
152 + .desc = "Reset Button",
157 + .gpio = NS_K330_GPIO_BTN_USB1,
158 + .desc = "USB1 Button",
163 + .gpio = NS_K330_GPIO_BTN_USB2,
164 + .desc = "USB2 Button",
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),
174 +static struct platform_device ns_k330_gpio_keys_device = {
175 + .name = "gpio-keys",
177 + .num_resources = 0,
179 + .platform_data = &ns_k330_gpio_keys_data,
183 +static void __init ns_k330_fixup(struct machine_desc *desc,
184 + struct tag *tags, char **cmdline,
185 + struct meminfo *mi)
189 + /* The board has 32MB of RAM mapped at 0. */
191 + mi->bank[0].start = 0;
192 + mi->bank[0].size = SZ_32M;
194 + for (t = tags; t->hdr.size; t = tag_next(t)) {
195 + switch (t->hdr.tag) {
197 + if (t->u.core.rootdev == 255)
198 + t->u.core.rootdev = 0;
204 +static void __init ns_k330_init(void)
206 + cns21xx_gpio_init();
208 + HAL_MISC_DISABLE_LED012_PINS();
209 + HAL_MISC_DISABLE_I2C_PINS();
210 + HAL_MISC_DISABLE_I2S_PINS();
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));
218 + cns21xx_gec_data.phy_type = CNS21XX_GEC_PHY_TYPE_INTERNAL;
219 + cns21xx_register_gec();
221 + platform_device_register(&ns_k330_gpio_leds_device);
222 + platform_device_register(&ns_k330_gpio_keys_device);
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,
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
240 # machine specific files
242 +obj-$(CONFIG_MACH_NS_K330) += mach-ns-k330.o