c38e40a591144328006a59568aca3029ef6b8fe7
[openwrt-10.03/.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-wnr2000.c
1 /*
2  *  NETGEAR WNR2000 board support
3  *
4  *  Copyright (C) 2008-2009 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/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17
18 #include <asm/mips_machine.h>
19
20 #include <asm/mach-ar71xx/ar71xx.h>
21
22 #include "devices.h"
23
24 #ifdef CONFIG_MTD_PARTITIONS
25 static struct mtd_partition wnr2000_partitions[] = {
26         {
27                 .name           = "u-boot",
28                 .offset         = 0,
29                 .size           = 0x040000,
30                 .mask_flags     = MTD_WRITEABLE,
31         } , {
32                 .name           = "u-boot-env",
33                 .offset         = 0x040000,
34                 .size           = 0x010000,
35         } , {
36                 .name           = "rootfs",
37                 .offset         = 0x050000,
38                 .size           = 0x240000,
39         } , {
40                 .name           = "user-config",
41                 .offset         = 0x290000,
42                 .size           = 0x010000,
43         } , {
44                 .name           = "uImage",
45                 .offset         = 0x2a0000,
46                 .size           = 0x120000,
47         } , {
48                 .name           = "language_table",
49                 .offset         = 0x3c0000,
50                 .size           = 0x020000,
51         } , {
52                 .name           = "rootfs_checksum",
53                 .offset         = 0x3e0000,
54                 .size           = 0x010000,
55         } , {
56                 .name           = "art",
57                 .offset         = 0x3f0000,
58                 .size           = 0x010000,
59                 .mask_flags     = MTD_WRITEABLE,
60         }
61 };
62 #endif /* CONFIG_MTD_PARTITIONS */
63
64 static struct flash_platform_data wnr2000_flash_data = {
65 #ifdef CONFIG_MTD_PARTITIONS
66         .parts          = wnr2000_partitions,
67         .nr_parts       = ARRAY_SIZE(wnr2000_partitions),
68 #endif
69 };
70
71 static struct spi_board_info wnr2000_spi_info[] = {
72         {
73                 .bus_num        = 0,
74                 .chip_select    = 0,
75                 .max_speed_hz   = 25000000,
76                 .modalias       = "m25p80",
77                 .platform_data  = &wnr2000_flash_data,
78         }
79 };
80
81 static void __init wnr2000_setup(void)
82 {
83         ar71xx_add_device_spi(NULL, wnr2000_spi_info,
84                                         ARRAY_SIZE(wnr2000_spi_info));
85
86         ar91xx_add_device_wmac();
87 }
88
89 MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup);