Re: UCB1400 Touchscreen kernel crash at boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Dne Čt 19. listopadu 2009 11:15:37 Patrick napsal(a):
> Hello,
> 
> I have migrated from 2.6.26 to 2.6.28 kernel on a ARM PXA320 platform. I
>  have a touchscreen that use UCB1400.
> 
> On the 2.6.26 kernel the touchscreen was working well. On the 2.6.28 I have
>  the following crash at boot:
> 
> mice: PS/2 mouse device common for all mice
> Unable to handle kernel NULL pointer dereference at virtual address
>  00000000 pgd = c0004000
> [00000000] *pgd=00000000
> Internal error: Oops: 805 [#1] PREEMPT
> Modules linked in:
> CPU: 0    Not tainted  (2.6.28-recoms #9)
> PC is at ucb1400_ts_probe+0x20/0x428
> LR is at input_allocate_device+0x58/0x94
> pc : [<c023d544>]    lr : [<c02322d0>]    psr: a0000013
> sp : c7817d38  ip : c7817d20  fp : c7817d5c
> r10: c041f100  r9 : 00000000  r8 : 00000001
> r7 : 00000000  r6 : c040bc28  r5 : c0425220  r4 : c040bc30
> r3 : c78aa7a8  r2 : c78aa7b0  r1 : c03d8180  r0 : c78aa000
> Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> Control: 0400397f  Table: a0004018  DAC: 00000035
> Process swapper (pid: 1, stack limit = 0xc7816270)
> Stack: (0xc7817d38 to 0xc7818000)
> 7d20:                                                       c00e219c
>  c00e1fcc 7d40: c040bc30 c0425220 c0425220 c0425220 c7817d6c c7817d60
>  c01c07dc c023d530 7d60: c7817d8c c7817d70 c01bf8a8 c01c07c8 c0061ec8
>  c040bc30 c0425220 c040bcdc 7d80: c7817dac c7817d90 c01bf9c8 c01bf7c0
>  c7817dac 00000000 c7817db0 c01bf95c 7da0: c7817dd4 c7817db0 c01bee48
>  c01bf968 c78034d8 c040bc78 00000000 c0425220 7dc0: c7a7b3e0 c001cd18
>  c7817de4 c7817dd8 c01bf6c8 c01bee08 c7817e14 c7817de8 7de0: c01bf2e4
>  c01bf6b4 c03a9518 c0425220 c0425220 c0023f04 00000000 c001cd18 7e00:
>  00000001 00000000 c7817e3c c7817e18 c01bfcac c01bf248 c042cb84 c0023f04
>  7e20: 00000000 c001cd18 00000001 00000000 c7817e4c c7817e40 c01c0b78
>  c01bfc20 7e40: c7817e5c c7817e50 c001cd2c c01c0b0c c7817fdc c7817e60
>  c002d300 c001cd24 7e60: 000000d0 c042ca08 00000000 c7812cc0 00000000
>  c7802160 c7817ee4 c7817e88 7e80: c0079548 c0079018 c7817edc 00000000
>  c7800de0 00000179 c7817eec 00000000 7ea0: c7800de0 0000017a c7817ed4
>  c7817eb8 c0098228 c0189b88 c78035a4 0000017a 7ec0: c78035a0 00000000
>  c7817f34 c7817ed8 c018050c c0098210 c7817f04 c7817f54 7ee0: 00000000
>  00000000 000000d0 c7811e30 00000000 c7816000 c7817f2c c7817f08 7f00:
>  c0180768 c0040df0 c0435cb8 c7816000 c78378a0 c7836180 c0435cb8 00000000
>  7f20: 00000000 00000000 c7817f44 c7817f38 c0180548 c0180340 c7817f74
>  c7817f48 7f40: c00dac68 c0040df0 c7836180 c03ac908 c0410894 0000017a
>  c78378a0 c7817f9e 7f60: 000000bf c0435cb8 c7817f94 c7817f78 c00dade8
>  c00daac8 c7817f00 c7836180 7f80: c00daee8 c0410894 c7817fc4 c7817f98
>  c0071b1c c00dad74 c01bddd8 39311530 7fa0: 00000031 00000000 000000c0
>  c04108d0 00000000 00000000 c7817fdc c00241c0 7fc0: c0023f04 00000000
>  00000000 00000000 c7817ff4 c7817fe0 c0008740 c002d2ac 7fe0: 00000000
>  00000000 00000000 c7817ff8 c004ad5c c00086dc 00000000 00000000 Backtrace:
> [<c023d524>] (ucb1400_ts_probe+0x0/0x428) from [<c01c07dc>]
>  (platform_drv_probe+0x20/0x24) r7:c0425220 r6:c0425220 r5:c0425220
>  r4:c040bc30
> [<c01c07bc>] (platform_drv_probe+0x0/0x24) from [<c01bf8a8>]
>  (driver_probe_device+0xf4/0x1a8) [<c01bf7b4>]
>  (driver_probe_device+0x0/0x1a8) from [<c01bf9c8>]
>  (__driver_attach+0x6c/0x90) r6:c040bcdc r5:c0425220 r4:c040bc30
> [<c01bf95c>] (__driver_attach+0x0/0x90) from [<c01bee48>]
>  (bus_for_each_dev+0x4c/0x84) r6:c01bf95c r5:c7817db0 r4:00000000
> [<c01bedfc>] (bus_for_each_dev+0x0/0x84) from [<c01bf6c8>]
>  (driver_attach+0x20/0x28) r7:c001cd18 r6:c7a7b3e0 r5:c0425220 r4:00000000
> [<c01bf6a8>] (driver_attach+0x0/0x28) from [<c01bf2e4>]
>  (bus_add_driver+0xa8/0x218) [<c01bf23c>] (bus_add_driver+0x0/0x218) from
>  [<c01bfcac>] (driver_register+0x98/0x11c) [<c01bfc14>]
>  (driver_register+0x0/0x11c) from [<c01c0b78>]
>  (platform_driver_register+0x78/0x94) [<c01c0b00>]
>  (platform_driver_register+0x0/0x94) from [<c001cd2c>]
>  (ucb1400_ts_init+0x14/0x1c) [<c001cd18>] (ucb1400_ts_init+0x0/0x1c) from
>  [<c002d300>] (do_one_initcall+0x60/0x194) [<c002d2a0>]
>  (do_one_initcall+0x0/0x194) from [<c0008740>] (kernel_init+0x70/0xdc)
>  r8:00000000 r7:00000000 r6:00000000 r5:c0023f04 r4:c00241c0
> [<c00086d0>] (kernel_init+0x0/0xdc) from [<c004ad5c>] (do_exit+0x0/0x7a8)
>  r5:00000000 r4:00000000
> Code: e59070cc e1a06000 ebffd34d e3500000 (e5870000)
> ---[ end trace c943999c78a8047e ]---
> Kernel panic - not syncing: Attempted to kill init!
> 
> 
> 
> I have made a quick investigation and I have found that
>  dev->dev.platform_data in ucb1400_ts_probe function is NULL. So I think
>  that somewhere a memory alloc is missing. Should I allocate memory for
>  platform_data in the ucb1400_ts_probe ?
> 
> Do you have any idea where is the bug ? Any idea is welcome !
> 
> Thanks in advance
> 
> Patrick
> 

Why don't you use newer kernel? I use colibri/pxa320 with ucb1400 for which I 
recently sent three patches into linux-arm-kernel and linux-input to solve some 
issues (probably not/partly related).

.28 doesn't have the capability to pass platform data through the ac97 bus, use 
mainline kernel (or even better ... go to git.kernel.org, search for ycmiao, 
checkout that and switch to 'devel' branch). Apply the following patches, make 
some sense of them and you should be fine. Some might be already applied.
> 
> 
> 
> _______________________________________________
> linux-arm mailing list
> linux-arm@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-arm
> 
From b8d3ab594008dd2714d4dedf12348d05c08a48fd Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut@xxxxxxxxx>
Date: Sun, 8 Nov 2009 02:51:55 +0100
Subject: [PATCH 3/4] UCB1400: Allow passing IRQ through platfrom_data

This patch allows UCB1400 to get IRQ GPIO from platform data. In case
platform_data are not supplied or the IRQ set in the platform_data is lower than
zero, fall back to the old IRQ detection algorithm.

Signed-off-by: Marek Vasut <marek.vasut@xxxxxxxxx>
---
 drivers/input/touchscreen/ucb1400_ts.c |   11 +++++++----
 drivers/mfd/ucb1400_core.c             |    7 +++++++
 include/linux/ucb1400.h                |    4 ++++
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 095f84b..89dcbe7 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -355,10 +355,13 @@ static int ucb1400_ts_probe(struct platform_device *dev)
 		goto err;
 	}
 
-	error = ucb1400_ts_detect_irq(ucb);
-	if (error) {
-		printk(KERN_ERR "UCB1400: IRQ probe failed\n");
-		goto err_free_devs;
+	/* Only in case the IRQ line wasn't supplied, try detecting it */
+	if (ucb->irq < 0) {
+		error = ucb1400_ts_detect_irq(ucb);
+		if (error) {
+			printk(KERN_ERR "UCB1400: IRQ probe failed\n");
+			goto err_free_devs;
+		}
 	}
 
 	init_waitqueue_head(&ucb->ts_wait);
diff --git a/drivers/mfd/ucb1400_core.c b/drivers/mfd/ucb1400_core.c
index fa294b6..85fd942 100644
--- a/drivers/mfd/ucb1400_core.c
+++ b/drivers/mfd/ucb1400_core.c
@@ -51,6 +51,7 @@ static int ucb1400_core_probe(struct device *dev)
 	struct ucb1400_ts ucb_ts;
 	struct ucb1400_gpio ucb_gpio;
 	struct snd_ac97 *ac97;
+	struct ucb1400_pdata *pdata = dev->platform_data;
 
 	memset(&ucb_ts, 0, sizeof(ucb_ts));
 	memset(&ucb_gpio, 0, sizeof(ucb_gpio));
@@ -88,6 +89,12 @@ static int ucb1400_core_probe(struct device *dev)
 
 	/* TOUCHSCREEN */
 	ucb_ts.ac97 = ac97;
+
+	if (pdata != NULL && pdata->irq >= 0)
+		ucb_ts.irq = pdata->irq;
+	else
+		ucb_ts.irq = -1;
+
 	ucb->ucb1400_ts = platform_device_alloc("ucb1400_ts", -1);
 	if (!ucb->ucb1400_ts) {
 		err = -ENOMEM;
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index adb4406..1b47909 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -110,6 +110,10 @@ struct ucb1400 {
 	struct platform_device	*ucb1400_gpio;
 };
 
+struct ucb1400_pdata {
+	int	irq;
+};
+
 static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
 {
 	return ac97->bus->ops->read(ac97, reg);
-- 
1.6.5

From a3acf49f2cbbf3d913e2796042b265898b4e989a Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut@xxxxxxxxx>
Date: Sun, 8 Nov 2009 02:53:49 +0100
Subject: [PATCH 4/4] Colibri/PXA320: Pass IRQ line to UCB1400

This patch passes the correct IRQ line to the UCB1400 codec through
platform_data.

Signed-off-by: Marek Vasut <marek.vasut@xxxxxxxxx>
---
 arch/arm/mach-pxa/colibri-pxa320.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
index 3b349e9..56b71bc 100644
--- a/arch/arm/mach-pxa/colibri-pxa320.c
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
+#include <linux/ucb1400.h>
 
 #include <asm/mach-types.h>
 #include <asm/sizes.h>
@@ -148,6 +149,15 @@ static inline void colibri_pxa320_init_lcd(void) {}
 
 #if	defined(CONFIG_TOUCHSCREEN_UCB1400) || \
 	defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static struct ucb1400_pdata colibri_pxa320_ucb1400_pdata = {
+	.irq		= gpio_to_irq(4),
+};
+
+static pxa2xx_audio_ops_t colibri_pxa320_ac97_pdata = {
+	.codec_pdata	= { &colibri_pxa320_ucb1400_pdata },
+};
+#define	colibri_pxa320_ac97_pd	(&colibri_pxa320_ac97_pdata)
+
 static struct platform_device colibri_pxa320_ts_device = {
 	.name		= "ucb1400_core",
 	.id		= -1,
@@ -159,6 +169,7 @@ static void __init colibri_pxa320_init_touchscreen(void)
 }
 #else
 static inline void colibri_pxa320_init_touchscreen(void) {}
+#define	colibri_pxa320_ac97_pd	(NULL)
 #endif
 
 #if	defined(CONFIG_SND_AC97_CODEC) || \
@@ -175,7 +186,7 @@ static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
 static inline void __init colibri_pxa320_init_ac97(void)
 {
 	pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
-	pxa_set_ac97_info(NULL);
+	pxa_set_ac97_info(colibri_pxa320_ac97_pd);
 }
 #else
 static inline void colibri_pxa320_init_ac97(void) {}
-- 
1.6.5

From 0a31bd0b502ebf7761562467711c68134521d8fc Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut@xxxxxxxxx>
Date: Sun, 8 Nov 2009 02:27:04 +0100
Subject: [PATCH 2/4] Colibri/PXA320: Add UCB1400 touchscreen support

Signed-off-by: Marek Vasut <marek.vasut@xxxxxxxxx>
---
 arch/arm/mach-pxa/colibri-pxa320.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
index ec0e14b..3b349e9 100644
--- a/arch/arm/mach-pxa/colibri-pxa320.c
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -146,6 +146,21 @@ static void __init colibri_pxa320_init_lcd(void)
 static inline void colibri_pxa320_init_lcd(void) {}
 #endif
 
+#if	defined(CONFIG_TOUCHSCREEN_UCB1400) || \
+	defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static struct platform_device colibri_pxa320_ts_device = {
+	.name		= "ucb1400_core",
+	.id		= -1,
+};
+
+static void __init colibri_pxa320_init_touchscreen(void)
+{
+	platform_device_register(&colibri_pxa320_ts_device);
+}
+#else
+static inline void colibri_pxa320_init_touchscreen(void) {}
+#endif
+
 #if	defined(CONFIG_SND_AC97_CODEC) || \
 	defined(CONFIG_SND_AC97_CODEC_MODULE)
 static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
@@ -205,6 +220,7 @@ void __init colibri_pxa320_init(void)
 	colibri_pxa320_init_lcd();
 	colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
 	colibri_pxa320_init_ac97();
+	colibri_pxa320_init_touchscreen();
 	colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
 				mfp_to_gpio(MFP_PIN_GPIO28));
 	colibri_pxa320_init_uart();
-- 
1.6.5

From 39b8a11d86905c0ed50932aa4f57dce8c46e9dd9 Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut@xxxxxxxxx>
Date: Sun, 8 Nov 2009 02:24:05 +0100
Subject: [PATCH 1/4] Colibri/PXA320: Fix AC97 ifdefs and include

The AC97 part wasn't initialized on Colibri/PXA320 because the macros were
wrong. Also, the code didn't compile because of a header file not being
included.

Signed-off-by: Marek Vasut <marek.vasut@xxxxxxxxx>
---
 arch/arm/mach-pxa/colibri-pxa320.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
index 4945728..ec0e14b 100644
--- a/arch/arm/mach-pxa/colibri-pxa320.c
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -27,6 +27,7 @@
 #include <mach/colibri.h>
 #include <mach/pxafb.h>
 #include <mach/ohci.h>
+#include <mach/audio.h>
 
 #include "generic.h"
 #include "devices.h"
@@ -145,7 +146,8 @@ static void __init colibri_pxa320_init_lcd(void)
 static inline void colibri_pxa320_init_lcd(void) {}
 #endif
 
-#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
+#if	defined(CONFIG_SND_AC97_CODEC) || \
+	defined(CONFIG_SND_AC97_CODEC_MODULE)
 static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
 	GPIO34_AC97_SYSCLK,
 	GPIO35_AC97_SDATA_IN_0,
-- 
1.6.5

_______________________________________________
linux-arm mailing list
linux-arm@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-arm

[Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

Add to Google Follow linuxarm on Twitter