ssb: extract FEM info from SPROM
authorRafał Miłecki <zajec5@gmail.com>
Thu, 8 Dec 2011 17:02:21 +0000 (18:02 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 13 Dec 2011 20:30:49 +0000 (15:30 -0500)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/ssb/pci.c
include/linux/ssb/ssb.h
include/linux/ssb/ssb_regs.h

index 34c3bab90b9a1e6a9e5f0032c207d16fc86ef21c..973223f5de8ebbeee690da524d0cf94c2593ce85 100644 (file)
@@ -607,6 +607,29 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
        memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
               sizeof(out->antenna_gain.ghz5));
 
+       /* Extract FEM info */
+       SPEX(fem.ghz2.tssipos, SSB_SPROM8_FEM2G,
+               SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT);
+       SPEX(fem.ghz2.extpa_gain, SSB_SPROM8_FEM2G,
+               SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT);
+       SPEX(fem.ghz2.pdet_range, SSB_SPROM8_FEM2G,
+               SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT);
+       SPEX(fem.ghz2.tr_iso, SSB_SPROM8_FEM2G,
+               SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT);
+       SPEX(fem.ghz2.antswlut, SSB_SPROM8_FEM2G,
+               SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT);
+
+       SPEX(fem.ghz5.tssipos, SSB_SPROM8_FEM5G,
+               SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT);
+       SPEX(fem.ghz5.extpa_gain, SSB_SPROM8_FEM5G,
+               SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT);
+       SPEX(fem.ghz5.pdet_range, SSB_SPROM8_FEM5G,
+               SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT);
+       SPEX(fem.ghz5.tr_iso, SSB_SPROM8_FEM5G,
+               SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT);
+       SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G,
+               SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT);
+
        sprom_extract_r458(out, in);
 
        /* TODO - get remaining rev 8 stuff needed */
index 061e560251b4d24a3177ace483b6d9e24e5a8411..dcf35b0f303aabef3698b0f7b06d4568748b87fb 100644 (file)
@@ -94,6 +94,15 @@ struct ssb_sprom {
                } ghz5;         /* 5GHz band */
        } antenna_gain;
 
+       struct {
+               struct {
+                       u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
+               } ghz2;
+               struct {
+                       u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
+               } ghz5;
+       } fem;
+
        /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */
 };
 
index 98941203a27f248cf8215f998d17e15e12aed598..c814ae6eeb2292df3cb8080b0a10bf04726418fd 100644 (file)
 #define  SSB_SPROM8_RXPO2G             0x00FF  /* 2GHz RX power offset */
 #define  SSB_SPROM8_RXPO5G             0xFF00  /* 5GHz RX power offset */
 #define  SSB_SPROM8_RXPO5G_SHIFT       8
+#define SSB_SPROM8_FEM2G               0x00AE
+#define SSB_SPROM8_FEM5G               0x00B0
+#define  SSB_SROM8_FEM_TSSIPOS         0x0001
+#define  SSB_SROM8_FEM_TSSIPOS_SHIFT   0
+#define  SSB_SROM8_FEM_EXTPA_GAIN      0x0006
+#define  SSB_SROM8_FEM_EXTPA_GAIN_SHIFT        1
+#define  SSB_SROM8_FEM_PDET_RANGE      0x00F8
+#define  SSB_SROM8_FEM_PDET_RANGE_SHIFT        3
+#define  SSB_SROM8_FEM_TR_ISO          0x0700
+#define  SSB_SROM8_FEM_TR_ISO_SHIFT    8
+#define  SSB_SROM8_FEM_ANTSWLUT                0xF800
+#define  SSB_SROM8_FEM_ANTSWLUT_SHIFT  11
+#define SSB_SPROM8_THERMAL             0x00B2
+#define SSB_SPROM8_MPWR_RAWTS          0x00B4
+#define SSB_SPROM8_TS_SLP_OPT_CORRX    0x00B6
+#define SSB_SPROM8_FOC_HWIQ_IQSWP      0x00B8
+#define SSB_SPROM8_PHYCAL_TEMPDELTA    0x00BA
 #define SSB_SPROM8_MAXP_BG             0x00C0  /* Max Power 2GHz in path 1 */
 #define  SSB_SPROM8_MAXP_BG_MASK       0x00FF  /* Mask for Max Power 2GHz */
 #define  SSB_SPROM8_ITSSI_BG           0xFF00  /* Mask for path 1 itssi_bg */