added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / arch / arm / mach-orion5x / wnr854t-setup.c
blob7ddc22c2bb5480d17455fe533023ddd36d66a58f
1 /*
2 * arch/arm/mach-orion5x/wnr854t-setup.c
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11 #include <linux/platform_device.h>
12 #include <linux/pci.h>
13 #include <linux/irq.h>
14 #include <linux/delay.h>
15 #include <linux/mtd/physmap.h>
16 #include <linux/mv643xx_eth.h>
17 #include <linux/ethtool.h>
18 #include <asm/mach-types.h>
19 #include <asm/gpio.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/pci.h>
22 #include <mach/orion5x.h>
23 #include "common.h"
24 #include "mpp.h"
26 static struct orion5x_mpp_mode wnr854t_mpp_modes[] __initdata = {
27 { 0, MPP_GPIO }, /* Power LED green (0=on) */
28 { 1, MPP_GPIO }, /* Reset Button (0=off) */
29 { 2, MPP_GPIO }, /* Power LED blink (0=off) */
30 { 3, MPP_GPIO }, /* WAN Status LED amber (0=off) */
31 { 4, MPP_GPIO }, /* PCI int */
32 { 5, MPP_GPIO }, /* ??? */
33 { 6, MPP_GPIO }, /* ??? */
34 { 7, MPP_GPIO }, /* ??? */
35 { 8, MPP_UNUSED }, /* ??? */
36 { 9, MPP_GIGE }, /* GE_RXERR */
37 { 10, MPP_UNUSED }, /* ??? */
38 { 11, MPP_UNUSED }, /* ??? */
39 { 12, MPP_GIGE }, /* GE_TXD[4] */
40 { 13, MPP_GIGE }, /* GE_TXD[5] */
41 { 14, MPP_GIGE }, /* GE_TXD[6] */
42 { 15, MPP_GIGE }, /* GE_TXD[7] */
43 { 16, MPP_GIGE }, /* GE_RXD[4] */
44 { 17, MPP_GIGE }, /* GE_RXD[5] */
45 { 18, MPP_GIGE }, /* GE_RXD[6] */
46 { 19, MPP_GIGE }, /* GE_RXD[7] */
47 { -1 },
51 * 8M NOR flash Device bus boot chip select
53 #define WNR854T_NOR_BOOT_BASE 0xf4000000
54 #define WNR854T_NOR_BOOT_SIZE SZ_8M
56 static struct mtd_partition wnr854t_nor_flash_partitions[] = {
58 .name = "kernel",
59 .offset = 0x00000000,
60 .size = 0x00100000,
61 }, {
62 .name = "rootfs",
63 .offset = 0x00100000,
64 .size = 0x00660000,
65 }, {
66 .name = "uboot",
67 .offset = 0x00760000,
68 .size = 0x00040000,
72 static struct physmap_flash_data wnr854t_nor_flash_data = {
73 .width = 2,
74 .parts = wnr854t_nor_flash_partitions,
75 .nr_parts = ARRAY_SIZE(wnr854t_nor_flash_partitions),
78 static struct resource wnr854t_nor_flash_resource = {
79 .flags = IORESOURCE_MEM,
80 .start = WNR854T_NOR_BOOT_BASE,
81 .end = WNR854T_NOR_BOOT_BASE + WNR854T_NOR_BOOT_SIZE - 1,
84 static struct platform_device wnr854t_nor_flash = {
85 .name = "physmap-flash",
86 .id = 0,
87 .dev = {
88 .platform_data = &wnr854t_nor_flash_data,
90 .num_resources = 1,
91 .resource = &wnr854t_nor_flash_resource,
94 static struct mv643xx_eth_platform_data wnr854t_eth_data = {
95 .phy_addr = MV643XX_ETH_PHY_NONE,
96 .speed = SPEED_1000,
97 .duplex = DUPLEX_FULL,
100 static void __init wnr854t_init(void)
103 * Setup basic Orion functions. Need to be called early.
105 orion5x_init();
107 orion5x_mpp_conf(wnr854t_mpp_modes);
110 * Configure peripherals.
112 orion5x_eth_init(&wnr854t_eth_data);
113 orion5x_uart0_init();
115 orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE,
116 WNR854T_NOR_BOOT_SIZE);
117 platform_device_register(&wnr854t_nor_flash);
120 static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
122 int irq;
125 * Check for devices with hard-wired IRQs.
127 irq = orion5x_pci_map_irq(dev, slot, pin);
128 if (irq != -1)
129 return irq;
132 * Mini-PCI slot.
134 if (slot == 7)
135 return gpio_to_irq(4);
137 return -1;
140 static struct hw_pci wnr854t_pci __initdata = {
141 .nr_controllers = 2,
142 .swizzle = pci_std_swizzle,
143 .setup = orion5x_pci_sys_setup,
144 .scan = orion5x_pci_sys_scan_bus,
145 .map_irq = wnr854t_pci_map_irq,
148 static int __init wnr854t_pci_init(void)
150 if (machine_is_wnr854t())
151 pci_common_init(&wnr854t_pci);
153 return 0;
155 subsys_initcall(wnr854t_pci_init);
157 MACHINE_START(WNR854T, "Netgear WNR854T")
158 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
159 .phys_io = ORION5X_REGS_PHYS_BASE,
160 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
161 .boot_params = 0x00000100,
162 .init_machine = wnr854t_init,
163 .map_io = orion5x_map_io,
164 .init_irq = orion5x_init_irq,
165 .timer = &orion5x_timer,
166 .fixup = tag_fixup_mem32,
167 MACHINE_END