Skip to contentSkip to conversation

omap3: serial code for 3630 and zoom2/3 fixes

PATCH New Sergio Aguirre 2 participants 9 messages Mar 15, 2010 – Mar 22, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover omap3: serial code for 3630 and zoom2/3 fixes

Hi,

This series contains fixes for omap2/3/4 serial code, and are fixing:
- Avoid doing ioremap of a zero-based physical address. (causing a kernel panic during early init on 3630boards)
- Unproper omap_revision check during uart globals setup. (omap_revision is not yet filled at that point)
- Don't try to enable all uarts generically for zoom2/3 and 3630sdp.
- Make zoom2/3 just register one serial port (ttyS0).

This is a subset of the original series found here: [1]

Thanks to:
- Vikram Pandita
- Paul Walmsley
- Kevin Hilman
- Manjunath Kondaiah
- Felipe Balbi
- Tony Lindgreen

For all the feedback recieved so far.

Regards,
Sergio

Detailed changelog:

Sergio Aguirre (7):
OMAP3: serial: Check for zero-based physical addr
OMAP3: serial: Use dev_* macros instead of printk omap2/3/4: serial: Remove condition for getting uart4_phys
omap3: zoom2/3 / 3630sdp: Don't init always all uarts
omap3: 3630sdp: Explicitly enable all UARTs
omap3: zoom 2/3: Change debugboard serial port id
omap3: zoom2/3: Register only 1 8250 port

 arch/arm/configs/omap_zoom2_defconfig        |    2 +-
 arch/arm/configs/omap_zoom3_defconfig        |    2 +-
 arch/arm/mach-omap2/board-3630sdp.c          |    1 +
 arch/arm/mach-omap2/board-zoom-debugboard.c  |    2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |    1 -
 arch/arm/mach-omap2/serial.c                 |   35 +++++++++++++------------
 6 files changed, 22 insertions(+), 21 deletions(-)

[1] http://marc.info/?l=linux-omap&m=126826639903105&w=2

#1 lore raw

PATCH 1/7 OMAP3: serial: Check for zero-based physical addr

This is for protecting a wrong mapping attempt of a zero-based physical address.

The result is that, no serial port will be attempted to be mapped.

Also add an additional protection for NULL clocks before attempting to enable them (if above condition applies)

---
 arch/arm/mach-omap2/serial.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/serial.c +13 -0
index da77930..ef91fc0 100644
@@ -664,6 +664,12 @@ void __init omap_serial_early_init(void)
 		struct device *dev = &pdev->dev;
 		struct plat_serial8250_port *p = dev->platform_data;
 
+		/* Don't map zero-based physical address */
+		if (p->mapbase == 0) {
+			printk(KERN_WARNING "omap serial: No physical address"
+			       " for uart#%d, so skipping early_init...\n", i);
+			continue;
+		}
 		/*
 		 * Module 4KB + L4 interconnect 4KB
 		 * Static mapping, never released
@@ -727,6 +733,13 @@ void __init omap_serial_init_port(int port)
 	pdev = &uart->pdev;
 	dev = &pdev->dev;
 
+	/* Don't proceed if there's no clocks available */
+	if (unlikely(!uart->ick || !uart->fck)) {
+		WARN(1, "%s: can't init uart%d, no clocks available\n",
+		     kobject_name(&dev->kobj), port);
+		return;
+	}
+
 	omap_uart_enable_clocks(uart);
 
 	omap_uart_reset(uart);
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 2/7 OMAP3: serial: Use dev_* macros instead of printk

In reply to Sergio Aguirre

As we have a struct device populated at the time we are printing the errors, using dev_* macros makes more sense, as could give a better idea where the error/warning came from.

---
 arch/arm/mach-omap2/serial.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/serial.c +6 -6
