make sure all channels in one BTS use the same TSC (training sequence code)

diff --git a/include/openbsc/gsm_data.h b/include/openbsc/gsm_data.h
index 1179152..b4ea227 100644
--- a/include/openbsc/gsm_data.h
+++ b/include/openbsc/gsm_data.h
@@ -14,6 +14,7 @@
 #define TS_MAX_LCHAN	8
 
 #define HARDCODED_ARFCN 123
+#define HARDCODED_TSC	7
 
 enum gsm_hooks {
 	GSM_HOOK_NM_SWLOAD,
@@ -272,6 +273,8 @@
 	u_int8_t nr;
 	/* location area code of this BTS */
 	u_int8_t location_area_code;
+	/* Training Sequence Code */
+	u_int8_t tsc;
 	/* type of BTS */
 	enum gsm_bts_type type;
 	/* how do we talk OML with this TRX? */
diff --git a/src/abis_rsl.c b/src/abis_rsl.c
index b56a47c..8df109c 100644
--- a/src/abis_rsl.c
+++ b/src/abis_rsl.c
@@ -424,9 +424,10 @@
 		return -1;
 	}
 
+	memset(&ci, 0, sizeof(ci));
 	ci.chan_desc.iei = 0x64;
 	ci.chan_desc.chan_nr = chan_nr;
-	ci.chan_desc.oct3 = (TSC << 5) | ((arfcn & 0x3ff) >> 8);
+	ci.chan_desc.oct3 = (lchan->ts->trx->bts->tsc << 5) | ((arfcn & 0x3ff) >> 8);
 	ci.chan_desc.oct4 = arfcn & 0xff;
 
 	dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
diff --git a/src/gsm_04_08.c b/src/gsm_04_08.c
index 0549076..574e6c1 100644
--- a/src/gsm_04_08.c
+++ b/src/gsm_04_08.c
@@ -622,6 +622,7 @@
 	/* fill the channel information element, this code
 	 * should probably be shared with rsl_rx_chan_rqd() */
 	cmm->chan_desc.chan_nr = lchan2chan_nr(lchan);
+	cmm->chan_desc.h0.tsc = lchan->ts->trx->bts->tsc;
 	cmm->chan_desc.h0.h = 0;
 	cmm->chan_desc.h0.arfcn_high = arfcn >> 8;
 	cmm->chan_desc.h0.arfcn_low = arfcn & 0xff;
diff --git a/src/gsm_data.c b/src/gsm_data.c
index d0ce168..e6447d9 100644
--- a/src/gsm_data.c
+++ b/src/gsm_data.c
@@ -108,6 +108,7 @@
 		bts->network = net;
 		bts->nr = i;
 		bts->type = bts_type;
+		bts->tsc = HARDCODED_TSC;
 
 		for (j = 0; j < BTS_MAX_TRX; j++) {
 			struct gsm_bts_trx *trx = &bts->trx[j];