All pastes #817716 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-15 20:49 UTC
rendered paste body
Index: arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c,v
retrieving revision 1.12
diff -u -r1.12 htcuniversal_core.c
--- arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c	18 Jul 2007 13:21:03 -0000	1.12
+++ arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c	15 Dec 2007 20:42:51 -0000
@@ -70,6 +70,8 @@
 
 static int htcuniversal_suspend(struct platform_device *dev, pm_message_t state)
 {
+	printk("htcuniversal_suspend\n");
+
 	/* Turn off external clocks here, because htcuniversal_power and asic3_mmc
 	 * scared to do so to not hurt each other. (-5 mA) */
 
@@ -120,6 +122,7 @@
 	PRER =    PWER_GPIO0 
 		| PWER_GPIO1
 		| PWER_GPIO9
+		| PWER_GPIO14 /* ASIC3 mux */
 		| PWER_GPIO10;
 	/* 3.6864 MHz oscillator power-down enable */
 	PCFR = PCFR_OPDE | PCFR_PI2CEN | PCFR_GPROD | PCFR_GPR_EN;
@@ -153,6 +156,7 @@
 
 static int htcuniversal_resume(struct platform_device *dev)
 {
+	printk("htcuniversal_resume\n");
 	htcuniversal_egpio_enable(0);
 
 	return 0;
Index: arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c,v
retrieving revision 1.9
diff -u -r1.9 htcuniversal_phone.c
--- arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c	18 Jul 2007 13:21:03 -0000	1.9
+++ arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c	15 Dec 2007 20:42:51 -0000
@@ -11,6 +11,9 @@
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/asic3_base.h>
+#include <linux/irq.h>
+#include <linux/gpiodev.h>
+#include <linux/interrupt.h>
 
 #include <asm/hardware.h>
 #include <asm/arch/serial.h>
@@ -22,6 +25,7 @@
 
 static void phone_reset(void)
 {
+	printk("phone_reset called\n");
 	asic3_set_gpio_out_b(&htcuniversal_asic3.dev, 1<<GPIOB_BB_RESET2, 0);
 
 	SET_HTCUNIVERSAL_GPIO(PHONE_RESET,0);
@@ -36,6 +40,7 @@
 
 static void phone_off(void)
 {
+	printk("phone_off called\n");
 	asic3_set_gpio_out_d(&htcuniversal_asic3.dev, 1<<GPIOD_BB_RESET1, 1<<GPIOD_BB_RESET1);
 	mdelay(2000);
 	asic3_set_gpio_out_d(&htcuniversal_asic3.dev, 1<<GPIOD_BB_RESET1, 0);
@@ -43,10 +48,18 @@
 	asic3_set_gpio_out_b(&htcuniversal_asic3.dev, 1<<GPIOB_BB_RESET2, 1<<GPIOB_BB_RESET2);
 	SET_HTCUNIVERSAL_GPIO(PHONE_OFF,0);
 }
-													
+						
+static irqreturn_t
+gsm_alerting(int irq, void *data)
+{
+/* 	printk("gsm alerting irq\n"); */
+	return IRQ_HANDLED;
+}
+							
 static void
 htcuniversal_phone_configure( int state )
 {
+	static int has_been_started = 0;
 	int tries;
 	unsigned short statusb;
 
@@ -58,7 +71,8 @@
 
 	case PXA_UART_CFG_POST_STARTUP:
 		/* pre-serial-up hardware configuration */
-
+		if (has_been_started)
+			break;
 		SET_HTCUNIVERSAL_GPIO(PHONE_START,0);   /* "bootloader" */
 		SET_HTCUNIVERSAL_GPIO(PHONE_UNKNOWN,0); /* not used     */
 		SET_HTCUNIVERSAL_GPIO(PHONE_OFF,0);     /* PHONE_OFF    */
@@ -93,12 +107,27 @@
 
 		printk("BB_READY tries=%d of 200\n",tries);
 
+
+		/* Set IRQ on GPIOB_BB_ALERT */
+		{
+			int retval;
+			int irq = asic3_irq_base( &htcuniversal_asic3.dev ) + ASIC3_GPIOB_IRQ_BASE + GPIOB_BB_UNKNOWN3;
+			printk("Will request IRQ=%d\n", irq);
+			pxa_gpio_mode(GPIO_BB_UNKNOWN3);
+/* 			set_irq_type(irq, IRQT_BOTHEDGE); /\* IRQ_TYPE_EDGE_RISING); *\/ */
+/* 			retval = request_irq(irq, gsm_alerting, SA_INTERRUPT, "gsm_alerting", NULL); */
+/* 			if (retval) */
+/* 				printk("Unable to get interrupt IRQ=%d\n", irq); */
+		}
+
+		has_been_started = 1;
 		break;
 
 	case PXA_UART_CFG_PRE_SHUTDOWN:
 
-			phone_off();
-
+/* 		phone_off(); */
+		printk("tried to call phone_off, stack will follow:\n");
+		dump_stack();
 		break;
 
 	default:
Index: arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c,v
retrieving revision 1.1
diff -u -r1.1 htcuniversal_pm.c
--- arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c	20 Oct 2006 17:37:37 -0000	1.1
+++ arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c	15 Dec 2007 20:42:51 -0000
@@ -33,6 +33,7 @@
 
 static void htcuniversal_pxa_ll_pm_suspend(unsigned long resume_addr)
 {
+	printk("htcuniversal_pxa_ll_pm_suspend called\n");
 	save_a0040000 = *addr_a0040000;
 	save_a0040004 = *addr_a0040004;
 	save_a0040008 = *addr_a0040008;
@@ -47,6 +48,7 @@
 
 static void htcuniversal_pxa_ll_pm_resume(void)
 {
+	printk("htcuniversal_pxa_ll_pm_resume called\n");
 	*addr_a0040000 = save_a0040000;
 	*addr_a0040004 = save_a0040004;
 	*addr_a0040008 = save_a0040008;
Index: drivers/char/watchdog/sa1100_wdt.c
===================================================================
RCS file: /cvs/linux/kernel26/drivers/char/watchdog/sa1100_wdt.c,v
retrieving revision 1.12
diff -u -r1.12 sa1100_wdt.c
--- drivers/char/watchdog/sa1100_wdt.c	2 Dec 2006 02:16:11 -0000	1.12
+++ drivers/char/watchdog/sa1100_wdt.c	15 Dec 2007 20:43:22 -0000
@@ -8,7 +8,7 @@
  *	modify it under the terms of the GNU General Public License
  *	as published by the Free Software Foundation; either version
  *	2 of the License, or (at your option) any later version.
- *
+3B *
  *	Neither Oleg Drokin nor iXcelerator.com admit liability nor provide
  *	warranty for any of this software. This material is provided
  *	"AS-IS" and at no charge.
@@ -25,6 +25,9 @@
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include <linux/init.h>
+#include <linux/kthread.h>
+#include <linux/sched.h>
+#include <linux/freezer.h>
 
 #ifdef CONFIG_ARCH_PXA
 #include <asm/arch/pxa-regs.h>
@@ -152,11 +155,25 @@
 	.fops		= &sa1100dog_fops,
 };
 
-static int margin __initdata = 60;		/* (secs) Default is 1 minute */
+static int margin __initdata = 200;		/* Default is 200 secs */
+
+static int internal_keepalive(void *unused_arg)
+{
+	while (!kthread_should_stop()) {
+		set_current_state(TASK_RUNNING);
+		OSMR3 = OSCR + pre_margin;
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule_timeout(msecs_to_jiffies(5000)); /* Sleep during 5 secs */
+		try_to_freeze();
+	}
+	
+	return 0;
+}
 
 static int __init sa1100dog_init(void)
 {
 	int ret;
+	struct task_struct *p;
 
 	/*
 	 * Read the reset status, and save it for later.  If
@@ -165,11 +182,16 @@
 	 */
 	boot_status = (RCSR & RCSR_WDR) ? WDIOF_CARDRESET : 0;
 	pre_margin = OSCR_FREQ * margin;
+	printk("Set timer to %d\n", OSCR + pre_margin);
+	OSMR3 = OSCR + pre_margin;
 
 	ret = misc_register(&sa1100dog_miscdev);
 	if (ret == 0)
 		printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
 		       margin);
+	if (IS_ERR(p = kthread_create(internal_keepalive, NULL, "sa1100d")))
+		panic("Could not create keepalive kthread !\n");
+	wake_up_process(p);
 	return ret;
 }