r3852 - branches/src/target/kernel/2.6.24.x/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Tue Jan 15 23:55:43 CET 2008


Author: werner
Date: 2008-01-15 23:55:39 +0100 (Tue, 15 Jan 2008)
New Revision: 3852

Added:
   branches/src/target/kernel/2.6.24.x/patches/gta02-acc.patch
Modified:
   branches/src/target/kernel/2.6.24.x/patches/series
Log:
Applied r3799 and r3800 from the 2.6.22.5 tree.

Note that lis302dl.c has moved from drivers/spi/ to drivers/input/misc/



Added: branches/src/target/kernel/2.6.24.x/patches/gta02-acc.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/gta02-acc.patch	2008-01-15 21:35:07 UTC (rev 3851)
+++ branches/src/target/kernel/2.6.24.x/patches/gta02-acc.patch	2008-01-15 22:55:39 UTC (rev 3852)
@@ -0,0 +1,205 @@
+Index: linux-2.6.24-rc7/arch/arm/mach-s3c2440/mach-gta02.c
+===================================================================
+--- linux-2.6.24-rc7.orig/arch/arm/mach-s3c2440/mach-gta02.c
++++ linux-2.6.24-rc7/arch/arm/mach-s3c2440/mach-gta02.c
+@@ -372,8 +372,6 @@
+ 	&s3c_device_usbgadget,
+ 	&s3c_device_nand,
+ 	&s3c_device_ts,
+-	&s3c_device_spi0,
+-	&s3c_device_spi1,
+ 	&gta02_nor_flash,
+ };
+ 
+@@ -517,11 +515,6 @@
+ 
+ /* SPI: Accelerometers attached to SPI of s3c244x */
+ 
+-static void gta02_spi_acc_set_cs(struct s3c2410_spi_info *spi, int cs, int pol)
+-{
+-	s3c2410_gpio_setpin(cs, pol);
+-}
+-
+ static const struct lis302dl_platform_data lis302_pdata[] = {
+ 	{
+ 		.name		= "lis302-1 (top)"
+@@ -551,10 +544,55 @@
+ 	},
+ };
+ 
+-static struct s3c2410_spi_info gta02_spi_acc_cfg = {
+-	.set_cs		= gta02_spi_acc_set_cs,
++
++static void spi_acc_cs(struct s3c2410_spigpio_info *spi, int cs)
++{
++	switch (cs) {
++	case BITBANG_CS_ACTIVE:
++		s3c2410_gpio_setpin(S3C2410_GPD12, 0);
++		break;
++	case BITBANG_CS_INACTIVE:
++		s3c2410_gpio_setpin(S3C2410_GPD12, 1);
++		break;
++	}
++}
++
++static struct s3c2410_spigpio_info spi_gpio_cfg = {
++	.pin_clk	= S3C2410_GPG7,
++	.pin_mosi	= S3C2410_GPG6,
++	.pin_miso	= S3C2410_GPG5,
+ 	.board_size	= ARRAY_SIZE(gta02_spi_acc_bdinfo),
+ 	.board_info	= gta02_spi_acc_bdinfo,
++	.chip_select	= &spi_acc_cs,
++};
++
++static struct resource s3c_spi_acc_resource[] = {
++	[0] = {
++		.start = S3C2410_GPG3,
++		.end   = S3C2410_GPG3,
++	},
++	[1] = {
++		.start = S3C2410_GPG5,
++		.end   = S3C2410_GPG5,
++	},
++	[2] = {
++		.start = S3C2410_GPG6,
++		.end   = S3C2410_GPG6,
++	},
++	[3] = {
++		.start = S3C2410_GPG7,
++		.end   = S3C2410_GPG7,
++	},
++};
++
++static struct platform_device s3c_device_spi_acc = {
++	.name		  = "s3c24xx-spi-gpio",
++	.id		  = 1,
++	.num_resources	  = ARRAY_SIZE(s3c_spi_acc_resource),
++	.resource	  = s3c_spi_acc_resource,
++	.dev = {
++		.platform_data = &spi_gpio_cfg,
++	},
+ };
+ 
+ static struct resource gta02_led_resources[] = {
+@@ -716,7 +754,6 @@
+ 	s3c_device_usb.dev.platform_data = &gta02_usb_info;
+ 	s3c_device_nand.dev.platform_data = &gta02_nand_info;
+ 	s3c_device_sdi.dev.platform_data = &gta02_mmc_cfg;
+-	s3c_device_spi1.dev.platform_data = &gta02_spi_acc_cfg;
+ 
+ 	/* Only GTA02v1 has a SD_DETECT GPIO.  Since the slot is not
+ 	 * hot-pluggable, this is not required anyway */
+@@ -756,6 +793,7 @@
+ 		break;
+ 	}
+ 
++	platform_device_register(&s3c_device_spi_acc);
+ 	platform_device_register(&gta01_button_dev);
+ 	platform_device_register(&gta01_pm_gsm_dev);
+ 
+@@ -777,6 +815,13 @@
+ 	s3c2410_gpio_cfgpin(GTA01_GPIO_LCD_RESET, S3C2410_GPIO_OUTPUT);
+ 	s3c2410_gpio_setpin(GTA01_GPIO_LCD_RESET, 1);
+ 
++	s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPIO_OUTPUT);
++	s3c2410_gpio_setpin(S3C2410_GPD12, 1);
++
++
++	s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPIO_OUTPUT);
++	s3c2410_gpio_setpin(S3C2410_GPD13, 1);
++
+ 	/* 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,
+Index: linux-2.6.24-rc7/drivers/input/misc/lis302dl.c
+===================================================================
+--- linux-2.6.24-rc7.orig/drivers/input/misc/lis302dl.c
++++ linux-2.6.24-rc7/drivers/input/misc/lis302dl.c
+@@ -84,6 +84,7 @@
+ 
+ enum lis302dl_reg_ctrl3 {
+ 	LIS302DL_CTRL3_PP_OD		= 0x40,
++	LIS302DL_CTRL3_IHL		= 0x80,
+ };
+ 
+ enum lis302dl_reg_status {
+@@ -134,16 +135,17 @@
+ 
+ /* lowlevel register access functions */
+ 
+-#define READ_BIT	0x01
+-#define MS_BIT		0x02
+-#define ADDR_SHIFT	2
++#define READ_BIT	0x80
++#define	ADDR_MASK	0x3f
+ 
+ static inline u_int8_t __reg_read(struct lis302dl_info *lis, u_int8_t reg)
+ {
+ 	int rc;
+ 	u_int8_t cmd;
+ 
+-	cmd = (reg << ADDR_SHIFT) | READ_BIT;
++	BUG_ON(reg & ~ADDR_MASK);
++
++	cmd = reg | READ_BIT;
+ 
+ 	rc = spi_w8r8(lis->spi_dev, cmd);
+ 
+@@ -165,7 +167,9 @@
+ {
+ 	u_int8_t buf[2];
+ 
+-	buf[0] = (reg << ADDR_SHIFT);
++	BUG_ON(reg & ~ADDR_MASK);
++
++	buf[0] = reg;
+ 	buf[1] = val;
+ 
+ 	return spi_write(lis->spi_dev, buf, sizeof(buf));
+@@ -218,10 +222,16 @@
+ {
+ 	struct lis302dl_info *lis = dev_get_drvdata(&spi->dev);
+ 
+-	if (int_pin == 1)
++	switch (int_pin) {
++	case 1:
+ 		reg_set_bit_mask(lis, LIS302DL_REG_CTRL3, 0x07, mode);
+-	else if (int_pin == 2)
++		break;
++	case 2:
+ 		reg_set_bit_mask(lis, LIS302DL_REG_CTRL3, 0x38, mode << 3);
++		break;
++	default:
++		BUG();
++	}
+ }
+ 
+ static void _report_btn_single(struct input_dev *inp, int btn)
+@@ -388,6 +398,7 @@
+ static struct attribute *lis302dl_sysfs_entries[] = {
+ 	&dev_attr_sample_rate.attr,
+ 	&dev_attr_full_scale.attr,
++	NULL
+ };
+ 
+ static struct attribute_group lis302dl_attr_group = {
+@@ -459,12 +470,15 @@
+ 		kfree(lis);
+ 		return -ENODEV;
+ 	}
++	/* switch interrupt to open collector, active-low */
++	reg_write(lis, LIS302DL_REG_CTRL3,
++	    LIS302DL_CTRL3_PP_OD | LIS302DL_CTRL3_IHL);
++	lis302dl_int_mode(spi, 1, LIX302DL_INTMODE_DATA_READY);
++	lis302dl_int_mode(spi, 2, LIX302DL_INTMODE_CLICK);
+ 
+-	/* switch interrupt to open collector */
+-	reg_write(lis, LIS302DL_CTRL3_PP_OD, 0x7c);
+-
++	/* Fix me: always interrupt */
+ 	rc = request_irq(lis->spi_dev->irq, lis302dl_interrupt, IRQF_DISABLED,
+-			 "lis302dl", NULL);
++			 "lis302dl", lis);
+ 	if (rc < 0) {
+ 		dev_err(&spi->dev, "error requesting IRQ %d\n",
+ 			lis->spi_dev->irq);

Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series	2008-01-15 21:35:07 UTC (rev 3851)
+++ branches/src/target/kernel/2.6.24.x/patches/series	2008-01-15 22:55:39 UTC (rev 3852)
@@ -49,6 +49,7 @@
 gta02-sound.patch
 lis302dl.patch
 gta02-leds.patch
+gta02-acc.patch
 
 # additional local stuff
 yaffs2-20070905.patch





More information about the commitlog mailing list