Revert r12510. Remove -rpath-link form TARGET_LDFLAGS as it breaks some
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / zyxel.c
1 /*
2 * $Id$
3 *
4 * ZyXEL Prestige P-334/P-335 boards
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 *
13 */
14
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17
18 #include <asm/bootinfo.h>
19 #include <asm/gpio.h>
20
21 #include <adm5120_board.h>
22 #include <adm5120_platform.h>
23 #include <adm5120_irq.h>
24
25 #define P33X_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
26
27 static void switch_bank_gpio5(unsigned bank)
28 {
29 switch (bank) {
30 case 0:
31 gpio_set_value(ADM5120_GPIO_PIN5, 0);
32 break;
33 case 1:
34 gpio_set_value(ADM5120_GPIO_PIN5, 1);
35 break;
36 }
37 }
38
39 static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = {
40 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
41 };
42
43 static struct mtd_partition p33x_partitions[] = {
44 {
45 .name = "bootbase",
46 .offset = 0,
47 .size = 16*1024,
48 .mask_flags = MTD_WRITEABLE,
49 } , {
50 .name = "rom",
51 .offset = MTDPART_OFS_APPEND,
52 .size = 16*1024,
53 } , {
54 .name = "bootext",
55 .offset = MTDPART_OFS_APPEND,
56 .size = 96*1024,
57 .mask_flags = MTD_WRITEABLE,
58 } , {
59 .name = "trx",
60 .offset = MTDPART_OFS_APPEND,
61 .size = MTDPART_SIZ_FULL,
62 } , {
63 .name = "firmware",
64 .offset = 32*1024,
65 .size = MTDPART_SIZ_FULL,
66 }
67 };
68
69 static struct platform_device *p334_devices[] __initdata = {
70 &adm5120_flash0_device,
71 };
72
73 static struct platform_device *p335_devices[] __initdata = {
74 &adm5120_flash0_device,
75 &adm5120_hcd_device,
76 };
77
78 static void __init p33x_setup(void)
79 {
80 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
81 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
82
83 /* setup data for flash0 device */
84 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
85 adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions);
86 adm5120_flash0_data.parts = p33x_partitions;
87
88 adm5120_gpiodev_resource.start &= ~P33X_GPIO_DEV_MASK;
89 /* TODO: setup mac address */
90 }
91
92 unsigned char p33x_vlans[6] __initdata = {
93 /* FIXME: untested */
94 0x50, 0x48, 0x44, 0x42, 0x41, 0x00
95 };
96
97 ADM5120_BOARD_START(P334WT, "ZyXEL Prestige 334WT")
98 .board_setup = p33x_setup,
99 .eth_num_ports = 5,
100 .eth_vlans = p33x_vlans,
101 .num_devices = ARRAY_SIZE(p334_devices),
102 .devices = p334_devices,
103 .pci_nr_irqs = ARRAY_SIZE(p33x_pci_irqs),
104 .pci_irq_map = p33x_pci_irqs,
105 ADM5120_BOARD_END
106
107 ADM5120_BOARD_START(P335, "ZyXEL Prestige 335/335WT")
108 .board_setup = p33x_setup,
109 .eth_num_ports = 5,
110 .eth_vlans = p33x_vlans,
111 .num_devices = ARRAY_SIZE(p335_devices),
112 .devices = p335_devices,
113 .pci_nr_irqs = ARRAY_SIZE(p33x_pci_irqs),
114 .pci_irq_map = p33x_pci_irqs,
115 ADM5120_BOARD_END