diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-25 16:20:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-25 16:20:36 -0500 |
commit | 2d2e7d195b902c419bc0b69ced026aca444d69a8 (patch) | |
tree | a4caa21b9db159873897d64b553042a1ae920ab5 /drivers/spi/spi-tegra20-sflash.c | |
parent | 15333539a9b3022656f815f643a77f6b054b335f (diff) | |
parent | 8b8b773e6b611e6629ac01f85d401c949d153546 (diff) |
Merge tag 'spi-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown:
"A respun version of the merges for the pull request previously sent
with a few additional fixes. The last two merges were fixed up by
hand since the branches have moved on and currently have the prior
merge in them.
Quite a busy release for the SPI subsystem, mostly in cleanups big and
small scattered through the stack rather than anything else:
- New driver for the Broadcom BC63xx HSSPI controller
- Fix duplicate device registration for ACPI
- Conversion of s3c64xx to DMAEngine (this pulls in platform and DMA
changes upon which the transiton depends)
- Some small optimisations to reduce the amount of time we hold locks
in the datapath, eliminate some redundant checks and the size of a
spi_transfer
- Lots of fixes, cleanups and general enhancements to drivers,
especially the rspi and Atmel drivers"
* tag 'spi-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (112 commits)
spi: core: Fix transfer failure when master->transfer_one returns positive value
spi: Correct set_cs() documentation
spi: Clarify transfer_one() w.r.t. spi_finalize_current_transfer()
spi: Spelling s/finised/finished/
spi: sc18is602: Convert to use bits_per_word_mask
spi: Remove duplicate code to set default bits_per_word setting
spi/pxa2xx: fix compilation warning when !CONFIG_PM_SLEEP
spi: clps711x: Add MODULE_ALIAS to support module auto-loading
spi: rspi: Add missing clk_disable() calls in error and cleanup paths
spi: rspi: Spelling s/transmition/transmission/
spi: rspi: Add support for specifying CPHA/CPOL
spi/pxa2xx: initialize DMA channels to -1 to prevent inadvertent match
spi: rspi: Add more QSPI register documentation
spi: rspi: Add more RSPI register documentation
spi: rspi: Remove dependency on DMAE for SHMOBILE
spi/s3c64xx: Correct indentation
spi: sh: Use spi_sh_clear_bit() instead of open-coded
spi: bitbang: Grammar s/make to make/to make/
spi: sh-hspi: Spelling s/recive/receive/
spi: core: Improve tx/rx_nbits check comments
...
Diffstat (limited to 'drivers/spi/spi-tegra20-sflash.c')
-rw-r--r-- | drivers/spi/spi-tegra20-sflash.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index e6f382b33818..08794977f21a 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c | |||
@@ -149,14 +149,14 @@ struct tegra_sflash_data { | |||
149 | static int tegra_sflash_runtime_suspend(struct device *dev); | 149 | static int tegra_sflash_runtime_suspend(struct device *dev); |
150 | static int tegra_sflash_runtime_resume(struct device *dev); | 150 | static int tegra_sflash_runtime_resume(struct device *dev); |
151 | 151 | ||
152 | static inline unsigned long tegra_sflash_readl(struct tegra_sflash_data *tsd, | 152 | static inline u32 tegra_sflash_readl(struct tegra_sflash_data *tsd, |
153 | unsigned long reg) | 153 | unsigned long reg) |
154 | { | 154 | { |
155 | return readl(tsd->base + reg); | 155 | return readl(tsd->base + reg); |
156 | } | 156 | } |
157 | 157 | ||
158 | static inline void tegra_sflash_writel(struct tegra_sflash_data *tsd, | 158 | static inline void tegra_sflash_writel(struct tegra_sflash_data *tsd, |
159 | unsigned long val, unsigned long reg) | 159 | u32 val, unsigned long reg) |
160 | { | 160 | { |
161 | writel(val, tsd->base + reg); | 161 | writel(val, tsd->base + reg); |
162 | } | 162 | } |
@@ -186,7 +186,7 @@ static unsigned tegra_sflash_fill_tx_fifo_from_client_txbuf( | |||
186 | struct tegra_sflash_data *tsd, struct spi_transfer *t) | 186 | struct tegra_sflash_data *tsd, struct spi_transfer *t) |
187 | { | 187 | { |
188 | unsigned nbytes; | 188 | unsigned nbytes; |
189 | unsigned long status; | 189 | u32 status; |
190 | unsigned max_n_32bit = tsd->curr_xfer_words; | 190 | unsigned max_n_32bit = tsd->curr_xfer_words; |
191 | u8 *tx_buf = (u8 *)t->tx_buf + tsd->cur_tx_pos; | 191 | u8 *tx_buf = (u8 *)t->tx_buf + tsd->cur_tx_pos; |
192 | 192 | ||
@@ -197,11 +197,11 @@ static unsigned tegra_sflash_fill_tx_fifo_from_client_txbuf( | |||
197 | status = tegra_sflash_readl(tsd, SPI_STATUS); | 197 | status = tegra_sflash_readl(tsd, SPI_STATUS); |
198 | while (!(status & SPI_TXF_FULL)) { | 198 | while (!(status & SPI_TXF_FULL)) { |
199 | int i; | 199 | int i; |
200 | unsigned int x = 0; | 200 | u32 x = 0; |
201 | 201 | ||
202 | for (i = 0; nbytes && (i < tsd->bytes_per_word); | 202 | for (i = 0; nbytes && (i < tsd->bytes_per_word); |
203 | i++, nbytes--) | 203 | i++, nbytes--) |
204 | x |= ((*tx_buf++) << i*8); | 204 | x |= (u32)(*tx_buf++) << (i * 8); |
205 | tegra_sflash_writel(tsd, x, SPI_TX_FIFO); | 205 | tegra_sflash_writel(tsd, x, SPI_TX_FIFO); |
206 | if (!nbytes) | 206 | if (!nbytes) |
207 | break; | 207 | break; |
@@ -215,16 +215,14 @@ static unsigned tegra_sflash_fill_tx_fifo_from_client_txbuf( | |||
215 | static int tegra_sflash_read_rx_fifo_to_client_rxbuf( | 215 | static int tegra_sflash_read_rx_fifo_to_client_rxbuf( |
216 | struct tegra_sflash_data *tsd, struct spi_transfer *t) | 216 | struct tegra_sflash_data *tsd, struct spi_transfer *t) |
217 | { | 217 | { |
218 | unsigned long status; | 218 | u32 status; |
219 | unsigned int read_words = 0; | 219 | unsigned int read_words = 0; |
220 | u8 *rx_buf = (u8 *)t->rx_buf + tsd->cur_rx_pos; | 220 | u8 *rx_buf = (u8 *)t->rx_buf + tsd->cur_rx_pos; |
221 | 221 | ||
222 | status = tegra_sflash_readl(tsd, SPI_STATUS); | 222 | status = tegra_sflash_readl(tsd, SPI_STATUS); |
223 | while (!(status & SPI_RXF_EMPTY)) { | 223 | while (!(status & SPI_RXF_EMPTY)) { |
224 | int i; | 224 | int i; |
225 | unsigned long x; | 225 | u32 x = tegra_sflash_readl(tsd, SPI_RX_FIFO); |
226 | |||
227 | x = tegra_sflash_readl(tsd, SPI_RX_FIFO); | ||
228 | for (i = 0; (i < tsd->bytes_per_word); i++) | 226 | for (i = 0; (i < tsd->bytes_per_word); i++) |
229 | *rx_buf++ = (x >> (i*8)) & 0xFF; | 227 | *rx_buf++ = (x >> (i*8)) & 0xFF; |
230 | read_words++; | 228 | read_words++; |
@@ -237,7 +235,7 @@ static int tegra_sflash_read_rx_fifo_to_client_rxbuf( | |||
237 | static int tegra_sflash_start_cpu_based_transfer( | 235 | static int tegra_sflash_start_cpu_based_transfer( |
238 | struct tegra_sflash_data *tsd, struct spi_transfer *t) | 236 | struct tegra_sflash_data *tsd, struct spi_transfer *t) |
239 | { | 237 | { |
240 | unsigned long val = 0; | 238 | u32 val = 0; |
241 | unsigned cur_words; | 239 | unsigned cur_words; |
242 | 240 | ||
243 | if (tsd->cur_direction & DATA_DIR_TX) | 241 | if (tsd->cur_direction & DATA_DIR_TX) |
@@ -267,7 +265,7 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, | |||
267 | { | 265 | { |
268 | struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master); | 266 | struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master); |
269 | u32 speed; | 267 | u32 speed; |
270 | unsigned long command; | 268 | u32 command; |
271 | 269 | ||
272 | speed = t->speed_hz; | 270 | speed = t->speed_hz; |
273 | if (speed != tsd->cur_speed) { | 271 | if (speed != tsd->cur_speed) { |
@@ -314,7 +312,7 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, | |||
314 | tegra_sflash_writel(tsd, command, SPI_COMMAND); | 312 | tegra_sflash_writel(tsd, command, SPI_COMMAND); |
315 | tsd->command_reg = command; | 313 | tsd->command_reg = command; |
316 | 314 | ||
317 | return tegra_sflash_start_cpu_based_transfer(tsd, t); | 315 | return tegra_sflash_start_cpu_based_transfer(tsd, t); |
318 | } | 316 | } |
319 | 317 | ||
320 | static int tegra_sflash_setup(struct spi_device *spi) | 318 | static int tegra_sflash_setup(struct spi_device *spi) |