aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2009-05-17 19:02:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-20 14:46:27 -0400
commit210dd1bb9b0329bcc1b4f8932022eddc6466980c (patch)
tree44319367ae3caf7059374242c3b79bc63a05d10e /drivers/net/wireless/p54
parent4eaf16bc1f92bf772f6d42860e86b399d00b7b94 (diff)
p54spi: fix incorrect access sequence to DMA_WRITE_CTRL in p54spi_spi_write_dma
Host is not allowed to modify DMA_WRITE_CTRL register if bit HOST_ALLOWED in it is not set. Wait for HOST_ALLOWED first. Also get rid of timeout in p54spi_wait_bit as it's been playing a role of workaround for such an incorrect register access. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r--drivers/net/wireless/p54/p54spi.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 59a5e778bb08..272b7e176afc 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -172,8 +172,6 @@ static int p54spi_wait_bit(struct p54s_priv *priv, u16 reg, __le32 bits)
172 __le32 buffer = p54spi_read32(priv, reg); 172 __le32 buffer = p54spi_read32(priv, reg);
173 if ((buffer & bits) == bits) 173 if ((buffer & bits) == bits)
174 return 1; 174 return 1;
175
176 msleep(0);
177 } 175 }
178 return 0; 176 return 0;
179} 177}
@@ -181,9 +179,6 @@ static int p54spi_wait_bit(struct p54s_priv *priv, u16 reg, __le32 bits)
181static int p54spi_spi_write_dma(struct p54s_priv *priv, __le32 base, 179static int p54spi_spi_write_dma(struct p54s_priv *priv, __le32 base,
182 const void *buf, size_t len) 180 const void *buf, size_t len)
183{ 181{
184 p54spi_write16(priv, SPI_ADRS_DMA_WRITE_CTRL,
185 cpu_to_le16(SPI_DMA_WRITE_CTRL_ENABLE));
186
187 if (!p54spi_wait_bit(priv, SPI_ADRS_DMA_WRITE_CTRL, 182 if (!p54spi_wait_bit(priv, SPI_ADRS_DMA_WRITE_CTRL,
188 cpu_to_le32(HOST_ALLOWED))) { 183 cpu_to_le32(HOST_ALLOWED))) {
189 dev_err(&priv->spi->dev, "spi_write_dma not allowed " 184 dev_err(&priv->spi->dev, "spi_write_dma not allowed "
@@ -191,6 +186,9 @@ static int p54spi_spi_write_dma(struct p54s_priv *priv, __le32 base,
191 return -EAGAIN; 186 return -EAGAIN;
192 } 187 }
193 188
189 p54spi_write16(priv, SPI_ADRS_DMA_WRITE_CTRL,
190 cpu_to_le16(SPI_DMA_WRITE_CTRL_ENABLE));
191
194 p54spi_write16(priv, SPI_ADRS_DMA_WRITE_LEN, cpu_to_le16(len)); 192 p54spi_write16(priv, SPI_ADRS_DMA_WRITE_LEN, cpu_to_le16(len));
195 p54spi_write32(priv, SPI_ADRS_DMA_WRITE_BASE, base); 193 p54spi_write32(priv, SPI_ADRS_DMA_WRITE_BASE, base);
196 p54spi_spi_write(priv, SPI_ADRS_DMA_DATA, buf, len); 194 p54spi_spi_write(priv, SPI_ADRS_DMA_DATA, buf, len);