6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007,2008 Gabor Juhos <juhosg at openwrt.org>
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.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
18 #include <asm/bootinfo.h>
21 #include <adm5120_defs.h>
22 #include <adm5120_irq.h>
23 #include <adm5120_board.h>
24 #include <adm5120_platform.h>
25 #include <adm5120_info.h>
27 #define EASY_PQFP_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN3)
28 #define EASY_BGA_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
30 static void switch_bank_gpio3(unsigned bank)
34 gpio_set_value(ADM5120_GPIO_PIN3, 0);
37 gpio_set_value(ADM5120_GPIO_PIN3, 1);
42 static void switch_bank_gpio5(unsigned bank)
46 gpio_set_value(ADM5120_GPIO_PIN5, 0);
49 gpio_set_value(ADM5120_GPIO_PIN5, 1);
54 static struct mtd_partition easy_partitions[] = {
59 .mask_flags = MTD_WRITEABLE,
62 .offset = MTDPART_OFS_APPEND,
66 .offset = MTDPART_OFS_APPEND,
67 .size = MTDPART_SIZ_FULL,
71 static struct adm5120_pci_irq easy5120rt_pci_irqs[] __initdata = {
72 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
75 static struct platform_device *easy5120pata_devices[] __initdata = {
76 &adm5120_flash0_device,
77 /* TODO: add VINETIC2 device? */
80 static struct platform_device *easy5120rt_devices[] __initdata = {
81 &adm5120_flash0_device,
85 static struct platform_device *easy5120wvoip_devices[] __initdata = {
86 &adm5120_flash0_device,
87 /* TODO: add VINETIC2 device? */
90 static struct platform_device *easy83000_devices[] __initdata = {
91 &adm5120_flash0_device,
92 /* TODO: add VINAX device? */
95 static void __init easy_setup_pqfp(void)
97 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for flash A20 line */
98 gpio_direction_output(ADM5120_GPIO_PIN3, 0);
100 /* setup data for flash0 device */
101 adm5120_flash0_data.switch_bank = switch_bank_gpio3;
102 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
103 adm5120_flash0_data.parts = easy_partitions;
105 adm5120_gpiodev_resource.start &= ~EASY_PQFP_GPIO_DEV_MASK;
107 /* TODO: setup mac addresses */
110 static void __init easy_setup_bga(void)
112 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
113 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
115 /* setup data for flash0 device */
116 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
117 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
118 adm5120_flash0_data.parts = easy_partitions;
120 adm5120_gpiodev_resource.start &= ~EASY_BGA_GPIO_DEV_MASK;
122 /* TODO: setup mac addresses */
125 unsigned char easy5120rt_vlans[6] = {
126 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
129 /*--------------------------------------------------------------------------*/
131 ADM5120_BOARD_START(EASY5120PATA, "Infineon EASY 5120P-ATA Reference Board")
132 .board_setup = easy_setup_pqfp,
134 .num_devices = ARRAY_SIZE(easy5120pata_devices),
135 .devices = easy5120pata_devices,
138 ADM5120_BOARD_START(EASY5120RT, "Infineon EASY 5120-RT Reference Board")
139 .board_setup = easy_setup_bga,
141 .eth_vlans = easy5120rt_vlans,
142 .num_devices = ARRAY_SIZE(easy5120rt_devices),
143 .devices = easy5120rt_devices,
144 .pci_nr_irqs = ARRAY_SIZE(easy5120rt_pci_irqs),
145 .pci_irq_map = easy5120rt_pci_irqs,
148 ADM5120_BOARD_START(EASY5120WVOIP, "Infineon EASY 5120-WVoIP Reference Board")
149 .board_setup = easy_setup_bga,
151 .num_devices = ARRAY_SIZE(easy5120wvoip_devices),
152 .devices = easy5120wvoip_devices,
155 ADM5120_BOARD_START(EASY83000, "Infineon EASY 83000 Reference Board")
156 .board_setup = easy_setup_pqfp,
158 .num_devices = ARRAY_SIZE(easy83000_devices),
159 .devices = easy83000_devices,