brcm2708: fix renamed definition (FS#2265)
[openwrt/openwrt.git] / target / linux / adm5120 / files-3.18 / arch / mips / adm5120 / zyxel / p-33x.c
1 /*
2 * ZyXEL Prestige P-33x boards support
3 *
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 */
11
12 #include "p-33x.h"
13
14 #include <prom/zynos.h>
15
16 #define P33X_GPIO_FLASH_A20 ADM5120_GPIO_PIN5
17 static struct mtd_partition p33x_partitions[] = {
18 {
19 .name = "bootbase",
20 .offset = 0,
21 .size = 16*1024,
22 .mask_flags = MTD_WRITEABLE,
23 } , {
24 .name = "rom",
25 .offset = MTDPART_OFS_APPEND,
26 .size = 16*1024,
27 .mask_flags = MTD_WRITEABLE,
28 } , {
29 .name = "bootext1",
30 .offset = MTDPART_OFS_APPEND,
31 .size = 32*1024,
32 } , {
33 .name = "bootext2",
34 .offset = MTDPART_OFS_APPEND,
35 .size = 64*1024,
36 } , {
37 .name = "trx",
38 .offset = MTDPART_OFS_APPEND,
39 .size = MTDPART_SIZ_FULL,
40 } , {
41 .name = "firmware",
42 .offset = 32*1024,
43 .size = MTDPART_SIZ_FULL,
44 }
45 };
46
47 static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = {
48 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
49 };
50
51 static u8 p33x_vlans[6] __initdata = {
52 /* FIXME: untested */
53 0x50, 0x48, 0x44, 0x42, 0x41, 0x00
54 };
55
56 static void switch_bank_gpio5(unsigned bank)
57 {
58 switch (bank) {
59 case 0:
60 gpio_set_value(P33X_GPIO_FLASH_A20, 0);
61 break;
62 case 1:
63 gpio_set_value(P33X_GPIO_FLASH_A20, 1);
64 break;
65 }
66 }
67
68 void __init p33x_generic_setup(void)
69 {
70 /* setup data for flash0 device */
71 gpio_request(P33X_GPIO_FLASH_A20, NULL); /* for flash A20 line */
72 gpio_direction_output(P33X_GPIO_FLASH_A20, 0);
73 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
74 adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions);
75 adm5120_flash0_data.parts = p33x_partitions;
76 adm5120_add_device_flash(0);
77
78 adm5120_add_device_uart(0);
79 adm5120_add_device_uart(1);
80
81 adm5120_setup_eth_macs(bootbase_info.mac);
82 adm5120_add_device_switch(6, p33x_vlans);
83
84 adm5120_pci_set_irq_map(ARRAY_SIZE(p33x_pci_irqs), p33x_pci_irqs);
85 }