diff options
author | Ben Dooks <ben-linux@fluff.org> | 2007-01-26 03:56:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-26 16:50:57 -0500 |
commit | 8736b9270c2f8993ca44c30f64d4c6d25e379687 (patch) | |
tree | 6729883c00bd75054020f822e958626e84bdc84d /drivers | |
parent | 46fe4ddd9dbb15305ab9b458e6cfa4dd47ac3e47 (diff) |
[PATCH] S3C24XX: fix passing spi chipselect to select routine
It turns out that the spi chipselect was not being passed to the set_cs
routine if one was specified in the platform data.
As part of the fix, change to using a set_cs field in the controller state,
and put a default gpio routine in if the data passed does not specify it.
Also remove the //#define DEBUG
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi_s3c24xx.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 8ca08713528e..651379c51ae6 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -10,9 +10,6 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | |||
14 | //#define DEBUG | ||
15 | |||
16 | #include <linux/init.h> | 13 | #include <linux/init.h> |
17 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
18 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
@@ -44,6 +41,9 @@ struct s3c24xx_spi { | |||
44 | int len; | 41 | int len; |
45 | int count; | 42 | int count; |
46 | 43 | ||
44 | int (*set_cs)(struct s3c2410_spi_info *spi, | ||
45 | int cs, int pol); | ||
46 | |||
47 | /* data buffers */ | 47 | /* data buffers */ |
48 | const unsigned char *tx; | 48 | const unsigned char *tx; |
49 | unsigned char *rx; | 49 | unsigned char *rx; |
@@ -64,6 +64,11 @@ static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev) | |||
64 | return spi_master_get_devdata(sdev->master); | 64 | return spi_master_get_devdata(sdev->master); |
65 | } | 65 | } |
66 | 66 | ||
67 | static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol) | ||
68 | { | ||
69 | s3c2410_gpio_setpin(spi->pin_cs, pol); | ||
70 | } | ||
71 | |||
67 | static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | 72 | static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) |
68 | { | 73 | { |
69 | struct s3c24xx_spi *hw = to_hw(spi); | 74 | struct s3c24xx_spi *hw = to_hw(spi); |
@@ -72,10 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
72 | 77 | ||
73 | switch (value) { | 78 | switch (value) { |
74 | case BITBANG_CS_INACTIVE: | 79 | case BITBANG_CS_INACTIVE: |
75 | if (hw->pdata->set_cs) | 80 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1); |
76 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
77 | else | ||
78 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1); | ||
79 | break; | 81 | break; |
80 | 82 | ||
81 | case BITBANG_CS_ACTIVE: | 83 | case BITBANG_CS_ACTIVE: |
@@ -96,14 +98,9 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
96 | /* write new configration */ | 98 | /* write new configration */ |
97 | 99 | ||
98 | writeb(spcon, hw->regs + S3C2410_SPCON); | 100 | writeb(spcon, hw->regs + S3C2410_SPCON); |
99 | 101 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol); | |
100 | if (hw->pdata->set_cs) | ||
101 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
102 | else | ||
103 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol); | ||
104 | 102 | ||
105 | break; | 103 | break; |
106 | |||
107 | } | 104 | } |
108 | } | 105 | } |
109 | 106 | ||
@@ -330,9 +327,12 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) | |||
330 | /* setup any gpio we can */ | 327 | /* setup any gpio we can */ |
331 | 328 | ||
332 | if (!hw->pdata->set_cs) { | 329 | if (!hw->pdata->set_cs) { |
330 | hw->set_cs = s3c24xx_spi_gpiocs; | ||
331 | |||
333 | s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); | 332 | s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); |
334 | s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); | 333 | s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); |
335 | } | 334 | } else |
335 | hw->set_cs = hw->pdata->set_cs; | ||
336 | 336 | ||
337 | /* register our spi controller */ | 337 | /* register our spi controller */ |
338 | 338 | ||