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