Author: adrian
Date: Mon May  9 06:30:00 2016
New Revision: 299248
URL: https://svnweb.freebsd.org/changeset/base/299248

Log:
  [siba] add 2GHz/5GHz FEM parameter fetching and accessor methods.
  
  This is used by the bwn(4) PHY-N code that I'm working on.

Modified:
  head/sys/dev/siba/siba_core.c
  head/sys/dev/siba/sibavar.h

Modified: head/sys/dev/siba/siba_core.c
==============================================================================
--- head/sys/dev/siba/siba_core.c       Mon May  9 06:05:23 2016        
(r299247)
+++ head/sys/dev/siba/siba_core.c       Mon May  9 06:30:00 2016        
(r299248)
@@ -1689,6 +1689,29 @@ siba_sprom_r8(struct siba_sprom *out, co
        SIBA_SHIFTOUT(again.ghz24.a2, SIBA_SPROM8_AGAIN23, SIBA_SPROM8_AGAIN2);
        SIBA_SHIFTOUT(again.ghz24.a3, SIBA_SPROM8_AGAIN23, SIBA_SPROM8_AGAIN3);
        bcopy(&out->again.ghz24, &out->again.ghz5, sizeof(out->again.ghz5));
+
+       /* FEM */
+       SIBA_SHIFTOUT(fem.ghz2.tssipos, SIBA_SPROM8_FEM2G,
+           SSB_SROM8_FEM_TSSIPOS);
+       SIBA_SHIFTOUT(fem.ghz2.extpa_gain, SIBA_SPROM8_FEM2G,
+           SSB_SROM8_FEM_EXTPA_GAIN);
+       SIBA_SHIFTOUT(fem.ghz2.pdet_range, SIBA_SPROM8_FEM2G,
+           SSB_SROM8_FEM_PDET_RANGE);
+       SIBA_SHIFTOUT(fem.ghz2.tr_iso, SIBA_SPROM8_FEM2G,
+           SSB_SROM8_FEM_TR_ISO);
+       SIBA_SHIFTOUT(fem.ghz2.antswlut, SIBA_SPROM8_FEM2G,
+           SSB_SROM8_FEM_ANTSWLUT);
+
+       SIBA_SHIFTOUT(fem.ghz5.tssipos, SIBA_SPROM8_FEM5G,
+           SSB_SROM8_FEM_TSSIPOS);
+       SIBA_SHIFTOUT(fem.ghz5.extpa_gain, SIBA_SPROM8_FEM5G,
+           SSB_SROM8_FEM_EXTPA_GAIN);
+       SIBA_SHIFTOUT(fem.ghz5.pdet_range, SIBA_SPROM8_FEM5G,
+           SSB_SROM8_FEM_PDET_RANGE);
+       SIBA_SHIFTOUT(fem.ghz5.tr_iso, SIBA_SPROM8_FEM5G,
+           SSB_SROM8_FEM_TR_ISO);
+       SIBA_SHIFTOUT(fem.ghz5.antswlut, SIBA_SPROM8_FEM5G,
+           SSB_SROM8_FEM_ANTSWLUT);
 }
 
 static int8_t
@@ -2338,6 +2361,36 @@ siba_read_sprom(device_t dev, device_t c
        case SIBA_SPROMVAR_BF2_HI:
                *result = siba->siba_sprom.bf2_hi;
                break;
+       case SIBA_SPROMVAR_FEM_2GHZ_TSSIPOS:
+               *result = siba->siba_sprom.fem.ghz2.tssipos;
+               break;
+       case SIBA_SPROMVAR_FEM_2GHZ_EXTPAGAIN:
+               *result = siba->siba_sprom.fem.ghz2.extpa_gain;
+               break;
+       case SIBA_SPROMVAR_FEM_2GHZ_PDET_RANGE:
+               *result = siba->siba_sprom.fem.ghz2.pdet_range;
+               break;
+       case SIBA_SPROMVAR_FEM_2GHZ_TR_ISO:
+               *result = siba->siba_sprom.fem.ghz2.tr_iso;
+               break;
+       case SIBA_SPROMVAR_FEM_2GHZ_ANTSWLUT:
+               *result = siba->siba_sprom.fem.ghz2.antswlut;
+               break;
+       case SIBA_SPROMVAR_FEM_5GHZ_TSSIPOS:
+               *result = siba->siba_sprom.fem.ghz5.tssipos;
+               break;
+       case SIBA_SPROMVAR_FEM_5GHZ_EXTPAGAIN:
+               *result = siba->siba_sprom.fem.ghz5.extpa_gain;
+               break;
+       case SIBA_SPROMVAR_FEM_5GHZ_PDET_RANGE:
+               *result = siba->siba_sprom.fem.ghz5.pdet_range;
+               break;
+       case SIBA_SPROMVAR_FEM_5GHZ_TR_ISO:
+               *result = siba->siba_sprom.fem.ghz5.tr_iso;
+               break;
+       case SIBA_SPROMVAR_FEM_5GHZ_ANTSWLUT:
+               *result = siba->siba_sprom.fem.ghz5.antswlut;
+               break;
        default:
                return (ENOENT);
        }

