summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/src/simtrace.h11
-rw-r--r--firmware/src/simtrace/main_simtrace.c10
2 files changed, 20 insertions, 1 deletions
diff --git a/firmware/src/simtrace.h b/firmware/src/simtrace.h
index 40ed3ab..b6d44c4 100644
--- a/firmware/src/simtrace.h
+++ b/firmware/src/simtrace.h
@@ -30,8 +30,17 @@
#define SIMTRACE_PIO_SC_SW AT91C_PIO_PA20
#define SIMTRACE_PIO_IO_SW AT91C_PIO_PA19
+/* to set power for VCC_SIM for early prototype
+ * unused pin in v1.0p
+ */
#define SIMTRACE_PIO_VCC_SIM AT91C_PIO_PA5
-#define SIMTRACE_PIO_VCC_PHONE AT91C_PIO_PA30
+
+/* to set power source for VCC_SIM for v1.0(p) */
+#define SIMTRACE_PIO_SIM_PWREN AT91C_PIO_PA5
+#define SIMTRACE_PIO_SIM_PWRFWD AT91C_PIO_PA26
+
+/* VCC_PHONE detection */
+#define SIMTRACE_PIO_VCC_PHONE AT91C_PIO_PA25
/* SPI flash */
#define PIO_SPIF_nWP AT91C_PIO_PA15
diff --git a/firmware/src/simtrace/main_simtrace.c b/firmware/src/simtrace/main_simtrace.c
index f919690..733f060 100644
--- a/firmware/src/simtrace/main_simtrace.c
+++ b/firmware/src/simtrace/main_simtrace.c
@@ -65,8 +65,18 @@ static void simtrace_set_mode(enum simtrace_md mode)
/* switch VCC_SIM pin into output mode, as in the first
* generation prototype we use it directly to supply Vcc
* to the SIM */
+
+ /* pin unused in v1.0(p) and v1.1p */
AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_VCC_SIM);
AT91F_PIO_SetOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_VCC_SIM);
+ /* for v1.0(p) and v1.1p, VCC_SIM can either be powered by
+ * VCC_PHONE using SIM_PWRFWD, or by the LDO using
+ * SIM_PWREN. they should be set exclusive. per default
+ * use VCC_PHONE */
+ AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWRFWD);
+ AT91F_PIO_SetOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWRFWD);
+ AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWREN);
+ AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SIM_PWREN);
/* switch UART0 pins to 'ISO7816 card mode' */
AT91F_PIO_CfgInput(AT91C_BASE_PIOA, UART0_PINS);
personal git repositories of Harald Welte. Your mileage may vary