[ramips] initial support for RT288x/RT305x
[openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt288x / mach-generic.c
1 /*
2  *  Generic RT288x machine setup
3  *
4  *  Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
5  *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6  *
7  *  This program is free software; you can redistribute it and/or modify it
8  *  under the terms of the GNU General Public License version 2 as published
9  *  by the Free Software Foundation.
10  */
11
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17
18 #include <asm/mips_machine.h>
19 #include <asm/mach-ralink/rt288x.h>
20 #include <asm/mach-ralink/platform.h>
21
22 #ifdef CONFIG_MTD_PARTITIONS
23 static struct mtd_partition generic_partitions[] = {
24         {
25                 .name   = "u-boot",
26                 .offset = 0,
27                 .size   = 0x030000,
28                 .mask_flags = MTD_WRITEABLE,
29         }, {
30                 .name   = "config",
31                 .offset = 0x030000,
32                 .size   = 0x010000,
33                 .mask_flags = MTD_WRITEABLE,
34         }, {
35                 .name   = "defconfig",
36                 .offset = 0x040000,
37                 .size   = 0x010000,
38                 .mask_flags = MTD_WRITEABLE,
39         }, {
40                 .name   = "kernel",
41                 .offset = 0x050000,
42                 .size   = 0x100000,
43         }, {
44                 .name   = "rootfs",
45 //              .offset = MTDPART_OFS_NXTBLK,
46 //              .size   = MTDPART_SIZ_FULL,
47                 .offset = 0x150000,
48                 .size   = 0x2B0000,
49         }
50 };
51 #endif /* CONFIG_MTD_PARTITIONS */
52
53 static struct physmap_flash_data generic_flash_data = {
54 #ifdef CONFIG_MTD_PARTITIONS
55         .nr_parts       = ARRAY_SIZE(generic_partitions),
56         .parts          = generic_partitions,
57 #endif
58 };
59
60 static void __init rt288x_generic_init(void)
61 {
62         rt288x_register_flash(0, &generic_flash_data);
63 }
64
65 MIPS_MACHINE(RT288X_MACH_GENERIC, "Generic RT288x board", rt288x_generic_init);