diff options
-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 | ||