comparison src/cs/drivers/drv_core/armio/armio.c @ 203:ba3693cbd40e

src/cs: sync with Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 29 Jun 2020 00:27:13 +0000
parents d05fb947b50d
children
comparison
equal deleted inserted replaced
202:ae3106eb5923 203:ba3693cbd40e
32 #include "memif/mem.h" 32 #include "memif/mem.h"
33 33
34 #include "inth/iq.h" 34 #include "inth/iq.h"
35 #include "armio/armio.h" 35 #include "armio/armio.h"
36 #include "abb/abb.h" // for AI_Power function : to be removed, use ABB_Power_Off in abb.c file instead !!! 36 #include "abb/abb.h" // for AI_Power function : to be removed, use ABB_Power_Off in abb.c file instead !!!
37
38 #ifdef CONFIG_TANGO_MODEM
39 #include "ffs/ffs_api.h"
40
41 SYS_UWORD8 AI_Tango_pinmux[4];
42 #endif
37 43
38 #if (CHIPSET != 12) 44 #if (CHIPSET != 12)
39 /* 45 /*
40 * AI_EnableBit 46 * AI_EnableBit
41 * 47 *
265 // On the FCDEV3B it also controls the audio amplifier. 271 // On the FCDEV3B it also controls the audio amplifier.
266 // On the GTM900 GPIOs 0 and 1 are RI and DSR outputs, respectively. 272 // On the GTM900 GPIOs 0 and 1 are RI and DSR outputs, respectively.
267 // For targets other than GTM900, we enable the audio amplifier 273 // 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. 274 // if we are in an MMI!=0 build - for ACI builds use the AT@SPKR command.
269 #ifdef CONFIG_TARGET_GTM900 275 #ifdef CONFIG_TARGET_GTM900
270 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F01; 276 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F05;
271 #elif (MMI != 0) || defined(CONFIG_GPIO1_HIGH) 277 #elif (MMI != 0) || defined(CONFIG_GPIO1_HIGH)
272 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F02; 278 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F06;
273 #else 279 #else
274 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F00; 280 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F04;
275 #endif 281 #endif
276 282
277 // ARMIO_CNTL_REG register configuration : 283 // ARMIO_CNTL_REG register configuration :
278 // set IOs 1,2,5,7,9,14 and 15 as ouputs. 284 // set IOs 1,2,5,7,9,14 and 15 as ouputs.
279 // bits conditionalized on CONFIG_TARGET_GTAMODEM or CONFIG_TARGET_FCFAM 285 // all others are FreeCalypso additions
280 // are FreeCalypso additions 286 #if defined(CONFIG_GPIO046_OUTPUTS) || defined(CONFIG_TARGET_GTM900)
281 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) || \
282 defined(CONFIG_TARGET_GTM900)
283 AI_ConfigBitAsOutput(0); 287 AI_ConfigBitAsOutput(0);
284 #endif 288 #endif
285 AI_ConfigBitAsOutput(1); 289 #ifndef CONFIG_TANGO_MODEM /* we do dynamic config on Tango instead */
286 #ifndef CONFIG_TARGET_LEONARDO /* GPIO 2 is an input on Leonardo! */ 290 AI_ConfigBitAsOutput(1);
287 AI_ConfigBitAsOutput(2); 291 #ifndef CONFIG_TARGET_LEONARDO /* GPIO 2 is an input on Leonardo! */
288 #endif 292 AI_ConfigBitAsOutput(2);
289 #ifdef CONFIG_GPIO3_OUTPUT 293 #endif
290 AI_ConfigBitAsOutput(3); 294 #ifdef CONFIG_GPIO3_OUTPUT
291 #endif 295 AI_ConfigBitAsOutput(3);
292 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) 296 #endif
297 #endif
298 #ifdef CONFIG_GPIO046_OUTPUTS
293 AI_ConfigBitAsOutput(4); 299 AI_ConfigBitAsOutput(4);
294 #endif 300 #endif
295 AI_ConfigBitAsOutput(5); 301 AI_ConfigBitAsOutput(5);
296 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) 302 #ifdef CONFIG_GPIO046_OUTPUTS
297 AI_ConfigBitAsOutput(6); 303 AI_ConfigBitAsOutput(6);
298 #endif 304 #endif
299 AI_ConfigBitAsOutput(7); 305 AI_ConfigBitAsOutput(7);
300 #if 1 /* FreeCalypso addition for all targets */ 306 #if 1 /* FreeCalypso addition for all targets */
301 AI_ConfigBitAsOutput(8); 307 AI_ConfigBitAsOutput(8);
311 #endif 317 #endif
312 AI_ConfigBitAsOutput(14); 318 AI_ConfigBitAsOutput(14);
313 AI_ConfigBitAsOutput(15); 319 AI_ConfigBitAsOutput(15);
314 #endif 320 #endif
315 } 321 }
322
323 #ifdef CONFIG_TANGO_MODEM
324 void AI_Init_Tango_pinmux(void)
325 {
326 ffs_file_read("/etc/tango-pinmux", AI_Tango_pinmux, 4);
327 /* apply this config */
328 if (AI_Tango_pinmux[0] & 0x80) {
329 if (AI_Tango_pinmux[0] & 1)
330 AI_SetBit(1);
331 else
332 AI_ResetBit(1);
333 AI_ConfigBitAsOutput(1);
334 }
335 /* GPIO2 config */
336 if (AI_Tango_pinmux[1] & 0x02) {
337 if (AI_Tango_pinmux[1] & 0x01)
338 AI_SetBit(2);
339 else
340 AI_ResetBit(2);
341 AI_ConfigBitAsOutput(2);
342 }
343 /* GPIO3 config */
344 if (AI_Tango_pinmux[1] & 0x20) {
345 if (AI_Tango_pinmux[1] & 0x10)
346 AI_SetBit(3);
347 else
348 AI_ResetBit(3);
349 AI_ConfigBitAsOutput(3);
350 }
351 /* RESET_OUT/IO7 config */
352 if (AI_Tango_pinmux[2] & 0x08) {
353 AI_EnableBit(3);
354 if (AI_Tango_pinmux[2] & 0x02) {
355 if (AI_Tango_pinmux[2] & 0x01)
356 AI_SetBit(7);
357 else
358 AI_ResetBit(7);
359 } else
360 AI_ConfigBitAsInput(7);
361 }
362 /* MCSI/GPIO config */
363 if (AI_Tango_pinmux[2] & 0x80) {
364 if (AI_Tango_pinmux[3] & 0x10) {
365 if (AI_Tango_pinmux[3] & 0x01)
366 AI_SetBit(9);
367 else
368 AI_ResetBit(9);
369 } else
370 AI_ConfigBitAsInput(9);
371 AI_EnableBit(5);
372 AI_EnableBit(6);
373 AI_EnableBit(7);
374 AI_EnableBit(8);
375 if (AI_Tango_pinmux[3] & 0x20) {
376 if (AI_Tango_pinmux[3] & 0x02)
377 AI_SetBit(10);
378 else
379 AI_ResetBit(10);
380 AI_ConfigBitAsOutput(10);
381 }
382 if (AI_Tango_pinmux[3] & 0x40) {
383 if (AI_Tango_pinmux[3] & 0x04)
384 AI_SetBit(11);
385 else
386 AI_ResetBit(11);
387 AI_ConfigBitAsOutput(11);
388 }
389 if (AI_Tango_pinmux[3] & 0x80) {
390 if (AI_Tango_pinmux[3] & 0x08)
391 AI_SetBit(12);
392 else
393 AI_ResetBit(12);
394 AI_ConfigBitAsOutput(12);
395 }
396 }
397 }
398 #endif
316 399
317 /* 400 /*
318 * AI_SelectIOForIT 401 * AI_SelectIOForIT
319 * 402 *
320 * Select which IO will be used to generate an interrupt. 403 * Select which IO will be used to generate an interrupt.