aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54/p54spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/p54/p54spi.c')
-rw-r--r--drivers/net/wireless/p54/p54spi.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 7ef191a9d792..9b347cea9854 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -164,12 +164,12 @@ static const struct p54spi_spi_reg p54spi_registers_array[] =
164 { SPI_ADRS_DMA_WRITE_BASE, 32, "DMA_RD_BASE " } 164 { SPI_ADRS_DMA_WRITE_BASE, 32, "DMA_RD_BASE " }
165}; 165};
166 166
167static int p54spi_wait_bit(struct p54s_priv *priv, u16 reg, __le32 bits) 167static int p54spi_wait_bit(struct p54s_priv *priv, u16 reg, u32 bits)
168{ 168{
169 int i; 169 int i;
170 170
171 for (i = 0; i < 2000; i++) { 171 for (i = 0; i < 2000; i++) {
172 __le32 buffer = p54spi_read32(priv, reg); 172 u32 buffer = p54spi_read32(priv, reg);
173 if ((buffer & bits) == bits) 173 if ((buffer & bits) == bits)
174 return 1; 174 return 1;
175 } 175 }
@@ -179,8 +179,7 @@ static int p54spi_wait_bit(struct p54s_priv *priv, u16 reg, __le32 bits)
179static int p54spi_spi_write_dma(struct p54s_priv *priv, __le32 base, 179static int p54spi_spi_write_dma(struct p54s_priv *priv, __le32 base,
180 const void *buf, size_t len) 180 const void *buf, size_t len)
181{ 181{
182 if (!p54spi_wait_bit(priv, SPI_ADRS_DMA_WRITE_CTRL, 182 if (!p54spi_wait_bit(priv, SPI_ADRS_DMA_WRITE_CTRL, HOST_ALLOWED)) {
183 cpu_to_le32(HOST_ALLOWED))) {
184 dev_err(&priv->spi->dev, "spi_write_dma not allowed " 183 dev_err(&priv->spi->dev, "spi_write_dma not allowed "
185 "to DMA write.\n"); 184 "to DMA write.\n");
186 return -EAGAIN; 185 return -EAGAIN;
@@ -333,7 +332,7 @@ static int p54spi_wakeup(struct p54s_priv *priv)
333 332
334 /* And wait for the READY interrupt */ 333 /* And wait for the READY interrupt */
335 if (!p54spi_wait_bit(priv, SPI_ADRS_HOST_INTERRUPTS, 334 if (!p54spi_wait_bit(priv, SPI_ADRS_HOST_INTERRUPTS,
336 cpu_to_le32(SPI_HOST_INT_READY))) { 335 SPI_HOST_INT_READY)) {
337 dev_err(&priv->spi->dev, "INT_READY timeout\n"); 336 dev_err(&priv->spi->dev, "INT_READY timeout\n");
338 return -EBUSY; 337 return -EBUSY;
339 } 338 }
@@ -444,7 +443,7 @@ static int p54spi_tx_frame(struct p54s_priv *priv, struct sk_buff *skb)
444 goto out; 443 goto out;
445 444
446 if (!p54spi_wait_bit(priv, SPI_ADRS_HOST_INTERRUPTS, 445 if (!p54spi_wait_bit(priv, SPI_ADRS_HOST_INTERRUPTS,
447 cpu_to_le32(SPI_HOST_INT_WR_READY))) { 446 SPI_HOST_INT_WR_READY)) {
448 dev_err(&priv->spi->dev, "WR_READY timeout\n"); 447 dev_err(&priv->spi->dev, "WR_READY timeout\n");
449 ret = -EAGAIN; 448 ret = -EAGAIN;
450 goto out; 449 goto out;