aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-10-04 19:45:19 +0200
committerHarald Welte <laforge@gnumonks.org>2013-10-04 19:58:14 +0200
commitb469e7314860794aebd904ebc4a63f877c01c3fc (patch)
treea2a3b421fdc89aa7ce25b6592369dc298b8b61e9
parent33fe4ca97b25a9c58d89829dba791ca1ba8b5cdd (diff)
Use GPS as default clock source on sysmoBTS 2050
-rw-r--r--src/osmo-bts-sysmo/Makefile.am2
-rw-r--r--src/osmo-bts-sysmo/l1_if.c37
-rw-r--r--src/osmo-bts-sysmo/l1_if.h5
3 files changed, 41 insertions, 3 deletions
diff --git a/src/osmo-bts-sysmo/Makefile.am b/src/osmo-bts-sysmo/Makefile.am
index 908a5b63..1fe17eea 100644
--- a/src/osmo-bts-sysmo/Makefile.am
+++ b/src/osmo-bts-sysmo/Makefile.am
@@ -9,7 +9,7 @@ EXTRA_DIST = misc/sysmobts_mgr.h misc/sysmobts_misc.h misc/sysmobts_par.h \
bin_PROGRAMS = sysmobts sysmobts-remote l1fwd-proxy sysmobts-mgr sysmobts-util
COMMON_SOURCES = main.c femtobts.c l1_if.c oml.c sysmobts_vty.c tch.c hw_misc.c calib_file.c \
- eeprom.c calib_fixup.c utils.c
+ eeprom.c calib_fixup.c utils.c misc/sysmobts_par.c
sysmobts_SOURCES = $(COMMON_SOURCES) l1_transp_hw.c
sysmobts_LDADD = $(top_builddir)/src/common/libbts.a $(LDADD)
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index e16bb497..0af1014c 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -57,6 +57,7 @@
#include "l1_if.h"
#include "l1_transp.h"
#include "hw_misc.h"
+#include "misc/sysmobts_par.h"
extern int pcu_direct;
@@ -1243,6 +1244,29 @@ int l1if_pdch_req(struct gsm_bts_trx_ts *ts, int is_ptcch, uint32_t fn,
return 0;
}
+/* get those femtol1_hdl.hw_info elements that sre in EEPROM */
+static int get_hwinfo_eeprom(struct femtol1_hdl *fl1h)
+{
+ int val, rc;
+
+ rc = sysmobts_par_get_int(SYSMOBTS_PAR_MODEL_NR, &val);
+ if (rc < 0)
+ return rc;
+ fl1h->hw_info.model_nr = val;
+
+ rc = sysmobts_par_get_int(SYSMOBTS_PAR_MODEL_FLAGS, &val);
+ if (rc < 0)
+ return rc;
+ fl1h->hw_info.model_flags = val;
+
+ rc = sysmobts_par_get_int(SYSMOBTS_PAR_TRX_NR, &val);
+ if (rc < 0)
+ return rc;
+ fl1h->hw_info.trx_nr = val;
+
+ return 0;
+}
+
struct femtol1_hdl *l1if_open(void *priv)
{
struct femtol1_hdl *fl1h;
@@ -1271,9 +1295,18 @@ struct femtol1_hdl *l1if_open(void *priv)
fl1h->ul_power_target = -75; /* dBm default */
fl1h->min_qual_rach = MIN_QUAL_RACH;
fl1h->min_qual_norm = MIN_QUAL_NORM;
- /* default clock source: OCXO */
+ get_hwinfo_eeprom(fl1h);
#if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(2,1,0)
- fl1h->clk_src = SuperFemto_ClkSrcId_Ocxo;
+ if (fl1h->hw_info.model_nr == 2050) {
+ /* On the sysmoBTS 2050, we don't have an OCXO but
+ * always slave our clock to the GPS receiver */
+ fl1h->clk_src = SuperFemto_ClkSrcId_GpsPps;
+ LOGP(DL1C, LOGL_INFO, "Clock source defaulting to GPS 1PPS "
+ "on sysmoBTS 2050\n");
+ } else {
+ /* default clock source: OCXO */
+ fl1h->clk_src = SuperFemto_ClkSrcId_Ocxo;
+ }
#else
fl1h->clk_src = SF_CLKSRC_OCXO;
#endif
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
index cf8af7b9..8d63569f 100644
--- a/src/osmo-bts-sysmo/l1_if.h
+++ b/src/osmo-bts-sysmo/l1_if.h
@@ -63,9 +63,14 @@ struct femtol1_hdl {
struct osmo_wqueue write_q[_NUM_MQ_WRITE];
struct {
+ /* from DSP/FPGA after L1 Init */
uint8_t dsp_version[3];
uint8_t fpga_version[3];
uint32_t band_support; /* bitmask of GSM_BAND_* */
+ /* from EEPROM */
+ uint16_t model_nr;
+ uint16_t model_flags;
+ uint8_t trx_nr;
} hw_info;
int fixup_needed;