ARM: OMAP4: Fix NULL pointer dereference crash.
Subsystems (3)
PATCH v2 1/2 ARM: OMAP4: Fix NULL pointer dereference crash.
After the patch series "[PATCH 00/14] OMAP PM fixes for .31-rc" merge in 2.6.31-rc5, the kernel crashed during boot on OMAP4430. This patch fixes it by adding UART4 support and related code. Without this patch omap_serial_init() would produce " NULL pointer dereference" and kernel crashes in the bootup on OMAP4430 platform.
Some more info on the merge issue can be found here. More info- http://lkml.org/lkml/2009/8/20/192
Note: While merging this patch,"IO_ADDRESS" needs to be changed to "OMAP2_IO_ADDRESS" if the Tony's below series is already merged in.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg15072.html
--- arch/arm/mach-omap2/board-4430sdp.c | 2 +- arch/arm/mach-omap2/serial.c | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/board-4430sdp.c +1 -1
@@ -39,7 +39,7 @@ static struct platform_device *sdp4430_devices[] __initdata = { };static struct omap_uart_config sdp4430_uart_config__initdata = { - .enabled_uarts = (1 <<0 ) | (1 <<1 ) | (1 <<2 ), + .enabled_uarts = (1 <<0 ) | (1 <<1 ) | (1 <<2 ) | (1 <<3 ), };static struct omap_lcd_config sdp4430_lcd_config__initdata = {
arch/arm/mach-omap2/serial.c +26 -1
@@ -112,7 +112,21 @@ static struct plat_serial8250_port serial_platform_data2[] = { .flags = 0 } }; - +#ifdef CONFIG_ARCH_OMAP4 +static struct plat_serial8250_port serial_platform_data3[] = { + { + .membase =IO_ADDRESS (OMAP_UART4_BASE ), + .mapbase =OMAP_UART4_BASE , + .irq =70 , + .flags =UPF_BOOT_AUTOCONF , + .iotype =UPIO_MEM , + .regshift =2 , + .uartclk =OMAP24XX_BASE_BAUD *16 , + }, { + .flags =0 + } +}; +#endif static inline unsigned int serial_read_reg (struct plat_serial8250_port *up,int offset) {
@@ -550,6 +564,17 @@ static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { }, }, }, +#ifdef CONFIG_ARCH_OMAP4 + { + .pdev = { + .name = "serial8250", + .id = PLAT8250_DEV_FOURPORT, + .dev = { + .platform_data = serial_platform_data3, + }, + }, + }, +#endif };void __init omap_serial_init (void )
Signature · 1 line
1.5.4.7
PATCH v2 2/2 ARM: OMAP4: Bypass the clock check.
Second reason of OMAP4 boot failure on 2.6.31.rc6, the UART platform data is not getting registered to kernel. Registration was failing because of clock check failure in omap_serial_init().
Below patch fix the same.
OMAP4 clock framework patches are still getting discussed on mailing list so till then we need this.
--- arch/arm/mach-omap2/serial.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/serial.c +5 -2
@@ -620,8 +620,11 @@ void __init omap_serial_init(void) uart->fck =NULL ; } -if (!uart->ick || !uart->fck) -continue ; +/* FIXME: Remove this once the clkdev is ready */ +if (!cpu_is_omap44xx ()) { +if (!uart->ick || !uart->fck) +continue ; + } uart->num = i; p->private_data = uart;
Signature · 1 line
1.5.4.7
PATCH v2 1/2 ARM: OMAP4: Fix NULL pointer dereference crash.
In reply to Santosh ShilimkarQuoted 9 lines · Santosh Shilimkar
After the patch series "[PATCH 00/14] OMAP PM fixes for .31-rc" merge in 2.6.31-rc5, the kernel crashed during boot on OMAP4430. This patch fixes it by adding UART4 support and related code. Without this patch
omap_serial_init()would produce " NULL pointer dereference" and kernel crashes in the bootup on OMAP4430 platform.Some more info on the merge issue can be found here. More info- http://lkml.org/lkml/2009/8/20/192
Quoted 8 lines
Note: While merging this patch,"IO_ADDRESS" needs to be changed to "
OMAP2_IO_ADDRESS" if the Tony's below series is already merged in.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg15072.htmlSigned-off-by Syed Rafiuddin <[email protected]>Signed-off-by Santosh Shilimkar <[email protected]>Acked-by Tony Lindgren <[email protected]>Acked-by Kevin Hilman <[email protected]>
One other problem, after looking at the Zoom2 UART stuff...
Quoted 46 lines
--- arch/arm/mach-omap2/board-4430sdp.c | 2 +- arch/arm/mach-omap2/serial.c | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-)arch/arm/mach-omap2/board-4430sdp.c +1
-1@@ -39,7 +39,7 @@ static struct platform_device *sdp4430_devices[] __initdata = { };static struct omap_uart_config sdp4430_uart_config__initdata = { - .enabled_uarts = (1 <<0 ) | (1 <<1 ) | (1 <<2 ), + .enabled_uarts = (1 <<0 ) | (1 <<1 ) | (1 <<2 ) | (1 <<3 ), };static struct omap_lcd_config sdp4430_lcd_config__initdata = {arch/arm/mach-omap2/serial.c +15
-1@@ -112,7 +112,21 @@ static struct plat_serial8250_port serial_platform_data2[] = { .flags = 0 } }; - +#ifdef CONFIG_ARCH_OMAP4 +static struct plat_serial8250_port serial_platform_data3[] = { + { + .membase =IO_ADDRESS (OMAP_UART4_BASE ), + .mapbase =OMAP_UART4_BASE , + .irq =70 , + .flags =UPF_BOOT_AUTOCONF , + .iotype =UPIO_MEM , + .regshift =2 , + .uartclk =OMAP24XX_BASE_BAUD *16 , + }, { + .flags =0 + } +}; +#endif static inline unsigned int serial_read_reg (struct plat_serial8250_port *up,int offset) {
arch/arm/mach-omap2/serial.c static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { · line 571
Quoted 8 lines
arch/arm/mach-omap2/serial.c +5
-0@@ -550,6 +564,17 @@ static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { }, }, }, +#ifdef CONFIG_ARCH_OMAP4 + { + .pdev = { + .name = "serial8250", + .id = PLAT8250_DEV_FOURPORT,
This should not be FOURPORT, it should just be a number. In this case, it should be 3 (the others start from zero.)
The Zoom2 one should then be changed to something >= 4.
Kevin
Quoted 11 lines
arch/arm/mach-omap2/serial.c +6
-0+ .dev = { + .platform_data = serial_platform_data3, + }, + }, + }, +#endif };void __init omap_serial_init (void )Signature · 1 line
1.5.4.7
PATCH v2 1/2 ARM: OMAP4: Fix NULL pointer dereference crash.
Quoted 71 lines · Kevin Hilman
Quoted 9 lines · Santosh Shilimkar
After the patch series "[PATCH 00/14] OMAP PM fixes for .31-rc" merge in 2.6.31-rc5, the kernel crashed during boot on OMAP4430. This patch fixes it by adding UART4 support and related code. Without this patch
omap_serial_init()would produce " NULL pointer dereference" and kernel crashes in the bootup on OMAP4430 platform.Some more info on the merge issue can be found here. More info- http://lkml.org/lkml/2009/8/20/192
Quoted 8 lines
Note: While merging this patch,"IO_ADDRESS" needs to be changed to "
OMAP2_IO_ADDRESS" if the Tony's below series is already merged in.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg15072.htmlSigned-off-by Syed Rafiuddin <[email protected]>Signed-off-by Santosh Shilimkar <[email protected]>Acked-by Tony Lindgren <[email protected]>Acked-by Kevin Hilman <[email protected]>One other problem, after looking at the Zoom2 UART stuff...
Quoted 49 lines
--- arch/arm/mach-omap2/board-4430sdp.c | 2 +- arch/arm/mach-omap2/serial.c | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-)arch/arm/mach-omap2/board-4430sdp.c +1
-1@@ -39,7 +39,7 @@ static struct platform_device *sdp4430_devices[] __initdata = { };static struct omap_uart_config sdp4430_uart_config__initdata = { - .enabled_uarts = (1 <<0 ) | (1 <<1 ) | (1 <<2 ), + .enabled_uarts = (1 <<0 ) | (1 <<1 ) | (1 <<2 ) | (1 <<3 ), };static struct omap_lcd_config sdp4430_lcd_config__initdata = {arch/arm/mach-omap2/serial.c +15
-1@@ -112,7 +112,21 @@ static struct plat_serial8250_port serial_platform_data2[] = { .flags = 0 } }; - +#ifdef CONFIG_ARCH_OMAP4 +static struct plat_serial8250_port serial_platform_data3[] = { + { + .membase =IO_ADDRESS (OMAP_UART4_BASE ), + .mapbase =OMAP_UART4_BASE , + .irq =70 , + .flags =UPF_BOOT_AUTOCONF , + .iotype =UPIO_MEM , + .regshift =2 , + .uartclk =OMAP24XX_BASE_BAUD *16 , + }, { + .flags =0 + } +}; +#endif static inline unsigned int serial_read_reg (struct plat_serial8250_port *up,int offset) {@@ -550,6 +564,17 @@ static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { }, }, },
Quoted 8 lines
arch/arm/mach-omap2/serial.c static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { · line 571
Quoted 5 lines
arch/arm/mach-omap2/serial.c +5
-0+#ifdef CONFIG_ARCH_OMAP4 + { + .pdev = { + .name = "serial8250", + .id = PLAT8250_DEV_FOURPORT,This should not be FOURPORT, it should just be a number. In this case, it should be 3 (the others start from zero.)
Santosh,
I've changed the .id field to '3' and will queue up this fix for the next merge window along with my fixes queue[1]. Please let me know if you want to do otherwise.
Kevin
[1] My fixes queue for the next window is the pm-upstream/fixes-32 branch which is based on Tony's for-next branch.
PATCH v2 1/2 ARM: OMAP4: Fix NULL pointer dereference crash.
Quoted 18 lines
Quoted 1 line
Quoted 1 line
static inline unsigned int serial_read_reg(struct
plat_serial8250_port*up,
Quoted 3 lines
arch/arm/mach-omap2/serial.c static struct omap_uart_state
Quoted 3 lines
arch/arm/mach-omap2/serial.c +0
-0int offset) {@@ -550,6 +564,17 @@ static struct omap_uart_stateomap_uart[OMAP_MAX_NR_PORTS] = {
Quoted 11 lines
arch/arm/mach-omap2/serial.c static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { · line 571
Quoted 8 lines
arch/arm/mach-omap2/serial.c +5
-0}, }, }, +#ifdef CONFIG_ARCH_OMAP4 + { + .pdev = { + .name = "serial8250", + .id = PLAT8250_DEV_FOURPORT,This should not be FOURPORT, it should just be a number. In this case, it should be 3 (the others start from zero.)
Quoted 5 lines
Santosh,
I've changed the .id field to '3' and will queue up this fix for the next merge window along with my fixes queue[1]. Please let me know if you want to do otherwise.
This is fine Kevin. Thanks !!
Bye the way I have also posted v3 version in which I changed the .id field to 3.
Regards,
Santosh
PATCH v2 1/2 ARM: OMAP4: Fix NULL pointer dereference crash.
Quoted 20 lines · Santosh
Quoted 20 lines
Quoted 1 line
Quoted 1 line
static inline unsigned int serial_read_reg(struct
plat_serial8250_port*up,
Quoted 3 lines
arch/arm/mach-omap2/serial.c static struct omap_uart_state
Quoted 3 lines
arch/arm/mach-omap2/serial.c +0
-0int offset) {@@ -550,6 +564,17 @@ static struct omap_uart_stateomap_uart[OMAP_MAX_NR_PORTS] = {
Quoted 11 lines
arch/arm/mach-omap2/serial.c static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { · line 571
Quoted 8 lines
arch/arm/mach-omap2/serial.c +5
-0}, }, }, +#ifdef CONFIG_ARCH_OMAP4 + { + .pdev = { + .name = "serial8250", + .id = PLAT8250_DEV_FOURPORT,This should not be FOURPORT, it should just be a number. In this case, it should be 3 (the others start from zero.)
Santosh,
Quoted 7 lines
Quoted 3 lines
I've changed the .id field to '3' and will queue up this fix for the next merge window along with my fixes queue[1]. Please let me know if you want to do otherwise.
This is fine Kevin. Thanks !!
Bye the way I have also posted v3 version in which I changed the .id field to 3.
Yeah, saw that after I replied. Thanks!
Kevin
PATCH v2 1/2 ARM: OMAP4: Fix NULL pointer dereference crash.
In reply to Kevin HilmanQuoted 4 lines · Kevin Hilman
This should not be FOURPORT, it should just be a number. In this case, it should be 3 (the others start from zero.)
The Zoom2 one should then be changed to something >= 4.
No it should not. There's an enum to control the numbering of these. Use that.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: