funbar-2.6.24-platform-spi-gpio-acc-repair.patch
From: warmcat <[EMAIL PROTECTED]>
This doesn't actually do anything about the INT problem yet.
The 2.6.24 gpio spi and platform situation was completely
messed up and was a long way from even being able to talk
to the motion sensors.
This patch gets the gpio SPI actually working and both
motion sensors probed and recognized on 2.6.24.
(FUNBAR is like FUBAR with a "Nearly" in there.)
- the gpio cs function only addressed one chip, I
pushed the pin info through platform so it does
both motion sensors
- the spi_board_info chip_select member ain't a
pin ID, it is a chip select index for the
spi master
- nobody set master->num_chipselect, I pushed it
through platform stuff into s3c2410_spigpio_info
- name of the gpio spi driver had changed and the
platform side not updated
Signed-off-by: Andy Green <[EMAIL PROTECTED]>
---
arch/arm/mach-s3c2440/mach-gta02.c | 37 ++++++++++++++++++-------------
drivers/input/misc/lis302dl.c | 12 ++++++----
drivers/spi/spi_s3c24xx_gpio.c | 2 ++
include/asm-arm/arch-s3c2410/spi-gpio.h | 1 +
include/linux/lis302dl.h | 1 +
5 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index b041118..1d54dc2 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -473,10 +473,12 @@ static struct spi_board_info gta02_spi_board_info[] __initdata = {
},
};
+#if 0 /* currently this is not used and we use gpio spi */
static struct glamo_spi_info glamo_spi_cfg = {
.board_size = ARRAY_SIZE(gta02_spi_board_info),
.board_info = gta02_spi_board_info,
};
+#endif /* 0 */
static struct glamo_spigpio_info glamo_spigpio_cfg = {
.pin_clk = GLAMO_GPIO10_OUTPUT,
@@ -504,9 +506,11 @@ static struct platform_device gta01_led_dev = {
static const struct lis302dl_platform_data lis302_pdata[] = {
{
- .name = "lis302-1 (top)"
+ .name = "lis302-1 (top)",
+ .pin_chip_select= S3C2410_GPD12,
}, {
- .name = "lis302-2 (bottom)"
+ .name = "lis302-2 (bottom)",
+ .pin_chip_select= S3C2410_GPD13,
},
};
@@ -517,7 +521,7 @@ static struct spi_board_info gta02_spi_acc_bdinfo[] = {
.irq = GTA02_IRQ_GSENSOR_1,
.max_speed_hz = 400 * 1000,
.bus_num = 1,
- .chip_select = S3C2410_GPD12,
+ .chip_select = 0,
.mode = SPI_MODE_3,
},
{
@@ -526,20 +530,22 @@ static struct spi_board_info gta02_spi_acc_bdinfo[] = {
.irq = GTA02_IRQ_GSENSOR_2,
.max_speed_hz = 400 * 1000,
.bus_num = 1,
- .chip_select = S3C2410_GPD13,
+ .chip_select = 1,
.mode = SPI_MODE_3,
},
};
-
-static void spi_acc_cs(struct s3c2410_spigpio_info *spi, int cs)
+static void spi_acc_cs(struct s3c2410_spigpio_info *spigpio_info, int cs)
{
+ struct lis302dl_platform_data * plat_data =
+ (struct lis302dl_platform_data *)spigpio_info->
+ board_info->platform_data;
switch (cs) {
case BITBANG_CS_ACTIVE:
- s3c2410_gpio_setpin(S3C2410_GPD12, 0);
+ s3c2410_gpio_setpin(plat_data->pin_chip_select, 0);
break;
case BITBANG_CS_INACTIVE:
- s3c2410_gpio_setpin(S3C2410_GPD12, 1);
+ s3c2410_gpio_setpin(plat_data->pin_chip_select, 1);
break;
}
}
@@ -551,6 +557,7 @@ static struct s3c2410_spigpio_info spi_gpio_cfg = {
.board_size = ARRAY_SIZE(gta02_spi_acc_bdinfo),
.board_info = gta02_spi_acc_bdinfo,
.chip_select = &spi_acc_cs,
+ .num_chipselect = 2,
};
static struct resource s3c_spi_acc_resource[] = {
@@ -573,7 +580,7 @@ static struct resource s3c_spi_acc_resource[] = {
};
static struct platform_device s3c_device_spi_acc = {
- .name = "s3c24xx-spi-gpio",
+ .name = "spi_s3c24xx_gpio",
.id = 1,
.num_resources = ARRAY_SIZE(s3c_spi_acc_resource),
.resource = s3c_spi_acc_resource,
@@ -833,6 +840,12 @@ static void __init gta02_machine_init(void)
break;
}
+ /* acc sensor chip selects */
+ s3c2410_gpio_setpin(S3C2410_GPD12, 1);
+ s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPIO_OUTPUT);
+ s3c2410_gpio_setpin(S3C2410_GPD13, 1);
+ s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPIO_OUTPUT);
+
INIT_WORK(>a02_udc_vbus_drawer.work, __gta02_udc_vbus_draw);
s3c24xx_udc_set_platdata(>a02_udc_cfg);
set_s3c2410ts_info(>a02_ts_cfg);
@@ -883,12 +896,6 @@ static void __init gta02_machine_init(void)
s3c2410_gpio_setpin(GTA01_GPIO_LCD_RESET, 1);
s3c2410_gpio_cfgpin(GTA01_GPIO_LCD_RESET, S3C2410_GPIO_OUTPUT);
- s3c2410_gpio_setpin(S3C2410_GPD12, 1);
- s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPIO_OUTPUT);
-
- s3c2410_gpio_setpin(S3C2410_GPD13, 1);
- s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPIO_OUTPUT);
-
/* Make sure the modem can wake us up */
set_irq_type(GTA02_IRQ_MODEM, IRQT_RISING);
rc = request_irq(GTA02_IRQ_MODEM, gta02_modem_irq, IRQF_DISABLED,
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
index 109d82c..6ed6a3e 100644
--- a/drivers/spi/spi_s3c24xx_gpio.c
+++ b/drivers/spi/spi_s3c24xx_gpio.c
@@ -116,6 +116,8 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
/* copy in the plkatform 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;
diff --git a/include/asm-arm/arch-s3c2410/spi-gpio.h b/include/asm-arm/arch-s3c2410/spi-gpio.h
index ba1dca8..42f0965 100644
--- a/include/asm-arm/arch-s3c2410/spi-gpio.h
+++ b/include/asm-arm/arch-s3c2410/spi-gpio.h
@@ -22,6 +22,7 @@ struct s3c2410_spigpio_info {
unsigned long pin_miso;
int bus_num;
+ int num_chipselect;
unsigned long board_size;
struct spi_board_info *board_info;
diff --git a/include/linux/lis302dl.h b/include/linux/lis302dl.h
index d0f31be..e45083a 100644
--- a/include/linux/lis302dl.h
+++ b/include/linux/lis302dl.h
@@ -5,6 +5,7 @@
struct lis302dl_platform_data {
char *name;
+ unsigned long pin_chip_select;
};
#endif /* _LINUX_LIS302DL_H */