Title: [7384] trunk: Task[#5518] Bind the index of uart device nodes to physical uart port.

Diff

Modified: trunk/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h (7383 => 7384)


--- trunk/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h	2009-09-18 10:13:04 UTC (rev 7384)
@@ -109,10 +109,14 @@
 
 unsigned long bfin_serial_console_base_addr[] = {
 #ifdef CONFIG_SERIAL_BFIN_UART0
-	 0xFFC00400,
+	0xFFC00400,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART1
-	 0xFFC02000,
+	0xFFC02000,
+#else
+	0,
 #endif
 };
 

Modified: trunk/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h (7383 => 7384)


--- trunk/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h	2009-09-18 10:13:04 UTC (rev 7384)
@@ -109,10 +109,14 @@
 
 unsigned long bfin_serial_console_base_addr[] = {
 #ifdef CONFIG_SERIAL_BFIN_UART0
-	 0xFFC00400,
+	0xFFC00400,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART1
-	 0xFFC02000,
+	0xFFC02000,
+#else
+	0,
 #endif
 };
 

Modified: trunk/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h (7383 => 7384)


--- trunk/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h	2009-09-18 10:13:04 UTC (rev 7384)
@@ -109,6 +109,10 @@
 }
 
 unsigned long bfin_serial_console_base_addr[] = {
+#ifdef CONFIG_SERIAL_BFIN_UART0
 	0xFFC00400,
+#else
+	0,
+#endif
 };
 

Modified: trunk/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h (7383 => 7384)


--- trunk/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h	2009-09-18 10:13:04 UTC (rev 7384)
@@ -109,9 +109,13 @@
 unsigned long bfin_serial_console_base_addr[] = {
 #ifdef CONFIG_SERIAL_BFIN_UART0
 	0xFFC00400,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART1
 	0xFFC02000,
+#else
+	0,
 #endif
 };
 

Modified: trunk/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h (7383 => 7384)


--- trunk/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h	2009-09-18 10:13:04 UTC (rev 7384)
@@ -110,12 +110,18 @@
 unsigned long bfin_serial_console_base_addr[] = {
 #ifdef CONFIG_SERIAL_BFIN_UART0
 	0xFFC00400,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART1
 	0xFFC02000,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART2
 	0xFFC02100,
+#else
+	0,
 #endif
 };
 

Modified: trunk/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h (7383 => 7384)


--- trunk/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h	2009-09-18 10:13:04 UTC (rev 7384)
@@ -98,15 +98,23 @@
 unsigned long bfin_serial_console_base_addr[] = {
 #ifdef CONFIG_SERIAL_BFIN_UART0
 	0xFFC00400,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART1
 	0xFFC02000,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART2
 	0xFFC02100,
+#else
+	0,
 #endif
 #ifdef CONFIG_SERIAL_BFIN_UART3
 	0xFFC03100,
+#else
+	0,
 #endif
 };
 

Modified: trunk/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h (7383 => 7384)


--- trunk/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h	2009-09-18 10:13:04 UTC (rev 7384)
@@ -109,6 +109,10 @@
 }
 
 unsigned long bfin_serial_console_base_addr[] = {
+#ifdef CONFIG_SERIAL_BFIN_UART0
 	0xFFC00400,
+#else
+	0,
+#endif
 };
 

Modified: trunk/drivers/serial/bfin_5xx.c (7383 => 7384)


--- trunk/drivers/serial/bfin_5xx.c	2009-09-18 09:14:38 UTC (rev 7383)
+++ trunk/drivers/serial/bfin_5xx.c	2009-09-18 10:13:04 UTC (rev 7384)
@@ -50,7 +50,7 @@
 #define DRIVER_NAME		"bfin-uart"
 
 static struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
-static int nr_active_ports = ARRAY_SIZE(bfin_serial_console_base_addr);
+static int nr_ports = ARRAY_SIZE(bfin_serial_console_base_addr);
 
 #if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
 	defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
@@ -1133,7 +1133,7 @@
 	}
 #endif
 
-	for (i = 0; i < nr_active_ports; i++) {
+	for (i = 0; i < nr_ports; i++) {
 		spin_lock_init(&bfin_serial_ports[i].port.lock);
 		bfin_serial_ports[i].port.uartclk   = get_sclk();
 		bfin_serial_ports[i].port.fifosize  = BFIN_UART_TX_FIFO_SIZE;
@@ -1233,8 +1233,8 @@
 	 * if so, search for the first available port that does have
 	 * console support.
 	 */
-	if (co->index == -1 || co->index >= nr_active_ports)
-		co->index = 0;
+	if (co->index == -1 || co->index >= nr_ports)
+		return -ENODEV;
 	uart = &bfin_serial_ports[co->index];
 
 	if (options)
@@ -1331,8 +1331,8 @@
 	bfin_serial_console.flags &= ~CON_PRINTBUFFER;
 #endif
 
-	if (port == -1 || port >= nr_active_ports)
-		port = 0;
+	if (port == -1 || port >= nr_ports)
+		return -ENODEV;
 	if (bfin_serial_init_ports())
 		return NULL;
 
@@ -1373,22 +1373,25 @@
 	struct resource *res;
 	struct bfin_serial_port *uart;
 	int ret;
-	static int index;
+	int index;
 
-	uart = &bfin_serial_ports[index];
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (res == NULL) {
 		dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n");
 		return -ENOENT;
 	}
 
-	if (res->start != bfin_serial_console_base_addr[index]) {
+	for (index = 0; index < nr_ports; index++)
+		if (res->start == bfin_serial_console_base_addr[index])
+			break;
+
+	if (index == nr_ports) {
 		dev_err(&pdev->dev, "Wrong uart platform device\n");
 		return -ENOENT;
 	}
-	index++;
 
+	uart = &bfin_serial_ports[index];
+
 	uart->port.membase = ioremap(res->start,
 		res->end - res->start + 1);
 	if (!uart->port.membase) {
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to