]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] S3C: Update number of serial ports
authorBen Dooks <ben-linux@fluff.org>
Mon, 3 Nov 2008 09:21:23 +0000 (09:21 +0000)
committerBen Dooks <ben-linux@fluff.org>
Thu, 18 Dec 2008 16:26:11 +0000 (16:26 +0000)
Update the serial driver to handle the 4 ports of the
S3C2443 and S364XX series.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
drivers/serial/Kconfig
drivers/serial/samsung.c

index e4ae499e587eecd85cddd4a2b882b6b000f40e74..b695ab3142d83e2249586623344d4a49ca0c84a9 100644 (file)
@@ -455,6 +455,16 @@ config SERIAL_SAMSUNG
          provide all of these ports, depending on how the serial port
          pins are configured.
 
+config SERIAL_SAMSUNG_UARTS
+       int
+       depends on SERIAL_SAMSUNG
+       default 2 if ARCH_S3C2400
+       default 4 if ARCH_S3C64XX || CPU_S3C2443
+       default 3
+       help
+         Select the number of available UART ports for the Samsung S3C
+         serial driver
+       
 config SERIAL_SAMSUNG_DEBUG
        bool "Samsung SoC serial debug"
        depends on SERIAL_SAMSUNG && DEBUG_LL
index ba2e8685f9f51c6d6e86a3846ad551d4e75fa742..ec873af261016ae2d0717d55bac6ad7033ee3bae 100644 (file)
 #define S3C24XX_SERIAL_MAJOR   204
 #define S3C24XX_SERIAL_MINOR   64
 
-/* we can support 3 uarts, but not always use them */
-
-#if defined(CONFIG_CPU_S3C2400) || defined(CONFIG_CPU_S3C24A0)
-#define NR_PORTS (2)
-#else
-#define NR_PORTS (3)
-#endif
-
 /* macros to change one thing to another */
 
 #define tx_enabled(port) ((port)->unused[0])
@@ -839,7 +831,7 @@ static struct uart_driver s3c24xx_uart_drv = {
        .minor          = S3C24XX_SERIAL_MINOR,
 };
 
-static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
+static struct s3c24xx_uart_port s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = {
        [0] = {
                .port = {
                        .lock           = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock),
@@ -864,7 +856,7 @@ static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
                        .line           = 1,
                }
        },
-#if NR_PORTS > 2
+#if CONFIG_SERIAL_SAMSUNG_UARTS > 2
 
        [2] = {
                .port = {
@@ -877,6 +869,20 @@ static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
                        .flags          = UPF_BOOT_AUTOCONF,
                        .line           = 2,
                }
+       },
+#endif
+#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
+       [3] = {
+               .port = {
+                       .lock           = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[3].port.lock),
+                       .iotype         = UPIO_MEM,
+                       .irq            = IRQ_S3CUART_RX3,
+                       .uartclk        = 0,
+                       .fifosize       = 16,
+                       .ops            = &s3c24xx_serial_ops,
+                       .flags          = UPF_BOOT_AUTOCONF,
+                       .line           = 3,
+               }
        }
 #endif
 };
@@ -1324,7 +1330,7 @@ static int s3c24xx_serial_init_ports(struct s3c24xx_uart_info *info)
 
        platdev_ptr = s3c24xx_uart_devs;
 
-       for (i = 0; i < NR_PORTS; i++, ptr++, platdev_ptr++) {
+       for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++, ptr++, platdev_ptr++) {
                s3c24xx_serial_init_port(ptr, info, *platdev_ptr);
        }
 
@@ -1345,7 +1351,7 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
 
        /* is this a valid port */
 
-       if (co->index == -1 || co->index >= NR_PORTS)
+       if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS)
                co->index = 0;
 
        port = &s3c24xx_serial_ports[co->index].port;