aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-sc18is602.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-25 16:20:36 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-25 16:20:36 -0500
commit2d2e7d195b902c419bc0b69ced026aca444d69a8 (patch)
treea4caa21b9db159873897d64b553042a1ae920ab5 /drivers/spi/spi-sc18is602.c
parent15333539a9b3022656f815f643a77f6b054b335f (diff)
parent8b8b773e6b611e6629ac01f85d401c949d153546 (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-sc18is602.c')
-rw-r--r--drivers/spi/spi-sc18is602.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
index 9eda21d739c6..121c2e1dea36 100644
--- a/drivers/spi/spi-sc18is602.c
+++ b/drivers/spi/spi-sc18is602.c
@@ -183,18 +183,11 @@ static int sc18is602_setup_transfer(struct sc18is602 *hw, u32 hz, u8 mode)
183static int sc18is602_check_transfer(struct spi_device *spi, 183static int sc18is602_check_transfer(struct spi_device *spi,
184 struct spi_transfer *t, int tlen) 184 struct spi_transfer *t, int tlen)
185{ 185{
186 int bpw;
187 uint32_t hz; 186 uint32_t hz;
188 187
189 if (t && t->len + tlen > SC18IS602_BUFSIZ) 188 if (t && t->len + tlen > SC18IS602_BUFSIZ)
190 return -EINVAL; 189 return -EINVAL;
191 190
192 bpw = spi->bits_per_word;
193 if (t && t->bits_per_word)
194 bpw = t->bits_per_word;
195 if (bpw != 8)
196 return -EINVAL;
197
198 hz = spi->max_speed_hz; 191 hz = spi->max_speed_hz;
199 if (t && t->speed_hz) 192 if (t && t->speed_hz)
200 hz = t->speed_hz; 193 hz = t->speed_hz;
@@ -254,9 +247,6 @@ error:
254 247
255static int sc18is602_setup(struct spi_device *spi) 248static int sc18is602_setup(struct spi_device *spi)
256{ 249{
257 if (!spi->bits_per_word)
258 spi->bits_per_word = 8;
259
260 if (spi->mode & ~(SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST)) 250 if (spi->mode & ~(SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST))
261 return -EINVAL; 251 return -EINVAL;
262 252
@@ -315,11 +305,12 @@ static int sc18is602_probe(struct i2c_client *client,
315 } 305 }
316 master->bus_num = client->adapter->nr; 306 master->bus_num = client->adapter->nr;
317 master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST; 307 master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST;
308 master->bits_per_word_mask = SPI_BPW_MASK(8);
318 master->setup = sc18is602_setup; 309 master->setup = sc18is602_setup;
319 master->transfer_one_message = sc18is602_transfer_one; 310 master->transfer_one_message = sc18is602_transfer_one;
320 master->dev.of_node = np; 311 master->dev.of_node = np;
321 312
322 error = spi_register_master(master); 313 error = devm_spi_register_master(dev, master);
323 if (error) 314 if (error)
324 goto error_reg; 315 goto error_reg;
325 316
@@ -330,16 +321,6 @@ error_reg:
330 return error; 321 return error;
331} 322}
332 323
333static int sc18is602_remove(struct i2c_client *client)
334{
335 struct sc18is602 *hw = i2c_get_clientdata(client);
336 struct spi_master *master = hw->master;
337
338 spi_unregister_master(master);
339
340 return 0;
341}
342
343static const struct i2c_device_id sc18is602_id[] = { 324static const struct i2c_device_id sc18is602_id[] = {
344 { "sc18is602", sc18is602 }, 325 { "sc18is602", sc18is602 },
345 { "sc18is602b", sc18is602b }, 326 { "sc18is602b", sc18is602b },
@@ -353,7 +334,6 @@ static struct i2c_driver sc18is602_driver = {
353 .name = "sc18is602", 334 .name = "sc18is602",
354 }, 335 },
355 .probe = sc18is602_probe, 336 .probe = sc18is602_probe,
356 .remove = sc18is602_remove,
357 .id_table = sc18is602_id, 337 .id_table = sc18is602_id,
358}; 338};
359 339