Changeset 3945
- Timestamp:
- 01/24/08 19:21:01 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/src/target/kernel/2.6.24.x/patches/gta02-acc.patch
r3937 r3945 12 12 }; 13 13 14 @@ -504,11 +502,6 @@ 14 @@ -475,10 +473,12 @@ 15 }, 16 }; 17 18 +#if 0 /* currently this is not used and we use gpio spi */ 19 static struct glamo_spi_info glamo_spi_cfg = { 20 .board_size = ARRAY_SIZE(gta02_spi_board_info), 21 .board_info = gta02_spi_board_info, 22 }; 23 +#endif /* 0 */ 24 25 static struct glamo_spigpio_info glamo_spigpio_cfg = { 26 .pin_clk = GLAMO_GPIO10_OUTPUT, 27 @@ -504,16 +504,13 @@ 15 28 16 29 /* SPI: Accelerometers attached to SPI of s3c244x */ … … 23 36 static const struct lis302dl_platform_data lis302_pdata[] = { 24 37 { 25 .name = "lis302-1 (top)" 26 @@ -538,10 +531,55 @@ 38 - .name = "lis302-1 (top)" 39 + .name = "lis302-1 (top)", 40 + .pin_chip_select= S3C2410_GPD12, 41 }, { 42 - .name = "lis302-2 (bottom)" 43 + .name = "lis302-2 (bottom)", 44 + .pin_chip_select= S3C2410_GPD13, 45 }, 46 }; 47 48 @@ -524,7 +521,7 @@ 49 .irq = GTA02_IRQ_GSENSOR_1, 50 .max_speed_hz = 400 * 1000, 51 .bus_num = 1, 52 - .chip_select = S3C2410_GPD12, 53 + .chip_select = 0, 54 .mode = SPI_MODE_3, 55 }, 56 { 57 @@ -533,15 +530,63 @@ 58 .irq = GTA02_IRQ_GSENSOR_2, 59 .max_speed_hz = 400 * 1000, 60 .bus_num = 1, 61 - .chip_select = S3C2410_GPD13, 62 + .chip_select = 1, 63 .mode = SPI_MODE_3, 27 64 }, 28 65 }; … … 30 67 -static struct s3c2410_spi_info gta02_spi_acc_cfg = { 31 68 - .set_cs = gta02_spi_acc_set_cs, 32 + 33 +static void spi_acc_cs(struct s3c2410_spigpio_info *spi, int cs) 69 +static void spi_acc_cs(struct s3c2410_spigpio_info *spigpio_info, int cs) 34 70 +{ 71 + struct lis302dl_platform_data * plat_data = 72 + (struct lis302dl_platform_data *)spigpio_info-> 73 + board_info->platform_data; 35 74 + switch (cs) { 36 75 + case BITBANG_CS_ACTIVE: 37 + s3c2410_gpio_setpin( S3C2410_GPD12, 0);76 + s3c2410_gpio_setpin(plat_data->pin_chip_select, 0); 38 77 + break; 39 78 + case BITBANG_CS_INACTIVE: 40 + s3c2410_gpio_setpin( S3C2410_GPD12, 1);79 + s3c2410_gpio_setpin(plat_data->pin_chip_select, 1); 41 80 + break; 42 81 + } … … 50 89 .board_info = gta02_spi_acc_bdinfo, 51 90 + .chip_select = &spi_acc_cs, 91 + .num_chipselect = 2, 52 92 +}; 53 93 + … … 72 112 + 73 113 +static struct platform_device s3c_device_spi_acc = { 74 + .name = "s 3c24xx-spi-gpio",114 + .name = "spi_s3c24xx_gpio", 75 115 + .id = 1, 76 116 + .num_resources = ARRAY_SIZE(s3c_spi_acc_resource), … … 82 122 83 123 static struct resource gta02_led_resources[] = { 84 @@ -784,7 +82 2,6 @@124 @@ -784,7 +829,6 @@ 85 125 s3c_device_usb.dev.platform_data = >a02_usb_info; 86 126 s3c_device_nand.dev.platform_data = >a02_nand_info; … … 90 130 /* Only GTA02v1 has a SD_DETECT GPIO. Since the slot is not 91 131 * hot-pluggable, this is not required anyway */ 92 @@ -824,6 +861,7 @@ 132 @@ -796,6 +840,12 @@ 133 break; 134 } 135 136 + /* acc sensor chip selects */ 137 + s3c2410_gpio_setpin(S3C2410_GPD12, 1); 138 + s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPIO_OUTPUT); 139 + s3c2410_gpio_setpin(S3C2410_GPD13, 1); 140 + s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPIO_OUTPUT); 141 + 142 INIT_WORK(>a02_udc_vbus_drawer.work, __gta02_udc_vbus_draw); 143 s3c24xx_udc_set_platdata(>a02_udc_cfg); 144 set_s3c2410ts_info(>a02_ts_cfg); 145 @@ -824,6 +874,7 @@ 93 146 break; 94 147 } … … 190 243 dev_err(&spi->dev, "error requesting IRQ %d\n", 191 244 lis->spi_dev->irq); 245 Index: linux-2.6.24-rc8/drivers/spi/spi_s3c24xx_gpio.c 246 =================================================================== 247 --- linux-2.6.24-rc8.orig/drivers/spi/spi_s3c24xx_gpio.c 248 +++ linux-2.6.24-rc8/drivers/spi/spi_s3c24xx_gpio.c 249 @@ -116,6 +116,8 @@ 250 /* copy in the plkatform data */ 251 info = sp->info = dev->dev.platform_data; 252 253 + master->num_chipselect = info->num_chipselect; 254 + 255 /* setup spi bitbang adaptor */ 256 sp->bitbang.master = spi_master_get(master); 257 sp->bitbang.master->bus_num = info->bus_num; 258 Index: linux-2.6.24-rc8/include/asm-arm/arch-s3c2410/spi-gpio.h 259 =================================================================== 260 --- linux-2.6.24-rc8.orig/include/asm-arm/arch-s3c2410/spi-gpio.h 261 +++ linux-2.6.24-rc8/include/asm-arm/arch-s3c2410/spi-gpio.h 262 @@ -22,6 +22,7 @@ 263 unsigned long pin_miso; 264 265 int bus_num; 266 + int num_chipselect; 267 268 unsigned long board_size; 269 struct spi_board_info *board_info; 270 Index: linux-2.6.24-rc8/include/linux/lis302dl.h 271 =================================================================== 272 --- linux-2.6.24-rc8.orig/include/linux/lis302dl.h 273 +++ linux-2.6.24-rc8/include/linux/lis302dl.h 274 @@ -5,6 +5,7 @@ 275 276 struct lis302dl_platform_data { 277 char *name; 278 + unsigned long pin_chip_select; 279 }; 280 281 #endif /* _LINUX_LIS302DL_H */
Note: See TracChangeset
for help on using the changeset viewer.
