4 * ZyXEL Prestige P-334/P-335 boards
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
26 #include <linux/kernel.h>
27 #include <linux/init.h>
29 #include <asm/bootinfo.h>
32 #include <adm5120_board.h>
33 #include <adm5120_platform.h>
34 #include <adm5120_irq.h>
36 static void switch_bank_gpio5(unsigned bank
)
40 gpio_set_value(ADM5120_GPIO_PIN5
, 0);
43 gpio_set_value(ADM5120_GPIO_PIN5
, 1);
48 static struct adm5120_pci_irq p33x_pci_irqs
[] __initdata
= {
49 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0
),
52 static struct mtd_partition p33x_partitions
[] = {
57 .mask_flags
= MTD_WRITEABLE
,
60 .offset
= MTDPART_OFS_APPEND
,
64 .offset
= MTDPART_OFS_APPEND
,
66 .mask_flags
= MTD_WRITEABLE
,
69 .offset
= MTDPART_OFS_APPEND
,
70 .size
= MTDPART_SIZ_FULL
,
74 .size
= MTDPART_SIZ_FULL
,
78 static struct platform_device
*p334_devices
[] __initdata
= {
79 &adm5120_flash0_device
,
82 static struct platform_device
*p335_devices
[] __initdata
= {
83 &adm5120_flash0_device
,
87 static void __init
p33x_setup(void)
89 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
90 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
92 /* setup data for flash0 device */
93 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
94 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(p33x_partitions
);
95 adm5120_flash0_data
.parts
= p33x_partitions
;
97 /* TODO: setup mac address */
100 unsigned char p33x_vlans
[6] __initdata
= {
101 /* FIXME: untested */
102 0x50, 0x48, 0x44, 0x42, 0x41, 0x00
105 static struct adm5120_board p334wt_board __initdata
= {
106 .mach_type
= MACH_ADM5120_P334WT
,
107 .name
= "ZyXEL Prestige 334WT",
108 .board_setup
= p33x_setup
,
110 .eth_vlans
= p33x_vlans
,
111 .num_devices
= ARRAY_SIZE(p334_devices
),
112 .devices
= p334_devices
,
113 .pci_nr_irqs
= ARRAY_SIZE(p33x_pci_irqs
),
114 .pci_irq_map
= p33x_pci_irqs
,
117 static struct adm5120_board p335_board __initdata
= {
118 .mach_type
= MACH_ADM5120_P335
,
119 .name
= "ZyXEL Prestige 335/335WT",
120 .board_setup
= p33x_setup
,
122 .eth_vlans
= p33x_vlans
,
123 .num_devices
= ARRAY_SIZE(p335_devices
),
124 .devices
= p335_devices
,
125 .pci_nr_irqs
= ARRAY_SIZE(p33x_pci_irqs
),
126 .pci_irq_map
= p33x_pci_irqs
,
129 static int __init
register_boards(void)
131 adm5120_board_register(&p334wt_board
);
132 adm5120_board_register(&p335_board
);
136 pure_initcall(register_boards
);