diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/coldfire_qspi.c | 2 | ||||
-rw-r--r-- | drivers/spi/mpc52xx_spi.c | 2 | ||||
-rw-r--r-- | drivers/spi/omap2_mcspi.c | 39 | ||||
-rw-r--r-- | drivers/spi/spi.c | 3 | ||||
-rw-r--r-- | drivers/spi/spi_fsl_espi.c | 35 |
5 files changed, 67 insertions, 14 deletions
diff --git a/drivers/spi/coldfire_qspi.c b/drivers/spi/coldfire_qspi.c index 052b3c7fa6a0..8856bcca9d29 100644 --- a/drivers/spi/coldfire_qspi.c +++ b/drivers/spi/coldfire_qspi.c | |||
@@ -317,7 +317,7 @@ static void mcfqspi_work(struct work_struct *work) | |||
317 | msg = container_of(mcfqspi->msgq.next, struct spi_message, | 317 | msg = container_of(mcfqspi->msgq.next, struct spi_message, |
318 | queue); | 318 | queue); |
319 | 319 | ||
320 | list_del_init(&mcfqspi->msgq); | 320 | list_del_init(&msg->queue); |
321 | spin_unlock_irqrestore(&mcfqspi->lock, flags); | 321 | spin_unlock_irqrestore(&mcfqspi->lock, flags); |
322 | 322 | ||
323 | spi = msg->spi; | 323 | spi = msg->spi; |
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index ec9f0b1bf864..84439f655601 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c | |||
@@ -563,7 +563,7 @@ static struct of_platform_driver mpc52xx_spi_of_driver = { | |||
563 | .of_match_table = mpc52xx_spi_match, | 563 | .of_match_table = mpc52xx_spi_match, |
564 | }, | 564 | }, |
565 | .probe = mpc52xx_spi_probe, | 565 | .probe = mpc52xx_spi_probe, |
566 | .remove = __exit_p(mpc52xx_spi_remove), | 566 | .remove = __devexit_p(mpc52xx_spi_remove), |
567 | }; | 567 | }; |
568 | 568 | ||
569 | static int __init mpc52xx_spi_init(void) | 569 | static int __init mpc52xx_spi_init(void) |
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 2a651e61bfbf..951a160fc27f 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
@@ -1305,10 +1305,49 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) | |||
1305 | /* work with hotplug and coldplug */ | 1305 | /* work with hotplug and coldplug */ |
1306 | MODULE_ALIAS("platform:omap2_mcspi"); | 1306 | MODULE_ALIAS("platform:omap2_mcspi"); |
1307 | 1307 | ||
1308 | #ifdef CONFIG_SUSPEND | ||
1309 | /* | ||
1310 | * When SPI wake up from off-mode, CS is in activate state. If it was in | ||
1311 | * unactive state when driver was suspend, then force it to unactive state at | ||
1312 | * wake up. | ||
1313 | */ | ||
1314 | static int omap2_mcspi_resume(struct device *dev) | ||
1315 | { | ||
1316 | struct spi_master *master = dev_get_drvdata(dev); | ||
1317 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); | ||
1318 | struct omap2_mcspi_cs *cs; | ||
1319 | |||
1320 | omap2_mcspi_enable_clocks(mcspi); | ||
1321 | list_for_each_entry(cs, &omap2_mcspi_ctx[master->bus_num - 1].cs, | ||
1322 | node) { | ||
1323 | if ((cs->chconf0 & OMAP2_MCSPI_CHCONF_FORCE) == 0) { | ||
1324 | |||
1325 | /* | ||
1326 | * We need to toggle CS state for OMAP take this | ||
1327 | * change in account. | ||
1328 | */ | ||
1329 | MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 1); | ||
1330 | __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); | ||
1331 | MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 0); | ||
1332 | __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); | ||
1333 | } | ||
1334 | } | ||
1335 | omap2_mcspi_disable_clocks(mcspi); | ||
1336 | return 0; | ||
1337 | } | ||
1338 | #else | ||
1339 | #define omap2_mcspi_resume NULL | ||
1340 | #endif | ||
1341 | |||
1342 | static const struct dev_pm_ops omap2_mcspi_pm_ops = { | ||
1343 | .resume = omap2_mcspi_resume, | ||
1344 | }; | ||
1345 | |||
1308 | static struct platform_driver omap2_mcspi_driver = { | 1346 | static struct platform_driver omap2_mcspi_driver = { |
1309 | .driver = { | 1347 | .driver = { |
1310 | .name = "omap2_mcspi", | 1348 | .name = "omap2_mcspi", |
1311 | .owner = THIS_MODULE, | 1349 | .owner = THIS_MODULE, |
1350 | .pm = &omap2_mcspi_pm_ops | ||
1312 | }, | 1351 | }, |
1313 | .remove = __exit_p(omap2_mcspi_remove), | 1352 | .remove = __exit_p(omap2_mcspi_remove), |
1314 | }; | 1353 | }; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 709c836607de..b02d0cbce890 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -584,8 +584,7 @@ void spi_unregister_master(struct spi_master *master) | |||
584 | list_del(&master->list); | 584 | list_del(&master->list); |
585 | mutex_unlock(&board_lock); | 585 | mutex_unlock(&board_lock); |
586 | 586 | ||
587 | dummy = device_for_each_child(master->dev.parent, &master->dev, | 587 | dummy = device_for_each_child(&master->dev, NULL, __unregister); |
588 | __unregister); | ||
589 | device_unregister(&master->dev); | 588 | device_unregister(&master->dev); |
590 | } | 589 | } |
591 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 590 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
diff --git a/drivers/spi/spi_fsl_espi.c b/drivers/spi/spi_fsl_espi.c index e3b4f6451966..a99e2333b949 100644 --- a/drivers/spi/spi_fsl_espi.c +++ b/drivers/spi/spi_fsl_espi.c | |||
@@ -258,18 +258,18 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
258 | return mpc8xxx_spi->count; | 258 | return mpc8xxx_spi->count; |
259 | } | 259 | } |
260 | 260 | ||
261 | static void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd) | 261 | static inline void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd) |
262 | { | 262 | { |
263 | if (cmd[1] && cmd[2] && cmd[3]) { | 263 | if (cmd) { |
264 | cmd[1] = (u8)(addr >> 16); | 264 | cmd[1] = (u8)(addr >> 16); |
265 | cmd[2] = (u8)(addr >> 8); | 265 | cmd[2] = (u8)(addr >> 8); |
266 | cmd[3] = (u8)(addr >> 0); | 266 | cmd[3] = (u8)(addr >> 0); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | static unsigned int fsl_espi_cmd2addr(u8 *cmd) | 270 | static inline unsigned int fsl_espi_cmd2addr(u8 *cmd) |
271 | { | 271 | { |
272 | if (cmd[1] && cmd[2] && cmd[3]) | 272 | if (cmd) |
273 | return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0; | 273 | return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0; |
274 | 274 | ||
275 | return 0; | 275 | return 0; |
@@ -395,9 +395,11 @@ static void fsl_espi_rw_trans(struct spi_message *m, | |||
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | addr = fsl_espi_cmd2addr(local_buf); | 398 | if (pos > 0) { |
399 | addr += pos; | 399 | addr = fsl_espi_cmd2addr(local_buf); |
400 | fsl_espi_addr2cmd(addr, local_buf); | 400 | addr += pos; |
401 | fsl_espi_addr2cmd(addr, local_buf); | ||
402 | } | ||
401 | 403 | ||
402 | espi_trans->n_tx = n_tx; | 404 | espi_trans->n_tx = n_tx; |
403 | espi_trans->n_rx = trans_len; | 405 | espi_trans->n_rx = trans_len; |
@@ -507,16 +509,29 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | |||
507 | 509 | ||
508 | /* We need handle RX first */ | 510 | /* We need handle RX first */ |
509 | if (events & SPIE_NE) { | 511 | if (events & SPIE_NE) { |
510 | u32 rx_data; | 512 | u32 rx_data, tmp; |
513 | u8 rx_data_8; | ||
511 | 514 | ||
512 | /* Spin until RX is done */ | 515 | /* Spin until RX is done */ |
513 | while (SPIE_RXCNT(events) < min(4, mspi->len)) { | 516 | while (SPIE_RXCNT(events) < min(4, mspi->len)) { |
514 | cpu_relax(); | 517 | cpu_relax(); |
515 | events = mpc8xxx_spi_read_reg(®_base->event); | 518 | events = mpc8xxx_spi_read_reg(®_base->event); |
516 | } | 519 | } |
517 | mspi->len -= 4; | ||
518 | 520 | ||
519 | rx_data = mpc8xxx_spi_read_reg(®_base->receive); | 521 | if (mspi->len >= 4) { |
522 | rx_data = mpc8xxx_spi_read_reg(®_base->receive); | ||
523 | } else { | ||
524 | tmp = mspi->len; | ||
525 | rx_data = 0; | ||
526 | while (tmp--) { | ||
527 | rx_data_8 = in_8((u8 *)®_base->receive); | ||
528 | rx_data |= (rx_data_8 << (tmp * 8)); | ||
529 | } | ||
530 | |||
531 | rx_data <<= (4 - mspi->len) * 8; | ||
532 | } | ||
533 | |||
534 | mspi->len -= 4; | ||
520 | 535 | ||
521 | if (mspi->rx) | 536 | if (mspi->rx) |
522 | mspi->get_rx(rx_data, mspi); | 537 | mspi->get_rx(rx_data, mspi); |