add initial support for the WZR-AGL300NH - patch by Joonas Lahtinen <joonas.lahtinen...
[openwrt/openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt288x / mach-wzr-agl300nh.c
1 /*
2 * Buffalo WZR-AGL300NH board support
3 *
4 * Copyright (C) 2010 Joonas Lahtinen <joonas.lahtinen@gmail.com>
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 #include <linux/leds.h>
17
18 #include <asm/mips_machine.h>
19 #include <asm/mach-ralink/machine.h>
20 #include <asm/mach-ralink/dev_gpio_leds.h>
21 #include <asm/mach-ralink/rt288x.h>
22 #include <asm/mach-ralink/rt288x_regs.h>
23
24 #include "devices.h"
25
26 #if 0
27 #define WZR_AGL300NH_GPIO_LED_POWER XX
28 #define WZR_AGL300NH_GPIO_BUTTON_AOSS XX
29 #define WZR_AGL300NH_GPIO_BUTTON_RESET XX
30 #endif // 0
31
32 #ifdef CONFIG_MTD_PARTITIONS
33
34 /*
35 From stock firmware:
36 mtd0: 00030000 00010000 "uboot"
37 mtd1: 00010000 00010000 "uboot_environ"
38 mtd2: 00010000 00010000 "factory_default"
39 mtd3: 000b0000 00010000 "linux"
40 mtd4: 002f0000 00010000 "rootfs"
41 mtd5: 00010000 00010000 "user_property"
42 */
43
44 static struct mtd_partition wzr_agl300nh_partitions[] = {
45 {
46 .name = "uboot",
47 .offset = 0,
48 .size = 0x030000,
49 .mask_flags = MTD_WRITEABLE,
50 }, {
51 .name = "uboot_environ",
52 .offset = 0x030000,
53 .size = 0x010000,
54 .mask_flags = MTD_WRITEABLE,
55 }, {
56 .name = "factory_default",
57 .offset = 0x040000,
58 .size = 0x010000,
59 .mask_flags = MTD_WRITEABLE,
60 }, {
61 .name = "linux",
62 .offset = 0x050000,
63 .size = 0x0b0000,
64 }, {
65 .name = "rootfs",
66 .offset = 0x100000,
67 .size = 0x2f0000,
68 }, {
69 .name = "user_property",
70 .offset = 0x3f0000,
71 .size = 0x010000,
72 }
73 };
74 #endif /* CONFIG_MTD_PARTITIONS */
75
76 static struct physmap_flash_data wzr_agl300nh_flash_data = {
77 #ifdef CONFIG_MTD_PARTITIONS
78 .nr_parts = ARRAY_SIZE(wzr_agl300nh_partitions),
79 .parts = wzr_agl300nh_partitions,
80 #endif
81 };
82
83 #if 0
84 static struct gpio_led wzr_agl300nh_leds_gpio[] __initdata = {
85 {
86 .name = "wzr-agl300nh:green:power",
87 .gpio = WZR_AGL300NH_GPIO_LED_POWER,
88 .active_low = ??,
89 }
90 };
91 #endif
92
93 static void __init wzr_agl300nh_init(void)
94 {
95 rt288x_gpio_init(RT2880_GPIO_MODE_UART0);
96
97 rt288x_register_flash(0, &wzr_agl300nh_flash_data);
98
99 /*
100 ramips_register_gpio_leds(-1, ARRAY_SIZE(wzr_agl300nh_leds_gpio),
101 wzr_agl300nh_leds_gpio);
102 */
103 }
104
105 MIPS_MACHINE(RAMIPS_MACH_WZR_AGL300NH, "Buffalo WZR-AGL300NH", wzr_agl300nh_init);