-
Notifications
You must be signed in to change notification settings - Fork 919
Description
SPI Control of TDD Tx and Rx does not work, without the following patch to ad9361_ensm_set_state function in ad9361.c.(the fix is to set the TXNRX_SPI_CTRL bit appropriately for Tx or Rx)
(I think the original author may have fallen foul of slightly ambiguous datasheet. TXNRX_SPI_CTRL does not set SPI CNTRL MODE (as coded in ad9361_set_ensm_mode).- Instead it controls TX (1) or Rx (0) when in SPI mode.
Would you be able to confirm this is correct, or point me to code responsible for setting SPI control of Tx and RX
Thanks
Matt
patch file wouldnt attach, so here it is inline
--- ad9361.c.ORIG 2015-10-02 18:14:07.000000000 +0100
+++ ad9361.c 2015-10-14 15:33:26.358829249 +0100
@@ -4018,6 +4018,7 @@
int32_t rc = 0;
uint32_t val;
uint32_t tmp;
- uint32_t ensm_config_2;
// if (phy->curr_ensm_state == ensm_state) {
// dev_dbg(dev, "Nothing to do, device is already in %d state",
@@ -4028,6 +4029,7 @@
dev_dbg(dev, "Device is in %x state, moving to %x", phy->curr_ensm_state,
ensm_state);
- ensm_config_2 = ad9361_spi_read(phy->spi, REG_ENSM_CONFIG_2); // if in SPI ctrl mode (NOT pinctrl) we nedd to set this TXNRX bit
if (phy->curr_ensm_state == ENSM_STATE_SLEEP) {
ad9361_spi_write(spi, REG_CLOCK_ENABLE,
@@ -4047,6 +4049,7 @@
switch (ensm_state) {
case ENSM_STATE_TX:
val |= FORCE_TX_ON;
-
ensm_config_2 |= TXNRX_SPI_CTRL; // Set bit for TX if (phy->pdata->fdd) rc = -EINVAL; else if (phy->curr_ensm_state != ENSM_STATE_ALERT)@@ -4054,6 +4057,7 @@
break;
case ENSM_STATE_RX:
val |= FORCE_RX_ON; -
ensm_config_2 &= ~TXNRX_SPI_CTRL; // clear bit for RX if (phy->pdata->fdd) rc = -EINVAL; else if (phy->curr_ensm_state != ENSM_STATE_ALERT)@@ -4097,6 +4101,10 @@
goto out;
} -
if ((!pinctrl) && (phy->pdata->tdd_use_dual_synth==0) && (phy->pdata->fdd==0)) { // only for TDD, Single Synth, NOT pinctrl mode
-
rc = ad9361_spi_write(spi, REG_ENSM_CONFIG_2, ensm_config_2); -
dev_info(dev, "Extra write for TDD Single_Synth REG_ENSM_CONFIG_2 0x%08x ",ensm_config_2); -
};rc = ad9361_spi_write(spi, REG_ENSM_CONFIG_1, val);
if (rc)
dev_err(dev, "Failed to restore state");