Root/target/linux/adm5120/files/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#define P33X_GPIO_DEV_MASK (1 << P33X_GPIO_FLASH_A20)
18
19static struct mtd_partition p33x_partitions[] = {
20    {
21        .name = "bootbase",
22        .offset = 0,
23        .size = 16*1024,
24        .mask_flags = MTD_WRITEABLE,
25    } , {
26        .name = "rom",
27        .offset = MTDPART_OFS_APPEND,
28        .size = 16*1024,
29        .mask_flags = MTD_WRITEABLE,
30    } , {
31        .name = "bootext1",
32        .offset = MTDPART_OFS_APPEND,
33        .size = 32*1024,
34    } , {
35        .name = "bootext2",
36        .offset = MTDPART_OFS_APPEND,
37        .size = 64*1024,
38    } , {
39        .name = "trx",
40        .offset = MTDPART_OFS_APPEND,
41        .size = MTDPART_SIZ_FULL,
42    } , {
43        .name = "firmware",
44        .offset = 32*1024,
45        .size = MTDPART_SIZ_FULL,
46    }
47};
48
49static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = {
50    PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
51};
52
53static u8 p33x_vlans[6] __initdata = {
54    /* FIXME: untested */
55    0x50, 0x48, 0x44, 0x42, 0x41, 0x00
56};
57
58static void switch_bank_gpio5(unsigned bank)
59{
60    switch (bank) {
61    case 0:
62        gpio_set_value(P33X_GPIO_FLASH_A20, 0);
63        break;
64    case 1:
65        gpio_set_value(P33X_GPIO_FLASH_A20, 1);
66        break;
67    }
68}
69
70void __init p33x_generic_setup(void)
71{
72    /* setup data for flash0 device */
73    gpio_request(P33X_GPIO_FLASH_A20, NULL); /* for flash A20 line */
74    gpio_direction_output(P33X_GPIO_FLASH_A20, 0);
75    adm5120_flash0_data.switch_bank = switch_bank_gpio5;
76    adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions);
77    adm5120_flash0_data.parts = p33x_partitions;
78    adm5120_add_device_flash(0);
79
80    adm5120_add_device_uart(0);
81    adm5120_add_device_uart(1);
82
83    adm5120_add_device_gpio(P33X_GPIO_DEV_MASK);
84
85    adm5120_setup_eth_macs(bootbase_info.mac);
86    adm5120_add_device_switch(6, p33x_vlans);
87
88    adm5120_pci_set_irq_map(ARRAY_SIZE(p33x_pci_irqs), p33x_pci_irqs);
89}
90

Archive Download this file



interactive