Modified: head/sys/dev/siba/sibavar.h
==============================================================================
--- head/sys/dev/siba/sibavar.h Mon May  9 06:05:23 2016        (r299247)
+++ head/sys/dev/siba/sibavar.h Mon May  9 06:30:00 2016        (r299248)
@@ -278,7 +278,17 @@ enum siba_sprom_vars {
        SIBA_SPROMVAR_BF_LO,
        SIBA_SPROMVAR_BF_HI,
        SIBA_SPROMVAR_BF2_LO,
-       SIBA_SPROMVAR_BF2_HI
+       SIBA_SPROMVAR_BF2_HI,
+       SIBA_SPROMVAR_FEM_2GHZ_TSSIPOS,
+       SIBA_SPROMVAR_FEM_2GHZ_EXTPAGAIN,
+       SIBA_SPROMVAR_FEM_2GHZ_PDET_RANGE,
+       SIBA_SPROMVAR_FEM_2GHZ_TR_ISO,
+       SIBA_SPROMVAR_FEM_2GHZ_ANTSWLUT,
+       SIBA_SPROMVAR_FEM_5GHZ_TSSIPOS,
+       SIBA_SPROMVAR_FEM_5GHZ_EXTPAGAIN,
+       SIBA_SPROMVAR_FEM_5GHZ_PDET_RANGE,
+       SIBA_SPROMVAR_FEM_5GHZ_TR_ISO,
+       SIBA_SPROMVAR_FEM_5GHZ_ANTSWLUT,
 };
 
 int            siba_read_sprom(device_t, device_t, int, uintptr_t *);
@@ -364,6 +374,18 @@ SIBA_SPROM_ACCESSOR(bf_lo, BF_LO,          uint1
 SIBA_SPROM_ACCESSOR(bf_hi,     BF_HI,          uint16_t);
 SIBA_SPROM_ACCESSOR(bf2_lo,    BF2_LO,         uint16_t);
 SIBA_SPROM_ACCESSOR(bf2_hi,    BF2_HI,         uint16_t);
+/* 2GHz FEM */
+SIBA_SPROM_ACCESSOR(fem_2ghz_tssipos, FEM_2GHZ_TSSIPOS, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_2ghz_extpa_gain, FEM_2GHZ_EXTPAGAIN, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_2ghz_pdet_range, FEM_2GHZ_PDET_RANGE, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_2ghz_tr_iso, FEM_2GHZ_TR_ISO, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_2ghz_antswlut, FEM_2GHZ_ANTSWLUT, uint8_t);
+/* 5GHz FEM */
+SIBA_SPROM_ACCESSOR(fem_5ghz_tssipos, FEM_5GHZ_TSSIPOS, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_5ghz_extpa_gain, FEM_5GHZ_EXTPAGAIN, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_5ghz_pdet_range, FEM_5GHZ_PDET_RANGE, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_5ghz_tr_iso, FEM_5GHZ_TR_ISO, uint8_t);
+SIBA_SPROM_ACCESSOR(fem_5ghz_antswlut, FEM_5GHZ_ANTSWLUT, uint8_t);
 
 #undef SIBA_SPROM_ACCESSOR
 
@@ -434,6 +456,17 @@ struct siba_sprom {
                        int8_t a0, a1, a2, a3;
                } ghz5;
        } again;        /* antenna gain */
+
+       struct {
+               struct {
+                       uint8_t tssipos, extpa_gain, pdet_range, tr_iso;
+                       uint8_t antswlut;
+               } ghz2;
+               struct {
+                       uint8_t tssipos, extpa_gain, pdet_range, tr_iso;
+                       uint8_t antswlut;
+               } ghz5;
+       } fem;
 };
 
 #define        SIBA_LDO_PAREF                  0
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to