diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/Kconfig | 10 | ||||
-rw-r--r-- | drivers/serial/samsung.c | 30 |
2 files changed, 28 insertions, 12 deletions
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index e4ae499e587e..b695ab3142d8 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -455,6 +455,16 @@ config SERIAL_SAMSUNG | |||
455 | provide all of these ports, depending on how the serial port | 455 | provide all of these ports, depending on how the serial port |
456 | pins are configured. | 456 | pins are configured. |
457 | 457 | ||
458 | config SERIAL_SAMSUNG_UARTS | ||
459 | int | ||
460 | depends on SERIAL_SAMSUNG | ||
461 | default 2 if ARCH_S3C2400 | ||
462 | default 4 if ARCH_S3C64XX || CPU_S3C2443 | ||
463 | default 3 | ||
464 | help | ||
465 | Select the number of available UART ports for the Samsung S3C | ||
466 | serial driver | ||
467 | |||
458 | config SERIAL_SAMSUNG_DEBUG | 468 | config SERIAL_SAMSUNG_DEBUG |
459 | bool "Samsung SoC serial debug" | 469 | bool "Samsung SoC serial debug" |
460 | depends on SERIAL_SAMSUNG && DEBUG_LL | 470 | depends on SERIAL_SAMSUNG && DEBUG_LL |
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c index ba2e8685f9f5..ec873af26101 100644 --- a/drivers/serial/samsung.c +++ b/drivers/serial/samsung.c | |||
@@ -59,14 +59,6 @@ | |||
59 | #define S3C24XX_SERIAL_MAJOR 204 | 59 | #define S3C24XX_SERIAL_MAJOR 204 |
60 | #define S3C24XX_SERIAL_MINOR 64 | 60 | #define S3C24XX_SERIAL_MINOR 64 |
61 | 61 | ||
62 | /* we can support 3 uarts, but not always use them */ | ||
63 | |||
64 | #if defined(CONFIG_CPU_S3C2400) || defined(CONFIG_CPU_S3C24A0) | ||
65 | #define NR_PORTS (2) | ||
66 | #else | ||
67 | #define NR_PORTS (3) | ||
68 | #endif | ||
69 | |||
70 | /* macros to change one thing to another */ | 62 | /* macros to change one thing to another */ |
71 | 63 | ||
72 | #define tx_enabled(port) ((port)->unused[0]) | 64 | #define tx_enabled(port) ((port)->unused[0]) |
@@ -839,7 +831,7 @@ static struct uart_driver s3c24xx_uart_drv = { | |||
839 | .minor = S3C24XX_SERIAL_MINOR, | 831 | .minor = S3C24XX_SERIAL_MINOR, |
840 | }; | 832 | }; |
841 | 833 | ||
842 | static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = { | 834 | static struct s3c24xx_uart_port s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = { |
843 | [0] = { | 835 | [0] = { |
844 | .port = { | 836 | .port = { |
845 | .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock), | 837 | .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock), |
@@ -864,7 +856,7 @@ static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = { | |||
864 | .line = 1, | 856 | .line = 1, |
865 | } | 857 | } |
866 | }, | 858 | }, |
867 | #if NR_PORTS > 2 | 859 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 2 |
868 | 860 | ||
869 | [2] = { | 861 | [2] = { |
870 | .port = { | 862 | .port = { |
@@ -877,6 +869,20 @@ static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = { | |||
877 | .flags = UPF_BOOT_AUTOCONF, | 869 | .flags = UPF_BOOT_AUTOCONF, |
878 | .line = 2, | 870 | .line = 2, |
879 | } | 871 | } |
872 | }, | ||
873 | #endif | ||
874 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 3 | ||
875 | [3] = { | ||
876 | .port = { | ||
877 | .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[3].port.lock), | ||
878 | .iotype = UPIO_MEM, | ||
879 | .irq = IRQ_S3CUART_RX3, | ||
880 | .uartclk = 0, | ||
881 | .fifosize = 16, | ||
882 | .ops = &s3c24xx_serial_ops, | ||
883 | .flags = UPF_BOOT_AUTOCONF, | ||
884 | .line = 3, | ||
885 | } | ||
880 | } | 886 | } |
881 | #endif | 887 | #endif |
882 | }; | 888 | }; |
@@ -1324,7 +1330,7 @@ static int s3c24xx_serial_init_ports(struct s3c24xx_uart_info *info) | |||
1324 | 1330 | ||
1325 | platdev_ptr = s3c24xx_uart_devs; | 1331 | platdev_ptr = s3c24xx_uart_devs; |
1326 | 1332 | ||
1327 | for (i = 0; i < NR_PORTS; i++, ptr++, platdev_ptr++) { | 1333 | for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++, ptr++, platdev_ptr++) { |
1328 | s3c24xx_serial_init_port(ptr, info, *platdev_ptr); | 1334 | s3c24xx_serial_init_port(ptr, info, *platdev_ptr); |
1329 | } | 1335 | } |
1330 | 1336 | ||
@@ -1345,7 +1351,7 @@ s3c24xx_serial_console_setup(struct console *co, char *options) | |||
1345 | 1351 | ||
1346 | /* is this a valid port */ | 1352 | /* is this a valid port */ |
1347 | 1353 | ||
1348 | if (co->index == -1 || co->index >= NR_PORTS) | 1354 | if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS) |
1349 | co->index = 0; | 1355 | co->index = 0; |
1350 | 1356 | ||
1351 | port = &s3c24xx_serial_ports[co->index].port; | 1357 | port = &s3c24xx_serial_ports[co->index].port; |