aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_s3c24xx_gpio.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
index 0fa25e2e80fe..d59105dc308b 100644
--- a/drivers/spi/spi_s3c24xx_gpio.c
+++ b/drivers/spi/spi_s3c24xx_gpio.c
@@ -96,6 +96,7 @@ static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value)
96 96
97static int s3c2410_spigpio_probe(struct platform_device *dev) 97static int s3c2410_spigpio_probe(struct platform_device *dev)
98{ 98{
99 struct s3c2410_spigpio_info *info;
99 struct spi_master *master; 100 struct spi_master *master;
100 struct s3c2410_spigpio *sp; 101 struct s3c2410_spigpio *sp;
101 int ret; 102 int ret;
@@ -113,7 +114,7 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
113 platform_set_drvdata(dev, sp); 114 platform_set_drvdata(dev, sp);
114 115
115 /* copy in the plkatform data */ 116 /* copy in the plkatform data */
116 sp->info = dev->dev.platform_data; 117 info = sp->info = dev->dev.platform_data;
117 118
118 /* setup spi bitbang adaptor */ 119 /* setup spi bitbang adaptor */
119 sp->bitbang.master = spi_master_get(master); 120 sp->bitbang.master = spi_master_get(master);
@@ -124,13 +125,18 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
124 sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2; 125 sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2;
125 sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3; 126 sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3;
126 127
127 /* set state of spi pins */ 128 /* set state of spi pins, always assume that the clock is
128 s3c2410_gpio_setpin(sp->info->pin_clk, 0); 129 * available, but do check the MOSI and MISO. */
129 s3c2410_gpio_setpin(sp->info->pin_mosi, 0); 130 s3c2410_gpio_setpin(info->pin_clk, 0);
131 s3c2410_gpio_cfgpin(info->pin_clk, S3C2410_GPIO_OUTPUT);
130 132
131 s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT); 133 if (info->pin_mosi < S3C2410_GPH10) {
132 s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT); 134 s3c2410_gpio_setpin(info->pin_mosi, 0);
133 s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT); 135 s3c2410_gpio_cfgpin(info->pin_mosi, S3C2410_GPIO_OUTPUT);
136 }
137
138 if (info->pin_miso != S3C2410_GPA0 && info->pin_miso < S3C2410_GPH10)
139 s3c2410_gpio_cfgpin(info->pin_miso, S3C2410_GPIO_INPUT);
134 140
135 ret = spi_bitbang_start(&sp->bitbang); 141 ret = spi_bitbang_start(&sp->bitbang);
136 if (ret) 142 if (ret)