comparison src/cs/drivers/drv_core/armio/armio.c @ 16:9582c4e40607

armio.c: no board-specific GPIO config
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 04:43:00 +0000
parents 92470e5d0b9e
children
comparison
equal deleted inserted replaced
15:41e50f700ee2 16:9582c4e40607
170 void AI_InitIOConfig(void) 170 void AI_InitIOConfig(void)
171 { 171 {
172 // reset the IOs config 172 // reset the IOs config
173 AI_ResetIoConfig(); 173 AI_ResetIoConfig();
174 174
175 // CLKM_IO_CNTL register configuration : 175 /*
176 // select IOs 6,8,9,10,11,12 and 13 on the pins instead of MCSI and MCUEN signals. 176 * In this special FFS editor run-from-RAM application
177 AI_EnableBit(0); /* FreeCalypso addition */ 177 * we don't make any board-specific GPIO or pinmux configs.
178 AI_EnableBit(2); 178 */
179 AI_EnableBit(4);
180
181 #ifdef CONFIG_TARGET_PIRELLI
182 AI_EnableBit(1);
183 AI_EnableBit(3);
184 #endif
185
186 /* Bits 5,6,7,8 are used to output I/O 9,10,11,12 or MCSI pins */
187 /* If Bluetooth, IO should be disabled, outputting MCSI used for Bluetooth voice */
188 /*
189 * FreeCalypso change: we don't have BT, our new criterion is
190 * whether or not a given board is wired for MCSI.
191 */
192 #if defined(CONFIG_MCSI_MODEM) || defined(CONFIG_TARGET_PIRELLI)
193 AI_DisableBit(5);
194 AI_DisableBit(6);
195 AI_DisableBit(7);
196 AI_DisableBit(8);
197 #else
198 AI_EnableBit(5);
199 AI_EnableBit(6);
200 AI_EnableBit(7);
201 AI_EnableBit(8);
202 #endif
203
204 AI_EnableBit(9);
205
206 // ARMIO_OUT register configuration :
207 // set IOs 8,9,10,11,12 and 13 as high
208 // set IOs 0 to 7 as low
209
210 #ifdef CONFIG_TARGET_C11X
211 /* C11x GPIO configuration mimics what the original fw sets */
212
213 /* GPIO out all zeros */
214 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
215
216 /* setting of GPIOs as outputs: register setting from the original fw */
217 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2209;
218
219 #elif defined(CONFIG_TARGET_C139)
220 /* C139 GPIO configuration mimics what the original fw sets */
221
222 /* GPIO out all zeros - the LCD backlight is OFF */
223 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
224
225 /* setting of GPIOs as outputs: register setting from the original fw */
226 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2A09;
227
228 #elif defined(CONFIG_TARGET_C155)
229 /* C155 GPIO config based on the available schematics */
230
231 /* GPIO out all zeros - the LCD backlight is OFF */
232 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
233
234 AI_ConfigBitAsOutput(1); /* LCD backlight control */
235 AI_ConfigBitAsOutput(2); /* headset jack switch */
236 AI_ConfigBitAsOutput(3); /* LCDA0 (?) */
237 AI_ConfigBitAsOutput(8); /* MUSIC_A0 */
238 AI_ConfigBitAsOutput(12); /* MUSIC_ON */
239
240 #elif defined(CONFIG_TARGET_J100)
241 /*
242 * GPIO config on this target is based on the disassembly of
243 * Init_Target() and AI_InitIOConfig() functions in the official fw.
244 */
245
246 /* GPIO out all zeros - the LCD backlight is OFF */
247 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
248
249 /* setting of GPIOs as outputs: register setting from the original fw */
250 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2A59;
251
252 #elif defined(CONFIG_TARGET_PIRELLI)
253
254 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
255
256 AI_ConfigBitAsOutput(1);
257 AI_ConfigBitAsOutput(4);
258 AI_ConfigBitAsOutput(7);
259
260 #else /* classic TI/Openmoko/FreeCalypso targets */
261 // set IOs 1 and 8 to 13 as high
262 // set IOs 0 and 2 to 7 as low
263 // On D-Sample GPIO 1 must be set to high to enable the audio amplifier,
264 // but on Openmoko's modem it is the interrupt to the AP.
265 // On the FCDEV3B it also controls the audio amplifier.
266 // On the GTM900 GPIOs 0 and 1 are RI and DSR outputs, respectively.
267 // For targets other than GTM900, we enable the audio amplifier
268 // if we are in an MMI!=0 build - for ACI builds use the AT@SPKR command.
269 #ifdef CONFIG_TARGET_GTM900
270 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F01;
271 #elif (MMI != 0) || defined(CONFIG_GPIO1_HIGH)
272 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F02;
273 #else
274 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F00;
275 #endif
276
277 // ARMIO_CNTL_REG register configuration :
278 // set IOs 1,2,5,7,9,14 and 15 as ouputs.
279 // bits conditionalized on CONFIG_TARGET_GTAMODEM or CONFIG_TARGET_FCFAM
280 // are FreeCalypso additions
281 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) || \
282 defined(CONFIG_TARGET_GTM900)
283 AI_ConfigBitAsOutput(0);
284 #endif
285 AI_ConfigBitAsOutput(1);
286 #ifndef CONFIG_TARGET_LEONARDO /* GPIO 2 is an input on Leonardo! */
287 AI_ConfigBitAsOutput(2);
288 #endif
289 #ifdef CONFIG_GPIO3_OUTPUT
290 AI_ConfigBitAsOutput(3);
291 #endif
292 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM)
293 AI_ConfigBitAsOutput(4);
294 #endif
295 AI_ConfigBitAsOutput(5);
296 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM)
297 AI_ConfigBitAsOutput(6);
298 #endif
299 AI_ConfigBitAsOutput(7);
300 #if 1 /* FreeCalypso addition for all targets */
301 AI_ConfigBitAsOutput(8);
302 #endif
303 AI_ConfigBitAsOutput(9);
304 #ifdef CONFIG_MCSI_UNUSED
305 AI_ConfigBitAsOutput(10);
306 AI_ConfigBitAsOutput(11);
307 AI_ConfigBitAsOutput(12);
308 #endif
309 #if 1 /* FreeCalypso addition for all targets */
310 AI_ConfigBitAsOutput(13);
311 #endif
312 AI_ConfigBitAsOutput(14);
313 AI_ConfigBitAsOutput(15);
314 #endif
315 } 179 }
316 180
317 /* 181 /*
318 * AI_SelectIOForIT 182 * AI_SelectIOForIT
319 * 183 *