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 "cellvision.h"
14 #include <prom/admboot.h>
16 #define CELLVISION_GPIO_FLASH_A20 ADM5120_GPIO_PIN5
17 #define CELLVISION_GPIO_DEV_MASK (1 << CELLVISION_GPIO_FLASH_A20)
19 #define CELLVISION_CONFIG_OFFSET 0x8000
20 #define CELLVISION_CONFIG_SIZE 0x1000
22 static struct mtd_partition cas6xx_partitions[] = {
27 .mask_flags = MTD_WRITEABLE,
30 .offset = MTDPART_OFS_APPEND,
34 .offset = MTDPART_OFS_APPEND,
38 .offset = MTDPART_OFS_APPEND,
42 .offset = MTDPART_OFS_APPEND,
43 .size = MTDPART_SIZ_FULL,
47 static struct mtd_partition cas7xx_partitions[] = {
52 .mask_flags = MTD_WRITEABLE,
55 .offset = MTDPART_OFS_APPEND,
59 .offset = MTDPART_OFS_APPEND,
63 .offset = MTDPART_OFS_APPEND,
64 .size = MTDPART_SIZ_FULL,
68 static void switch_bank_gpio5(unsigned bank)
72 gpio_set_value(CELLVISION_GPIO_FLASH_A20, 0);
75 gpio_set_value(CELLVISION_GPIO_FLASH_A20, 1);
80 static void __init cellvision_flash_setup(void)
82 /* setup flash A20 line */
83 gpio_request(CELLVISION_GPIO_FLASH_A20, NULL);
84 gpio_direction_output(CELLVISION_GPIO_FLASH_A20, 0);
86 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
87 adm5120_add_device_flash(0);
90 void __init cellvision_mac_setup(void)
95 err = admboot_get_mac_base(CELLVISION_CONFIG_OFFSET,
96 CELLVISION_CONFIG_SIZE, mac_base);
98 if ((err) || !is_valid_ether_addr(mac_base))
99 random_ether_addr(mac_base);
101 adm5120_setup_eth_macs(mac_base);
104 void __init cas6xx_flash_setup(void)
106 adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions);
107 adm5120_flash0_data.parts = cas6xx_partitions;
109 cellvision_flash_setup();
112 void __init cas7xx_flash_setup(void)
114 adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions);
115 adm5120_flash0_data.parts = cas7xx_partitions;
117 cellvision_flash_setup();
120 void __init cas6xx_setup(void)
122 cas6xx_flash_setup();
123 adm5120_add_device_uart(0);
124 adm5120_add_device_uart(1);
125 adm5120_add_device_switch(1, NULL);
128 MIPS_MACHINE(MACH_ADM5120_CAS630, "CAS-630", "Cellvision CAS-630/630W",
130 MIPS_MACHINE(MACH_ADM5120_CAS670, "CAS-670", "Cellvision CAS-670/670W",
133 void __init cas7xx_setup(void)
135 cas7xx_flash_setup();
136 cellvision_mac_setup();
137 adm5120_add_device_uart(0);
138 adm5120_add_device_uart(1);
139 adm5120_add_device_switch(1, NULL);
142 MIPS_MACHINE(MACH_ADM5120_CAS700, "CAS-700", "Cellvision CAS-700/700W",
144 MIPS_MACHINE(MACH_ADM5120_CAS790, "CAS-790", "Cellvision CAS-790",
146 MIPS_MACHINE(MACH_ADM5120_CAS861, "CAS-861", "Cellvision CAS-861/861W",