2 * Cellvision/SparkLAN boards
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
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.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/gpio.h>
16 #include <asm/bootinfo.h>
18 #include <asm/mach-adm5120/adm5120_info.h>
19 #include <asm/mach-adm5120/adm5120_board.h>
20 #include <asm/mach-adm5120/adm5120_platform.h>
21 #include <asm/mach-adm5120/adm5120_irq.h>
23 #define CELLVISION_GPIO_FLASH_A20 ADM5120_GPIO_PIN5
24 #define CELLVISION_GPIO_DEV_MASK (1 << CELLVISION_GPIO_FLASH_A20)
26 #ifdef CONFIG_MTD_PARTITIONS
27 static struct mtd_partition cas6xx_partitions
[] = {
32 .mask_flags
= MTD_WRITEABLE
,
35 .offset
= MTDPART_OFS_APPEND
,
39 .offset
= MTDPART_OFS_APPEND
,
43 .offset
= MTDPART_OFS_APPEND
,
47 .offset
= MTDPART_OFS_APPEND
,
48 .size
= MTDPART_SIZ_FULL
,
52 static struct mtd_partition cas7xx_partitions
[] = {
57 .mask_flags
= MTD_WRITEABLE
,
60 .offset
= MTDPART_OFS_APPEND
,
64 .offset
= MTDPART_OFS_APPEND
,
68 .offset
= MTDPART_OFS_APPEND
,
69 .size
= MTDPART_SIZ_FULL
,
72 #endif /* CONFIG_MTD_PARTITIONS */
74 static struct adm5120_pci_irq cas771_pci_irqs
[] __initdata
= {
75 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0
),
76 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1
),
77 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2
)
80 static struct gpio_led cas771_gpio_leds
[] __initdata
= {
81 GPIO_LED_STD(ADM5120_GPIO_PIN0
, "cam_flash", NULL
),
82 /* GPIO PIN3 is the reset */
83 GPIO_LED_STD(ADM5120_GPIO_PIN6
, "access", NULL
),
84 GPIO_LED_STD(ADM5120_GPIO_P0L1
, "status", NULL
),
85 GPIO_LED_STD(ADM5120_GPIO_P0L2
, "diag", NULL
),
88 static void switch_bank_gpio5(unsigned bank
)
92 gpio_set_value(CELLVISION_GPIO_FLASH_A20
, 0);
95 gpio_set_value(CELLVISION_GPIO_FLASH_A20
, 1);
100 static void __init
cellvision_generic_setup(void)
102 /* setup flash A20 line */
103 gpio_request(CELLVISION_GPIO_FLASH_A20
, NULL
);
104 gpio_direction_output(CELLVISION_GPIO_FLASH_A20
, 0);
106 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
107 adm5120_add_device_flash(0);
110 static void __init
cas6xx_setup(void)
112 #ifdef CONFIG_MTD_PARTITIONS
113 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas6xx_partitions
);
114 adm5120_flash0_data
.parts
= cas6xx_partitions
;
115 #endif /* CONFIG_MTD_PARTITIONS */
116 cellvision_generic_setup();
118 adm5120_add_device_switch(1, NULL
);
121 ADM5120_BOARD(MACH_ADM5120_CAS630
, "Cellvision CAS-630/630W", cas6xx_setup
);
122 ADM5120_BOARD(MACH_ADM5120_CAS670
, "Cellvision CAS-670/670W", cas6xx_setup
);
124 static void __init
cas7xx_setup(void)
126 #ifdef CONFIG_MTD_PARTITIONS
127 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas7xx_partitions
);
128 adm5120_flash0_data
.parts
= cas7xx_partitions
;
129 #endif /* CONFIG_MTD_PARTITIONS */
131 adm5120_add_device_switch(1, NULL
);
134 ADM5120_BOARD(MACH_ADM5120_CAS700
, "Cellvision CAS-700/700W", cas7xx_setup
);
135 ADM5120_BOARD(MACH_ADM5120_CAS790
, "Cellvision CAS-790", cas7xx_setup
);
136 ADM5120_BOARD(MACH_ADM5120_CAS861
, "Cellvision CAS-861/861W", cas7xx_setup
);
138 static void __init
cas771_setup(void)
141 adm5120_add_device_gpio_leds(ARRAY_SIZE(cas771_gpio_leds
),
143 adm5120_pci_set_irq_map(ARRAY_SIZE(cas771_pci_irqs
), cas771_pci_irqs
);
146 ADM5120_BOARD(MACH_ADM5120_CAS771
, "Cellvision CAS-771/771W", cas771_setup
);
148 static u8 nfs_vlans
[6] __initdata
= { /* TODO: not tested */
149 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
152 static void __init
nfs_setup(void)
154 #ifdef CONFIG_MTD_PARTITIONS
155 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas6xx_partitions
);
156 adm5120_flash0_data
.parts
= cas6xx_partitions
;
157 #endif /* CONFIG_MTD_PARTITIONS */
159 cellvision_generic_setup();
160 adm5120_add_device_switch(5, nfs_vlans
);
162 /* TODO: add PCI IRQ map */
165 ADM5120_BOARD(MACH_ADM5120_NFS101U
, "Cellvision NFS-101U/101WU", nfs_setup
);