diff options
author | Varka Bhadram <varkabhadram@gmail.com> | 2015-05-29 01:26:55 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-05-31 07:40:53 -0400 |
commit | 1a1bc59c5f7657387d1a4b45d63248fed55ab88c (patch) | |
tree | dfb5bc8302d51d7cd8aaf2f6116f50a32d799611 /drivers/net | |
parent | aad1b0b5d3e0e4cdadd695b7188873ba614ca4ef (diff) |
cc2520: fix CC2591 handling
This patch changes tha way of handling of cc2591-cc2520 combination
by moving amplified variable from platform data to private data.
This will be useful in other sections like tx power support.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
Cc: Brad Campbell <bradjc5@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ieee802154/cc2520.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c index ea280d437ca1..0d9353756598 100644 --- a/drivers/net/ieee802154/cc2520.c +++ b/drivers/net/ieee802154/cc2520.c | |||
@@ -196,6 +196,7 @@ struct cc2520_private { | |||
196 | u8 *buf; /* SPI TX/Rx data buffer */ | 196 | u8 *buf; /* SPI TX/Rx data buffer */ |
197 | struct mutex buffer_mutex; /* SPI buffer mutex */ | 197 | struct mutex buffer_mutex; /* SPI buffer mutex */ |
198 | bool is_tx; /* Flag for sync b/w Tx and Rx */ | 198 | bool is_tx; /* Flag for sync b/w Tx and Rx */ |
199 | bool amplified; /* Flag for CC2591 */ | ||
199 | int fifo_pin; /* FIFO GPIO pin number */ | 200 | int fifo_pin; /* FIFO GPIO pin number */ |
200 | struct work_struct fifop_irqwork;/* Workqueue for FIFOP */ | 201 | struct work_struct fifop_irqwork;/* Workqueue for FIFOP */ |
201 | spinlock_t lock; /* Lock for is_tx*/ | 202 | spinlock_t lock; /* Lock for is_tx*/ |
@@ -738,7 +739,9 @@ static int cc2520_get_platform_data(struct spi_device *spi, | |||
738 | pdata->vreg = of_get_named_gpio(np, "vreg-gpio", 0); | 739 | pdata->vreg = of_get_named_gpio(np, "vreg-gpio", 0); |
739 | pdata->reset = of_get_named_gpio(np, "reset-gpio", 0); | 740 | pdata->reset = of_get_named_gpio(np, "reset-gpio", 0); |
740 | 741 | ||
741 | pdata->amplified = of_property_read_bool(np, "amplified"); | 742 | /* CC2591 front end for CC2520 */ |
743 | if (of_property_read_bool(np, "amplified")) | ||
744 | priv->amplified = true; | ||
742 | 745 | ||
743 | return 0; | 746 | return 0; |
744 | } | 747 | } |
@@ -781,7 +784,7 @@ static int cc2520_hw_init(struct cc2520_private *priv) | |||
781 | * amplifier. See section 8 page 17 of TI application note AN065. | 784 | * amplifier. See section 8 page 17 of TI application note AN065. |
782 | * http://www.ti.com/lit/an/swra229a/swra229a.pdf | 785 | * http://www.ti.com/lit/an/swra229a/swra229a.pdf |
783 | */ | 786 | */ |
784 | if (pdata.amplified) { | 787 | if (priv->amplified) { |
785 | ret = cc2520_write_register(priv, CC2520_AGCCTRL1, 0x16); | 788 | ret = cc2520_write_register(priv, CC2520_AGCCTRL1, 0x16); |
786 | if (ret) | 789 | if (ret) |
787 | goto err_ret; | 790 | goto err_ret; |
@@ -896,6 +899,9 @@ static int cc2520_probe(struct spi_device *spi) | |||
896 | spin_lock_init(&priv->lock); | 899 | spin_lock_init(&priv->lock); |
897 | init_completion(&priv->tx_complete); | 900 | init_completion(&priv->tx_complete); |
898 | 901 | ||
902 | /* Assumption that CC2591 is not connected */ | ||
903 | priv->amplified = false; | ||
904 | |||
899 | /* Request all the gpio's */ | 905 | /* Request all the gpio's */ |
900 | if (!gpio_is_valid(pdata.fifo)) { | 906 | if (!gpio_is_valid(pdata.fifo)) { |
901 | dev_err(&spi->dev, "fifo gpio is not valid\n"); | 907 | dev_err(&spi->dev, "fifo gpio is not valid\n"); |