target/fw: set the TRF6151 tsp IDs from the rffe initialization

Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
Steve Markgraf 2011-01-24 16:48:56 +01:00
parent 66de91f3a8
commit cb8b198375
6 changed files with 27 additions and 17 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -4,7 +4,7 @@
#include <osmocore/gsm_utils.h>
/* 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);

View File

@ -52,7 +52,6 @@ void layer1_init(void)
/* Initialize TPU, TSP and TRF drivers */
tpu_init();
tsp_init();
trf6151_init();
rffe_init();

View File

@ -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);