diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/Kconfig | 45 | ||||
-rw-r--r-- | drivers/tty/serial/Makefile | 5 | ||||
-rw-r--r-- | drivers/tty/serial/s3c2410.c | 74 | ||||
-rw-r--r-- | drivers/tty/serial/s3c2412.c | 78 | ||||
-rw-r--r-- | drivers/tty/serial/s3c2440.c | 77 | ||||
-rw-r--r-- | drivers/tty/serial/s3c6400.c | 79 | ||||
-rw-r--r-- | drivers/tty/serial/s5pv210.c | 94 | ||||
-rw-r--r-- | drivers/tty/serial/samsung.c | 360 | ||||
-rw-r--r-- | drivers/tty/serial/samsung.h | 18 |
9 files changed, 253 insertions, 577 deletions
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 925a1e547a83..fb89b85d0d81 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -457,7 +457,7 @@ config SERIAL_SAMSUNG | |||
457 | config SERIAL_SAMSUNG_UARTS_4 | 457 | config SERIAL_SAMSUNG_UARTS_4 |
458 | bool | 458 | bool |
459 | depends on ARM && PLAT_SAMSUNG | 459 | depends on ARM && PLAT_SAMSUNG |
460 | default y if CPU_S3C2443 | 460 | default y if !(CPU_S3C2410 || SERIAL_S3C2412 || CPU_S3C2440 || CPU_S3C2442) |
461 | help | 461 | help |
462 | Internal node for the common case of 4 Samsung compatible UARTs | 462 | Internal node for the common case of 4 Samsung compatible UARTs |
463 | 463 | ||
@@ -465,7 +465,7 @@ config SERIAL_SAMSUNG_UARTS | |||
465 | int | 465 | int |
466 | depends on ARM && PLAT_SAMSUNG | 466 | depends on ARM && PLAT_SAMSUNG |
467 | default 6 if ARCH_S5P6450 | 467 | default 6 if ARCH_S5P6450 |
468 | default 4 if SERIAL_SAMSUNG_UARTS_4 | 468 | default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 |
469 | default 3 | 469 | default 3 |
470 | help | 470 | help |
471 | Select the number of available UART ports for the Samsung S3C | 471 | Select the number of available UART ports for the Samsung S3C |
@@ -495,47 +495,6 @@ config SERIAL_SAMSUNG_CONSOLE | |||
495 | your boot loader about how to pass options to the kernel at | 495 | your boot loader about how to pass options to the kernel at |
496 | boot time.) | 496 | boot time.) |
497 | 497 | ||
498 | config SERIAL_S3C2410 | ||
499 | tristate "Samsung S3C2410 Serial port support" | ||
500 | depends on SERIAL_SAMSUNG && CPU_S3C2410 | ||
501 | default y if CPU_S3C2410 | ||
502 | help | ||
503 | Serial port support for the Samsung S3C2410 SoC | ||
504 | |||
505 | config SERIAL_S3C2412 | ||
506 | tristate "Samsung S3C2412/S3C2413 Serial port support" | ||
507 | depends on SERIAL_SAMSUNG && CPU_S3C2412 | ||
508 | default y if CPU_S3C2412 | ||
509 | help | ||
510 | Serial port support for the Samsung S3C2412 and S3C2413 SoC | ||
511 | |||
512 | config SERIAL_S3C2440 | ||
513 | tristate "Samsung S3C2440/S3C2442/S3C2416 Serial port support" | ||
514 | depends on SERIAL_SAMSUNG && (CPU_S3C2440 || CPU_S3C2442 || CPU_S3C2416) | ||
515 | default y if CPU_S3C2440 | ||
516 | default y if CPU_S3C2442 | ||
517 | select SERIAL_SAMSUNG_UARTS_4 if CPU_S3C2416 | ||
518 | help | ||
519 | Serial port support for the Samsung S3C2440, S3C2416 and S3C2442 SoC | ||
520 | |||
521 | config SERIAL_S3C6400 | ||
522 | tristate "Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support" | ||
523 | depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5P6450 || CPU_S5PC100) | ||
524 | select SERIAL_SAMSUNG_UARTS_4 | ||
525 | default y | ||
526 | help | ||
527 | Serial port support for the Samsung S3C6400, S3C6410, S5P6440, S5P6450 | ||
528 | and S5PC100 SoCs | ||
529 | |||
530 | config SERIAL_S5PV210 | ||
531 | tristate "Samsung S5PV210 Serial port support" | ||
532 | depends on SERIAL_SAMSUNG && (CPU_S5PV210 || CPU_EXYNOS4210 || SOC_EXYNOS4212) | ||
533 | select SERIAL_SAMSUNG_UARTS_4 if (CPU_S5PV210 || CPU_EXYNOS4210 || SOC_EXYNOS4212) | ||
534 | default y | ||
535 | help | ||
536 | Serial port support for Samsung's S5P Family of SoC's | ||
537 | |||
538 | |||
539 | config SERIAL_MAX3100 | 498 | config SERIAL_MAX3100 |
540 | tristate "MAX3100 support" | 499 | tristate "MAX3100 support" |
541 | depends on SPI | 500 | depends on SPI |
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index e10cf5b54b6d..84bc2e5a57be 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile | |||
@@ -39,11 +39,6 @@ obj-$(CONFIG_SERIAL_BCM63XX) += bcm63xx_uart.o | |||
39 | obj-$(CONFIG_SERIAL_BFIN) += bfin_uart.o | 39 | obj-$(CONFIG_SERIAL_BFIN) += bfin_uart.o |
40 | obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o | 40 | obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o |
41 | obj-$(CONFIG_SERIAL_SAMSUNG) += samsung.o | 41 | obj-$(CONFIG_SERIAL_SAMSUNG) += samsung.o |
42 | obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o | ||
43 | obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o | ||
44 | obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o | ||
45 | obj-$(CONFIG_SERIAL_S3C6400) += s3c6400.o | ||
46 | obj-$(CONFIG_SERIAL_S5PV210) += s5pv210.o | ||
47 | obj-$(CONFIG_SERIAL_MAX3100) += max3100.o | 42 | obj-$(CONFIG_SERIAL_MAX3100) += max3100.o |
48 | obj-$(CONFIG_SERIAL_MAX3107) += max3107.o | 43 | obj-$(CONFIG_SERIAL_MAX3107) += max3107.o |
49 | obj-$(CONFIG_SERIAL_MAX3107_AAVA) += max3107-aava.o | 44 | obj-$(CONFIG_SERIAL_MAX3107_AAVA) += max3107-aava.o |
diff --git a/drivers/tty/serial/s3c2410.c b/drivers/tty/serial/s3c2410.c deleted file mode 100644 index 1491c32d1436..000000000000 --- a/drivers/tty/serial/s3c2410.c +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for Samsung S3C2410 SoC onboard UARTs. | ||
3 | * | ||
4 | * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/ioport.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/serial_core.h> | ||
18 | #include <linux/serial.h> | ||
19 | |||
20 | #include <asm/irq.h> | ||
21 | #include <mach/hardware.h> | ||
22 | |||
23 | #include <plat/regs-serial.h> | ||
24 | #include <mach/regs-gpio.h> | ||
25 | |||
26 | #include "samsung.h" | ||
27 | |||
28 | static struct s3c24xx_uart_info s3c2410_uart_inf = { | ||
29 | .name = "Samsung S3C2410 UART", | ||
30 | .type = PORT_S3C2410, | ||
31 | .fifosize = 16, | ||
32 | .rx_fifomask = S3C2410_UFSTAT_RXMASK, | ||
33 | .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT, | ||
34 | .rx_fifofull = S3C2410_UFSTAT_RXFULL, | ||
35 | .tx_fifofull = S3C2410_UFSTAT_TXFULL, | ||
36 | .tx_fifomask = S3C2410_UFSTAT_TXMASK, | ||
37 | .tx_fifoshift = S3C2410_UFSTAT_TXSHIFT, | ||
38 | .def_clk_sel = S3C2410_UCON_CLKSEL0, | ||
39 | .num_clks = 2, | ||
40 | .clksel_mask = S3C2410_UCON_CLKMASK, | ||
41 | .clksel_shift = S3C2410_UCON_CLKSHIFT, | ||
42 | }; | ||
43 | |||
44 | static int s3c2410_serial_probe(struct platform_device *dev) | ||
45 | { | ||
46 | return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); | ||
47 | } | ||
48 | |||
49 | static struct platform_driver s3c2410_serial_driver = { | ||
50 | .probe = s3c2410_serial_probe, | ||
51 | .remove = __devexit_p(s3c24xx_serial_remove), | ||
52 | .driver = { | ||
53 | .name = "s3c2410-uart", | ||
54 | .owner = THIS_MODULE, | ||
55 | }, | ||
56 | }; | ||
57 | |||
58 | static int __init s3c2410_serial_init(void) | ||
59 | { | ||
60 | return s3c24xx_serial_init(&s3c2410_serial_driver, &s3c2410_uart_inf); | ||
61 | } | ||
62 | |||
63 | static void __exit s3c2410_serial_exit(void) | ||
64 | { | ||
65 | platform_driver_unregister(&s3c2410_serial_driver); | ||
66 | } | ||
67 | |||
68 | module_init(s3c2410_serial_init); | ||
69 | module_exit(s3c2410_serial_exit); | ||
70 | |||
71 | MODULE_LICENSE("GPL v2"); | ||
72 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
73 | MODULE_DESCRIPTION("Samsung S3C2410 SoC Serial port driver"); | ||
74 | MODULE_ALIAS("platform:s3c2410-uart"); | ||
diff --git a/drivers/tty/serial/s3c2412.c b/drivers/tty/serial/s3c2412.c deleted file mode 100644 index 38ae730307df..000000000000 --- a/drivers/tty/serial/s3c2412.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for Samsung S3C2412 and S3C2413 SoC onboard UARTs. | ||
3 | * | ||
4 | * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/ioport.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/serial_core.h> | ||
18 | #include <linux/serial.h> | ||
19 | |||
20 | #include <asm/irq.h> | ||
21 | #include <mach/hardware.h> | ||
22 | |||
23 | #include <plat/regs-serial.h> | ||
24 | #include <mach/regs-gpio.h> | ||
25 | |||
26 | #include "samsung.h" | ||
27 | |||
28 | static struct s3c24xx_uart_info s3c2412_uart_inf = { | ||
29 | .name = "Samsung S3C2412 UART", | ||
30 | .type = PORT_S3C2412, | ||
31 | .fifosize = 64, | ||
32 | .has_divslot = 1, | ||
33 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, | ||
34 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, | ||
35 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, | ||
36 | .tx_fifofull = S3C2440_UFSTAT_TXFULL, | ||
37 | .tx_fifomask = S3C2440_UFSTAT_TXMASK, | ||
38 | .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT, | ||
39 | .def_clk_sel = S3C2410_UCON_CLKSEL2, | ||
40 | .num_clks = 4, | ||
41 | .clksel_mask = S3C2412_UCON_CLKMASK, | ||
42 | .clksel_shift = S3C2412_UCON_CLKSHIFT, | ||
43 | }; | ||
44 | |||
45 | /* device management */ | ||
46 | |||
47 | static int s3c2412_serial_probe(struct platform_device *dev) | ||
48 | { | ||
49 | dbg("s3c2440_serial_probe: dev=%p\n", dev); | ||
50 | return s3c24xx_serial_probe(dev, &s3c2412_uart_inf); | ||
51 | } | ||
52 | |||
53 | static struct platform_driver s3c2412_serial_driver = { | ||
54 | .probe = s3c2412_serial_probe, | ||
55 | .remove = __devexit_p(s3c24xx_serial_remove), | ||
56 | .driver = { | ||
57 | .name = "s3c2412-uart", | ||
58 | .owner = THIS_MODULE, | ||
59 | }, | ||
60 | }; | ||
61 | |||
62 | static inline int s3c2412_serial_init(void) | ||
63 | { | ||
64 | return s3c24xx_serial_init(&s3c2412_serial_driver, &s3c2412_uart_inf); | ||
65 | } | ||
66 | |||
67 | static inline void s3c2412_serial_exit(void) | ||
68 | { | ||
69 | platform_driver_unregister(&s3c2412_serial_driver); | ||
70 | } | ||
71 | |||
72 | module_init(s3c2412_serial_init); | ||
73 | module_exit(s3c2412_serial_exit); | ||
74 | |||
75 | MODULE_DESCRIPTION("Samsung S3C2412,S3C2413 SoC Serial port driver"); | ||
76 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
77 | MODULE_LICENSE("GPL v2"); | ||
78 | MODULE_ALIAS("platform:s3c2412-uart"); | ||
diff --git a/drivers/tty/serial/s3c2440.c b/drivers/tty/serial/s3c2440.c deleted file mode 100644 index 70652f56ab60..000000000000 --- a/drivers/tty/serial/s3c2440.c +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for Samsung S3C2440 and S3C2442 SoC onboard UARTs. | ||
3 | * | ||
4 | * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/ioport.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/serial_core.h> | ||
18 | #include <linux/serial.h> | ||
19 | |||
20 | #include <asm/irq.h> | ||
21 | #include <mach/hardware.h> | ||
22 | |||
23 | #include <plat/regs-serial.h> | ||
24 | #include <mach/regs-gpio.h> | ||
25 | |||
26 | #include "samsung.h" | ||
27 | |||
28 | static struct s3c24xx_uart_info s3c2440_uart_inf = { | ||
29 | .name = "Samsung S3C2440 UART", | ||
30 | .type = PORT_S3C2440, | ||
31 | .fifosize = 64, | ||
32 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, | ||
33 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, | ||
34 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, | ||
35 | .tx_fifofull = S3C2440_UFSTAT_TXFULL, | ||
36 | .tx_fifomask = S3C2440_UFSTAT_TXMASK, | ||
37 | .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT, | ||
38 | .def_clk_sel = S3C2410_UCON_CLKSEL2, | ||
39 | .num_clks = 4, | ||
40 | .clksel_mask = S3C2440_UCON_CLKMASK, | ||
41 | .clksel_shift = S3C2440_UCON_CLKSHIFT, | ||
42 | }; | ||
43 | |||
44 | /* device management */ | ||
45 | |||
46 | static int s3c2440_serial_probe(struct platform_device *dev) | ||
47 | { | ||
48 | dbg("s3c2440_serial_probe: dev=%p\n", dev); | ||
49 | return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); | ||
50 | } | ||
51 | |||
52 | static struct platform_driver s3c2440_serial_driver = { | ||
53 | .probe = s3c2440_serial_probe, | ||
54 | .remove = __devexit_p(s3c24xx_serial_remove), | ||
55 | .driver = { | ||
56 | .name = "s3c2440-uart", | ||
57 | .owner = THIS_MODULE, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static int __init s3c2440_serial_init(void) | ||
62 | { | ||
63 | return s3c24xx_serial_init(&s3c2440_serial_driver, &s3c2440_uart_inf); | ||
64 | } | ||
65 | |||
66 | static void __exit s3c2440_serial_exit(void) | ||
67 | { | ||
68 | platform_driver_unregister(&s3c2440_serial_driver); | ||
69 | } | ||
70 | |||
71 | module_init(s3c2440_serial_init); | ||
72 | module_exit(s3c2440_serial_exit); | ||
73 | |||
74 | MODULE_DESCRIPTION("Samsung S3C2440,S3C2442 SoC Serial port driver"); | ||
75 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
76 | MODULE_LICENSE("GPL v2"); | ||
77 | MODULE_ALIAS("platform:s3c2440-uart"); | ||
diff --git a/drivers/tty/serial/s3c6400.c b/drivers/tty/serial/s3c6400.c deleted file mode 100644 index 30a69f1cd3e6..000000000000 --- a/drivers/tty/serial/s3c6400.c +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for Samsung S3C6400 and S3C6410 SoC onboard UARTs. | ||
3 | * | ||
4 | * Copyright 2008 Openmoko, Inc. | ||
5 | * Copyright 2008 Simtec Electronics | ||
6 | * Ben Dooks <ben@simtec.co.uk> | ||
7 | * http://armlinux.simtec.co.uk/ | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/ioport.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/serial_core.h> | ||
20 | #include <linux/serial.h> | ||
21 | |||
22 | #include <asm/irq.h> | ||
23 | #include <mach/hardware.h> | ||
24 | |||
25 | #include <plat/regs-serial.h> | ||
26 | |||
27 | #include "samsung.h" | ||
28 | |||
29 | static struct s3c24xx_uart_info s3c6400_uart_inf = { | ||
30 | .name = "Samsung S3C6400 UART", | ||
31 | .type = PORT_S3C6400, | ||
32 | .fifosize = 64, | ||
33 | .has_divslot = 1, | ||
34 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, | ||
35 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, | ||
36 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, | ||
37 | .tx_fifofull = S3C2440_UFSTAT_TXFULL, | ||
38 | .tx_fifomask = S3C2440_UFSTAT_TXMASK, | ||
39 | .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT, | ||
40 | .def_clk_sel = S3C2410_UCON_CLKSEL2, | ||
41 | .num_clks = 4, | ||
42 | .clksel_mask = S3C6400_UCON_CLKMASK, | ||
43 | .clksel_shift = S3C6400_UCON_CLKSHIFT, | ||
44 | }; | ||
45 | |||
46 | /* device management */ | ||
47 | |||
48 | static int s3c6400_serial_probe(struct platform_device *dev) | ||
49 | { | ||
50 | dbg("s3c6400_serial_probe: dev=%p\n", dev); | ||
51 | return s3c24xx_serial_probe(dev, &s3c6400_uart_inf); | ||
52 | } | ||
53 | |||
54 | static struct platform_driver s3c6400_serial_driver = { | ||
55 | .probe = s3c6400_serial_probe, | ||
56 | .remove = __devexit_p(s3c24xx_serial_remove), | ||
57 | .driver = { | ||
58 | .name = "s3c6400-uart", | ||
59 | .owner = THIS_MODULE, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | static int __init s3c6400_serial_init(void) | ||
64 | { | ||
65 | return s3c24xx_serial_init(&s3c6400_serial_driver, &s3c6400_uart_inf); | ||
66 | } | ||
67 | |||
68 | static void __exit s3c6400_serial_exit(void) | ||
69 | { | ||
70 | platform_driver_unregister(&s3c6400_serial_driver); | ||
71 | } | ||
72 | |||
73 | module_init(s3c6400_serial_init); | ||
74 | module_exit(s3c6400_serial_exit); | ||
75 | |||
76 | MODULE_DESCRIPTION("Samsung S3C6400,S3C6410 SoC Serial port driver"); | ||
77 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
78 | MODULE_LICENSE("GPL v2"); | ||
79 | MODULE_ALIAS("platform:s3c6400-uart"); | ||
diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c deleted file mode 100644 index d23209460dd3..000000000000 --- a/drivers/tty/serial/s5pv210.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com/ | ||
4 | * | ||
5 | * Based on drivers/serial/s3c6400.c | ||
6 | * | ||
7 | * Driver for Samsung S5PV210 SoC UARTs. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/ioport.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/serial_core.h> | ||
20 | #include <linux/serial.h> | ||
21 | #include <linux/delay.h> | ||
22 | |||
23 | #include <asm/irq.h> | ||
24 | #include <mach/hardware.h> | ||
25 | #include <plat/regs-serial.h> | ||
26 | #include "samsung.h" | ||
27 | |||
28 | #define S5PV210_UART_DEFAULT_INFO(fifo_size) \ | ||
29 | .name = "Samsung S5PV210 UART0", \ | ||
30 | .type = PORT_S3C6400, \ | ||
31 | .fifosize = fifo_size, \ | ||
32 | .has_divslot = 1, \ | ||
33 | .rx_fifomask = S5PV210_UFSTAT_RXMASK, \ | ||
34 | .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, \ | ||
35 | .rx_fifofull = S5PV210_UFSTAT_RXFULL, \ | ||
36 | .tx_fifofull = S5PV210_UFSTAT_TXFULL, \ | ||
37 | .tx_fifomask = S5PV210_UFSTAT_TXMASK, \ | ||
38 | .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, \ | ||
39 | .def_clk_sel = S3C2410_UCON_CLKSEL0, \ | ||
40 | .num_clks = 2, \ | ||
41 | .clksel_mask = S5PV210_UCON_CLKMASK, \ | ||
42 | .clksel_shift = S5PV210_UCON_CLKSHIFT | ||
43 | |||
44 | static struct s3c24xx_uart_info s5p_port_fifo256 = { | ||
45 | S5PV210_UART_DEFAULT_INFO(256), | ||
46 | }; | ||
47 | |||
48 | static struct s3c24xx_uart_info s5p_port_fifo64 = { | ||
49 | S5PV210_UART_DEFAULT_INFO(64), | ||
50 | }; | ||
51 | |||
52 | static struct s3c24xx_uart_info s5p_port_fifo16 = { | ||
53 | S5PV210_UART_DEFAULT_INFO(16), | ||
54 | }; | ||
55 | |||
56 | static struct s3c24xx_uart_info *s5p_uart_inf[] = { | ||
57 | [0] = &s5p_port_fifo256, | ||
58 | [1] = &s5p_port_fifo64, | ||
59 | [2] = &s5p_port_fifo16, | ||
60 | [3] = &s5p_port_fifo16, | ||
61 | }; | ||
62 | |||
63 | /* device management */ | ||
64 | static int s5p_serial_probe(struct platform_device *pdev) | ||
65 | { | ||
66 | return s3c24xx_serial_probe(pdev, s5p_uart_inf[pdev->id]); | ||
67 | } | ||
68 | |||
69 | static struct platform_driver s5p_serial_driver = { | ||
70 | .probe = s5p_serial_probe, | ||
71 | .remove = __devexit_p(s3c24xx_serial_remove), | ||
72 | .driver = { | ||
73 | .name = "s5pv210-uart", | ||
74 | .owner = THIS_MODULE, | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static int __init s5p_serial_init(void) | ||
79 | { | ||
80 | return s3c24xx_serial_init(&s5p_serial_driver, *s5p_uart_inf); | ||
81 | } | ||
82 | |||
83 | static void __exit s5p_serial_exit(void) | ||
84 | { | ||
85 | platform_driver_unregister(&s5p_serial_driver); | ||
86 | } | ||
87 | |||
88 | module_init(s5p_serial_init); | ||
89 | module_exit(s5p_serial_exit); | ||
90 | |||
91 | MODULE_LICENSE("GPL"); | ||
92 | MODULE_ALIAS("platform:s5pv210-uart"); | ||
93 | MODULE_DESCRIPTION("Samsung S5PV210 UART Driver support"); | ||
94 | MODULE_AUTHOR("Thomas Abraham <thomas.ab@samsung.com>"); | ||
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 78aea1a49ad8..c89987b64c15 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -206,7 +206,7 @@ static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport, | |||
206 | struct s3c24xx_uart_info *info = ourport->info; | 206 | struct s3c24xx_uart_info *info = ourport->info; |
207 | 207 | ||
208 | if (ufstat & info->rx_fifofull) | 208 | if (ufstat & info->rx_fifofull) |
209 | return info->fifosize; | 209 | return ourport->port.fifosize; |
210 | 210 | ||
211 | return (ufstat & info->rx_fifomask) >> info->rx_fifoshift; | 211 | return (ufstat & info->rx_fifomask) >> info->rx_fifoshift; |
212 | } | 212 | } |
@@ -1079,11 +1079,10 @@ static inline void s3c24xx_serial_cpufreq_deregister(struct s3c24xx_uart_port *p | |||
1079 | */ | 1079 | */ |
1080 | 1080 | ||
1081 | static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | 1081 | static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, |
1082 | struct s3c24xx_uart_info *info, | ||
1083 | struct platform_device *platdev) | 1082 | struct platform_device *platdev) |
1084 | { | 1083 | { |
1085 | struct uart_port *port = &ourport->port; | 1084 | struct uart_port *port = &ourport->port; |
1086 | struct s3c2410_uartcfg *cfg = platdev->dev.platform_data; | 1085 | struct s3c2410_uartcfg *cfg = ourport->cfg; |
1087 | struct resource *res; | 1086 | struct resource *res; |
1088 | int ret; | 1087 | int ret; |
1089 | 1088 | ||
@@ -1095,32 +1094,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1095 | if (port->mapbase != 0) | 1094 | if (port->mapbase != 0) |
1096 | return 0; | 1095 | return 0; |
1097 | 1096 | ||
1098 | /* | ||
1099 | * If platform data is supplied, keep a copy of the location of | ||
1100 | * platform data in the driver's private data. | ||
1101 | */ | ||
1102 | if (cfg) | ||
1103 | ourport->cfg = cfg; | ||
1104 | |||
1105 | if (cfg->hwport > CONFIG_SERIAL_SAMSUNG_UARTS) { | ||
1106 | printk(KERN_ERR "%s: port %d bigger than %d\n", __func__, | ||
1107 | cfg->hwport, CONFIG_SERIAL_SAMSUNG_UARTS); | ||
1108 | return -ERANGE; | ||
1109 | } | ||
1110 | |||
1111 | /* setup info for port */ | 1097 | /* setup info for port */ |
1112 | port->dev = &platdev->dev; | 1098 | port->dev = &platdev->dev; |
1113 | ourport->info = info; | ||
1114 | 1099 | ||
1115 | /* Startup sequence is different for s3c64xx and higher SoC's */ | 1100 | /* Startup sequence is different for s3c64xx and higher SoC's */ |
1116 | if (s3c24xx_serial_has_interrupt_mask(port)) | 1101 | if (s3c24xx_serial_has_interrupt_mask(port)) |
1117 | s3c24xx_serial_ops.startup = s3c64xx_serial_startup; | 1102 | s3c24xx_serial_ops.startup = s3c64xx_serial_startup; |
1118 | 1103 | ||
1119 | /* copy the info in from provided structure */ | ||
1120 | ourport->port.fifosize = info->fifosize; | ||
1121 | |||
1122 | dbg("s3c24xx_serial_init_port: %p (hw %d)...\n", port, cfg->hwport); | ||
1123 | |||
1124 | port->uartclk = 1; | 1104 | port->uartclk = 1; |
1125 | 1105 | ||
1126 | if (cfg->uart_flags & UPF_CONS_FLOW) { | 1106 | if (cfg->uart_flags & UPF_CONS_FLOW) { |
@@ -1187,34 +1167,46 @@ static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL); | |||
1187 | 1167 | ||
1188 | static int probe_index; | 1168 | static int probe_index; |
1189 | 1169 | ||
1190 | int s3c24xx_serial_probe(struct platform_device *dev, | 1170 | static int s3c24xx_serial_probe(struct platform_device *pdev) |
1191 | struct s3c24xx_uart_info *info) | ||
1192 | { | 1171 | { |
1193 | struct s3c24xx_uart_port *ourport; | 1172 | struct s3c24xx_uart_port *ourport; |
1194 | int ret; | 1173 | int ret; |
1195 | 1174 | ||
1196 | dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index); | 1175 | dbg("s3c24xx_serial_probe(%p) %d\n", pdev, probe_index); |
1197 | 1176 | ||
1198 | ourport = &s3c24xx_serial_ports[probe_index]; | 1177 | ourport = &s3c24xx_serial_ports[probe_index]; |
1178 | |||
1179 | ourport->drv_data = (struct s3c24xx_serial_drv_data *) | ||
1180 | platform_get_device_id(pdev)->driver_data; | ||
1181 | |||
1182 | ourport->info = ourport->drv_data->info; | ||
1183 | ourport->cfg = (pdev->dev.platform_data) ? | ||
1184 | (struct s3c2410_uartcfg *)pdev->dev.platform_data : | ||
1185 | ourport->drv_data->def_cfg; | ||
1186 | |||
1187 | ourport->port.fifosize = (ourport->info->fifosize) ? | ||
1188 | ourport->info->fifosize : | ||
1189 | ourport->drv_data->fifosize[probe_index]; | ||
1190 | |||
1199 | probe_index++; | 1191 | probe_index++; |
1200 | 1192 | ||
1201 | dbg("%s: initialising port %p...\n", __func__, ourport); | 1193 | dbg("%s: initialising port %p...\n", __func__, ourport); |
1202 | 1194 | ||
1203 | ret = s3c24xx_serial_init_port(ourport, info, dev); | 1195 | ret = s3c24xx_serial_init_port(ourport, pdev); |
1204 | if (ret < 0) | 1196 | if (ret < 0) |
1205 | goto probe_err; | 1197 | goto probe_err; |
1206 | 1198 | ||
1207 | dbg("%s: adding port\n", __func__); | 1199 | dbg("%s: adding port\n", __func__); |
1208 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); | 1200 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); |
1209 | platform_set_drvdata(dev, &ourport->port); | 1201 | platform_set_drvdata(pdev, &ourport->port); |
1210 | 1202 | ||
1211 | ret = device_create_file(&dev->dev, &dev_attr_clock_source); | 1203 | ret = device_create_file(&pdev->dev, &dev_attr_clock_source); |
1212 | if (ret < 0) | 1204 | if (ret < 0) |
1213 | printk(KERN_ERR "%s: failed to add clksrc attr.\n", __func__); | 1205 | dev_err(&pdev->dev, "failed to add clock source attr.\n"); |
1214 | 1206 | ||
1215 | ret = s3c24xx_serial_cpufreq_register(ourport); | 1207 | ret = s3c24xx_serial_cpufreq_register(ourport); |
1216 | if (ret < 0) | 1208 | if (ret < 0) |
1217 | dev_err(&dev->dev, "failed to add cpufreq notifier\n"); | 1209 | dev_err(&pdev->dev, "failed to add cpufreq notifier\n"); |
1218 | 1210 | ||
1219 | return 0; | 1211 | return 0; |
1220 | 1212 | ||
@@ -1222,9 +1214,7 @@ int s3c24xx_serial_probe(struct platform_device *dev, | |||
1222 | return ret; | 1214 | return ret; |
1223 | } | 1215 | } |
1224 | 1216 | ||
1225 | EXPORT_SYMBOL_GPL(s3c24xx_serial_probe); | 1217 | static int __devexit s3c24xx_serial_remove(struct platform_device *dev) |
1226 | |||
1227 | int __devexit s3c24xx_serial_remove(struct platform_device *dev) | ||
1228 | { | 1218 | { |
1229 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); | 1219 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1230 | 1220 | ||
@@ -1237,8 +1227,6 @@ int __devexit s3c24xx_serial_remove(struct platform_device *dev) | |||
1237 | return 0; | 1227 | return 0; |
1238 | } | 1228 | } |
1239 | 1229 | ||
1240 | EXPORT_SYMBOL_GPL(s3c24xx_serial_remove); | ||
1241 | |||
1242 | /* UART power management code */ | 1230 | /* UART power management code */ |
1243 | #ifdef CONFIG_PM_SLEEP | 1231 | #ifdef CONFIG_PM_SLEEP |
1244 | static int s3c24xx_serial_suspend(struct device *dev) | 1232 | static int s3c24xx_serial_suspend(struct device *dev) |
@@ -1278,41 +1266,6 @@ static const struct dev_pm_ops s3c24xx_serial_pm_ops = { | |||
1278 | #define SERIAL_SAMSUNG_PM_OPS NULL | 1266 | #define SERIAL_SAMSUNG_PM_OPS NULL |
1279 | #endif /* CONFIG_PM_SLEEP */ | 1267 | #endif /* CONFIG_PM_SLEEP */ |
1280 | 1268 | ||
1281 | int s3c24xx_serial_init(struct platform_driver *drv, | ||
1282 | struct s3c24xx_uart_info *info) | ||
1283 | { | ||
1284 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); | ||
1285 | |||
1286 | drv->driver.pm = SERIAL_SAMSUNG_PM_OPS; | ||
1287 | |||
1288 | return platform_driver_register(drv); | ||
1289 | } | ||
1290 | |||
1291 | EXPORT_SYMBOL_GPL(s3c24xx_serial_init); | ||
1292 | |||
1293 | /* module initialisation code */ | ||
1294 | |||
1295 | static int __init s3c24xx_serial_modinit(void) | ||
1296 | { | ||
1297 | int ret; | ||
1298 | |||
1299 | ret = uart_register_driver(&s3c24xx_uart_drv); | ||
1300 | if (ret < 0) { | ||
1301 | printk(KERN_ERR "failed to register UART driver\n"); | ||
1302 | return -1; | ||
1303 | } | ||
1304 | |||
1305 | return 0; | ||
1306 | } | ||
1307 | |||
1308 | static void __exit s3c24xx_serial_modexit(void) | ||
1309 | { | ||
1310 | uart_unregister_driver(&s3c24xx_uart_drv); | ||
1311 | } | ||
1312 | |||
1313 | module_init(s3c24xx_serial_modinit); | ||
1314 | module_exit(s3c24xx_serial_modexit); | ||
1315 | |||
1316 | /* Console code */ | 1269 | /* Console code */ |
1317 | 1270 | ||
1318 | #ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE | 1271 | #ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE |
@@ -1418,36 +1371,12 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud, | |||
1418 | else | 1371 | else |
1419 | rate = 1; | 1372 | rate = 1; |
1420 | 1373 | ||
1421 | |||
1422 | *baud = rate / (16 * (ubrdiv + 1)); | 1374 | *baud = rate / (16 * (ubrdiv + 1)); |
1423 | dbg("calculated baud %d\n", *baud); | 1375 | dbg("calculated baud %d\n", *baud); |
1424 | } | 1376 | } |
1425 | 1377 | ||
1426 | } | 1378 | } |
1427 | 1379 | ||
1428 | /* s3c24xx_serial_init_ports | ||
1429 | * | ||
1430 | * initialise the serial ports from the machine provided initialisation | ||
1431 | * data. | ||
1432 | */ | ||
1433 | |||
1434 | static int s3c24xx_serial_init_ports(struct s3c24xx_uart_info **info) | ||
1435 | { | ||
1436 | struct s3c24xx_uart_port *ptr = s3c24xx_serial_ports; | ||
1437 | struct platform_device **platdev_ptr; | ||
1438 | int i; | ||
1439 | |||
1440 | dbg("s3c24xx_serial_init_ports: initialising ports...\n"); | ||
1441 | |||
1442 | platdev_ptr = s3c24xx_uart_devs; | ||
1443 | |||
1444 | for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++, ptr++, platdev_ptr++) { | ||
1445 | s3c24xx_serial_init_port(ptr, info[i], *platdev_ptr); | ||
1446 | } | ||
1447 | |||
1448 | return 0; | ||
1449 | } | ||
1450 | |||
1451 | static int __init | 1380 | static int __init |
1452 | s3c24xx_serial_console_setup(struct console *co, char *options) | 1381 | s3c24xx_serial_console_setup(struct console *co, char *options) |
1453 | { | 1382 | { |
@@ -1491,11 +1420,6 @@ s3c24xx_serial_console_setup(struct console *co, char *options) | |||
1491 | return uart_set_options(port, co, baud, parity, bits, flow); | 1420 | return uart_set_options(port, co, baud, parity, bits, flow); |
1492 | } | 1421 | } |
1493 | 1422 | ||
1494 | /* s3c24xx_serial_initconsole | ||
1495 | * | ||
1496 | * initialise the console from one of the uart drivers | ||
1497 | */ | ||
1498 | |||
1499 | static struct console s3c24xx_serial_console = { | 1423 | static struct console s3c24xx_serial_console = { |
1500 | .name = S3C24XX_SERIAL_NAME, | 1424 | .name = S3C24XX_SERIAL_NAME, |
1501 | .device = uart_console_device, | 1425 | .device = uart_console_device, |
@@ -1505,34 +1429,238 @@ static struct console s3c24xx_serial_console = { | |||
1505 | .setup = s3c24xx_serial_console_setup, | 1429 | .setup = s3c24xx_serial_console_setup, |
1506 | .data = &s3c24xx_uart_drv, | 1430 | .data = &s3c24xx_uart_drv, |
1507 | }; | 1431 | }; |
1432 | #endif /* CONFIG_SERIAL_SAMSUNG_CONSOLE */ | ||
1433 | |||
1434 | #ifdef CONFIG_CPU_S3C2410 | ||
1435 | static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { | ||
1436 | .info = &(struct s3c24xx_uart_info) { | ||
1437 | .name = "Samsung S3C2410 UART", | ||
1438 | .type = PORT_S3C2410, | ||
1439 | .fifosize = 16, | ||
1440 | .rx_fifomask = S3C2410_UFSTAT_RXMASK, | ||
1441 | .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT, | ||
1442 | .rx_fifofull = S3C2410_UFSTAT_RXFULL, | ||
1443 | .tx_fifofull = S3C2410_UFSTAT_TXFULL, | ||
1444 | .tx_fifomask = S3C2410_UFSTAT_TXMASK, | ||
1445 | .tx_fifoshift = S3C2410_UFSTAT_TXSHIFT, | ||
1446 | .def_clk_sel = S3C2410_UCON_CLKSEL0, | ||
1447 | .num_clks = 2, | ||
1448 | .clksel_mask = S3C2410_UCON_CLKMASK, | ||
1449 | .clksel_shift = S3C2410_UCON_CLKSHIFT, | ||
1450 | }, | ||
1451 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1452 | .ucon = S3C2410_UCON_DEFAULT, | ||
1453 | .ufcon = S3C2410_UFCON_DEFAULT, | ||
1454 | }, | ||
1455 | }; | ||
1456 | #define S3C2410_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c2410_serial_drv_data) | ||
1457 | #else | ||
1458 | #define S3C2410_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1459 | #endif | ||
1508 | 1460 | ||
1509 | int s3c24xx_serial_initconsole(struct platform_driver *drv, | 1461 | #ifdef CONFIG_CPU_S3C2412 |
1510 | struct s3c24xx_uart_info **info) | 1462 | static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { |
1463 | .info = &(struct s3c24xx_uart_info) { | ||
1464 | .name = "Samsung S3C2412 UART", | ||
1465 | .type = PORT_S3C2412, | ||
1466 | .fifosize = 64, | ||
1467 | .has_divslot = 1, | ||
1468 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, | ||
1469 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, | ||
1470 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, | ||
1471 | .tx_fifofull = S3C2440_UFSTAT_TXFULL, | ||
1472 | .tx_fifomask = S3C2440_UFSTAT_TXMASK, | ||
1473 | .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT, | ||
1474 | .def_clk_sel = S3C2410_UCON_CLKSEL2, | ||
1475 | .num_clks = 4, | ||
1476 | .clksel_mask = S3C2412_UCON_CLKMASK, | ||
1477 | .clksel_shift = S3C2412_UCON_CLKSHIFT, | ||
1478 | }, | ||
1479 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1480 | .ucon = S3C2410_UCON_DEFAULT, | ||
1481 | .ufcon = S3C2410_UFCON_DEFAULT, | ||
1482 | }, | ||
1483 | }; | ||
1484 | #define S3C2412_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c2412_serial_drv_data) | ||
1485 | #else | ||
1486 | #define S3C2412_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1487 | #endif | ||
1511 | 1488 | ||
1512 | { | 1489 | #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2416) || \ |
1513 | struct platform_device *dev = s3c24xx_uart_devs[0]; | 1490 | defined(CONFIG_CPU_S3C2443) |
1491 | static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { | ||
1492 | .info = &(struct s3c24xx_uart_info) { | ||
1493 | .name = "Samsung S3C2440 UART", | ||
1494 | .type = PORT_S3C2440, | ||
1495 | .fifosize = 64, | ||
1496 | .has_divslot = 1, | ||
1497 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, | ||
1498 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, | ||
1499 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, | ||
1500 | .tx_fifofull = S3C2440_UFSTAT_TXFULL, | ||
1501 | .tx_fifomask = S3C2440_UFSTAT_TXMASK, | ||
1502 | .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT, | ||
1503 | .def_clk_sel = S3C2410_UCON_CLKSEL2, | ||
1504 | .num_clks = 4, | ||
1505 | .clksel_mask = S3C2412_UCON_CLKMASK, | ||
1506 | .clksel_shift = S3C2412_UCON_CLKSHIFT, | ||
1507 | }, | ||
1508 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1509 | .ucon = S3C2410_UCON_DEFAULT, | ||
1510 | .ufcon = S3C2410_UFCON_DEFAULT, | ||
1511 | }, | ||
1512 | }; | ||
1513 | #define S3C2440_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c2440_serial_drv_data) | ||
1514 | #else | ||
1515 | #define S3C2440_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1516 | #endif | ||
1514 | 1517 | ||
1515 | dbg("s3c24xx_serial_initconsole\n"); | 1518 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) || \ |
1519 | defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) || \ | ||
1520 | defined(CONFIG_CPU_S5PC100) | ||
1521 | static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { | ||
1522 | .info = &(struct s3c24xx_uart_info) { | ||
1523 | .name = "Samsung S3C6400 UART", | ||
1524 | .type = PORT_S3C6400, | ||
1525 | .fifosize = 64, | ||
1526 | .has_divslot = 1, | ||
1527 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, | ||
1528 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, | ||
1529 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, | ||
1530 | .tx_fifofull = S3C2440_UFSTAT_TXFULL, | ||
1531 | .tx_fifomask = S3C2440_UFSTAT_TXMASK, | ||
1532 | .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT, | ||
1533 | .def_clk_sel = S3C2410_UCON_CLKSEL2, | ||
1534 | .num_clks = 4, | ||
1535 | .clksel_mask = S3C6400_UCON_CLKMASK, | ||
1536 | .clksel_shift = S3C6400_UCON_CLKSHIFT, | ||
1537 | }, | ||
1538 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1539 | .ucon = S3C2410_UCON_DEFAULT, | ||
1540 | .ufcon = S3C2410_UFCON_DEFAULT, | ||
1541 | }, | ||
1542 | }; | ||
1543 | #define S3C6400_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c6400_serial_drv_data) | ||
1544 | #else | ||
1545 | #define S3C6400_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1546 | #endif | ||
1516 | 1547 | ||
1517 | /* select driver based on the cpu */ | 1548 | #ifdef CONFIG_CPU_S5PV210 |
1549 | static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { | ||
1550 | .info = &(struct s3c24xx_uart_info) { | ||
1551 | .name = "Samsung S5PV210 UART", | ||
1552 | .type = PORT_S3C6400, | ||
1553 | .has_divslot = 1, | ||
1554 | .rx_fifomask = S5PV210_UFSTAT_RXMASK, | ||
1555 | .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, | ||
1556 | .rx_fifofull = S5PV210_UFSTAT_RXFULL, | ||
1557 | .tx_fifofull = S5PV210_UFSTAT_TXFULL, | ||
1558 | .tx_fifomask = S5PV210_UFSTAT_TXMASK, | ||
1559 | .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, | ||
1560 | .def_clk_sel = S3C2410_UCON_CLKSEL0, | ||
1561 | .num_clks = 2, | ||
1562 | .clksel_mask = S5PV210_UCON_CLKMASK, | ||
1563 | .clksel_shift = S5PV210_UCON_CLKSHIFT, | ||
1564 | }, | ||
1565 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1566 | .ucon = S5PV210_UCON_DEFAULT, | ||
1567 | .ufcon = S5PV210_UFCON_DEFAULT, | ||
1568 | }, | ||
1569 | .fifosize = { 256, 64, 16, 16 }, | ||
1570 | }; | ||
1571 | #define S5PV210_SERIAL_DRV_DATA ((kernel_ulong_t)&s5pv210_serial_drv_data) | ||
1572 | #else | ||
1573 | #define S5PV210_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1574 | #endif | ||
1518 | 1575 | ||
1519 | if (dev == NULL) { | 1576 | #ifdef CONFIG_CPU_EXYNOS4210 |
1520 | printk(KERN_ERR "s3c24xx: no devices for console init\n"); | 1577 | static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = { |
1521 | return 0; | 1578 | .info = &(struct s3c24xx_uart_info) { |
1522 | } | 1579 | .name = "Samsung Exynos4 UART", |
1580 | .type = PORT_S3C6400, | ||
1581 | .has_divslot = 1, | ||
1582 | .rx_fifomask = S5PV210_UFSTAT_RXMASK, | ||
1583 | .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, | ||
1584 | .rx_fifofull = S5PV210_UFSTAT_RXFULL, | ||
1585 | .tx_fifofull = S5PV210_UFSTAT_TXFULL, | ||
1586 | .tx_fifomask = S5PV210_UFSTAT_TXMASK, | ||
1587 | .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, | ||
1588 | .def_clk_sel = S3C2410_UCON_CLKSEL0, | ||
1589 | .num_clks = 1, | ||
1590 | .clksel_mask = 0, | ||
1591 | .clksel_shift = 0, | ||
1592 | }, | ||
1593 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1594 | .ucon = S5PV210_UCON_DEFAULT, | ||
1595 | .ufcon = S5PV210_UFCON_DEFAULT, | ||
1596 | .has_fracval = 1, | ||
1597 | }, | ||
1598 | .fifosize = { 256, 64, 16, 16 }, | ||
1599 | }; | ||
1600 | #define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos4210_serial_drv_data) | ||
1601 | #else | ||
1602 | #define EXYNOS4210_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1603 | #endif | ||
1523 | 1604 | ||
1524 | if (strcmp(dev->name, drv->driver.name) != 0) | 1605 | static struct platform_device_id s3c24xx_serial_driver_ids[] = { |
1525 | return 0; | 1606 | { |
1607 | .name = "s3c2410-uart", | ||
1608 | .driver_data = S3C2410_SERIAL_DRV_DATA, | ||
1609 | }, { | ||
1610 | .name = "s3c2412-uart", | ||
1611 | .driver_data = S3C2412_SERIAL_DRV_DATA, | ||
1612 | }, { | ||
1613 | .name = "s3c2440-uart", | ||
1614 | .driver_data = S3C2440_SERIAL_DRV_DATA, | ||
1615 | }, { | ||
1616 | .name = "s3c6400-uart", | ||
1617 | .driver_data = S3C6400_SERIAL_DRV_DATA, | ||
1618 | }, { | ||
1619 | .name = "s5pv210-uart", | ||
1620 | .driver_data = S5PV210_SERIAL_DRV_DATA, | ||
1621 | }, { | ||
1622 | .name = "exynos4210-uart", | ||
1623 | .driver_data = EXYNOS4210_SERIAL_DRV_DATA, | ||
1624 | }, | ||
1625 | { }, | ||
1626 | }; | ||
1627 | MODULE_DEVICE_TABLE(platform, s3c24xx_serial_driver_ids); | ||
1628 | |||
1629 | static struct platform_driver samsung_serial_driver = { | ||
1630 | .probe = s3c24xx_serial_probe, | ||
1631 | .remove = __devexit_p(s3c24xx_serial_remove), | ||
1632 | .id_table = s3c24xx_serial_driver_ids, | ||
1633 | .driver = { | ||
1634 | .name = "samsung-uart", | ||
1635 | .owner = THIS_MODULE, | ||
1636 | .pm = SERIAL_SAMSUNG_PM_OPS, | ||
1637 | }, | ||
1638 | }; | ||
1526 | 1639 | ||
1527 | s3c24xx_serial_console.data = &s3c24xx_uart_drv; | 1640 | /* module initialisation code */ |
1528 | s3c24xx_serial_init_ports(info); | ||
1529 | 1641 | ||
1530 | register_console(&s3c24xx_serial_console); | 1642 | static int __init s3c24xx_serial_modinit(void) |
1531 | return 0; | 1643 | { |
1644 | int ret; | ||
1645 | |||
1646 | ret = uart_register_driver(&s3c24xx_uart_drv); | ||
1647 | if (ret < 0) { | ||
1648 | printk(KERN_ERR "failed to register UART driver\n"); | ||
1649 | return -1; | ||
1650 | } | ||
1651 | |||
1652 | return platform_driver_register(&samsung_serial_driver); | ||
1532 | } | 1653 | } |
1533 | 1654 | ||
1534 | #endif /* CONFIG_SERIAL_SAMSUNG_CONSOLE */ | 1655 | static void __exit s3c24xx_serial_modexit(void) |
1656 | { | ||
1657 | uart_unregister_driver(&s3c24xx_uart_drv); | ||
1658 | } | ||
1659 | |||
1660 | module_init(s3c24xx_serial_modinit); | ||
1661 | module_exit(s3c24xx_serial_modexit); | ||
1535 | 1662 | ||
1663 | MODULE_ALIAS("platform:samsung-uart"); | ||
1536 | MODULE_DESCRIPTION("Samsung SoC Serial port driver"); | 1664 | MODULE_DESCRIPTION("Samsung SoC Serial port driver"); |
1537 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | 1665 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
1538 | MODULE_LICENSE("GPL v2"); | 1666 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/tty/serial/samsung.h b/drivers/tty/serial/samsung.h index c9cab2c5ae0d..1a4bca3e4179 100644 --- a/drivers/tty/serial/samsung.h +++ b/drivers/tty/serial/samsung.h | |||
@@ -32,6 +32,12 @@ struct s3c24xx_uart_info { | |||
32 | int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *); | 32 | int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *); |
33 | }; | 33 | }; |
34 | 34 | ||
35 | struct s3c24xx_serial_drv_data { | ||
36 | struct s3c24xx_uart_info *info; | ||
37 | struct s3c2410_uartcfg *def_cfg; | ||
38 | unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; | ||
39 | }; | ||
40 | |||
35 | struct s3c24xx_uart_port { | 41 | struct s3c24xx_uart_port { |
36 | unsigned char rx_claimed; | 42 | unsigned char rx_claimed; |
37 | unsigned char tx_claimed; | 43 | unsigned char tx_claimed; |
@@ -45,6 +51,7 @@ struct s3c24xx_uart_port { | |||
45 | struct clk *clk; | 51 | struct clk *clk; |
46 | struct clk *baudclk; | 52 | struct clk *baudclk; |
47 | struct uart_port port; | 53 | struct uart_port port; |
54 | struct s3c24xx_serial_drv_data *drv_data; | ||
48 | 55 | ||
49 | /* reference to platform data */ | 56 | /* reference to platform data */ |
50 | struct s3c2410_uartcfg *cfg; | 57 | struct s3c2410_uartcfg *cfg; |
@@ -69,17 +76,6 @@ struct s3c24xx_uart_port { | |||
69 | #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg)) | 76 | #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg)) |
70 | #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg)) | 77 | #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg)) |
71 | 78 | ||
72 | extern int s3c24xx_serial_probe(struct platform_device *dev, | ||
73 | struct s3c24xx_uart_info *uart); | ||
74 | |||
75 | extern int __devexit s3c24xx_serial_remove(struct platform_device *dev); | ||
76 | |||
77 | extern int s3c24xx_serial_initconsole(struct platform_driver *drv, | ||
78 | struct s3c24xx_uart_info **uart); | ||
79 | |||
80 | extern int s3c24xx_serial_init(struct platform_driver *drv, | ||
81 | struct s3c24xx_uart_info *info); | ||
82 | |||
83 | #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG | 79 | #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG |
84 | 80 | ||
85 | extern void printascii(const char *); | 81 | extern void printascii(const char *); |