From e83f3a93083b8df39c461e1c8744e5e137084473 Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Tue, 18 Jan 2011 17:18:11 +0100 Subject: fw/board/gta0x: move rffe configuration to board/gta0x Signed-off-by: Steve Markgraf --- src/target/firmware/Makefile | 6 +- .../firmware/board/common/rffe_gta0x_triband.c | 114 --------------------- .../firmware/board/gta0x/rffe_gta0x_triband.c | 114 +++++++++++++++++++++ 3 files changed, 116 insertions(+), 118 deletions(-) delete mode 100644 src/target/firmware/board/common/rffe_gta0x_triband.c create mode 100644 src/target/firmware/board/gta0x/rffe_gta0x_triband.c diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile index 77e326db..20547763 100644 --- a/src/target/firmware/Makefile +++ b/src/target/firmware/Makefile @@ -13,10 +13,8 @@ calypso_COMMON_OBJS=board/common/calypso_uart.o board/common/calypso_pwl.o # OpenMoko GTA0x -gta0x_COMMON_OBJS=$(calypso_COMMON_OBJS) board/common/rffe_gta0x_triband.o -gta0x_COMMON_ENVIRONMENTS=highram -gta0x_OBJS=$(gta0x_COMMON_OBJS) board/gta0x/init.o board/gta0x/rf_power.o -gta0x_ENVIRONMENTS=$(gta0x_COMMON_ENVIRONMENTS) +gta0x_OBJS=$(calypso_COMMON_OBJS) board/gta0x/rffe_gta0x_triband.o board/gta0x/init.o board/gta0x/rf_power.o +gta0x_ENVIRONMENTS=highram # Compal Generic diff --git a/src/target/firmware/board/common/rffe_gta0x_triband.c b/src/target/firmware/board/common/rffe_gta0x_triband.c deleted file mode 100644 index 7a379884..00000000 --- a/src/target/firmware/board/common/rffe_gta0x_triband.c +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include - -/* This is a value that has been measured on the C123 by Harald: 71dBm, - it is the difference between the input level at the antenna and what - the DSP reports, subtracted by the total gain of the TRF6151 */ -#define SYSTEM_INHERENT_GAIN 71 - -/* describe how the RF frontend is wired on the Openmoko GTA0x boards */ - -#define RITA_RESET TSPACT(0) /* Reset of the Rita TRF6151 */ -#define PA_ENABLE TSPACT(9) /* Enable the Power Amplifier */ -#define GSM_TXEN TSPACT(3) /* PA GSM switch, low-active */ - -/* All VCn controls are low-active */ -#define ASM_VC1 TSPACT(2) /* Antenna switch VC1 */ -#define ASM_VC2 TSPACT(1) /* Antenna switch VC2 */ -#define ASM_VC3 TSPACT(4) /* Antenna switch VC3 */ - -#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) -{ - uint16_t tspact = tsp_act_state(); - - /* First we mask off all bits from the state cache */ - tspact &= ~PA_ENABLE; - tspact &= ~GSM_TXEN; - tspact |= ASM_VC1 | ASM_VC2 | ASM_VC3; /* low-active */ - - switch (band) { - case GSM_BAND_850: - case GSM_BAND_900: - case GSM_BAND_1800: - break; - case GSM_BAND_1900: - tspact &= ~ASM_VC2; - break; - default: - /* TODO return/signal error here */ - break; - } - -#ifdef CONFIG_TX_ENABLE - /* Then we selectively set the bits on, if required */ - if (tx) { - switch (band) { - case GSM_BAND_850: - case GSM_BAND_900: - tspact &= ~ASM_VC3; - break; - case GSM_BAND_1800: - case GSM_BAND_1900: - tspact &= ~ASM_VC1; - tspact |= ASM_VC2; - tspact |= GSM_TXEN; - break; - default: - break; - } - tspact |= PA_ENABLE; - } -#endif /* TRANSMIT_SUPPORT */ - - tsp_act_update(tspact); -} - -#define MCU_SW_TRACE 0xfffef00e -#define ARM_CONF_REG 0xfffef006 - -void rffe_init(void) -{ - uint16_t reg; - - reg = readw(ARM_CONF_REG); - reg &= ~ (1 << 7); /* TSPACT4 I/O function, not nRDYMEM */ - writew(reg, ARM_CONF_REG); - - 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) -{ - return trf6151_get_gain(); -} - -const uint8_t system_inherent_gain = SYSTEM_INHERENT_GAIN; - -/* Given the expected input level of exp_inp dBm/8 and the target of target_bb - * dBm8, configure the RF Frontend with the respective gain */ -void rffe_set_gain(int16_t exp_inp, int16_t target_bb) -{ - trf6151_compute_gain(exp_inp, target_bb); -} - -void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) -{ - /* FIXME */ -} diff --git a/src/target/firmware/board/gta0x/rffe_gta0x_triband.c b/src/target/firmware/board/gta0x/rffe_gta0x_triband.c new file mode 100644 index 00000000..7a379884 --- /dev/null +++ b/src/target/firmware/board/gta0x/rffe_gta0x_triband.c @@ -0,0 +1,114 @@ +#include +#include + +#include +#include +#include +#include +#include + +/* This is a value that has been measured on the C123 by Harald: 71dBm, + it is the difference between the input level at the antenna and what + the DSP reports, subtracted by the total gain of the TRF6151 */ +#define SYSTEM_INHERENT_GAIN 71 + +/* describe how the RF frontend is wired on the Openmoko GTA0x boards */ + +#define RITA_RESET TSPACT(0) /* Reset of the Rita TRF6151 */ +#define PA_ENABLE TSPACT(9) /* Enable the Power Amplifier */ +#define GSM_TXEN TSPACT(3) /* PA GSM switch, low-active */ + +/* All VCn controls are low-active */ +#define ASM_VC1 TSPACT(2) /* Antenna switch VC1 */ +#define ASM_VC2 TSPACT(1) /* Antenna switch VC2 */ +#define ASM_VC3 TSPACT(4) /* Antenna switch VC3 */ + +#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) +{ + uint16_t tspact = tsp_act_state(); + + /* First we mask off all bits from the state cache */ + tspact &= ~PA_ENABLE; + tspact &= ~GSM_TXEN; + tspact |= ASM_VC1 | ASM_VC2 | ASM_VC3; /* low-active */ + + switch (band) { + case GSM_BAND_850: + case GSM_BAND_900: + case GSM_BAND_1800: + break; + case GSM_BAND_1900: + tspact &= ~ASM_VC2; + break; + default: + /* TODO return/signal error here */ + break; + } + +#ifdef CONFIG_TX_ENABLE + /* Then we selectively set the bits on, if required */ + if (tx) { + switch (band) { + case GSM_BAND_850: + case GSM_BAND_900: + tspact &= ~ASM_VC3; + break; + case GSM_BAND_1800: + case GSM_BAND_1900: + tspact &= ~ASM_VC1; + tspact |= ASM_VC2; + tspact |= GSM_TXEN; + break; + default: + break; + } + tspact |= PA_ENABLE; + } +#endif /* TRANSMIT_SUPPORT */ + + tsp_act_update(tspact); +} + +#define MCU_SW_TRACE 0xfffef00e +#define ARM_CONF_REG 0xfffef006 + +void rffe_init(void) +{ + uint16_t reg; + + reg = readw(ARM_CONF_REG); + reg &= ~ (1 << 7); /* TSPACT4 I/O function, not nRDYMEM */ + writew(reg, ARM_CONF_REG); + + 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) +{ + return trf6151_get_gain(); +} + +const uint8_t system_inherent_gain = SYSTEM_INHERENT_GAIN; + +/* Given the expected input level of exp_inp dBm/8 and the target of target_bb + * dBm8, configure the RF Frontend with the respective gain */ +void rffe_set_gain(int16_t exp_inp, int16_t target_bb) +{ + trf6151_compute_gain(exp_inp, target_bb); +} + +void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) +{ + /* FIXME */ +} -- cgit v1.2.3