Index: bcm430x_radio.c
===================================================================
--- bcm430x_radio.c	(Revision 350)
+++ bcm430x_radio.c	(Arbeitskopie)
@@ -111,9 +111,7 @@
 	/*TODO*/
 }
 
-static void bcm430x_calc_nrssi_threshold(struct bcm430x_private *bcm);
-
-s16 bcm430x_calc_nrssi_slope(struct bcm430x_private *bcm)
+void bcm430x_calc_nrssi_slope(struct bcm430x_private *bcm)
 {
 	/*FIXME: We are not completely sure, if the nrssi values are really s16.
 	 *       We have to check by testing, if the values and the u16 to s16 casts are correct.
@@ -126,7 +124,6 @@
 
 	switch (bcm->current_core->phy->type) {
 	case BCM430x_PHYTYPE_B:
-//TODO: review
 		backup[0] = bcm430x_radio_read16(bcm, 0x007A);
 		backup[1] = bcm430x_radio_read16(bcm, 0x0052);
 		backup[2] = bcm430x_radio_read16(bcm, 0x0043);
@@ -193,7 +190,7 @@
 		slope = nrssi0 - nrssi1;
 		if (slope == 0)
 			slope = 64;
-		slope = 0x400000 / slope;
+		bcm->current_core->radio->nrssislope = 0x400000 / slope;
 
 		if (nrssi0 <= -4) {
 			bcm->current_core->radio->nrssi[0] = nrssi0;
@@ -201,7 +198,6 @@
 		}
 		break;
 	case BCM430x_PHYTYPE_G:
-//TODO review
 		backup[0] = bcm430x_radio_read16(bcm, 0x007A);
 		backup[1] = bcm430x_radio_read16(bcm, 0x0052);
 		backup[2] = bcm430x_radio_read16(bcm, 0x0043);
@@ -269,7 +265,7 @@
 		slope = nrssi0 - nrssi1;
 		if (slope == 0)
 			slope = 64;
-		slope = 0x400000 / slope;
+		bcm->current_core->radio->nrssislope = 0x400000 / slope;
 
 		if (nrssi0 > -5) {
 			bcm->current_core->radio->nrssi[0] = nrssi1;
@@ -307,11 +303,9 @@
 	default:
 		assert(0);
 	}
-
-	return slope;
 }
 
-static void bcm430x_calc_nrssi_threshold(struct bcm430x_private *bcm)
+void bcm430x_calc_nrssi_threshold(struct bcm430x_private *bcm)
 {
 	s16 threshold;
 	s16 a, b;
@@ -714,7 +708,7 @@
 u16 bcm430x_radio_init2050(struct bcm430x_private *bcm)
 {
 	u16 backup[13];
-	u16 reg78 = 0, ret;
+	u16 ret;
 	u16 i, j;
 	u32 tmp1 = 0, tmp2 = 0;
 
@@ -865,9 +859,7 @@
 		}
 	}
 	if (i >= 15) {
-//		ret = bcm430x_radio_read16(bcm, 0x0078);
-		//FIXME: I guess the following is correct, instead of reading the register again:
-		ret = reg78;
+		ret = bcm430x_radio_read16(bcm, 0x0078);
 	}
 
 	return ret;
Index: bcm430x_phy.c
===================================================================
--- bcm430x_phy.c	(Revision 350)
+++ bcm430x_phy.c	(Arbeitskopie)
@@ -428,7 +428,7 @@
 			bcm430x_phy_write(bcm, 0x002A, 0x08A3);
 		}
 
-		bcm->current_core->phy->minlowsig1 = 0xFFFF;
+		bcm->current_core->phy->minlowsig[0] = 0xFFFF;
 
 		for (i=0; i<4; i++) {
 			bcm430x_radio_write16(bcm, 0x0052, radio_regs[0] | i);
@@ -437,14 +437,14 @@
 		for (i=0; i<10; i++) {
 			bcm430x_radio_write16(bcm, 0x0052, radio_regs[0] | i);
 			mls = bcm430x_phy_mls_r15_loop(bcm)/10;
-			if (mls < bcm->current_core->phy->minlowsig1) {
-				bcm->current_core->phy->minlowsig1 = mls;
-				bcm->current_core->phy->minlowsigpos1 = i;
+			if (mls < bcm->current_core->phy->minlowsig[0]) {
+				bcm->current_core->phy->minlowsig[0] = mls;
+				bcm->current_core->phy->minlowsigpos[0] = i;
 			}
 		}
-		bcm430x_radio_write16(bcm, 0x0052, radio_regs[0] | bcm->current_core->phy->minlowsigpos1);
+		bcm430x_radio_write16(bcm, 0x0052, radio_regs[0] | bcm->current_core->phy->minlowsigpos[0]);
 
-		bcm->current_core->phy->minlowsig2 = 0xFFFF;
+		bcm->current_core->phy->minlowsig[1] = 0xFFFF;
 
 		for (i=-4;i<5;i+=2) {
 			for (j=-4;j<5;j+=2) {
@@ -455,13 +455,13 @@
 				}
 				bcm430x_phy_write(bcm, 0x002F, fval);
 				mls = bcm430x_phy_mls_r15_loop(bcm)/10;
-				if (mls < bcm->current_core->phy->minlowsig2) {
-					bcm->current_core->phy->minlowsig2 = mls;
-					bcm->current_core->phy->minlowsigpos2 = fval;
+				if (mls < bcm->current_core->phy->minlowsig[1]) {
+					bcm->current_core->phy->minlowsig[1] = mls;
+					bcm->current_core->phy->minlowsigpos[1] = fval;
 				}
 			}
 		}
-		bcm430x_phy_write(bcm, 0x002F, bcm->current_core->phy->minlowsigpos2+0x0101);
+		bcm430x_phy_write(bcm, 0x002F, bcm->current_core->phy->minlowsigpos[1]+0x0101);
 		if (bcm->current_core->radio->id == 0x2053) {
 			bcm430x_phy_write(bcm, 0x000A, phy_regs[1]);
 			bcm430x_phy_write(bcm, 0x002A, phy_regs[2]);
@@ -1122,8 +1122,8 @@
 		bcm430x_phy_write(bcm, 0x002A, 0x88C2);
 	bcm430x_radio_set_txpower_b(bcm, 0xFFFF, 0xFFFF, 0xFFFF);
 	if (bcm->sprom.boardflags & BCM430x_BFL_RSSI) {
-		//FIXME: FuncPlaceholder
-		//FIXME: FuncPlaceholder
+		bcm430x_calc_nrssi_slope(bcm);
+		bcm430x_calc_nrssi_threshold(bcm);
 	}
 	bcm430x_phy_init_pctl(bcm);
 }
@@ -1317,16 +1317,14 @@
 		bcm430x_phy_write(bcm, 0x04C2, 0x1816);
 		bcm430x_phy_write(bcm, 0x04C3, 0x8606);
 	}
-	//FIXME: Add element to struct bcm430x_private for keeping retval
-	//       of _radio_initXXXX()
-#if 0
-	if (retval == -1) {
-		retval = bcm430x_radio_init2050(bcm);
+	if (bcm->current_core->radio->initval == 0xFFFF) {
+		bcm->current_core->radio->initval = bcm430x_radio_init2050(bcm);
 		bcm430x_phy_measurelowsig(bcm);
 	} else {
-		bcm430x_radio_write16(bcm, 0x0078, retval);
+		//bcm430x_radio_write16(bcm, 0x0078, bcm->current_core->radio->initval);
+		//FIXME: take the saved value from measurelowsig for G PHY as mask
+		// bcm430x_radio_write16(bcm, 0x0052, (bcm430x_radio_read16(0x0052) & 0xFFF0) | ???);
 	}
-#endif
 
 	if (bcm->current_core->phy->connected) {
 		//FIXME: Set GPHY CompLo
@@ -1346,21 +1344,20 @@
 	}
 
 	if ((bcm->sprom.boardflags & BCM430x_BFL_RSSI) == 0) {
-		//FIXME: Update NRSSI Table
-		//FIXME: Set NRSSI Threshold
+		//FIXME: Update hardware NRSSI Table
+		bcm430x_calc_nrssi_threshold(bcm);
 	} else {
-#if 0
-		if (phy_unkCC && phy_inkD0) {
-			//FIXME: 2050 NRSSI Slope
-		} else {
-			//FIXME: Set NRSSI Threshold
+		if (bcm->current_core->phy->connected) {
+			if ((bcm->current_core->radio->nrssi[0] == -1000) && (bcm->current_core->radio->nrssi[1] == -1000)) {
+				bcm430x_calc_nrssi_slope(bcm);
+			} else {
+				bcm430x_calc_nrssi_threshold(bcm);
+			}
 		}
-#endif
 	}
 	bcm430x_phy_init_pctl(bcm);
 }
 
-
 int bcm430x_phy_init(struct bcm430x_private *bcm)
 {
 	int initialized = 0;
Index: bcm430x_radio.h
===================================================================
--- bcm430x_radio.h	(Revision 350)
+++ bcm430x_radio.h	(Arbeitskopie)
@@ -66,4 +66,5 @@
 	return bcm->current_core->radio->interfmode;
 }
 
-s16 bcm430x_calc_nrssi_slope(struct bcm430x_private *bcm);
+void bcm430x_calc_nrssi_slope(struct bcm430x_private *bcm);
+void bcm430x_calc_nrssi_threshold(struct bcm430x_private *bcm);
Index: bcm430x_main.c
===================================================================
--- bcm430x_main.c	(Revision 350)
+++ bcm430x_main.c	(Arbeitskopie)
@@ -1746,13 +1746,16 @@
 			core->phy = &bcm->phy[i];
 			core->phy->antenna_diversity = 0xffff;
 			core->phy->savedpctlreg = 0xFFFF;
-			core->phy->minlowsig1 = 0xFFFF;
-			core->phy->minlowsig2 = 0xFFFF;
-			core->phy->minlowsigpos1 = 0;
-			core->phy->minlowsigpos2 = 0;
+			core->phy->minlowsig[0] = 0xFFFF;
+			core->phy->minlowsig[1] = 0xFFFF;
+			core->phy->minlowsigpos[0] = 0;
+			core->phy->minlowsigpos[1] = 0;
 			core->radio = &bcm->radio[i];
 			core->radio->channel = 0xffff;
-			core->radio->lofcal = 0xffff;
+			core->radio->lofcal = 0xFFFF;
+			core->radio->initval = 0xFFFF;
+			core->radio->nrssi[0] = -1000;
+			core->radio->nrssi[1] = -1000;
 			core->dma = &bcm->dma[i];
 			core->pio = &bcm->pio[i];
 			break;
Index: bcm430x.h
===================================================================
--- bcm430x.h	(Revision 350)
+++ bcm430x.h	(Arbeitskopie)
@@ -394,10 +394,8 @@
 	u8 rev;
 	u16 antenna_diversity;
 	u16 savedpctlreg;
-	u16 minlowsig1;
-	u16 minlowsig2;
-	u16 minlowsigpos1;
-	u16 minlowsigpos2;
+	u16 minlowsig[2];
+	u16 minlowsigpos[2];
 	u8 connected:1,
 	   calibrated:1;
 };
@@ -416,12 +414,15 @@
 	u16 interfstack[20];
 	/* Saved values from the NRSSI Slope calculation */
 	s16 nrssi[2];
+	s16 nrssislope;
 
 	/* current channel */
 	u16 channel;
 
 	u16 lofcal;
 
+	u16 initval;
+
 	u8 enabled:1;
 };
