Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / arm / mach-orion / wrt350n_v2-setup.c
blob44e187d3124e54bce77b5a8535b8ceb567cdc9ff
1 /*
2 * arch/arm/mach-orion/dns323-setup.c
4 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/pci.h>
17 #include <linux/irq.h>
18 #include <linux/mtd/physmap.h>
19 #include <linux/mv643xx_eth.h>
20 #include <linux/leds.h>
21 #include <linux/gpio_keys.h>
22 #include <linux/input.h>
23 #include <linux/i2c.h>
24 #include <asm/mach-types.h>
25 #include <asm/gpio.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/pci.h>
28 #include <asm/arch/orion.h>
29 #include <asm/arch/platform.h>
30 #include "common.h"
33 /****************************************************************************
34 * Ethernet
37 static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
38 .phy_addr = 0,
41 /****************************************************************************
42 * 8MiB NOR flash
44 * Layout as used by Linksys:
45 * 0x00000000-0x00760000 : "kernel"
46 * 0x001a0000-0x00760000 : "rootfs"
47 * 0x00760000-0x007a0000 : "lang"
48 * 0x007a0000-0x007c0000 : "nvram"
49 * 0x007c0000-0x00800000 : "u-boot"
52 #define WRT350N_V2_NOR_BOOT_BASE 0xf4000000
53 #define WRT350N_V2_NOR_BOOT_SIZE SZ_8M
55 static struct mtd_partition wrt350n_v2_partitions[] = {
57 .name = "kernel",
58 .size = 0x00760000,
59 .offset = 0,
60 }, {
61 .name = "rootfs",
62 .size = 0x005c0000,
63 .offset = 0x001a0000,
64 }, {
65 .name = "lang",
66 .size = 0x00040000,
67 .offset = 0x00760000,
68 }, {
69 .name = "nvram",
70 .size = 0x00020000,
71 .offset = 0x007a0000,
72 }, {
73 .name = "u-boot",
74 .size = 0x00040000,
75 .offset = 0x007c0000,
79 static struct physmap_flash_data wrt350n_v2_nor_flash_data = {
80 .width = 1,
81 .parts = wrt350n_v2_partitions,
82 .nr_parts = ARRAY_SIZE(wrt350n_v2_partitions)
85 static struct resource wrt350n_v2_nor_flash_resource = {
86 .flags = IORESOURCE_MEM,
87 .start = WRT350N_V2_NOR_BOOT_BASE,
88 .end = WRT350N_V2_NOR_BOOT_BASE + WRT350N_V2_NOR_BOOT_SIZE - 1,
91 static struct platform_device wrt350n_v2_nor_flash = {
92 .name = "physmap-flash",
93 .id = 0,
94 .dev = { .platform_data = &wrt350n_v2_nor_flash_data, },
95 .resource = &wrt350n_v2_nor_flash_resource,
96 .num_resources = 1,
101 /**************************************************************************
102 * General Setup
105 static struct platform_device *wrt350n_v2_plat_devices[] __initdata = {
106 &wrt350n_v2_nor_flash,
109 static void __init wrt350n_v2_init(void)
111 /* Setup basic Orion functions. Need to be called early. */
112 orion_init();
114 /* setup flash mapping
116 orion_setup_cpu_win(ORION_DEV_BOOT, WRT350N_V2_NOR_BOOT_BASE,
117 WRT350N_V2_NOR_BOOT_SIZE, -1);
120 /* set MPP as Linksys's kernel did */
121 orion_write(MPP_0_7_CTRL, 0x00000003);
122 orion_write(MPP_8_15_CTRL, 0x00000101);
123 orion_write(MPP_16_19_CTRL, 0);
124 orion_write(MPP_DEV_CTRL, 0);
126 /* register flash and other platform devices */
127 platform_add_devices(wrt350n_v2_plat_devices,
128 ARRAY_SIZE(wrt350n_v2_plat_devices));
129 orion_eth_init(&wrt350n_v2_eth_data);
133 MACHINE_START(WRT350N_V2, "Linksys WRT350N v2")
134 /* Maintainer: No-one yet*/
135 .phys_io = ORION_REGS_PHYS_BASE,
136 .io_pg_offst = ((ORION_REGS_VIRT_BASE) >> 18) & 0xFFFC,
137 .boot_params = 0x00000100,
138 .init_machine = wrt350n_v2_init,
139 .map_io = orion_map_io,
140 .init_irq = orion_init_irq,
141 .timer = &orion_timer,
142 MACHINE_END