|
|
@ -2,7 +2,7 @@ |
|
|
|
* @file ad9361_api.c |
|
|
|
* @brief Implementation of AD9361 API Driver. |
|
|
|
* @author DBogdan (dragos.bogdan@analog.com) |
|
|
|
******************************************************************************** |
|
|
|
******************************************************************************** |
|
|
|
* Copyright 2013(c) Analog Devices, Inc. |
|
|
|
* |
|
|
|
* All rights reserved. |
|
|
@ -35,7 +35,7 @@ |
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
*******************************************************************************/ |
|
|
|
*******************************************************************************/ |
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
|
/***************************** Include Files **********************************/ |
|
|
@ -73,19 +73,16 @@ static struct axiadc_chip_info axiadc_chip_info_tbl[] = |
|
|
|
* |
|
|
|
* Note: This function will/may affect the data path. |
|
|
|
*/ |
|
|
|
int32_t ad9361_init (struct ad9361_rf_phy **ad9361_phy, AD9361_InitParam *init_param) |
|
|
|
int32_t ad9361_init (struct ad9361_rf_phy *phy, struct spi_device *spi, AD9361_InitParam *init_param) |
|
|
|
{ |
|
|
|
struct ad9361_rf_phy *phy; |
|
|
|
int32_t ret = 0; |
|
|
|
int32_t rev = 0; |
|
|
|
int32_t i = 0; |
|
|
|
|
|
|
|
phy = (struct ad9361_rf_phy *)zmalloc(sizeof(*phy)); |
|
|
|
if (!phy) { |
|
|
|
return -ENOMEM; |
|
|
|
} |
|
|
|
|
|
|
|
phy->spi = &spi1; |
|
|
|
memset(phy, 0, sizeof *phy); |
|
|
|
|
|
|
|
phy->spi = spi; |
|
|
|
|
|
|
|
phy->clk_refin = (struct clk *)zmalloc(sizeof(*phy->clk_refin)); |
|
|
|
if (!phy->clk_refin) { |
|
|
@ -114,7 +111,7 @@ int32_t ad9361_init (struct ad9361_rf_phy **ad9361_phy, AD9361_InitParam *init_p |
|
|
|
phy->dev_sel = init_param->dev_sel; |
|
|
|
|
|
|
|
/* Identification number */ |
|
|
|
// phy->spi->id_no = init_param->id_no;
|
|
|
|
//phy->spi->id_no = init_param->id_no;
|
|
|
|
phy->id_no = init_param->id_no; |
|
|
|
|
|
|
|
/* Reference Clock */ |
|
|
@ -417,12 +414,12 @@ int32_t ad9361_init (struct ad9361_rf_phy **ad9361_phy, AD9361_InitParam *init_p |
|
|
|
} |
|
|
|
rev = ret & REV_MASK; |
|
|
|
|
|
|
|
/* if (AD9364_DEVICE) {
|
|
|
|
/* if (AD9364_DEVICE) {
|
|
|
|
phy->pdata->rx2tx2 = false; |
|
|
|
phy->pdata->rx1tx1_mode_use_rx_num = 1; |
|
|
|
phy->pdata->rx1tx1_mode_use_tx_num = 1; |
|
|
|
} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
switch (phy->dev_sel) { |
|
|
|
case ID_AD9364: |
|
|
|
phy->pdata->rx2tx2 = false; |
|
|
@ -463,8 +460,6 @@ int32_t ad9361_init (struct ad9361_rf_phy **ad9361_phy, AD9361_InitParam *init_p |
|
|
|
|
|
|
|
printf("%s : AD936x Rev %d successfully initialized\n", __func__, (int)rev); |
|
|
|
|
|
|
|
*ad9361_phy = phy; |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
out: |
|
|
@ -474,7 +469,6 @@ out: |
|
|
|
#endif |
|
|
|
free(phy->clk_refin); |
|
|
|
free(phy->pdata); |
|
|
|
free(phy); |
|
|
|
printf("%s : AD936x initialization error\n", __func__); |
|
|
|
|
|
|
|
return -ENODEV; |
|
|
@ -1885,8 +1879,8 @@ int32_t ad9361_set_no_ch_mode(struct ad9361_rf_phy *phy, uint8_t no_ch_mode) |
|
|
|
* Note: This function will/may affect the data path. |
|
|
|
*/ |
|
|
|
/*
|
|
|
|
int32_t ad9361_do_mcs(struct ad9361_rf_phy *phy_master, struct ad9361_rf_phy *phy_slave) |
|
|
|
{ |
|
|
|
int32_t ad9361_do_mcs(struct ad9361_rf_phy *phy_master, struct ad9361_rf_phy *phy_slave) |
|
|
|
{ |
|
|
|
uint32_t ensm_mode; |
|
|
|
int32_t step; |
|
|
|
int32_t reg; |
|
|
@ -1918,8 +1912,8 @@ int32_t ad9361_do_mcs(struct ad9361_rf_phy *phy_master, struct ad9361_rf_phy *ph |
|
|
|
ad9361_set_en_state_machine_mode(phy_slave, ensm_mode); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
*/ |
|
|
|
} |
|
|
|
*/ |
|
|
|
/**
|
|
|
|
* Power Down RX/TX LO/Synthesizers. |
|
|
|
* @param phy The AD9361 state structure. |
|
|
|