Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45821
b: refs/heads/master
c: 8736b92
h: refs/heads/master
i:
  45819: cab41fa
v: v3
  • Loading branch information
Ben Dooks authored and Linus Torvalds committed Jan 26, 2007
1 parent 1371733 commit db3f0dc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46fe4ddd9dbb15305ab9b458e6cfa4dd47ac3e47
refs/heads/master: 8736b9270c2f8993ca44c30f64d4c6d25e379687
28 changes: 14 additions & 14 deletions trunk/drivers/spi/spi_s3c24xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*
*/


//#define DEBUG

#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
Expand Down Expand Up @@ -44,6 +41,9 @@ struct s3c24xx_spi {
int len;
int count;

int (*set_cs)(struct s3c2410_spi_info *spi,
int cs, int pol);

/* data buffers */
const unsigned char *tx;
unsigned char *rx;
Expand All @@ -64,6 +64,11 @@ static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev)
return spi_master_get_devdata(sdev->master);
}

static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol)
{
s3c2410_gpio_setpin(spi->pin_cs, pol);
}

static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
{
struct s3c24xx_spi *hw = to_hw(spi);
Expand All @@ -72,10 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)

switch (value) {
case BITBANG_CS_INACTIVE:
if (hw->pdata->set_cs)
hw->pdata->set_cs(hw->pdata, value, cspol);
else
s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1);
hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1);
break;

case BITBANG_CS_ACTIVE:
Expand All @@ -96,14 +98,9 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
/* write new configration */

writeb(spcon, hw->regs + S3C2410_SPCON);

if (hw->pdata->set_cs)
hw->pdata->set_cs(hw->pdata, value, cspol);
else
s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol);
hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol);

break;

}
}

Expand Down Expand Up @@ -330,9 +327,12 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
/* setup any gpio we can */

if (!hw->pdata->set_cs) {
hw->set_cs = s3c24xx_spi_gpiocs;

s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);
s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);
}
} else
hw->set_cs = hw->pdata->set_cs;

/* register our spi controller */

Expand Down

0 comments on commit db3f0dc

Please sign in to comment.