index ef91fc0..a55e6ae 100644
@@ -550,7 +550,7 @@ static ssize_t sleep_timeout_store(struct device *dev,
 	unsigned int value;
 
 	if (sscanf(buf, "%u", &value) != 1) {
-		printk(KERN_ERR "sleep_timeout_store: Invalid value\n");
+		dev_err(dev, "sleep_timeout_store: Invalid value\n");
 		return -EINVAL;
 	}
 
@@ -666,8 +666,8 @@ void __init omap_serial_early_init(void)
 
 		/* Don't map zero-based physical address */
 		if (p->mapbase == 0) {
-			printk(KERN_WARNING "omap serial: No physical address"
-			       " for uart#%d, so skipping early_init...\n", i);
+			dev_warn(dev, "no physical address for uart#%d,"
+				 " so skipping early_init...\n", i);
 			continue;
 		}
 		/*
@@ -676,21 +676,21 @@ void __init omap_serial_early_init(void)
 		 */
 		p->membase = ioremap(p->mapbase, SZ_8K);
 		if (!p->membase) {
-			printk(KERN_ERR "ioremap failed for uart%i\n", i + 1);
+			dev_err(dev, "ioremap failed for uart%i\n", i + 1);
 			continue;
 		}
 
 		sprintf(name, "uart%d_ick", i + 1);
 		uart->ick = clk_get(NULL, name);
 		if (IS_ERR(uart->ick)) {
-			printk(KERN_ERR "Could not get uart%d_ick\n", i + 1);
+			dev_err(dev, "Could not get uart%d_ick\n", i + 1);
 			uart->ick = NULL;
 		}
 
 		sprintf(name, "uart%d_fck", i+1);
 		uart->fck = clk_get(NULL, name);
 		if (IS_ERR(uart->fck)) {
-			printk(KERN_ERR "Could not get uart%d_fck\n", i + 1);
+			dev_err(dev, "Could not get uart%d_fck\n", i + 1);
 			uart->fck = NULL;
 		}
 
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 3/7 omap2/3/4: serial: Remove condition for getting uart4_phys

In reply to Sergio Aguirre

This check is invalid, since we haven't filled the omap_revision var at this point.

---
 arch/arm/mach-omap2/serial.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/serial.c +1 -13
index a55e6ae..3771254 100644
@@ -115,7 +115,6 @@ static struct plat_serial8250_port serial_platform_data2[] = {
 	}
 };
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 static struct plat_serial8250_port serial_platform_data3[] = {
 	{
 		.irq		= 70,
@@ -128,23 +127,12 @@ static struct plat_serial8250_port serial_platform_data3[] = {
 	}
 };
 
-static inline void omap2_set_globals_uart4(struct omap_globals *omap2_globals)
-{
-	serial_platform_data3[0].mapbase = omap2_globals->uart4_phys;
-}
-#else
-static inline void omap2_set_globals_uart4(struct omap_globals *omap2_globals)
-{
-}
-#endif
-
 void __init omap2_set_globals_uart(struct omap_globals *omap2_globals)
 {
 	serial_platform_data0[0].mapbase = omap2_globals->uart1_phys;
 	serial_platform_data1[0].mapbase = omap2_globals->uart2_phys;
 	serial_platform_data2[0].mapbase = omap2_globals->uart3_phys;
-	if (cpu_is_omap3630() || cpu_is_omap44xx())
-		omap2_set_globals_uart4(omap2_globals);
+	serial_platform_data3[0].mapbase = omap2_globals->uart4_phys;
 }
 
 static inline unsigned int __serial_read_reg(struct uart_port *up,
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH 4/7 omap3: zoom2/3 / 3630sdp: Don't init always all uarts

In reply to Sergio Aguirre

This is useless, since in Zoom2/3 boards, the ports aren't even physically accessible.

They must be explicitly initted in the board-zoom2.c, board-zoom3.c and board-3630sdp.c files instead.

---
 arch/arm/mach-omap2/board-zoom-peripherals.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +0 -1
index ca95d8d..6b39849 100644
@@ -280,7 +280,6 @@ static void enable_board_wakeup_source(void)
 void __init zoom_peripherals_init(void)
 {
 	omap_i2c_init();
-	omap_serial_init();
 	usb_musb_init(&musb_board_data);
 	enable_board_wakeup_source();
 }
Signature · 1 line
1.6.3.3
#5 lore raw

PATCH 5/7 omap3: 3630sdp: Explicitly enable all UARTs

In reply to Sergio Aguirre

All UARTs seem physically reachable, so, enable them all.

---
 arch/arm/mach-omap2/board-3630sdp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-3630sdp.c +1 -0
index a0a2a11..504d2bd 100644
@@ -96,6 +96,7 @@ static struct omap_board_mux board_mux[] __initdata = {
 static void __init omap_sdp_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
+	omap_serial_init();
 	zoom_peripherals_init();
 	board_smc91x_init();
 	enable_board_wakeup_source();
Signature · 1 line
1.6.3.3
#6 lore raw

PATCH 6/7 omap3: zoom 2/3: Change debugboard serial port id

In reply to Sergio Aguirre

This is now changed to PLAT8250_DEV_PLATFORM (= 0), because it's the only port that's going to be initialized in Zoom 2/3 boards.

So, it doesn't make sense to keep the hardcoded 3 value anymore.

---
 arch/arm/mach-omap2/board-zoom-debugboard.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-zoom-debugboard.c +1 -1
index bb4018b..e15d2e8 100644
@@ -96,7 +96,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
 
 static struct platform_device zoom_debugboard_serial_device = {
 	.name			= "serial8250",
-	.id			= 3,
+	.id			= PLAT8250_DEV_PLATFORM,
 	.dev			= {
 		.platform_data	= serial_platform_data,
 	},
Signature · 1 line
1.6.3.3
#7 lore raw

PATCH 7/7 omap3: zoom2/3: Register only 1 8250 port

In reply to Sergio Aguirre

There's no more serial ports available, so, doesn't make sense to create 4 device nodes.

---
 arch/arm/configs/omap_zoom2_defconfig |    2 +-
 arch/arm/configs/omap_zoom3_defconfig |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/configs/omap_zoom2_defconfig +1 -1
index f5c6e11..881faea 100644
@@ -661,7 +661,7 @@ CONFIG_DEVKMEM=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=32
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SERIAL_8250_EXTENDED=y
 CONFIG_SERIAL_8250_MANY_PORTS=y
 CONFIG_SERIAL_8250_SHARE_IRQ=y
arch/arm/configs/omap_zoom3_defconfig +1 -1
index ea9a501..5e55b55 100644
@@ -680,7 +680,7 @@ CONFIG_DEVKMEM=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=32
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SERIAL_8250_EXTENDED=y
 CONFIG_SERIAL_8250_MANY_PORTS=y
 CONFIG_SERIAL_8250_SHARE_IRQ=y
Signature · 1 line
1.6.3.3
maintainer
#8 lore raw

cover omap3: serial code for 3630 and zoom2/3 fixes

In reply to Sergio Aguirre
Quoted 11 lines · Sergio Aguirre

Hi,

This series contains fixes for omap2/3/4 serial code, and are fixing:
- Avoid doing ioremap of a zero-based physical address. (causing a kernel panic during early init on 3630boards)
- Unproper omap_revision check during uart globals setup. (omap_revision is not yet filled at that point)
- Don't try to enable all uarts generically for zoom2/3 and 3630sdp.
- Make zoom2/3 just register one serial port (ttyS0).

Thanks, I've pulled this into omap-fixes-for-linus.

Regards,

Tony

Quoted 39 lines

This is a subset of the original series found here: [1]

Thanks to:
- Vikram Pandita
- Paul Walmsley
- Kevin Hilman
- Manjunath Kondaiah
- Felipe Balbi
- Tony Lindgreen

For all the feedback recieved so far.

Regards,
Sergio

Detailed changelog:

Sergio Aguirre (7):
OMAP3: serial: Check for zero-based physical addr
OMAP3: serial: Use dev_* macros instead of printk omap2/3/4: serial: Remove condition for getting uart4_phys
omap3: zoom2/3 / 3630sdp: Don't init always all uarts
omap3: 3630sdp: Explicitly enable all UARTs
omap3: zoom 2/3: Change debugboard serial port id
omap3: zoom2/3: Register only 1 8250 port

 arch/arm/configs/omap_zoom2_defconfig        |    2 +-
 arch/arm/configs/omap_zoom3_defconfig        |    2 +-
 arch/arm/mach-omap2/board-3630sdp.c          |    1 +
 arch/arm/mach-omap2/board-zoom-debugboard.c  |    2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |    1 -
 arch/arm/mach-omap2/serial.c                 |   35 +++++++++++++------------
 6 files changed, 22 insertions(+), 21 deletions(-)

[1] http://marc.info/?l=linux-omap&m=126826639903105&w=2
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html