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

werner at sita.openmoko.org werner at sita.openmoko.org
Tue Apr 1 05:47:51 CEST 2008


Author: werner
Date: 2008-04-01 05:47:47 +0200 (Tue, 01 Apr 2008)
New Revision: 4285

Modified:
   branches/src/target/kernel/2.6.24.x/patches/gta02-acc.patch
   branches/src/target/kernel/2.6.24.x/patches/introduce-fiq-basis.patch
Log:
fix-lis302dl-isr-lock.patch

It seems that the two accelermoter interrupts can interrupt each other after some
time and destroy one interrupt acknowledge action by starting an acknowledge for
the second accelermoter partway through.  Since the two are edge-triggered interrupts
after this happens we do not see any more interrupts from the one whose acknowledge
was broken.

This patch protects the acknowldge / poll ISR with a spinlock that defers interrupt
acknowledge by the processor until the service for the first accelerometer is
completed.

Signed-off-by: Andy Green <andy at openmoko.com>
---

 arch/arm/mach-s3c2440/mach-gta02.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)


gta02-acc.patch: applied fix-lis302dl-isr-lock.patch
introduce-fiq-basis.patch: make sure motion_irq_lock stays below the includes



Modified: 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-04-01 03:27:12 UTC (rev 4284)
+++ branches/src/target/kernel/2.6.24.x/patches/gta02-acc.patch	2008-04-01 03:47:47 UTC (rev 4285)
@@ -2,7 +2,17 @@
 ===================================================================
 --- linux-2.6.24.orig/arch/arm/mach-s3c2440/mach-gta02.c
 +++ linux-2.6.24/arch/arm/mach-s3c2440/mach-gta02.c
-@@ -375,8 +375,6 @@
+@@ -78,6 +78,9 @@
+ 
+ #include <linux/glamofb.h>
+ 
++/* arbitrates which sensor IRQ owns the shared SPI bus */
++static spinlock_t motion_irq_lock;
++
+ static struct map_desc gta02_iodesc[] __initdata = {
+ 	{
+ 		.virtual	= 0xe0000000,
+@@ -377,8 +380,6 @@
  	&s3c_device_usbgadget,
  	&s3c_device_nand,
  	&s3c_device_ts,
@@ -11,7 +21,7 @@
  	&gta02_nor_flash,
  };
  
-@@ -476,10 +474,12 @@
+@@ -478,10 +479,12 @@
  	},
  };
  
@@ -24,7 +34,7 @@
  
  static struct glamo_spigpio_info glamo_spigpio_cfg = {
  	.pin_clk	= GLAMO_GPIO10_OUTPUT,
-@@ -505,16 +505,93 @@
+@@ -507,16 +510,97 @@
  
  /* SPI: Accelerometers attached to SPI of s3c244x */
  
@@ -39,8 +49,9 @@
 + * Foreground / interrupt arbitration is okay because the interrupts are
 + * disabled around all the foreground SPI code.
 + *
-+ * Interrupt / Interrupt arbitration is okay because the interrupts are
-+ * at the same priority (I think)
++ * Interrupt / Interrupt arbitration is evidently needed, otherwise we
++ * lose edge-triggered service after a while due to the two sensors sharing
++ * the SPI bus having irqs at the same time eventually.
 + *
 + * Servicing is typ 75 - 100us at 400MHz.
 + */
@@ -54,10 +65,12 @@
 +	struct lis302dl_platform_data *pdata = lis->pdata;
 +	u8 shifter = 0xc0 | LIS302DL_REG_OUT_X; /* read, autoincrement */
 +	int n, n1;
++	unsigned long flags;
 +#ifdef DEBUG_SPEW_MS
 +	s8 x, y, z;
 +#endif
 +
++	spin_lock_irqsave(&motion_irq_lock, flags);
 +	s3c2410_gpio_setpin(pdata->pin_chip_select, 0);
 +	for (n = 0; n < 8; n++) { /* write the r/w, inc and address */
 +		s3c2410_gpio_setpin(pdata->pin_clk, 0);
@@ -95,6 +108,7 @@
 +		}
 +	}
 +	s3c2410_gpio_setpin(pdata->pin_chip_select, 1);
++	spin_unlock_irqrestore(&motion_irq_lock, flags);
 +	input_sync(lis->input_dev);
 +#ifdef DEBUG_SPEW_MS
 +	printk("%s: %d %d %d\n", pdata->name, x, y, z);
@@ -123,7 +137,7 @@
  	},
  };
  
-@@ -523,26 +600,75 @@
+@@ -525,26 +609,75 @@
  		.modalias	= "lis302dl",
  		.platform_data	= &lis302_pdata[0],
  		.irq		= GTA02_IRQ_GSENSOR_1,
@@ -205,7 +219,12 @@
  };
  
  static struct resource gta02_led_resources[] = {
-@@ -785,7 +911,6 @@
+@@ -786,10 +919,11 @@
+ {
+ 	int rc;
+ 
++	spin_lock_init(&motion_irq_lock);
++
  	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;
@@ -213,7 +232,7 @@
  
  	/* Only GTA02v1 has a SD_DETECT GPIO.  Since the slot is not
  	 * hot-pluggable, this is not required anyway */
-@@ -797,6 +922,12 @@
+@@ -801,6 +935,12 @@
  		break;
  	}
  
@@ -226,7 +245,7 @@
  	INIT_WORK(&gta02_udc_vbus_drawer.work, __gta02_udc_vbus_draw);
  	s3c24xx_udc_set_platdata(&gta02_udc_cfg);
  	set_s3c2410ts_info(&gta02_ts_cfg);
-@@ -825,6 +956,7 @@
+@@ -829,6 +969,7 @@
  		break;
  	}
  
@@ -944,7 +963,7 @@
 ===================================================================
 --- linux-2.6.24.orig/arch/arm/mach-s3c2410/mach-gta01.c
 +++ linux-2.6.24/arch/arm/mach-s3c2410/mach-gta01.c
-@@ -521,7 +521,7 @@
+@@ -510,7 +510,7 @@
  	},
  };
  

Modified: branches/src/target/kernel/2.6.24.x/patches/introduce-fiq-basis.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/introduce-fiq-basis.patch	2008-04-01 03:27:12 UTC (rev 4284)
+++ branches/src/target/kernel/2.6.24.x/patches/introduce-fiq-basis.patch	2008-04-01 03:47:47 UTC (rev 4285)
@@ -368,13 +368,16 @@
 ===================================================================
 --- linux-2.6.24.orig/arch/arm/mach-s3c2440/mach-gta02.c
 +++ linux-2.6.24/arch/arm/mach-s3c2440/mach-gta02.c
-@@ -78,6 +78,28 @@
+@@ -78,9 +78,31 @@
  
  #include <linux/glamofb.h>
  
 +#include <asm/arch/fiq_ipc_gta02.h>
 +#include "fiq_c_isr.h"
 +
+ /* arbitrates which sensor IRQ owns the shared SPI bus */
+ static spinlock_t motion_irq_lock;
+ 
 +/* define FIQ IPC struct */
 +/*
 + * contains stuff FIQ ISR modifies and normal kernel code can see and use





More information about the commitlog mailing list