From cb8b1983755a415eaeb58b74ab8f02e93c87ea99 Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Mon, 24 Jan 2011 16:48:56 +0100 Subject: target/fw: set the TRF6151 tsp IDs from the rffe initialization Signed-off-by: Steve Markgraf --- .../firmware/board/common/rffe_gta0x_triband.c | 9 +++++++-- src/target/firmware/board/compal/rffe_dualband.c | 9 +++++++-- src/target/firmware/include/calypso/tsp.h | 1 + src/target/firmware/include/rf/trf6151.h | 2 +- src/target/firmware/layer1/init.c | 1 - src/target/firmware/rf/trf6151.c | 22 +++++++++++----------- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/target/firmware/board/common/rffe_gta0x_triband.c b/src/target/firmware/board/common/rffe_gta0x_triband.c index a21cc612..cbfccd1c 100644 --- a/src/target/firmware/board/common/rffe_gta0x_triband.c +++ b/src/target/firmware/board/common/rffe_gta0x_triband.c @@ -23,8 +23,8 @@ #define ASM_VC2 TSPACT(1) /* Antenna switch VC2 */ #define ASM_VC3 TSPACT(4) /* Antenna switch VC3 */ -#define IOTA_STROBE TSPEN0 /* Strobe for the Iota TSP */ -#define RITA_STROBE TSPEN2 /* Strobe for the Rita TSP */ +#define IOTA_STROBE TSPEN(0) /* Strobe for the Iota TSP */ +#define RITA_STROBE TSPEN(2) /* Strobe for the Rita TSP */ /* switch RF Frontend Mode */ void rffe_mode(enum gsm_band band, int tx) @@ -73,6 +73,11 @@ void rffe_init(void) reg = readw(MCU_SW_TRACE); reg &= ~(1 << 1); /* TSPACT9 I/O function, not MAS(1) */ writew(reg, MCU_SW_TRACE); + + /* Configure the TSPEN which is connected to the TWL3025 */ + tsp_setup(IOTA_STROBE, 1, 0, 0); + + trf6151_init(RITA_STROBE, RITA_RESET); } uint8_t rffe_get_gain(void) diff --git a/src/target/firmware/board/compal/rffe_dualband.c b/src/target/firmware/board/compal/rffe_dualband.c index bfd3d98e..a0e03379 100644 --- a/src/target/firmware/board/compal/rffe_dualband.c +++ b/src/target/firmware/board/compal/rffe_dualband.c @@ -19,8 +19,8 @@ #define TRENA TSPACT(6) /* Transmit Enable (Antenna Switch) */ #define GSM_TXEN TSPACT(8) /* GSM (as opposed to DCS) Transmit */ -#define IOTA_STROBE TSPEN0 /* Strobe for the Iota TSP */ -#define RITA_STROBE TSPEN2 /* Strobe for the Rita TSP */ +#define IOTA_STROBE TSPEN(0) /* Strobe for the Iota TSP */ +#define RITA_STROBE TSPEN(2) /* Strobe for the Rita TSP */ /* switch RF Frontend Mode */ void rffe_mode(enum gsm_band band, int tx) @@ -58,6 +58,11 @@ void rffe_init(void) reg = readw(MCU_SW_TRACE); reg &= ~(1 << 5); /* TSPACT8 I/O function, not nMREQ */ writew(reg, MCU_SW_TRACE); + + /* Configure the TSPEN which is connected to the TWL3025 */ + tsp_setup(IOTA_STROBE, 1, 0, 0); + + trf6151_init(RITA_STROBE, RITA_RESET); } uint8_t rffe_get_gain(void) diff --git a/src/target/firmware/include/calypso/tsp.h b/src/target/firmware/include/calypso/tsp.h index 0252f36e..d58a562a 100644 --- a/src/target/firmware/include/calypso/tsp.h +++ b/src/target/firmware/include/calypso/tsp.h @@ -2,6 +2,7 @@ #define _CALYPSO_TSP_H #define TSPACT(x) (1 << x) +#define TSPEN(x) (x) /* initiate a TSP write through the TPU */ void tsp_write(uint8_t dev_idx, uint8_t bitlen, uint32_t dout); diff --git a/src/target/firmware/include/rf/trf6151.h b/src/target/firmware/include/rf/trf6151.h index 0e27abb9..1a908087 100644 --- a/src/target/firmware/include/rf/trf6151.h +++ b/src/target/firmware/include/rf/trf6151.h @@ -4,7 +4,7 @@ #include /* initialize (reset + power up) */ -void trf6151_init(void); +void trf6151_init(uint8_t tsp_uid, uint16_t tsp_reset_id); /* switch power off or on */ void trf6151_power(int on); diff --git a/src/target/firmware/layer1/init.c b/src/target/firmware/layer1/init.c index 7af327eb..e7fde232 100644 --- a/src/target/firmware/layer1/init.c +++ b/src/target/firmware/layer1/init.c @@ -52,7 +52,6 @@ void layer1_init(void) /* Initialize TPU, TSP and TRF drivers */ tpu_init(); tsp_init(); - trf6151_init(); rffe_init(); diff --git a/src/target/firmware/rf/trf6151.c b/src/target/firmware/rf/trf6151.c index 179f9f90..0efe5273 100644 --- a/src/target/firmware/rf/trf6151.c +++ b/src/target/firmware/rf/trf6151.c @@ -95,6 +95,7 @@ enum trf6151_reg { uint16_t rf_arfcn = 871; /* TODO: this needs to be private */ static uint16_t rf_band; +static uint8_t trf6151_tsp_uid; static uint8_t trf6151_vga_dbm = 40; static int trf6151_gain_high = 1; @@ -110,7 +111,7 @@ static void trf6151_reg_write(uint16_t reg, uint16_t val) { printd("trf6151_reg_write(reg=%u, val=0x%04x)\n", reg, val); /* each TSP write takes 4 TPU instructions */ - tsp_write(TRF6151_TSP_UID, 16, (reg | val)); + tsp_write(trf6151_tsp_uid, 16, (reg | val)); trf6151_reg_cache[reg] = val; } @@ -232,24 +233,23 @@ enum trf6151_gsm_band { GSM1900 = 6, }; -static inline void trf6151_reset(void) +static inline void trf6151_reset(uint16_t reset_id) { /* pull the nRESET line low */ - tsp_act_disable((1 << 0)); + tsp_act_disable(reset_id); tpu_enq_wait(50); /* release nRESET */ - tsp_act_enable((1 << 0)); + tsp_act_enable(reset_id); } -void trf6151_init(void) +void trf6151_init(uint8_t tsp_uid, uint16_t tsp_reset_id) { - /* Configure TSPEN0, which is connected to TWL3025, - * FIXME: why is this here and not in the TWL3025 driver? */ - tsp_setup(0, 1, 0, 0); - /* Configure TSPEN2, which is connected ot TRF6151 STROBE */ - tsp_setup(TRF6151_TSP_UID, 0, 1, 1); + trf6151_tsp_uid = tsp_uid; - trf6151_reset(); + /* Configure the TSPEN which is connected to TRF6151 STROBE */ + tsp_setup(trf6151_tsp_uid, 0, 1, 1); + + trf6151_reset(tsp_reset_id); /* configure TRF6151 for operation */ trf6151_power(1); -- cgit v1.2.3