OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * Cellvision/SparkLAN boards |
||
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 "cellvision.h" |
||
13 | |||
14 | #include <prom/admboot.h> |
||
15 | |||
16 | #define CELLVISION_GPIO_FLASH_A20 ADM5120_GPIO_PIN5 |
||
17 | #define CELLVISION_GPIO_DEV_MASK (1 << CELLVISION_GPIO_FLASH_A20) |
||
18 | |||
19 | #define CELLVISION_CONFIG_OFFSET 0x8000 |
||
20 | #define CELLVISION_CONFIG_SIZE 0x1000 |
||
21 | |||
22 | static struct mtd_partition cas6xx_partitions[] = { |
||
23 | { |
||
24 | .name = "admboot", |
||
25 | .offset = 0, |
||
26 | .size = 32*1024, |
||
27 | .mask_flags = MTD_WRITEABLE, |
||
28 | } , { |
||
29 | .name = "config", |
||
30 | .offset = MTDPART_OFS_APPEND, |
||
31 | .size = 32*1024, |
||
32 | } , { |
||
33 | .name = "nvfs1", |
||
34 | .offset = MTDPART_OFS_APPEND, |
||
35 | .size = 64*1024, |
||
36 | } , { |
||
37 | .name = "nvfs2", |
||
38 | .offset = MTDPART_OFS_APPEND, |
||
39 | .size = 64*1024, |
||
40 | } , { |
||
41 | .name = "firmware", |
||
42 | .offset = MTDPART_OFS_APPEND, |
||
43 | .size = MTDPART_SIZ_FULL, |
||
44 | } |
||
45 | }; |
||
46 | |||
47 | static struct mtd_partition cas7xx_partitions[] = { |
||
48 | { |
||
49 | .name = "admboot", |
||
50 | .offset = 0, |
||
51 | .size = 32*1024, |
||
52 | .mask_flags = MTD_WRITEABLE, |
||
53 | } , { |
||
54 | .name = "config", |
||
55 | .offset = MTDPART_OFS_APPEND, |
||
56 | .size = 32*1024, |
||
57 | } , { |
||
58 | .name = "nvfs", |
||
59 | .offset = MTDPART_OFS_APPEND, |
||
60 | .size = 128*1024, |
||
61 | } , { |
||
62 | .name = "firmware", |
||
63 | .offset = MTDPART_OFS_APPEND, |
||
64 | .size = MTDPART_SIZ_FULL, |
||
65 | } |
||
66 | }; |
||
67 | |||
68 | static void switch_bank_gpio5(unsigned bank) |
||
69 | { |
||
70 | switch (bank) { |
||
71 | case 0: |
||
72 | gpio_set_value(CELLVISION_GPIO_FLASH_A20, 0); |
||
73 | break; |
||
74 | case 1: |
||
75 | gpio_set_value(CELLVISION_GPIO_FLASH_A20, 1); |
||
76 | break; |
||
77 | } |
||
78 | } |
||
79 | |||
80 | static void __init cellvision_flash_setup(void) |
||
81 | { |
||
82 | /* setup flash A20 line */ |
||
83 | gpio_request(CELLVISION_GPIO_FLASH_A20, NULL); |
||
84 | gpio_direction_output(CELLVISION_GPIO_FLASH_A20, 0); |
||
85 | |||
86 | adm5120_flash0_data.switch_bank = switch_bank_gpio5; |
||
87 | adm5120_add_device_flash(0); |
||
88 | } |
||
89 | |||
90 | void __init cellvision_mac_setup(void) |
||
91 | { |
||
92 | u8 mac_base[6]; |
||
93 | int err; |
||
94 | |||
95 | err = admboot_get_mac_base(CELLVISION_CONFIG_OFFSET, |
||
96 | CELLVISION_CONFIG_SIZE, mac_base); |
||
97 | |||
98 | if ((err) || !is_valid_ether_addr(mac_base)) |
||
99 | random_ether_addr(mac_base); |
||
100 | |||
101 | adm5120_setup_eth_macs(mac_base); |
||
102 | } |
||
103 | |||
104 | void __init cas6xx_flash_setup(void) |
||
105 | { |
||
106 | adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions); |
||
107 | adm5120_flash0_data.parts = cas6xx_partitions; |
||
108 | |||
109 | cellvision_flash_setup(); |
||
110 | } |
||
111 | |||
112 | void __init cas7xx_flash_setup(void) |
||
113 | { |
||
114 | adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions); |
||
115 | adm5120_flash0_data.parts = cas7xx_partitions; |
||
116 | |||
117 | cellvision_flash_setup(); |
||
118 | } |
||
119 | |||
120 | void __init cas6xx_setup(void) |
||
121 | { |
||
122 | cas6xx_flash_setup(); |
||
123 | adm5120_add_device_uart(0); |
||
124 | adm5120_add_device_uart(1); |
||
125 | adm5120_add_device_switch(1, NULL); |
||
126 | } |
||
127 | |||
128 | MIPS_MACHINE(MACH_ADM5120_CAS630, "CAS-630", "Cellvision CAS-630/630W", |
||
129 | cas6xx_setup); |
||
130 | MIPS_MACHINE(MACH_ADM5120_CAS670, "CAS-670", "Cellvision CAS-670/670W", |
||
131 | cas6xx_setup); |
||
132 | |||
133 | void __init cas7xx_setup(void) |
||
134 | { |
||
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); |
||
140 | } |
||
141 | |||
142 | MIPS_MACHINE(MACH_ADM5120_CAS700, "CAS-700", "Cellvision CAS-700/700W", |
||
143 | cas7xx_setup); |
||
144 | MIPS_MACHINE(MACH_ADM5120_CAS790, "CAS-790", "Cellvision CAS-790", |
||
145 | cas7xx_setup); |
||
146 | MIPS_MACHINE(MACH_ADM5120_CAS861, "CAS-861", "Cellvision CAS-861/861W", |
||
147 | cas7xx_setup); |