FreeCalypso > hg > ffs-editor
comparison src/cs/layer1/tpu_drivers/source0/tpudrv12.h @ 0:92470e5d0b9e
src: partial import from FC Selenite
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 15 May 2020 01:28:16 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:92470e5d0b9e |
|---|---|
| 1 /****************** Revision Controle System Header *********************** | |
| 2 * GSM Layer 1 software | |
| 3 * Copyright (c) Texas Instruments 1998 | |
| 4 * | |
| 5 * Filename tpudrv12.h | |
| 6 * Copyright 2003 (C) Texas Instruments | |
| 7 * | |
| 8 ****************** Revision Controle System Header ***********************/ | |
| 9 | |
| 10 //--- Configuration values | |
| 11 #define FEM_TEST 0 // 1 => ENABLE the FEM_TEST mode | |
| 12 #define RF_VERSION 1 // 1 or V1, 5 for V5, etc | |
| 13 #define SAFE_INIT_WA 0 // 1 => ENABLE the "RITA safe init" | |
| 14 // TeST - Enable Main VCO buffer for test | |
| 15 #define MAIN_VCO_ACCESS_WA 0 // 1 => ENABLE the Main VCO buffer | |
| 16 | |
| 17 #include "rf.cfg" | |
| 18 #include "fc-target.h" | |
| 19 | |
| 20 //--- RITA PG declaration | |
| 21 | |
| 22 #define R_PG_10 0 | |
| 23 #define R_PG_13 1 | |
| 24 #define R_PG_20 2 // For RFPG 2.2, use 2.0 | |
| 25 #define R_PG_23 3 | |
| 26 | |
| 27 //--- PA declaration | |
| 28 #define PA_MGF9009 0 | |
| 29 #define PA_RF3146 1 | |
| 30 #define PA_RF3133 2 | |
| 31 #define PA_PF08123B 3 | |
| 32 #define PA_AWT6108 4 | |
| 33 | |
| 34 #if (RF_PA == PA_MGF9009 || RF_PA == PA_PF08123B) | |
| 35 #define PA_CTRL_INT 0 | |
| 36 #else | |
| 37 #define PA_CTRL_INT 1 | |
| 38 #endif | |
| 39 | |
| 40 //- Select the RF PG (x10), i.e. 10 for 1.0, 11 for 1.1 or 20 for 2.0 | |
| 41 // AlphaRF7 => "PG #1.3" for TPU purposes (not an official PC number) | |
| 42 // This is also used in l1_rf12.h to select the SWAP_IQ | |
| 43 #if (RF_PG >= R_PG_20) | |
| 44 // TeST - PLL2 WA activation => Set PLL2 Speed-up ON in RX | |
| 45 #define PLL2_WA 0 // 0 => DISABLE the PLL2_WA (Rene's "Work-Around") | |
| 46 #define ALPHA_RF7_WA 0 // 0 => DISABLE the Alpha RF7 work-arounds | |
| 47 #elif (RF_PG == R_PG_13) | |
| 48 // TeST - PLL2 WA activation => Set PLL2 Speed-up ON in RX | |
| 49 #define PLL2_WA 1 // 1 => ENABLE the PLL2_WA (Rene's "Work-Around") | |
| 50 #define ALPHA_RF7_WA 1 // 1 => ENABLE the Alpha RF7 work-arounds | |
| 51 #else | |
| 52 // TeST - PLL2 WA activation => Set PLL2 Speed-up ON in RX | |
| 53 #define PLL2_WA 1 // 1 => ENABLE the PLL2_WA (Rene's "Work-Around") | |
| 54 #define ALPHA_RF7_WA 1 // 1 => ENABLE the Alpha RF7 work-arounds | |
| 55 #endif | |
| 56 | |
| 57 //- Bit definitions for TST register programings, etc | |
| 58 #define BIT_0 0x000001 | |
| 59 #define BIT_1 0x000002 | |
| 60 #define BIT_2 0x000004 | |
| 61 #define BIT_3 0x000008 | |
| 62 #define BIT_4 0x000010 | |
| 63 #define BIT_5 0x000020 | |
| 64 #define BIT_6 0x000040 | |
| 65 #define BIT_7 0x000080 | |
| 66 #define BIT_8 0x000100 | |
| 67 #define BIT_9 0x000200 | |
| 68 #define BIT_10 0x000400 | |
| 69 #define BIT_11 0x000800 | |
| 70 #define BIT_12 0x001000 | |
| 71 #define BIT_13 0x002000 | |
| 72 #define BIT_14 0x004000 | |
| 73 #define BIT_15 0x008000 | |
| 74 #define BIT_16 0x010000 | |
| 75 #define BIT_17 0x020000 | |
| 76 #define BIT_18 0x040000 | |
| 77 #define BIT_19 0x080000 | |
| 78 #define BIT_20 0x100000 | |
| 79 #define BIT_21 0x200000 | |
| 80 #define BIT_22 0x400000 | |
| 81 #define BIT_23 0x800000 | |
| 82 | |
| 83 //--- TRF6151 definitions ------------------------------------------ | |
| 84 | |
| 85 //- BASE REGISTER definitions | |
| 86 #define REG_RX 0x000000 // MODE0 | |
| 87 #define REG_PLL 0x000001 // MODE1 | |
| 88 #define REG_PWR 0x000002 // MODE2 | |
| 89 #define REG_CFG 0x000003 // MODE3 | |
| 90 | |
| 91 //- TeST REGISTER definitions => Used for WA only | |
| 92 // TeST - PLL2 WA => Define PLL2 TEST register | |
| 93 #define TST_PLL2 0x00001E // MODE 14 | |
| 94 | |
| 95 // TeST - Enable Main VCO buffer for test => Define TST_VCO3 register | |
| 96 #define TST_VCO3 0x00000F // MODE 15 (0*16+15*1) | |
| 97 #define TST_VCO4 0x000024 // MODE 36 (2*16+4*1) | |
| 98 | |
| 99 // Alpha RF7 WA TeST registers | |
| 100 #define TST_LDO 0x000027 // MODE 39 (2*16+7*1) | |
| 101 #define TST_PLL1 0x00001D // MODE 29 (1*16+13*1) | |
| 102 #define TST_TX2 0x000037 // MODE 55 (3*16+7*1) | |
| 103 | |
| 104 // More Alpha RF7 WA TeST registers | |
| 105 #define TST_TX3 0x00003C // MODE 61 (3*16+12*1) | |
| 106 #define TST_TX4 0x00003D // MODE 61 (3*16+13*1) | |
| 107 | |
| 108 // PG 2.1 WA TeST registers | |
| 109 #define TST_PLL3 0x00001F // MODE 31 (1*16+15*1) | |
| 110 // #define TST_PLL4 0x00002C // MODE 44 (2*16+12*1) | |
| 111 #define TST_MISC 0x00003E // MODE 62 (3*16+14*1) => Used for setting the VCXO current | |
| 112 #define TST_LO 0x00001C // MODE 28 (1*16+12*1) | |
| 113 | |
| 114 // Registers used to improve the Modulation Spectrum in DCS/PCS for PG2.1 V1 | |
| 115 // UPDATE_SERIAL_REGISTER_COPY is a "dummy addres" that, | |
| 116 // when accessed, triggers the copy of the serial registers. | |
| 117 // This is necessary to switch into "manual operation mode" | |
| 118 #define UPDATE_SERIAL_INTERFACE_COPY 0x000007 | |
| 119 #define TX_LOOP_MANUAL BIT_3 | |
| 120 | |
| 121 | |
| 122 //- REG_RX - MODE0 | |
| 123 #define BLOCK_DETECT_0 BIT_3 | |
| 124 #define BLOCK_DETECT_1 BIT_4 | |
| 125 #define RST_BLOCK_DETECT_0 BIT_5 | |
| 126 #define RST_BLOCK_DETECT_1 BIT_6 | |
| 127 #define READ_EN BIT_7 | |
| 128 #define RX_CAL_MODE BIT_8 | |
| 129 #define RF_GAIN (BIT_10 | BIT_9) | |
| 130 | |
| 131 | |
| 132 //- REG_PLL - MODE1 | |
| 133 //PLL_REGB | |
| 134 //PLL_REGA | |
| 135 | |
| 136 //- REG_PWR - MODE2 | |
| 137 #define BANDGAP_MODE_OFF 0x0 | |
| 138 #define BANDGAP_MODE_ON_ENA BIT_4 | |
| 139 #define BANDGAP_MODE_ON_DIS (BIT_4 | BIT_3) | |
| 140 #define REGUL_MODE_ON BIT_5 | |
| 141 // BIT[8..6] band | |
| 142 #define BAND_SELECT_GSM BIT_6 | |
| 143 #define BAND_SELECT_DCS BIT_7 | |
| 144 #define BAND_SELECT_850_LO BIT_8 | |
| 145 #define BAND_SELECT_850_HI (BIT_8 | BIT_6) | |
| 146 #define BAND_SELECT_PCS (BIT_8 | BIT_7) | |
| 147 | |
| 148 #define SYNTHE_MODE_OFF 0x0 | |
| 149 #define SYNTHE_MODE_RX BIT_9 | |
| 150 #define SYNTHE_MODE_TX BIT_10 | |
| 151 #define RX_MODE_OFF 0x0 | |
| 152 #define RX_MODE_A BIT_11 | |
| 153 #define RX_MODE_B1 BIT_12 | |
| 154 #define RX_MODE_B2 (BIT_12 | BIT_11) | |
| 155 #define TX_MODE_OFF 0x0 | |
| 156 #define TX_MODE_ON BIT_13 | |
| 157 #define PACTRL_APC_OFF 0x0 | |
| 158 #define PACTRL_APC_ON BIT_14 | |
| 159 #define PACTRL_APC_DIS 0x0 | |
| 160 #define PACTRL_APC_ENA BIT_15 | |
| 161 | |
| 162 | |
| 163 //- REG_CFG - MODE3 | |
| 164 // Common PA controller settings: | |
| 165 #define PACTRL_TYPE_PWR 0x0 | |
| 166 #define PACTRL_TYPE_CUR BIT_3 | |
| 167 #define PACTRL_IDIOD_30_UA 0x0 | |
| 168 #define PACTRL_IDIOD_300_UA BIT_4 | |
| 169 | |
| 170 // PA controller Clara-like (Power Sensing) settings: | |
| 171 #define PACTRL_VHOME_610_MV (BIT_7 | BIT_5) | |
| 172 #define PACTRL_VHOME_839_MV (BIT_7 | BIT_5) | |
| 173 #define PACTRL_VHOME_1000_MV (BIT_6 | BIT_9) | |
| 174 #define PACTRL_VHOME_1600_MV (BIT_8 | BIT_5) | |
| 175 #define PACTRL_RES_OPEN 0x0 | |
| 176 #define PACTRL_RES_150_K BIT_10 | |
| 177 #define PACTRL_RES_300_K BIT_11 | |
| 178 #define PACTRL_RES_NU (BIT_10 | BIT_11) | |
| 179 #define PACTRL_CAP_0_PF 0x0 | |
| 180 #define PACTRL_CAP_12_5_PF BIT_12 | |
| 181 #define PACTRL_CAP_25_PF (BIT_13 | BIT_12) | |
| 182 #define PACTRL_CAP_50_PF BIT_13 | |
| 183 | |
| 184 // PACTRL_CFG contains the configuration of the PACTRL that will | |
| 185 // be put into the REG_CFG register at initialization time | |
| 186 // WARNING - Do not forget to set the PACTRL_TYPE (PWR or CUR) | |
| 187 // in this #define!!! | |
| 188 #if (RF_PA == 0) // MGF9009 (LCPA) | |
| 189 #define PACTRL_CFG \ | |
| 190 PACTRL_IDIOD_300_UA | \ | |
| 191 PACTRL_CAP_25_PF | \ | |
| 192 PACTRL_VHOME_1000_MV | \ | |
| 193 PACTRL_RES_300_K | |
| 194 #elif (RF_PA == 1) // 3146 | |
| 195 #define PACTRL_CFG 0 | |
| 196 | |
| 197 #elif (RF_PA == 2) // 3133 | |
| 198 #define PACTRL_CFG 0 | |
| 199 | |
| 200 #elif (RF_PA == 3) // PF08123B | |
| 201 #define PACTRL_CFG \ | |
| 202 PACTRL_TYPE_PWR | \ | |
| 203 PACTRL_CAP_50_PF | \ | |
| 204 PACTRL_RES_300_K | \ | |
| 205 PACTRL_VHOME_610_MV | |
| 206 #elif (RF_PA == 4) // AWT6108 | |
| 207 #define PACTRL_CFG 0 | |
| 208 #else | |
| 209 #error Unknown PA specifiec! | |
| 210 #endif | |
| 211 | |
| 212 // Temperature sensor | |
| 213 #define TEMP_SENSOR_OFF 0x0 | |
| 214 #define TEMP_SENSOR_ON BIT_14 | |
| 215 // Internal Logic Init Disable | |
| 216 #define ILOGIC_INIT_DIS BIT_15 | |
| 217 // ILOGIC_INIT_DIS must be ALWAYS set when programming the REG_CFG register | |
| 218 // It was introduced in PG 1.2 | |
| 219 // For previous PGs this BIT was unused, so it can be safelly programmed | |
| 220 // for all PGs | |
| 221 | |
| 222 | |
| 223 // RF signals connected to TSPACT [0..7] | |
| 224 | |
| 225 #ifdef CONFIG_TARGET_PIRELLI | |
| 226 #define RF_RESET_LINE BIT_5 | |
| 227 #else | |
| 228 #define RF_RESET_LINE BIT_0 | |
| 229 #endif | |
| 230 | |
| 231 #define RF_SER_ON RF_RESET_LINE | |
| 232 #define RF_SER_OFF 0 | |
| 233 | |
| 234 #define TEST_TX_ON 0 | |
| 235 #define TEST_RX_ON 0 | |
| 236 | |
| 237 #if defined(CONFIG_TARGET_LEONARDO) || defined(CONFIG_TARGET_ESAMPLE) || \ | |
| 238 defined(CONFIG_TARGET_TANGO) | |
| 239 | |
| 240 // 4-band config (E-sample, P2, Leonardo) | |
| 241 #define FEM_7 BIT_2 // act2 | |
| 242 #define FEM_8 BIT_1 // act1 | |
| 243 #define FEM_9 BIT_4 // act4 | |
| 244 | |
| 245 #define PA_HI_BAND BIT_3 // act3 | |
| 246 #define PA_LO_BAND 0 | |
| 247 #define PA_OFF 0 | |
| 248 | |
| 249 #define FEM_PINS (FEM_7 | FEM_8 | FEM_9) | |
| 250 | |
| 251 #define FEM_OFF ( FEM_PINS ^ 0 ) | |
| 252 | |
| 253 #define FEM_SLEEP ( 0 ) | |
| 254 | |
| 255 // This configuration is always inverted. | |
| 256 | |
| 257 // RX_UP/DOWN and TX_UP/DOWN | |
| 258 #define RU_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 259 #define RD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 260 #define TU_900 ( PA_LO_BAND | FEM_PINS ^ FEM_7 ) | |
| 261 #define TD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 262 | |
| 263 #define RU_850 ( PA_OFF | FEM_PINS ^ FEM_9 ) | |
| 264 #define RD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 265 #define TU_850 ( PA_LO_BAND | FEM_PINS ^ FEM_7 ) | |
| 266 #define TD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 267 | |
| 268 #define RU_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 269 #define RD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 270 #define TU_1800 ( PA_HI_BAND | FEM_PINS ^ FEM_8 ) | |
| 271 #define TD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 272 | |
| 273 #define RU_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 274 #define RD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 275 #define TU_1900 ( PA_HI_BAND | FEM_PINS ^ FEM_8 ) | |
| 276 #define TD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 277 | |
| 278 #elif defined(CONFIG_TARGET_GTAMODEM) | |
| 279 | |
| 280 // Openmoko's triband configuration is a bastardized version | |
| 281 // of TI's quadband one from Leonardo/E-Sample | |
| 282 | |
| 283 #define FEM_7 BIT_2 // act2 | |
| 284 #define FEM_8 BIT_1 // act1 | |
| 285 #define FEM_9 BIT_4 // act4 | |
| 286 | |
| 287 #define PA_HI_BAND BIT_3 // act3 | |
| 288 #define PA_LO_BAND 0 | |
| 289 #define PA_OFF 0 | |
| 290 | |
| 291 #define FEM_PINS (FEM_7 | FEM_8 | FEM_9) | |
| 292 | |
| 293 #define FEM_OFF ( FEM_PINS ^ 0 ) | |
| 294 | |
| 295 #define FEM_SLEEP ( 0 ) | |
| 296 | |
| 297 // This configuration is always inverted. | |
| 298 | |
| 299 // RX_UP/DOWN and TX_UP/DOWN | |
| 300 #define RU_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 301 #define RD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 302 #define TU_900 ( PA_LO_BAND | FEM_PINS ^ FEM_9 ) | |
| 303 #define TD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 304 | |
| 305 #define RU_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 306 #define RD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 307 #define TU_850 ( PA_LO_BAND | FEM_PINS ^ FEM_9 ) | |
| 308 #define TD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 309 | |
| 310 #define RU_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 311 #define RD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 312 #define TU_1800 ( PA_HI_BAND | FEM_PINS ^ FEM_7 ) | |
| 313 #define TD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 314 | |
| 315 #define RU_1900 ( PA_OFF | FEM_PINS ^ FEM_8 ) | |
| 316 #define RD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 317 #define TU_1900 ( PA_HI_BAND | FEM_PINS ^ FEM_7 ) | |
| 318 #define TD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 319 | |
| 320 #elif defined(CONFIG_TARGET_FCFAM) | |
| 321 | |
| 322 /* | |
| 323 * In our FreeCalypso hw family, we would like to be able to use | |
| 324 * both triband and quadband RFFEs. Our current FCDEV3B is triband, | |
| 325 * copied from Openmoko, and the same is expected to be the case for | |
| 326 * future low-budget designs, but if someone pays for a new RF layout, | |
| 327 * we can use a quadband RFFE instead. If we ever have two different | |
| 328 * hw platforms or variants that differ in the RFFE but are otherwise | |
| 329 * firmware-compatible, we would like to have the same fw build | |
| 330 * work with both triband and quadband RFFEs. How is it possible? | |
| 331 * The trick is that we define our set of TSPACT RFFE control signals | |
| 332 * starting with our current OM-based triband version, and add one | |
| 333 * more signal to support potential future quadband designs. | |
| 334 */ | |
| 335 | |
| 336 #define FEM_RX_1900 BIT_1 // act1 | |
| 337 #define FEM_TX_HIGH BIT_2 // act2 | |
| 338 #define FEM_TX_LOW BIT_4 // act4 | |
| 339 #define FEM_RX_850 BIT_5 // act5 | |
| 340 | |
| 341 #define PA_HI_BAND BIT_3 // act3 | |
| 342 #define PA_LO_BAND 0 | |
| 343 #define PA_OFF 0 | |
| 344 | |
| 345 #define FEM_PINS (FEM_TX_LOW | FEM_TX_HIGH | FEM_RX_850 | FEM_RX_1900) | |
| 346 | |
| 347 #define FEM_OFF ( FEM_PINS ^ 0 ) | |
| 348 | |
| 349 #define FEM_SLEEP ( 0 ) | |
| 350 | |
| 351 // This configuration is always inverted. | |
| 352 | |
| 353 // RX_UP/DOWN and TX_UP/DOWN | |
| 354 #define RU_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 355 #define RD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 356 #define TU_900 ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW ) | |
| 357 #define TD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 358 | |
| 359 #define RU_850 ( PA_OFF | FEM_PINS ^ FEM_RX_850 ) | |
| 360 #define RD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 361 #define TU_850 ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW ) | |
| 362 #define TD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 363 | |
| 364 #define RU_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 365 #define RD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 366 #define TU_1800 ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH ) | |
| 367 #define TD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 368 | |
| 369 #define RU_1900 ( PA_OFF | FEM_PINS ^ FEM_RX_1900 ) | |
| 370 #define RD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 371 #define TU_1900 ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH ) | |
| 372 #define TD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 373 | |
| 374 #elif defined(CONFIG_TARGET_MGC2GSMT) | |
| 375 | |
| 376 /* | |
| 377 * The common MGC2GSMT version of Huawei GTM900-B is very closely based | |
| 378 * on Leonardo (2-band version), but the two FEM Tx control signals | |
| 379 * are reversed. | |
| 380 */ | |
| 381 | |
| 382 #define FEM_TX_LOW BIT_1 // act1 | |
| 383 #define FEM_TX_HIGH BIT_2 // act2 | |
| 384 | |
| 385 #define PA_HI_BAND BIT_3 // act3 | |
| 386 #define PA_LO_BAND 0 | |
| 387 #define PA_OFF 0 | |
| 388 | |
| 389 #define FEM_PINS (FEM_TX_LOW | FEM_TX_HIGH) | |
| 390 | |
| 391 #define FEM_OFF ( FEM_PINS ^ 0 ) | |
| 392 | |
| 393 #define FEM_SLEEP ( 0 ) | |
| 394 | |
| 395 // This configuration is always inverted. | |
| 396 | |
| 397 // RX_UP/DOWN and TX_UP/DOWN | |
| 398 #define RU_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 399 #define RD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 400 #define TU_900 ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW ) | |
| 401 #define TD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 402 | |
| 403 #define RU_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 404 #define RD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 405 #define TU_850 ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW ) | |
| 406 #define TD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 407 | |
| 408 #define RU_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 409 #define RD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 410 #define TU_1800 ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH ) | |
| 411 #define TD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 412 | |
| 413 #define RU_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 414 #define RD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 415 #define TU_1900 ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH ) | |
| 416 #define TD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 417 | |
| 418 #elif defined(CONFIG_TARGET_PIRELLI) | |
| 419 | |
| 420 #define ANTSW_RX_PCS BIT_4 | |
| 421 #define ANTSW_TX_HIGH BIT_10 | |
| 422 #define ANTSW_TX_LOW BIT_11 | |
| 423 | |
| 424 #define PA_HI_BAND BIT_3 // act3 | |
| 425 #define PA_LO_BAND 0 | |
| 426 #define PA_OFF 0 | |
| 427 | |
| 428 #define PA_ENABLE BIT_0 | |
| 429 | |
| 430 // Pirelli uses a non-inverting buffer | |
| 431 | |
| 432 #define FEM_OFF ( 0 ) | |
| 433 | |
| 434 #define FEM_SLEEP ( 0 ) | |
| 435 | |
| 436 // RX_UP/DOWN and TX_UP/DOWN (triband) | |
| 437 #define RU_900 ( PA_OFF | 0 ) | |
| 438 #define RD_900 ( PA_OFF | 0 ) | |
| 439 #define TU_900 ( PA_LO_BAND | ANTSW_TX_LOW ) | |
| 440 #define TD_900 ( PA_OFF | 0 ) | |
| 441 | |
| 442 #define RU_850 ( PA_OFF | 0 ) | |
| 443 #define RD_850 ( PA_OFF | 0 ) | |
| 444 #define TU_850 ( PA_LO_BAND | ANTSW_TX_LOW ) | |
| 445 #define TD_850 ( PA_OFF | 0 ) | |
| 446 | |
| 447 #define RU_1800 ( PA_OFF | 0 ) | |
| 448 #define RD_1800 ( PA_OFF | 0 ) | |
| 449 #define TU_1800 ( PA_HI_BAND | ANTSW_TX_HIGH ) | |
| 450 #define TD_1800 ( PA_OFF | 0 ) | |
| 451 | |
| 452 #define RU_1900 ( PA_OFF | ANTSW_RX_PCS ) | |
| 453 #define RD_1900 ( PA_OFF | 0 ) | |
| 454 #define TU_1900 ( PA_HI_BAND | ANTSW_TX_HIGH ) | |
| 455 #define TD_1900 ( PA_OFF | 0 ) | |
| 456 | |
| 457 #elif defined(CONFIG_TARGET_COMPAL) | |
| 458 | |
| 459 #define PA_HI_BAND BIT_8 // act8 | |
| 460 #define PA_LO_BAND 0 | |
| 461 #define PA_OFF 0 | |
| 462 | |
| 463 #define PA_ENABLE BIT_1 | |
| 464 | |
| 465 // FEM control signals are active low | |
| 466 #define FEM_PINS (BIT_6 | BIT_2) | |
| 467 | |
| 468 #define FEM_OFF ( FEM_PINS ^ 0 ) | |
| 469 | |
| 470 #define FEM_SLEEP ( 0 ) | |
| 471 | |
| 472 #define FEM_TX_HIGH BIT_6 | |
| 473 #if USE_TSPACT2_FOR_TXLOW | |
| 474 #define FEM_TX_LOW BIT_2 | |
| 475 #else | |
| 476 #define FEM_TX_LOW BIT_6 | |
| 477 #endif | |
| 478 | |
| 479 // RX_UP/DOWN and TX_UP/DOWN | |
| 480 #define RU_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 481 #define RD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 482 #define TU_900 ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW ) | |
| 483 #define TD_900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 484 | |
| 485 #define RU_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 486 #define RD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 487 #define TU_850 ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW ) | |
| 488 #define TD_850 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 489 | |
| 490 #define RU_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 491 #define RD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 492 #define TU_1800 ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH ) | |
| 493 #define TD_1800 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 494 | |
| 495 #define RU_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 496 #define RD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 497 #define TU_1900 ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH ) | |
| 498 #define TD_1900 ( PA_OFF | FEM_PINS ^ 0 ) | |
| 499 | |
| 500 #endif // FreeCalypso target selection | |
| 501 | |
| 502 #define TC1_DEVICE_ABB TC1_DEVICE0 // TSPEN0 | |
| 503 #ifdef CONFIG_TARGET_PIRELLI | |
| 504 #define TC1_DEVICE_RF TC1_DEVICE1 // TSPEN1 | |
| 505 #else | |
| 506 #define TC1_DEVICE_RF TC1_DEVICE2 // TSPEN2 | |
| 507 #endif | |
| 508 | |
| 509 | |
| 510 //--- TIMINGS ---------------------------------------------------------- | |
| 511 | |
| 512 /*------------------------------------------*/ | |
| 513 /* Download delay values */ | |
| 514 /*------------------------------------------*/ | |
| 515 // 1 qbit = 12/13 usec (~0.9230769), i.e. 200 usec is ~ 217 qbit (200 * 13 / 12) | |
| 516 | |
| 517 #define T TPU_CLOCK_RANGE | |
| 518 | |
| 519 | |
| 520 // - TPU instruction into TSP timings --- | |
| 521 // 1 tpu instruction = 1 qbit | |
| 522 #define DLT_1 1 // 1 tpu instruction = 1 qbit | |
| 523 #define DLT_2 2 // 2 tpu instruction = 2 qbit | |
| 524 #define DLT_3 3 // 3 tpu instruction = 3 qbit | |
| 525 #define DLT_4 4 // 4 tpu instruction = 4 qbit | |
| 526 #define SL_SU_DELAY2 DLT_3 // Needed to compile with old l1_rf12 | |
| 527 | |
| 528 // - Serialization timings --- | |
| 529 // The following values where calculated with Katrin Matthes... | |
| 530 //#define SL_7 3 // To send 7 bits to the ABB, 14*T (1/6.5MHz) are needed, | |
| 531 // // i.e. 14 / 6 qbit = 2.333 ~ 3 qbit | |
| 532 //#define SL_2B 6 // To send 2 bytes to the RF, 34*T (1/6.5MHz) are needed, | |
| 533 // // i.e. 34 / 6 qbit = 5.7 ~ 6 qbit | |
| 534 // ... while the following values are based on the HYP004.doc document | |
| 535 #define SL_7 2 // To send 7 bits to the ABB, 12*T (1/6.5MHz) are needed, | |
| 536 // i.e. 12 / 6 qbit = 2 qbit | |
| 537 #define SL_2B 4 // To send 2 bytes to the RF, 21*T (1/6.5MHz) are needed, | |
| 538 // i.e. 21 / 6 qbit = 3.5 ~ 4 qbit | |
| 539 | |
| 540 // - TPU command execution + serialization length --- | |
| 541 #define DLT_1B 4 // 3*move + serialization of 7 bits | |
| 542 #define DLT_2B 7 // 4*move + serialization of 2 bytes | |
| 543 //#define DLT_1B DLT_3 + SL_7 // 3*move + serialization of 7 bits | |
| 544 //#define DLT_2B DLT_4 + SL_2B // 4*move + serialization of 2 bytes | |
| 545 | |
| 546 | |
| 547 // - INIT (delta or DLT) timings --- | |
| 548 #define DLT_I1 5 // Time required to set EN high before RF_SER_OFF -> RF_SER_ON | |
| 549 #define DLT_I2 8 // Time required to set RF_SER_OFF | |
| 550 #define DLT_I3 5 // Time required to set RF_SER_ON | |
| 551 #define DLT_I4 110 // Regulator Turn-ON time | |
| 552 | |
| 553 | |
| 554 // - tdt & rdt --- | |
| 555 // MAX GSM (not GPRS) rdt and tdt values are... | |
| 556 //#define rdt 380 // MAX GSM rx delta timing | |
| 557 //#define tdt 400 // MAX GSM tx delta timing | |
| 558 // but current rdt and tdt values are... | |
| 559 #define rdt 0 // rx delta timing | |
| 560 #define tdt 0 // tx delta timing | |
| 561 | |
| 562 // - RX timings --- | |
| 563 // - RX down: | |
| 564 // The times below are offsets to when BDLENA goes down | |
| 565 #define TRF_R10 ( 0 - DLT_1B ) // disable BDLENA & BDLON -> power DOWN ABB (end of RX burst), needs DLT_1B to execute | |
| 566 #define TRF_R9 ( - 30 - DLT_2B ) // disable RF SWITCH, power DOWN Rita (go to Idle2 mode) | |
| 567 | |
| 568 // - RX up: | |
| 569 // The times below are offsets to when BDLENA goes high | |
| 570 // Burst data comes here | |
| 571 #define TRF_R8 ( PROVISION_TIME - 0 - DLT_1B ) // enable BDLENA, disable BDLCAL (I/Q comes 32qbit later) | |
| 572 #define TRF_R7 ( PROVISION_TIME - 7 - DLT_1 ) // enable RF SWITCH | |
| 573 #define TRF_R6 ( PROVISION_TIME - 67 - DLT_1B ) // enable BDLCAL -> ABB DL filter init | |
| 574 #define TRF_R5 ( PROVISION_TIME - 72 - DLT_1B ) // enable BDLON -> power ON ABB DL path | |
| 575 #define TRF_R4 ( PROVISION_TIME - 76 - DLT_2B - rdt ) // power ON RX | |
| 576 #define TRF_R3 (PROVISION_TIME - 143 - DLT_2B - rdt ) // select the AGC & LNA gains + start DC offset calibration (stops automatically) | |
| 577 //l1dmacro_adc_read_rx() called here requires ~ 16 tpuinst | |
| 578 #define TRF_R2 (PROVISION_TIME - 198 - DLT_2B - rdt ) // set BAND + power ON RX Synth | |
| 579 #define TRF_R1 (PROVISION_TIME - 208 - DLT_2B - rdt ) // set RX Synth channel | |
| 580 | |
| 581 // - TX timings --- | |
| 582 // - TX down: | |
| 583 // The times below are offsets to when BULENA goes down | |
| 584 | |
| 585 #if (PA_CTRL_INT == 1) | |
| 586 #define TRF_T13 ( 35 - DLT_1B ) // right after, BULON low | |
| 587 #define TRF_T12_5 ( 32 - DLT_2B ) // Power OFF TX loop => power down RF. | |
| 588 #define TRF_T12_3 ( 23 - DLT_1 ) // Disable TXEN. | |
| 589 #endif | |
| 590 | |
| 591 #if (PA_CTRL_INT == 0) | |
| 592 #define TRF_T13 ( 35 - DLT_1B ) // right after, BULON low | |
| 593 #define TRF_T12_2 ( 32 - DLT_2B ) // power down RF step 2 | |
| 594 #define TRF_T12 ( 18 - DLT_2B ) // power down RF step 1 | |
| 595 #endif | |
| 596 | |
| 597 #define TRF_T11 ( 0 - DLT_1B ) // disable BULENA -> end of TX burst | |
| 598 #define TRF_T10_5 ( - 40 - DLT_1B ) // ADC read | |
| 599 | |
| 600 // - TX up: | |
| 601 // The times below are offsets to when BULENA goes high | |
| 602 //burst data comes here | |
| 603 #define TRF_T10_4 ( 22 - DLT_1 ) // enable RF SWITCH + TXEN | |
| 604 #define TRF_T10 ( 17 - DLT_1 ) // enable RF SWITCH | |
| 605 | |
| 606 #if (PA_CTRL_INT == 0) | |
| 607 #define TRF_T9 ( 8 - DLT_2B ) // enable PACTRL | |
| 608 #endif | |
| 609 | |
| 610 #define TRF_T8 ( - 0 - DLT_1B ) // enable BULENA -> start of TX burst | |
| 611 #define TRF_T7 ( - 50 - DLT_1B - tdt ) // disable BULCAL -> stop ABB UL calibration | |
| 612 #define TRF_T6 ( - 130 - DLT_1B - tdt ) // enable BULCAL -> start ABB UL calibration | |
| 613 #define TRF_T5 ( - 158 - DLT_2B - tdt ) // power ON TX | |
| 614 #define TRF_T4 ( - 190 - DLT_1B - tdt ) // enable BULON -> power ON ABB UL path | |
| 615 // TRF_T3_MAN_1, TRF_T3_MAN_2 & TRF_T3_MAN_3 are only executed in DCS for PG 2.0 and above | |
| 616 #define TRF_T3_MAN_3 ( - 239 - DLT_2B - tdt ) // PG2.1: Set the right TX loop charge pump current for DCS & PCS | |
| 617 #define TRF_T3_MAN_2 ( - 249 - DLT_2B - tdt ) // PG2.1: Go into "TX Manual mode" | |
| 618 #define TRF_T3_MAN_1 ( - 259 - DLT_2B - tdt ) // PG2.1: IN DCS, use manual mode: Copy Serial Interface Registers for "Manual operation" | |
| 619 #define TRF_T3 ( - 259 - DLT_2B - tdt ) // PG2.1: In GSM & PCS go to "Automatic TX mode" | |
| 620 #define TRF_T2 ( - 269 - DLT_2B - tdt ) // PG2.0: set BAND + Power ON Main TX PLL + PACTRL ON | |
| 621 #define TRF_T1 ( - 279 - DLT_2B - tdt ) // set TX Main PLL channel | |
| 622 |
