aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authormokopatches <mokopatches@openmoko.org>2008-11-19 17:03:16 +0000
committerwarmcat <andy@warmcat.com>2008-11-19 17:03:16 +0000
commit97b917eaa7396335ec12cbb2927eafbe0f5b3489 (patch)
treeba4981fc414e5db41b6507d73249d277e1287557 /drivers/spi
parenta65837dce6a2d4061ebfccfb6a8e4234b5c98ef5 (diff)
gta02-acc.patch
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_s3c24xx_gpio.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
index cc1f647f579..b41de422cb4 100644
--- a/drivers/spi/spi_s3c24xx_gpio.c
+++ b/drivers/spi/spi_s3c24xx_gpio.c
@@ -91,7 +91,7 @@ static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value)
struct s3c2410_spigpio *sg = spidev_to_sg(dev);
if (sg->info && sg->info->chip_select)
- (sg->info->chip_select)(sg->info, value);
+ (sg->info->chip_select)(sg->info, dev->chip_select, value);
}
static int s3c2410_spigpio_probe(struct platform_device *dev)
@@ -100,6 +100,7 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
struct spi_master *master;
struct s3c2410_spigpio *sp;
int ret;
+ int i;
master = spi_alloc_master(&dev->dev, sizeof(struct s3c2410_spigpio));
if (master == NULL) {
@@ -112,9 +113,11 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
platform_set_drvdata(dev, sp);
- /* copy in the plkatform data */
+ /* copy in the platform data */
info = sp->info = dev->dev.platform_data;
+ master->num_chipselect = info->num_chipselect;
+
/* setup spi bitbang adaptor */
sp->bitbang.master = spi_master_get(master);
sp->bitbang.master->bus_num = info->bus_num;
@@ -142,6 +145,22 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
if (ret)
goto err_no_bitbang;
+ /* register the chips to go with the board */
+
+ for (i = 0; i < sp->info->board_size; i++) {
+ struct spi_device *spidev;
+
+ dev_info(&dev->dev, "registering %p: %s\n",
+ &sp->info->board_info[i],
+ sp->info->board_info[i].modalias);
+
+ sp->info->board_info[i].controller_data = sp;
+ spidev = spi_new_device(master, sp->info->board_info + i);
+ if (spidev)
+ spidev->max_speed_hz =
+ sp->info->board_info[i].max_speed_hz;
+ }
+
return 0;
err_no_bitbang: