ramips: implement clock API for RT288x
[openwrt/svn-archive/archive.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
17 #include <asm/mach-ralink/machine.h>
18 #include <asm/mach-ralink/rt288x.h>
19 #include <asm/mach-ralink/rt288x_regs.h>
20
21 #include "devices.h"
22
23 /*
24 * MTD layout from stock firmware:
25 * mtd0: 00030000 00010000 "uboot"
26 * mtd1: 00010000 00010000 "uboot_environ"
27 * mtd2: 00010000 00010000 "factory_default"
28 * mtd3: 000b0000 00010000 "linux"
29 * mtd4: 002f0000 00010000 "rootfs"
30 * mtd5: 00010000 00010000 "user_property"
31 */
32
33 #ifdef CONFIG_MTD_PARTITIONS
34 static struct mtd_partition wzr_agl300nh_partitions[] = {
35 {
36 .name = "uboot",
37 .offset = 0,
38 .size = 0x030000,
39 .mask_flags = MTD_WRITEABLE,
40 }, {
41 .name = "uboot_environ",
42 .offset = 0x030000,
43 .size = 0x010000,
44 .mask_flags = MTD_WRITEABLE,
45 }, {
46 .name = "factory_default",
47 .offset = 0x040000,
48 .size = 0x010000,
49 .mask_flags = MTD_WRITEABLE,
50 }, {
51 .name = "linux",
52 .offset = 0x050000,
53 .size = 0x0b0000,
54 }, {
55 .name = "rootfs",
56 .offset = 0x100000,
57 .size = 0x2f0000,
58 }, {
59 .name = "user_property",
60 .offset = 0x3f0000,
61 .size = 0x010000,
62 }
63 };
64 #endif /* CONFIG_MTD_PARTITIONS */
65
66 static struct physmap_flash_data wzr_agl300nh_flash_data = {
67 #ifdef CONFIG_MTD_PARTITIONS
68 .nr_parts = ARRAY_SIZE(wzr_agl300nh_partitions),
69 .parts = wzr_agl300nh_partitions,
70 #endif
71 };
72
73 static void __init wzr_agl300nh_init(void)
74 {
75 rt288x_gpio_init(RT2880_GPIO_MODE_UART0);
76
77 rt288x_register_flash(0, &wzr_agl300nh_flash_data);
78 rt288x_register_wifi();
79 }
80
81 MIPS_MACHINE(RAMIPS_MACH_WZR_AGL300NH, "WZR-AGL300NH",
82 "Buffalo WZR-AGL300NH", wzr_agl300nh_init);