bcm-v4

[Specification

int N PHY Cal TX IQ LO (struct nphy_txgains target, bool full, bool mphase)

  1. Establish an 11-element u16 array named buffer
  2. Set diq_start to 0
  3. Set last to 0
  4. Establish 2-element u16 arrays named save and gain
  5. Establish a 2-element struct nphy_iqcal_params named params
  6. Establish a 2-element bool array named updated and initialized to 0
  7. Call N PHY Stay in Carrier Search with argument 1

  8. If PHY Revision >= 4

    1. Set avoid to phyhang_avoid

    2. Set phyhang_avoid to 0

  9. Read an N PHY Table with ID 7, length 2, offset 0x110, width 16, and data pointer save
  10. Loop 2 times with index i
    1. Call N PHY IQ Cal Gain Params with i, target, &params[i] as arguments

    2. Set gain[i] to params[i].cal_gain
  11. Write an N PHY Table with ID 7, length 2, offset 0x110, width 16, and data pointer gain
  12. Call N PHY TX Cal Radio Setup

  13. Call N PHY TX Cal PHY Setup

  14. If PHY Revision >= 6 or ((PHY Revision is 5) and ((nphy_ipa2g_on and the band is 2GHz)))

    1. If the band width is 40 MHz
      1. Set the table_pointer to tbl_tx_iqlo_cal_loft_ladder_40
      2. Set the table_length to the value for that table
    2. Otherwise
      1. Set the table_pointer to tbl_tx_iqlo_cal_loft_ladder_20
      2. Set the table_length to the value for that table
    3. Write an N PHY Table with ID 15, length from above, offset 0, width 16, and data pointer from above
    4. If the band width is 40 MHz
      1. Set the table_pointer to tbl_tx_iqlo_cal_iqimb_ladder_40
      2. Set the table_length to the value for that table
    5. Otherwise
      1. Set the table_pointer to tbl_tx_iqlo_cal_iqimb_ladder_20
      2. Set the table_length to the value for that table
    6. Write an N PHY Table with ID 15, table_length from above, offset 32, width 16, and data pointer from above
  15. Write 0x8AA9 to PHY Register 0xC2
  16. If the band width is 20 MHz
    1. Set freq to 2500
  17. Otherwise
    1. Set freq to 5000
  18. If mphase_cal_phase_id > 2

    1. Call N PHY Run Samples with (band width * 8), 0xFFFF, 0, 1, 0 as arguments

    2. Set error to 0
  19. Otherwise
    1. Call N PHY TX Tone with freq, 250, 1, 0 as arguments and save result as error

  20. If error is zero
    1. If mphase_cal_phase_id > 2

      1. Set table_pointer to mphase_txcal_bestcoeffs

      2. Set table_length to the length of that table
      3. If PHY Revision < 3

        1. Decrease table_length by 2
    2. Otherwise
      1. If full is zero and nphy_txiqlocal_coeffsvalid

        1. Set table_pointer to nphy_txiqlocal_bestc

        2. Set table_length to the length of that table
        3. If PHY Revision < 3

          1. Decrease table_length by 2
      2. Otherwise
        1. Set full to 1
        2. If PHY Revision >= 3

          1. Set table_pointer to tbl_tx_iqlo_cal_startcoefs_nphyrev3
          2. Set table_length to the length of that table
        3. Otherwise
          1. Set a table_pointer to tbl_tx_iqlo_cal_startcoefs
          2. Set the table_length to the length of that table
    3. Write an N PHY Table with ID 15, table_length, offset 64, width 16, and the data from table_pointer
    4. If full
      1. If PHY Revision >= 3

        1. Set max to the number of entries in tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3
      2. Otherwise
        1. Set max to the number of entries in tbl_tx_iqlo_cal_cmds_fullcal
    5. Otherwise
      1. If PHY Revision >= 3

        1. Set max to the number of entries in tbl_tx_iqlo_cal_cmds_recal_nphyrev3
      2. Otherwise
        1. Set max to the number of entries in tbl_tx_iqlo_cal_cmds_recal
    6. If mphase
      1. Set count to mphase_txcal_cmdidx

      2. If (count + mphase_txcal_numcmds) < max

        1. Set numb to count + mphase_txcal_numcmds

      3. Otherwise
        1. Set numb to max
    7. Otherwise
      1. Set count to 0
      2. Set numb to max
    8. Loop with index count, starting with current value, stop at numb (non-inclusive)
      1. If full
        1. If PHY Revision >= 3

          1. Set cmd to tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[count]
        2. Otherwise
          1. Set cmd to tbl_tx_iqlo_cal_cmds_fullcal[count]
      2. Otherwise
        1. If PHY Revision >= 3

          1. Set cmd to tbl_tx_iqlo_cal_cmds_recal_nphyrev3[count]
        2. Otherwise
          1. Set cmd to tbl_tx_iqlo_cal_cmds_recal[count]
      3. Set core to (cmd & 0x3000) >> 12

      4. Set type to (cmd & 0x0F00) >> 8

      5. If (PHY Revision is 6) or ((PHY Revision is 5) and (band is 2 GHz))
        1. If updated[core] is zero
          1. Call N PHY Update TX Cal Ladder with core as argument

          2. Set updated[core] to 1
      6. Set tmp to (params[core].ncorr[type] << 8) | 0x66

      7. Write tmp to PHY Register 0xC1
      8. If type is 1, 3, or 4
        1. Read an N PHY Table with ID 15, length 1, offset 69 + core, width 16, and data pointer buffer
        2. Set diq_start to buffer[0]
        3. Set buffer[0] to 0
        4. Write an N PHY Table with ID 15, length 1, offset 69 + core, width 16, and data of 0
      9. Write cmd to PHY Register 0xC0
      10. Spin wait for (PHY Register 0xC0 & 0xC000) to be non-zero. Wait a maximum 0f 20,000 usec with tests every 10 usec

      11. Read an N PHY Table with ID 15, length table_length, offset 96, width 16, and data pointer buffer
      12. Write an N PHY Table with ID 15, length table_length, offset 64, width 16, and data pointer buffer
      13. If type is 1, 3, or 4
        1. Set buffer[0] to diq_start
    9. If mphase
      1. If numb >= max

        1. Set mphase_txcal_cmdidx to 0

      2. Otherwise
        1. Set mphase_txcal_cmdidx to numb

    10. If PHY Revision < 3

      1. Set last to 6
    11. Otherwise
      1. Set last to 7
    12. If mphase is 0 or mphase_cal_phase_id equals last

      1. Read an N PHY Table with ID 15, length 4, offset 96, width 16, and data pointer buffer
      2. Write an N PHY Table with ID 15, length 4, offset 80, width 16, and data pointer buffer
      3. If the PHY Revision < 2

        1. Set buffer[0], buffer[1], buffer[2] and buffer[3] to 0
      4. Write an N PHY Table with ID 15, length 4, offset 88, width 16, and data pointer buffer
      5. Read an N PHY Table with ID 15, length 2, offset 101, width 16, and data pointer buffer
      6. Write an N PHY Table with ID 15, length 2, offset 85, width 16, and data pointer buffer
      7. Write an N PHY Table with ID 15, length 2, offset 93, width 16, and data pointer buffer
      8. Set length to the number of elements in nphy_txiqlocal_bestc

      9. If PHY Revision < 3

        1. Reduce length by 2
      10. Read an N PHY Table with ID 15, length length, offset 96, width 16, and data pointer nphy_txiqlocal_bestc

      11. Set nphy_txiqlocal_coeffsvalid to 1

      12. Set nphy_txiqlocal_chanspec to radio_chanspec

    13. Otherwise
      1. Set length to the length of mphase_txcal_bestcoeffs

      2. If PHY Revision < 3

        1. Reduce length by 2
      3. Read an N PHY Table with ID 5, length length, offset 96, width 16, and data pointer mphase_txcal_bestcoeffs

    14. Call N PHY Stop Playback

    15. Write 0 to PHY Register 0xC2
  21. Call N PHY TX Cal PHY Cleanup

  22. Write an N PHY Table with ID 7, length 2, offset 0x110, width 16, and data from save
  23. If PHY Revision < 2 and ((mphase is zero) or (mphase_cal_phase_id equals last))

    1. Call N PHY TX IQ Workaround

  24. If PHY Revision >= 4

    1. Set phyhang_avoid to avoid

  25. Call N PHY Stay in Carrier Search with argument 0

  26. Return error

tbl_tx_iqlo_cal_loft_ladder_40

0x0200

0x0300

0x0400

0x0700

0x0900

0x0c00

0x1200

0x1201

0x1202

0x1203

0x1204

0x1205

0x1206

0x1207

0x1907

0x2307

0x3207

0x4707

tbl_tx_iqlo_cal_loft_ladder_20

0x0300

0x0500

0x0700

0x0900

0x0d00

0x1100

0x1900

0x1901

0x1902

0x1903

0x1904

0x1905

0x1906

0x1907

0x2407

0x3207

0x4607

0x6407

tbl_tx_iqlo_cal_iqimb_ladder_40

0x0100

0x0200

0x0400

0x0700

0x0900

0x0c00

0x1200

0x1900

0x2300

0x3200

0x4700

0x4701

0x4702

0x4703

0x4704

0x4705

0x4706

0x4707

tbl_tx_iqlo_cal_iqimb_ladder_20

0x0200

0x0300

0x0600

0x0900

0x0d00

0x1100

0x1900

0x2400

0x3200

0x4600

0x6400

0x6401

0x6402

0x6403

0x6404

0x6405

0x6406

0x6407

tbl_tx_iqlo_cal_startcoefs_nphyrev3

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

tbl_tx_iqlo_cal_startcoefs

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

0x0000

tbl_tx_iqlo_cal_cmds_recal_nphyrev3

0x8423

0x8323

0x8073

0x8256

0x8045

0x8223

0x9423

0x9323

0x9073

0x9256

0x9045

0x9223

tbl_tx_iqlo_cal_cmds_recal

0x8101

0x8253

0x8053

0x8234

0x8034

0x9101

0x9253

0x9053

0x9234

0x9034

tbl_tx_iqlo_cal_cmds_fullcal

0x8123

0x8264

0x8086

0x8245

0x8056

0x9123

0x9264

0x9086

0x9245

0x9056

tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3

0x8434

0x8334

0x8084

0x8267

0x8056

0x8234

0x9434

0x9334

0x9084

0x9267

0x9056

0x9234


Exported/Archived from the wiki to HTML on 2016-10-27