aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_s3c24xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi_s3c24xx.c')
-rw-r--r--drivers/spi/spi_s3c24xx.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 6e834b8b9d27..b7476b888197 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -192,8 +192,11 @@ static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
192 hw->len = t->len; 192 hw->len = t->len;
193 hw->count = 0; 193 hw->count = 0;
194 194
195 init_completion(&hw->done);
196
195 /* send the first byte */ 197 /* send the first byte */
196 writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT); 198 writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
199
197 wait_for_completion(&hw->done); 200 wait_for_completion(&hw->done);
198 201
199 return hw->count; 202 return hw->count;
@@ -235,6 +238,7 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
235 238
236static int __init s3c24xx_spi_probe(struct platform_device *pdev) 239static int __init s3c24xx_spi_probe(struct platform_device *pdev)
237{ 240{
241 struct s3c2410_spi_info *pdata;
238 struct s3c24xx_spi *hw; 242 struct s3c24xx_spi *hw;
239 struct spi_master *master; 243 struct spi_master *master;
240 struct resource *res; 244 struct resource *res;
@@ -251,10 +255,10 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
251 memset(hw, 0, sizeof(struct s3c24xx_spi)); 255 memset(hw, 0, sizeof(struct s3c24xx_spi));
252 256
253 hw->master = spi_master_get(master); 257 hw->master = spi_master_get(master);
254 hw->pdata = pdev->dev.platform_data; 258 hw->pdata = pdata = pdev->dev.platform_data;
255 hw->dev = &pdev->dev; 259 hw->dev = &pdev->dev;
256 260
257 if (hw->pdata == NULL) { 261 if (pdata == NULL) {
258 dev_err(&pdev->dev, "No platform data supplied\n"); 262 dev_err(&pdev->dev, "No platform data supplied\n");
259 err = -ENOENT; 263 err = -ENOENT;
260 goto err_no_pdata; 264 goto err_no_pdata;
@@ -263,6 +267,10 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
263 platform_set_drvdata(pdev, hw); 267 platform_set_drvdata(pdev, hw);
264 init_completion(&hw->done); 268 init_completion(&hw->done);
265 269
270 /* setup the master state. */
271
272 master->num_chipselect = hw->pdata->num_cs;
273
266 /* setup the state for the bitbang driver */ 274 /* setup the state for the bitbang driver */
267 275
268 hw->bitbang.master = hw->master; 276 hw->bitbang.master = hw->master;
@@ -330,13 +338,13 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
330 338
331 /* setup any gpio we can */ 339 /* setup any gpio we can */
332 340
333 if (!hw->pdata->set_cs) { 341 if (!pdata->set_cs) {
334 hw->set_cs = s3c24xx_spi_gpiocs; 342 hw->set_cs = s3c24xx_spi_gpiocs;
335 343
336 s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); 344 s3c2410_gpio_setpin(pdata->pin_cs, 1);
337 s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); 345 s3c2410_gpio_cfgpin(pdata->pin_cs, S3C2410_GPIO_OUTPUT);
338 } else 346 } else
339 hw->set_cs = hw->pdata->set_cs; 347 hw->set_cs = pdata->set_cs;
340 348
341 /* register our spi controller */ 349 /* register our spi controller */
342 350
@@ -415,7 +423,7 @@ static int s3c24xx_spi_resume(struct platform_device *pdev)
415#define s3c24xx_spi_resume NULL 423#define s3c24xx_spi_resume NULL
416#endif 424#endif
417 425
418MODULE_ALIAS("s3c2410_spi"); /* for platform bus hotplug */ 426MODULE_ALIAS("platform:s3c2410-spi");
419static struct platform_driver s3c24xx_spidrv = { 427static struct platform_driver s3c24xx_spidrv = {
420 .remove = __exit_p(s3c24xx_spi_remove), 428 .remove = __exit_p(s3c24xx_spi_remove),
421 .suspend = s3c24xx_spi_suspend, 429 .suspend = s3c24xx_spi_suspend,