aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-06-17 19:26:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:03:42 -0400
commit7390284290b184a7f4bb648ca15dc62c3dea3e75 (patch)
treeb829f116cb11e3c066616e69f15375f4b013becf /drivers/spi
parente7db06b5d5afcef15c4c3e61c3a7441ed7ad1407 (diff)
mpc52xx_psc_spi: convert to cs_control callback
mpc52xx_psc_spi driver is the last user of the legacy activate_cs and deactivate_cs callbacks, so convert the driver to the cs_control hook and remove the legacy callbacks from fsl_spi_platform_data struct. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index bdae9f908978..1b74d5ca03f3 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/types.h>
16#include <linux/errno.h> 17#include <linux/errno.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/of_platform.h> 19#include <linux/of_platform.h>
@@ -30,8 +31,7 @@
30 31
31struct mpc52xx_psc_spi { 32struct mpc52xx_psc_spi {
32 /* fsl_spi_platform data */ 33 /* fsl_spi_platform data */
33 void (*activate_cs)(u8, u8); 34 void (*cs_control)(struct spi_device *spi, bool on);
34 void (*deactivate_cs)(u8, u8);
35 u32 sysclk; 35 u32 sysclk;
36 36
37 /* driver internal data */ 37 /* driver internal data */
@@ -111,18 +111,16 @@ static void mpc52xx_psc_spi_activate_cs(struct spi_device *spi)
111 out_be16((u16 __iomem *)&psc->ccr, ccr); 111 out_be16((u16 __iomem *)&psc->ccr, ccr);
112 mps->bits_per_word = cs->bits_per_word; 112 mps->bits_per_word = cs->bits_per_word;
113 113
114 if (mps->activate_cs) 114 if (mps->cs_control)
115 mps->activate_cs(spi->chip_select, 115 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0);
116 (spi->mode & SPI_CS_HIGH) ? 1 : 0);
117} 116}
118 117
119static void mpc52xx_psc_spi_deactivate_cs(struct spi_device *spi) 118static void mpc52xx_psc_spi_deactivate_cs(struct spi_device *spi)
120{ 119{
121 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); 120 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master);
122 121
123 if (mps->deactivate_cs) 122 if (mps->cs_control)
124 mps->deactivate_cs(spi->chip_select, 123 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
125 (spi->mode & SPI_CS_HIGH) ? 1 : 0);
126} 124}
127 125
128#define MPC52xx_PSC_BUFSIZE (MPC52xx_PSC_RFNUM_MASK + 1) 126#define MPC52xx_PSC_BUFSIZE (MPC52xx_PSC_RFNUM_MASK + 1)
@@ -382,15 +380,13 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
382 mps->irq = irq; 380 mps->irq = irq;
383 if (pdata == NULL) { 381 if (pdata == NULL) {
384 dev_warn(dev, "probe called without platform data, no " 382 dev_warn(dev, "probe called without platform data, no "
385 "(de)activate_cs function will be called\n"); 383 "cs_control function will be called\n");
386 mps->activate_cs = NULL; 384 mps->cs_control = NULL;
387 mps->deactivate_cs = NULL;
388 mps->sysclk = 0; 385 mps->sysclk = 0;
389 master->bus_num = bus_num; 386 master->bus_num = bus_num;
390 master->num_chipselect = 255; 387 master->num_chipselect = 255;
391 } else { 388 } else {
392 mps->activate_cs = pdata->activate_cs; 389 mps->cs_control = pdata->cs_control;
393 mps->deactivate_cs = pdata->deactivate_cs;
394 mps->sysclk = pdata->sysclk; 390 mps->sysclk = pdata->sysclk;
395 master->bus_num = pdata->bus_num; 391 master->bus_num = pdata->bus_num;
396 master->num_chipselect = pdata->max_chipselect; 392 master->num_chipselect = pdata->max_chipselect;