984bab7b851e68d79c069ad02b5be4fa6b8f357b
[openwrt/openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-wcr150gn.c
1 /*
2 * Sparklan WCR-150GN board support
3 *
4 * Copyright (C) 2010 Roman Yeryomin <roman@advem.lv>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16
17 #include <asm/mach-ralink/machine.h>
18 #include <asm/mach-ralink/dev-gpio-buttons.h>
19 #include <asm/mach-ralink/dev-gpio-leds.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
22
23 #include "devices.h"
24
25 #ifdef CONFIG_MTD_PARTITIONS
26 static struct mtd_partition wcr150gn_partitions[] = {
27 {
28 .name = "bootloader",
29 .offset = 0,
30 .size = 0x030000,
31 .mask_flags = MTD_WRITEABLE,
32 }, {
33 .name = "config",
34 .offset = 0x030000,
35 .size = 0x040000,
36 }, {
37 .name = "factory",
38 .offset = 0x040000,
39 .size = 0x050000,
40 }, {
41 .name = "kernel",
42 .offset = 0x050000,
43 .size = 0x120000,
44 }, {
45 .name = "rootfs",
46 .offset = 0x120000,
47 .size = 0x400000,
48 }
49 };
50 #endif /* CONFIG_MTD_PARTITIONS */
51
52 static struct physmap_flash_data wcr150gn_flash_data = {
53 #ifdef CONFIG_MTD_PARTITIONS
54 .nr_parts = ARRAY_SIZE(wcr150gn_partitions),
55 .parts = wcr150gn_partitions,
56 #endif
57 };
58
59 static void __init wcr150gn_init(void)
60 {
61 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
62 rt305x_register_flash(0, &wcr150gn_flash_data);
63 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
64 rt305x_register_ethernet();
65 rt305x_register_wifi();
66 rt305x_register_wdt();
67 }
68
69 MIPS_MACHINE(RAMIPS_MACH_WCR150GN, "WCR150GN", "Sparklan WCR-150GN",
70 wcr150gn_init);