diff options
93 files changed, 1583 insertions, 1048 deletions
diff --git a/Documentation/ABI/testing/sysfs-tty b/Documentation/ABI/testing/sysfs-tty index ad22fb0ee765..9eb3c2b6b040 100644 --- a/Documentation/ABI/testing/sysfs-tty +++ b/Documentation/ABI/testing/sysfs-tty | |||
| @@ -138,3 +138,19 @@ Description: | |||
| 138 | 138 | ||
| 139 | These sysfs values expose the TIOCGSERIAL interface via | 139 | These sysfs values expose the TIOCGSERIAL interface via |
| 140 | sysfs rather than via ioctls. | 140 | sysfs rather than via ioctls. |
| 141 | |||
| 142 | What: /sys/class/tty/ttyS0/rx_trig_bytes | ||
| 143 | Date: May 2014 | ||
| 144 | Contact: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> | ||
| 145 | Description: | ||
| 146 | Shows current RX interrupt trigger bytes or sets the | ||
| 147 | user specified value to change it for the FIFO buffer. | ||
| 148 | Users can show or set this value regardless of opening the | ||
| 149 | serial device file or not. | ||
| 150 | |||
| 151 | The RX trigger can be set one of four kinds of values for UART | ||
| 152 | serials. When users input a meaning less value to this I/F, | ||
| 153 | the RX trigger is changed to the nearest lower value for the | ||
| 154 | device specification. For example, when user sets 7bytes on | ||
| 155 | 16550A, which has 1/4/8/14 bytes trigger, the RX trigger is | ||
| 156 | automatically changed to 4 bytes. | ||
diff --git a/Documentation/devicetree/bindings/serial/efm32-uart.txt b/Documentation/devicetree/bindings/serial/efm32-uart.txt index 3ca01336b837..8adbab268ca3 100644 --- a/Documentation/devicetree/bindings/serial/efm32-uart.txt +++ b/Documentation/devicetree/bindings/serial/efm32-uart.txt | |||
| @@ -6,7 +6,7 @@ Required properties: | |||
| 6 | - interrupts : Should contain uart interrupt | 6 | - interrupts : Should contain uart interrupt |
| 7 | 7 | ||
| 8 | Optional properties: | 8 | Optional properties: |
| 9 | - efm32,location : Decides the location of the USART I/O pins. | 9 | - energymicro,location : Decides the location of the USART I/O pins. |
| 10 | Allowed range : [0 .. 5] | 10 | Allowed range : [0 .. 5] |
| 11 | Default: 0 | 11 | Default: 0 |
| 12 | 12 | ||
| @@ -16,5 +16,5 @@ uart@0x4000c400 { | |||
| 16 | compatible = "energymicro,efm32-uart"; | 16 | compatible = "energymicro,efm32-uart"; |
| 17 | reg = <0x4000c400 0x400>; | 17 | reg = <0x4000c400 0x400>; |
| 18 | interrupts = <15>; | 18 | interrupts = <15>; |
| 19 | efm32,location = <0>; | 19 | energymicro,location = <0>; |
| 20 | }; | 20 | }; |
diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt index a1d1205d8185..c95005efbcb8 100644 --- a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt +++ b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | * Freescale low power universal asynchronous receiver/transmitter (lpuart) | 1 | * Freescale low power universal asynchronous receiver/transmitter (lpuart) |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible : Should be "fsl,<soc>-lpuart" | 4 | - compatible : |
| 5 | - "fsl,vf610-lpuart" for lpuart compatible with the one integrated | ||
| 6 | on Vybrid vf610 SoC with 8-bit register organization | ||
| 7 | - "fsl,ls1021a-lpuart" for lpuart compatible with the one integrated | ||
| 8 | on LS1021A SoC with 32-bit big-endian register organization | ||
| 5 | - reg : Address and length of the register set for the device | 9 | - reg : Address and length of the register set for the device |
| 6 | - interrupts : Should contain uart interrupt | 10 | - interrupts : Should contain uart interrupt |
| 7 | - clocks : phandle + clock specifier pairs, one for each entry in clock-names | 11 | - clocks : phandle + clock specifier pairs, one for each entry in clock-names |
diff --git a/Documentation/devicetree/bindings/serial/samsung_uart.txt b/Documentation/devicetree/bindings/serial/samsung_uart.txt index 2c8a17cf5cb5..e85f37ec33f0 100644 --- a/Documentation/devicetree/bindings/serial/samsung_uart.txt +++ b/Documentation/devicetree/bindings/serial/samsung_uart.txt | |||
| @@ -1,14 +1,58 @@ | |||
| 1 | * Samsung's UART Controller | 1 | * Samsung's UART Controller |
| 2 | 2 | ||
| 3 | The Samsung's UART controller is used for interfacing SoC with serial communicaion | 3 | The Samsung's UART controller is used for interfacing SoC with serial |
| 4 | devices. | 4 | communicaion devices. |
| 5 | 5 | ||
| 6 | Required properties: | 6 | Required properties: |
| 7 | - compatible: should be | 7 | - compatible: should be one of following: |
| 8 | - "samsung,exynos4210-uart", for UART's compatible with Exynos4210 uart ports. | 8 | - "samsung,exynos4210-uart" - Exynos4210 SoC, |
| 9 | - "samsung,s3c2410-uart" - compatible with ports present on S3C2410 SoC, | ||
| 10 | - "samsung,s3c2412-uart" - compatible with ports present on S3C2412 SoC, | ||
| 11 | - "samsung,s3c2440-uart" - compatible with ports present on S3C2440 SoC, | ||
| 12 | - "samsung,s3c6400-uart" - compatible with ports present on S3C6400 SoC, | ||
| 13 | - "samsung,s5pv210-uart" - compatible with ports present on S5PV210 SoC. | ||
| 9 | 14 | ||
| 10 | - reg: base physical address of the controller and length of memory mapped | 15 | - reg: base physical address of the controller and length of memory mapped |
| 11 | region. | 16 | region. |
| 12 | 17 | ||
| 13 | - interrupts: interrupt number to the cpu. The interrupt specifier format depends | 18 | - interrupts: a single interrupt signal to SoC interrupt controller, |
| 14 | on the interrupt controller parent. | 19 | according to interrupt bindings documentation [1]. |
| 20 | |||
| 21 | - clock-names: input names of clocks used by the controller: | ||
| 22 | - "uart" - controller bus clock, | ||
| 23 | - "clk_uart_baudN" - Nth baud base clock input (N = 0, 1, ...), | ||
| 24 | according to SoC User's Manual (only N = 0 is allowedfor SoCs without | ||
| 25 | internal baud clock mux). | ||
| 26 | - clocks: phandles and specifiers for all clocks specified in "clock-names" | ||
| 27 | property, in the same order, according to clock bindings documentation [2]. | ||
| 28 | |||
| 29 | [1] Documentation/devicetree/bindings/interrupt-controller/interrupts.txt | ||
| 30 | [2] Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
| 31 | |||
| 32 | Optional properties: | ||
| 33 | - samsung,uart-fifosize: The fifo size supported by the UART channel | ||
| 34 | |||
| 35 | Note: Each Samsung UART should have an alias correctly numbered in the | ||
| 36 | "aliases" node, according to serialN format, where N is the port number | ||
| 37 | (non-negative decimal integer) as specified by User's Manual of respective | ||
| 38 | SoC. | ||
| 39 | |||
| 40 | Example: | ||
| 41 | aliases { | ||
| 42 | serial0 = &uart0; | ||
| 43 | serial1 = &uart1; | ||
| 44 | serial2 = &uart2; | ||
| 45 | }; | ||
| 46 | |||
| 47 | Example: | ||
| 48 | uart1: serial@7f005400 { | ||
| 49 | compatible = "samsung,s3c6400-uart"; | ||
| 50 | reg = <0x7f005400 0x100>; | ||
| 51 | interrupt-parent = <&vic1>; | ||
| 52 | interrupts = <6>; | ||
| 53 | clock-names = "uart", "clk_uart_baud2", | ||
| 54 | "clk_uart_baud3"; | ||
| 55 | clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>, | ||
| 56 | <&clocks SCLK_UART>; | ||
| 57 | samsung,uart-fifosize = <16>; | ||
| 58 | }; | ||
diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt index f13f1c5be91c..7f76214f728a 100644 --- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt +++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt | |||
| @@ -4,9 +4,18 @@ Required properties: | |||
| 4 | - compatible : "snps,dw-apb-uart" | 4 | - compatible : "snps,dw-apb-uart" |
| 5 | - reg : offset and length of the register set for the device. | 5 | - reg : offset and length of the register set for the device. |
| 6 | - interrupts : should contain uart interrupt. | 6 | - interrupts : should contain uart interrupt. |
| 7 | |||
| 8 | Clock handling: | ||
| 9 | The clock rate of the input clock needs to be supplied by one of | ||
| 7 | - clock-frequency : the input clock frequency for the UART. | 10 | - clock-frequency : the input clock frequency for the UART. |
| 11 | - clocks : phandle to the input clock | ||
| 12 | |||
| 13 | The supplying peripheral clock can also be handled, needing a second property | ||
| 14 | - clock-names: tuple listing input clock names. | ||
| 15 | Required elements: "baudclk", "apb_pclk" | ||
| 8 | 16 | ||
| 9 | Optional properties: | 17 | Optional properties: |
| 18 | - resets : phandle to the parent reset controller. | ||
| 10 | - reg-shift : quantity to shift the register offsets by. If this property is | 19 | - reg-shift : quantity to shift the register offsets by. If this property is |
| 11 | not present then the register offsets are not shifted. | 20 | not present then the register offsets are not shifted. |
| 12 | - reg-io-width : the size (in bytes) of the IO accesses that should be | 21 | - reg-io-width : the size (in bytes) of the IO accesses that should be |
| @@ -23,3 +32,26 @@ Example: | |||
| 23 | reg-shift = <2>; | 32 | reg-shift = <2>; |
| 24 | reg-io-width = <4>; | 33 | reg-io-width = <4>; |
| 25 | }; | 34 | }; |
| 35 | |||
| 36 | Example with one clock: | ||
| 37 | |||
| 38 | uart@80230000 { | ||
| 39 | compatible = "snps,dw-apb-uart"; | ||
| 40 | reg = <0x80230000 0x100>; | ||
| 41 | clocks = <&baudclk>; | ||
| 42 | interrupts = <10>; | ||
| 43 | reg-shift = <2>; | ||
| 44 | reg-io-width = <4>; | ||
| 45 | }; | ||
| 46 | |||
| 47 | Example with two clocks: | ||
| 48 | |||
| 49 | uart@80230000 { | ||
| 50 | compatible = "snps,dw-apb-uart"; | ||
| 51 | reg = <0x80230000 0x100>; | ||
| 52 | clocks = <&baudclk>, <&apb_pclk>; | ||
| 53 | clock-names = "baudclk", "apb_pclk"; | ||
| 54 | interrupts = <10>; | ||
| 55 | reg-shift = <2>; | ||
| 56 | reg-io-width = <4>; | ||
| 57 | }; | ||
diff --git a/arch/arc/boot/dts/angel4.dts b/arch/arc/boot/dts/angel4.dts index 5bb2fdaca02f..6b57475967a6 100644 --- a/arch/arc/boot/dts/angel4.dts +++ b/arch/arc/boot/dts/angel4.dts | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | interrupt-parent = <&intc>; | 17 | interrupt-parent = <&intc>; |
| 18 | 18 | ||
| 19 | chosen { | 19 | chosen { |
| 20 | bootargs = "console=ttyARC0,115200n8 earlyprintk=ttyARC0"; | 20 | bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 console=ttyARC0,115200n8"; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | aliases { | 23 | aliases { |
diff --git a/arch/arc/plat-arcfpga/Kconfig b/arch/arc/plat-arcfpga/Kconfig index e27bb5cc3c1e..b9f34cf55acf 100644 --- a/arch/arc/plat-arcfpga/Kconfig +++ b/arch/arc/plat-arcfpga/Kconfig | |||
| @@ -41,11 +41,4 @@ config ISS_SMP_EXTN | |||
| 41 | -XTL (To enable CPU start/stop/set-PC for another CPU) | 41 | -XTL (To enable CPU start/stop/set-PC for another CPU) |
| 42 | It doesn't provide coherent Caches and/or Atomic Ops (LLOCK/SCOND) | 42 | It doesn't provide coherent Caches and/or Atomic Ops (LLOCK/SCOND) |
| 43 | 43 | ||
| 44 | config ARC_SERIAL_BAUD | ||
| 45 | int "UART Baud rate" | ||
| 46 | default "115200" | ||
| 47 | depends on SERIAL_ARC || SERIAL_ARC_CONSOLE | ||
| 48 | help | ||
| 49 | Baud rate for the ARC UART | ||
| 50 | |||
| 51 | endif | 44 | endif |
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c index 61c7e5997387..b8d0d456627f 100644 --- a/arch/arc/plat-arcfpga/platform.c +++ b/arch/arc/plat-arcfpga/platform.c | |||
| @@ -22,115 +22,22 @@ | |||
| 22 | #include <plat/smp.h> | 22 | #include <plat/smp.h> |
| 23 | #include <plat/irq.h> | 23 | #include <plat/irq.h> |
| 24 | 24 | ||
| 25 | /*----------------------- Platform Devices -----------------------------*/ | ||
| 26 | |||
| 27 | #if IS_ENABLED(CONFIG_SERIAL_ARC) | ||
| 28 | static unsigned long arc_uart_info[] = { | ||
| 29 | 0, /* uart->is_emulated (runtime @running_on_hw) */ | ||
| 30 | 0, /* uart->port.uartclk */ | ||
| 31 | 0, /* uart->baud */ | ||
| 32 | 0 | ||
| 33 | }; | ||
| 34 | |||
| 35 | #if defined(CONFIG_SERIAL_ARC_CONSOLE) | ||
| 36 | /* | ||
| 37 | * static platform data - but only for early serial | ||
| 38 | * TBD: derive this from a special DT node | ||
| 39 | */ | ||
| 40 | static struct resource arc_uart0_res[] = { | ||
| 41 | { | ||
| 42 | .start = UART0_BASE, | ||
| 43 | .end = UART0_BASE + 0xFF, | ||
| 44 | .flags = IORESOURCE_MEM, | ||
| 45 | }, | ||
| 46 | { | ||
| 47 | .start = UART0_IRQ, | ||
| 48 | .end = UART0_IRQ, | ||
| 49 | .flags = IORESOURCE_IRQ, | ||
| 50 | }, | ||
| 51 | }; | ||
| 52 | |||
| 53 | static struct platform_device arc_uart0_dev = { | ||
| 54 | .name = "arc-uart", | ||
| 55 | .id = 0, | ||
| 56 | .num_resources = ARRAY_SIZE(arc_uart0_res), | ||
| 57 | .resource = arc_uart0_res, | ||
| 58 | .dev = { | ||
| 59 | .platform_data = &arc_uart_info, | ||
| 60 | }, | ||
| 61 | }; | ||
| 62 | |||
| 63 | static struct platform_device *fpga_early_devs[] __initdata = { | ||
| 64 | &arc_uart0_dev, | ||
| 65 | }; | ||
| 66 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ | ||
| 67 | |||
| 68 | static void arc_fpga_serial_init(void) | ||
| 69 | { | ||
| 70 | /* To let driver workaround ISS bug: baudh Reg can't be set to 0 */ | ||
| 71 | arc_uart_info[0] = !running_on_hw; | ||
| 72 | |||
| 73 | arc_uart_info[1] = arc_get_core_freq(); | ||
| 74 | |||
| 75 | arc_uart_info[2] = CONFIG_ARC_SERIAL_BAUD; | ||
| 76 | |||
| 77 | #if defined(CONFIG_SERIAL_ARC_CONSOLE) | ||
| 78 | early_platform_add_devices(fpga_early_devs, | ||
| 79 | ARRAY_SIZE(fpga_early_devs)); | ||
| 80 | |||
| 81 | /* | ||
| 82 | * ARC console driver registers (build time) as an early platform driver | ||
| 83 | * of class "earlyprintk". However it needs explicit cmdline toggle | ||
| 84 | * "earlyprintk=ttyARC0" to be successfuly runtime registered. | ||
| 85 | * Otherwise the early probe below fails to find the driver | ||
| 86 | */ | ||
| 87 | early_platform_driver_probe("earlyprintk", 1, 0); | ||
| 88 | |||
| 89 | /* | ||
| 90 | * This is to make sure that arc uart would be preferred console | ||
| 91 | * despite one/more of following: | ||
| 92 | * -command line lacked "console=ttyARC0" or | ||
| 93 | * -CONFIG_VT_CONSOLE was enabled (for no reason whatsoever) | ||
| 94 | * Note that this needs to be done after above early console is reg, | ||
| 95 | * otherwise the early console never gets a chance to run. | ||
| 96 | */ | ||
| 97 | add_preferred_console("ttyARC", 0, "115200"); | ||
| 98 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ | ||
| 99 | } | ||
| 100 | #else /* !IS_ENABLED(CONFIG_SERIAL_ARC) */ | ||
| 101 | static void arc_fpga_serial_init(void) | ||
| 102 | { | ||
| 103 | } | ||
| 104 | #endif | ||
| 105 | |||
| 106 | static void __init plat_fpga_early_init(void) | 25 | static void __init plat_fpga_early_init(void) |
| 107 | { | 26 | { |
| 108 | pr_info("[plat-arcfpga]: registering early dev resources\n"); | 27 | pr_info("[plat-arcfpga]: registering early dev resources\n"); |
| 109 | 28 | ||
| 110 | arc_fpga_serial_init(); | ||
| 111 | |||
| 112 | #ifdef CONFIG_ISS_SMP_EXTN | 29 | #ifdef CONFIG_ISS_SMP_EXTN |
| 113 | iss_model_init_early_smp(); | 30 | iss_model_init_early_smp(); |
| 114 | #endif | 31 | #endif |
| 115 | } | 32 | } |
| 116 | 33 | ||
| 117 | static struct of_dev_auxdata plat_auxdata_lookup[] __initdata = { | ||
| 118 | #if IS_ENABLED(CONFIG_SERIAL_ARC) | ||
| 119 | OF_DEV_AUXDATA("snps,arc-uart", UART0_BASE, "arc-uart", arc_uart_info), | ||
| 120 | #endif | ||
| 121 | {} | ||
| 122 | }; | ||
| 123 | |||
| 124 | static void __init plat_fpga_populate_dev(void) | 34 | static void __init plat_fpga_populate_dev(void) |
| 125 | { | 35 | { |
| 126 | pr_info("[plat-arcfpga]: registering device resources\n"); | ||
| 127 | |||
| 128 | /* | 36 | /* |
| 129 | * Traverses flattened DeviceTree - registering platform devices | 37 | * Traverses flattened DeviceTree - registering platform devices |
| 130 | * complete with their resources | 38 | * (if any) complete with their resources |
| 131 | */ | 39 | */ |
| 132 | of_platform_populate(NULL, of_default_bus_match_table, | 40 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 133 | plat_auxdata_lookup, NULL); | ||
| 134 | } | 41 | } |
| 135 | 42 | ||
| 136 | /*----------------------- Machine Descriptions ------------------------------ | 43 | /*----------------------- Machine Descriptions ------------------------------ |
diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi index aaaac7981200..94d59983fc2d 100644 --- a/arch/arm/boot/dts/exynos3250.dtsi +++ b/arch/arm/boot/dts/exynos3250.dtsi | |||
| @@ -39,6 +39,8 @@ | |||
| 39 | i2c5 = &i2c_5; | 39 | i2c5 = &i2c_5; |
| 40 | i2c6 = &i2c_6; | 40 | i2c6 = &i2c_6; |
| 41 | i2c7 = &i2c_7; | 41 | i2c7 = &i2c_7; |
| 42 | serial0 = &serial_0; | ||
| 43 | serial1 = &serial_1; | ||
| 42 | }; | 44 | }; |
| 43 | 45 | ||
| 44 | cpus { | 46 | cpus { |
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index 17b22e9cc2aa..93bcc1fe8a4e 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi | |||
| @@ -44,6 +44,10 @@ | |||
| 44 | fimc1 = &fimc_1; | 44 | fimc1 = &fimc_1; |
| 45 | fimc2 = &fimc_2; | 45 | fimc2 = &fimc_2; |
| 46 | fimc3 = &fimc_3; | 46 | fimc3 = &fimc_3; |
| 47 | serial0 = &serial_0; | ||
| 48 | serial1 = &serial_1; | ||
| 49 | serial2 = &serial_2; | ||
| 50 | serial3 = &serial_3; | ||
| 47 | }; | 51 | }; |
| 48 | 52 | ||
| 49 | clock_audss: clock-controller@03810000 { | 53 | clock_audss: clock-controller@03810000 { |
| @@ -363,7 +367,7 @@ | |||
| 363 | status = "disabled"; | 367 | status = "disabled"; |
| 364 | }; | 368 | }; |
| 365 | 369 | ||
| 366 | serial@13800000 { | 370 | serial_0: serial@13800000 { |
| 367 | compatible = "samsung,exynos4210-uart"; | 371 | compatible = "samsung,exynos4210-uart"; |
| 368 | reg = <0x13800000 0x100>; | 372 | reg = <0x13800000 0x100>; |
| 369 | interrupts = <0 52 0>; | 373 | interrupts = <0 52 0>; |
| @@ -372,7 +376,7 @@ | |||
| 372 | status = "disabled"; | 376 | status = "disabled"; |
| 373 | }; | 377 | }; |
| 374 | 378 | ||
| 375 | serial@13810000 { | 379 | serial_1: serial@13810000 { |
| 376 | compatible = "samsung,exynos4210-uart"; | 380 | compatible = "samsung,exynos4210-uart"; |
| 377 | reg = <0x13810000 0x100>; | 381 | reg = <0x13810000 0x100>; |
| 378 | interrupts = <0 53 0>; | 382 | interrupts = <0 53 0>; |
| @@ -381,7 +385,7 @@ | |||
| 381 | status = "disabled"; | 385 | status = "disabled"; |
| 382 | }; | 386 | }; |
| 383 | 387 | ||
| 384 | serial@13820000 { | 388 | serial_2: serial@13820000 { |
| 385 | compatible = "samsung,exynos4210-uart"; | 389 | compatible = "samsung,exynos4210-uart"; |
| 386 | reg = <0x13820000 0x100>; | 390 | reg = <0x13820000 0x100>; |
| 387 | interrupts = <0 54 0>; | 391 | interrupts = <0 54 0>; |
| @@ -390,7 +394,7 @@ | |||
| 390 | status = "disabled"; | 394 | status = "disabled"; |
| 391 | }; | 395 | }; |
| 392 | 396 | ||
| 393 | serial@13830000 { | 397 | serial_3: serial@13830000 { |
| 394 | compatible = "samsung,exynos4210-uart"; | 398 | compatible = "samsung,exynos4210-uart"; |
| 395 | reg = <0x13830000 0x100>; | 399 | reg = <0x13830000 0x100>; |
| 396 | interrupts = <0 55 0>; | 400 | interrupts = <0 55 0>; |
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi index 79d0608d6dcc..ff2d2cb0f79e 100644 --- a/arch/arm/boot/dts/exynos5.dtsi +++ b/arch/arm/boot/dts/exynos5.dtsi | |||
| @@ -18,6 +18,13 @@ | |||
| 18 | / { | 18 | / { |
| 19 | interrupt-parent = <&gic>; | 19 | interrupt-parent = <&gic>; |
| 20 | 20 | ||
| 21 | aliases { | ||
| 22 | serial0 = &serial_0; | ||
| 23 | serial1 = &serial_1; | ||
| 24 | serial2 = &serial_2; | ||
| 25 | serial3 = &serial_3; | ||
| 26 | }; | ||
| 27 | |||
| 21 | chipid@10000000 { | 28 | chipid@10000000 { |
| 22 | compatible = "samsung,exynos4210-chipid"; | 29 | compatible = "samsung,exynos4210-chipid"; |
| 23 | reg = <0x10000000 0x100>; | 30 | reg = <0x10000000 0x100>; |
| @@ -50,25 +57,25 @@ | |||
| 50 | interrupts = <1 9 0xf04>; | 57 | interrupts = <1 9 0xf04>; |
| 51 | }; | 58 | }; |
| 52 | 59 | ||
| 53 | serial@12C00000 { | 60 | serial_0: serial@12C00000 { |
| 54 | compatible = "samsung,exynos4210-uart"; | 61 | compatible = "samsung,exynos4210-uart"; |
| 55 | reg = <0x12C00000 0x100>; | 62 | reg = <0x12C00000 0x100>; |
| 56 | interrupts = <0 51 0>; | 63 | interrupts = <0 51 0>; |
| 57 | }; | 64 | }; |
| 58 | 65 | ||
| 59 | serial@12C10000 { | 66 | serial_1: serial@12C10000 { |
| 60 | compatible = "samsung,exynos4210-uart"; | 67 | compatible = "samsung,exynos4210-uart"; |
| 61 | reg = <0x12C10000 0x100>; | 68 | reg = <0x12C10000 0x100>; |
| 62 | interrupts = <0 52 0>; | 69 | interrupts = <0 52 0>; |
| 63 | }; | 70 | }; |
| 64 | 71 | ||
| 65 | serial@12C20000 { | 72 | serial_2: serial@12C20000 { |
| 66 | compatible = "samsung,exynos4210-uart"; | 73 | compatible = "samsung,exynos4210-uart"; |
| 67 | reg = <0x12C20000 0x100>; | 74 | reg = <0x12C20000 0x100>; |
| 68 | interrupts = <0 53 0>; | 75 | interrupts = <0 53 0>; |
| 69 | }; | 76 | }; |
| 70 | 77 | ||
| 71 | serial@12C30000 { | 78 | serial_3: serial@12C30000 { |
| 72 | compatible = "samsung,exynos4210-uart"; | 79 | compatible = "samsung,exynos4210-uart"; |
| 73 | reg = <0x12C30000 0x100>; | 80 | reg = <0x12C30000 0x100>; |
| 74 | interrupts = <0 54 0>; | 81 | interrupts = <0 54 0>; |
diff --git a/arch/arm/boot/dts/exynos5260.dtsi b/arch/arm/boot/dts/exynos5260.dtsi index 5398a60207ca..4539a0ae714d 100644 --- a/arch/arm/boot/dts/exynos5260.dtsi +++ b/arch/arm/boot/dts/exynos5260.dtsi | |||
| @@ -21,6 +21,10 @@ | |||
| 21 | pinctrl0 = &pinctrl_0; | 21 | pinctrl0 = &pinctrl_0; |
| 22 | pinctrl1 = &pinctrl_1; | 22 | pinctrl1 = &pinctrl_1; |
| 23 | pinctrl2 = &pinctrl_2; | 23 | pinctrl2 = &pinctrl_2; |
| 24 | serial0 = &uart0; | ||
| 25 | serial1 = &uart1; | ||
| 26 | serial2 = &uart2; | ||
| 27 | serial3 = &uart3; | ||
| 24 | }; | 28 | }; |
| 25 | 29 | ||
| 26 | cpus { | 30 | cpus { |
diff --git a/arch/arm/boot/dts/exynos5410.dtsi b/arch/arm/boot/dts/exynos5410.dtsi index 3839c26f467f..52070e54589a 100644 --- a/arch/arm/boot/dts/exynos5410.dtsi +++ b/arch/arm/boot/dts/exynos5410.dtsi | |||
| @@ -20,6 +20,12 @@ | |||
| 20 | compatible = "samsung,exynos5410", "samsung,exynos5"; | 20 | compatible = "samsung,exynos5410", "samsung,exynos5"; |
| 21 | interrupt-parent = <&gic>; | 21 | interrupt-parent = <&gic>; |
| 22 | 22 | ||
| 23 | aliases { | ||
| 24 | serial0 = &uart0; | ||
| 25 | serial1 = &uart1; | ||
| 26 | serial2 = &uart2; | ||
| 27 | }; | ||
| 28 | |||
| 23 | cpus { | 29 | cpus { |
| 24 | #address-cells = <1>; | 30 | #address-cells = <1>; |
| 25 | #size-cells = <0>; | 31 | #size-cells = <0>; |
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi index ae3a17c791f6..8f3373cd7b87 100644 --- a/arch/arm/boot/dts/exynos5440.dtsi +++ b/arch/arm/boot/dts/exynos5440.dtsi | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | interrupt-parent = <&gic>; | 18 | interrupt-parent = <&gic>; |
| 19 | 19 | ||
| 20 | aliases { | 20 | aliases { |
| 21 | serial0 = &serial_0; | ||
| 22 | serial1 = &serial_1; | ||
| 21 | spi0 = &spi_0; | 23 | spi0 = &spi_0; |
| 22 | tmuctrl0 = &tmuctrl_0; | 24 | tmuctrl0 = &tmuctrl_0; |
| 23 | tmuctrl1 = &tmuctrl_1; | 25 | tmuctrl1 = &tmuctrl_1; |
| @@ -102,7 +104,7 @@ | |||
| 102 | >; | 104 | >; |
| 103 | }; | 105 | }; |
| 104 | 106 | ||
| 105 | serial@B0000 { | 107 | serial_0: serial@B0000 { |
| 106 | compatible = "samsung,exynos4210-uart"; | 108 | compatible = "samsung,exynos4210-uart"; |
| 107 | reg = <0xB0000 0x1000>; | 109 | reg = <0xB0000 0x1000>; |
| 108 | interrupts = <0 2 0>; | 110 | interrupts = <0 2 0>; |
| @@ -110,7 +112,7 @@ | |||
| 110 | clock-names = "uart", "clk_uart_baud0"; | 112 | clock-names = "uart", "clk_uart_baud0"; |
| 111 | }; | 113 | }; |
| 112 | 114 | ||
| 113 | serial@C0000 { | 115 | serial_1: serial@C0000 { |
| 114 | compatible = "samsung,exynos4210-uart"; | 116 | compatible = "samsung,exynos4210-uart"; |
| 115 | reg = <0xC0000 0x1000>; | 117 | reg = <0xC0000 0x1000>; |
| 116 | interrupts = <0 3 0>; | 118 | interrupts = <0 3 0>; |
diff --git a/arch/arm/boot/dts/s3c2416.dtsi b/arch/arm/boot/dts/s3c2416.dtsi index 955e4a4f8c31..30b8f7e47454 100644 --- a/arch/arm/boot/dts/s3c2416.dtsi +++ b/arch/arm/boot/dts/s3c2416.dtsi | |||
| @@ -16,6 +16,10 @@ | |||
| 16 | model = "Samsung S3C2416 SoC"; | 16 | model = "Samsung S3C2416 SoC"; |
| 17 | compatible = "samsung,s3c2416"; | 17 | compatible = "samsung,s3c2416"; |
| 18 | 18 | ||
| 19 | aliases { | ||
| 20 | serial3 = &uart3; | ||
| 21 | }; | ||
| 22 | |||
| 19 | cpus { | 23 | cpus { |
| 20 | #address-cells = <1>; | 24 | #address-cells = <1>; |
| 21 | #size-cells = <0>; | 25 | #size-cells = <0>; |
| @@ -68,7 +72,7 @@ | |||
| 68 | <&clocks SCLK_UART>; | 72 | <&clocks SCLK_UART>; |
| 69 | }; | 73 | }; |
| 70 | 74 | ||
| 71 | serial@5000C000 { | 75 | uart3: serial@5000C000 { |
| 72 | compatible = "samsung,s3c2440-uart"; | 76 | compatible = "samsung,s3c2440-uart"; |
| 73 | reg = <0x5000C000 0x4000>; | 77 | reg = <0x5000C000 0x4000>; |
| 74 | interrupts = <1 18 24 4>, <1 18 25 4>; | 78 | interrupts = <1 18 24 4>, <1 18 25 4>; |
diff --git a/arch/arm/boot/dts/s3c24xx.dtsi b/arch/arm/boot/dts/s3c24xx.dtsi index 2d1d7dc9418a..5ed43b857cc4 100644 --- a/arch/arm/boot/dts/s3c24xx.dtsi +++ b/arch/arm/boot/dts/s3c24xx.dtsi | |||
| @@ -16,6 +16,9 @@ | |||
| 16 | 16 | ||
| 17 | aliases { | 17 | aliases { |
| 18 | pinctrl0 = &pinctrl_0; | 18 | pinctrl0 = &pinctrl_0; |
| 19 | serial0 = &uart0; | ||
| 20 | serial1 = &uart1; | ||
| 21 | serial2 = &uart2; | ||
| 19 | }; | 22 | }; |
| 20 | 23 | ||
| 21 | intc:interrupt-controller@4a000000 { | 24 | intc:interrupt-controller@4a000000 { |
| @@ -46,21 +49,21 @@ | |||
| 46 | #pwm-cells = <4>; | 49 | #pwm-cells = <4>; |
| 47 | }; | 50 | }; |
| 48 | 51 | ||
| 49 | serial@50000000 { | 52 | uart0: serial@50000000 { |
| 50 | compatible = "samsung,s3c2410-uart"; | 53 | compatible = "samsung,s3c2410-uart"; |
| 51 | reg = <0x50000000 0x4000>; | 54 | reg = <0x50000000 0x4000>; |
| 52 | interrupts = <1 28 0 4>, <1 28 1 4>; | 55 | interrupts = <1 28 0 4>, <1 28 1 4>; |
| 53 | status = "disabled"; | 56 | status = "disabled"; |
| 54 | }; | 57 | }; |
| 55 | 58 | ||
| 56 | serial@50004000 { | 59 | uart1: serial@50004000 { |
| 57 | compatible = "samsung,s3c2410-uart"; | 60 | compatible = "samsung,s3c2410-uart"; |
| 58 | reg = <0x50004000 0x4000>; | 61 | reg = <0x50004000 0x4000>; |
| 59 | interrupts = <1 23 3 4>, <1 23 4 4>; | 62 | interrupts = <1 23 3 4>, <1 23 4 4>; |
| 60 | status = "disabled"; | 63 | status = "disabled"; |
| 61 | }; | 64 | }; |
| 62 | 65 | ||
| 63 | serial@50008000 { | 66 | uart2: serial@50008000 { |
| 64 | compatible = "samsung,s3c2410-uart"; | 67 | compatible = "samsung,s3c2410-uart"; |
| 65 | reg = <0x50008000 0x4000>; | 68 | reg = <0x50008000 0x4000>; |
| 66 | interrupts = <1 15 6 4>, <1 15 7 4>; | 69 | interrupts = <1 15 6 4>, <1 15 7 4>; |
diff --git a/arch/arm/boot/dts/s3c64xx.dtsi b/arch/arm/boot/dts/s3c64xx.dtsi index 4e3be4d3493d..ff5bdaac987a 100644 --- a/arch/arm/boot/dts/s3c64xx.dtsi +++ b/arch/arm/boot/dts/s3c64xx.dtsi | |||
| @@ -23,6 +23,10 @@ | |||
| 23 | aliases { | 23 | aliases { |
| 24 | i2c0 = &i2c0; | 24 | i2c0 = &i2c0; |
| 25 | pinctrl0 = &pinctrl0; | 25 | pinctrl0 = &pinctrl0; |
| 26 | serial0 = &uart0; | ||
| 27 | serial1 = &uart1; | ||
| 28 | serial2 = &uart2; | ||
| 29 | serial3 = &uart3; | ||
| 26 | }; | 30 | }; |
| 27 | 31 | ||
| 28 | cpus { | 32 | cpus { |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 8320abd1ef14..0ea9986059af 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
| @@ -2347,8 +2347,6 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp) | |||
| 2347 | printk("%s(%d):mgslpc_close(%s) entry, count=%d\n", | 2347 | printk("%s(%d):mgslpc_close(%s) entry, count=%d\n", |
| 2348 | __FILE__, __LINE__, info->device_name, port->count); | 2348 | __FILE__, __LINE__, info->device_name, port->count); |
| 2349 | 2349 | ||
| 2350 | WARN_ON(!port->count); | ||
| 2351 | |||
| 2352 | if (tty_port_close_start(port, tty, filp) == 0) | 2350 | if (tty_port_close_start(port, tty, filp) == 0) |
| 2353 | goto cleanup; | 2351 | goto cleanup; |
| 2354 | 2352 | ||
| @@ -2510,7 +2508,7 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp) | |||
| 2510 | __FILE__, __LINE__, tty->driver->name, port->count); | 2508 | __FILE__, __LINE__, tty->driver->name, port->count); |
| 2511 | 2509 | ||
| 2512 | /* If port is closing, signal caller to try again */ | 2510 | /* If port is closing, signal caller to try again */ |
| 2513 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING){ | 2511 | if (port->flags & ASYNC_CLOSING){ |
| 2514 | wait_event_interruptible_tty(tty, port->close_wait, | 2512 | wait_event_interruptible_tty(tty, port->close_wait, |
| 2515 | !(port->flags & ASYNC_CLOSING)); | 2513 | !(port->flags & ASYNC_CLOSING)); |
| 2516 | retval = ((port->flags & ASYNC_HUP_NOTIFY) ? | 2514 | retval = ((port->flags & ASYNC_HUP_NOTIFY) ? |
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index a57bb5ab761c..fd66f57390d0 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c | |||
| @@ -1579,7 +1579,7 @@ static int cy_open(struct tty_struct *tty, struct file *filp) | |||
| 1579 | /* | 1579 | /* |
| 1580 | * If the port is the middle of closing, bail out now | 1580 | * If the port is the middle of closing, bail out now |
| 1581 | */ | 1581 | */ |
| 1582 | if (tty_hung_up_p(filp) || (info->port.flags & ASYNC_CLOSING)) { | 1582 | if (info->port.flags & ASYNC_CLOSING) { |
| 1583 | wait_event_interruptible_tty(tty, info->port.close_wait, | 1583 | wait_event_interruptible_tty(tty, info->port.close_wait, |
| 1584 | !(info->port.flags & ASYNC_CLOSING)); | 1584 | !(info->port.flags & ASYNC_CLOSING)); |
| 1585 | return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; | 1585 | return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; |
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index 17ee3bf0926b..345cebb07ae7 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c | |||
| @@ -93,11 +93,6 @@ static int ipw_open(struct tty_struct *linux_tty, struct file *filp) | |||
| 93 | return -ENODEV; | 93 | return -ENODEV; |
| 94 | 94 | ||
| 95 | mutex_lock(&tty->ipw_tty_mutex); | 95 | mutex_lock(&tty->ipw_tty_mutex); |
| 96 | |||
| 97 | if (tty->closing) { | ||
| 98 | mutex_unlock(&tty->ipw_tty_mutex); | ||
| 99 | return -ENODEV; | ||
| 100 | } | ||
| 101 | if (tty->port.count == 0) | 96 | if (tty->port.count == 0) |
| 102 | tty->tx_bytes_queued = 0; | 97 | tty->tx_bytes_queued = 0; |
| 103 | 98 | ||
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 2ebe47b78a3e..152443ab1447 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
| @@ -2088,9 +2088,7 @@ static int gsm_activate_mux(struct gsm_mux *gsm) | |||
| 2088 | struct gsm_dlci *dlci; | 2088 | struct gsm_dlci *dlci; |
| 2089 | int i = 0; | 2089 | int i = 0; |
| 2090 | 2090 | ||
| 2091 | init_timer(&gsm->t2_timer); | 2091 | setup_timer(&gsm->t2_timer, gsm_control_retransmit, (unsigned long)gsm); |
| 2092 | gsm->t2_timer.function = gsm_control_retransmit; | ||
| 2093 | gsm->t2_timer.data = (unsigned long)gsm; | ||
| 2094 | init_waitqueue_head(&gsm->event); | 2092 | init_waitqueue_head(&gsm->event); |
| 2095 | spin_lock_init(&gsm->control_lock); | 2093 | spin_lock_init(&gsm->control_lock); |
| 2096 | spin_lock_init(&gsm->tx_lock); | 2094 | spin_lock_init(&gsm->tx_lock); |
| @@ -2230,8 +2228,7 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len) | |||
| 2230 | 2228 | ||
| 2231 | static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) | 2229 | static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) |
| 2232 | { | 2230 | { |
| 2233 | int ret, i; | 2231 | int ret, i, base; |
| 2234 | int base = gsm->num << 6; /* Base for this MUX */ | ||
| 2235 | 2232 | ||
| 2236 | gsm->tty = tty_kref_get(tty); | 2233 | gsm->tty = tty_kref_get(tty); |
| 2237 | gsm->output = gsmld_output; | 2234 | gsm->output = gsmld_output; |
| @@ -2241,6 +2238,7 @@ static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) | |||
| 2241 | else { | 2238 | else { |
| 2242 | /* Don't register device 0 - this is the control channel and not | 2239 | /* Don't register device 0 - this is the control channel and not |
| 2243 | a usable tty interface */ | 2240 | a usable tty interface */ |
| 2241 | base = gsm->num << 6; /* Base for this MUX */ | ||
| 2244 | for (i = 1; i < NUM_DLCI; i++) | 2242 | for (i = 1; i < NUM_DLCI; i++) |
| 2245 | tty_register_device(gsm_tty_driver, base + i, NULL); | 2243 | tty_register_device(gsm_tty_driver, base + i, NULL); |
| 2246 | } | 2244 | } |
| @@ -2368,6 +2366,7 @@ static void gsmld_close(struct tty_struct *tty) | |||
| 2368 | static int gsmld_open(struct tty_struct *tty) | 2366 | static int gsmld_open(struct tty_struct *tty) |
| 2369 | { | 2367 | { |
| 2370 | struct gsm_mux *gsm; | 2368 | struct gsm_mux *gsm; |
| 2369 | int ret; | ||
| 2371 | 2370 | ||
| 2372 | if (tty->ops->write == NULL) | 2371 | if (tty->ops->write == NULL) |
| 2373 | return -EINVAL; | 2372 | return -EINVAL; |
| @@ -2382,7 +2381,13 @@ static int gsmld_open(struct tty_struct *tty) | |||
| 2382 | 2381 | ||
| 2383 | /* Attach the initial passive connection */ | 2382 | /* Attach the initial passive connection */ |
| 2384 | gsm->encoding = 1; | 2383 | gsm->encoding = 1; |
| 2385 | return gsmld_attach_gsm(tty, gsm); | 2384 | |
| 2385 | ret = gsmld_attach_gsm(tty, gsm); | ||
| 2386 | if (ret != 0) { | ||
| 2387 | gsm_cleanup_mux(gsm); | ||
| 2388 | mux_put(gsm); | ||
| 2389 | } | ||
| 2390 | return ret; | ||
| 2386 | } | 2391 | } |
| 2387 | 2392 | ||
| 2388 | /** | 2393 | /** |
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 25c9bc783722..9bbdb1de12e2 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
| @@ -316,7 +316,7 @@ done: | |||
| 316 | * pty_common_install - set up the pty pair | 316 | * pty_common_install - set up the pty pair |
| 317 | * @driver: the pty driver | 317 | * @driver: the pty driver |
| 318 | * @tty: the tty being instantiated | 318 | * @tty: the tty being instantiated |
| 319 | * @bool: legacy, true if this is BSD style | 319 | * @legacy: true if this is BSD style |
| 320 | * | 320 | * |
| 321 | * Perform the initial set up for the tty/pty pair. Called from the | 321 | * Perform the initial set up for the tty/pty pair. Called from the |
| 322 | * tty layer when the port is first opened. | 322 | * tty layer when the port is first opened. |
| @@ -331,18 +331,17 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty, | |||
| 331 | int idx = tty->index; | 331 | int idx = tty->index; |
| 332 | int retval = -ENOMEM; | 332 | int retval = -ENOMEM; |
| 333 | 333 | ||
| 334 | o_tty = alloc_tty_struct(); | ||
| 335 | if (!o_tty) | ||
| 336 | goto err; | ||
| 337 | ports[0] = kmalloc(sizeof **ports, GFP_KERNEL); | 334 | ports[0] = kmalloc(sizeof **ports, GFP_KERNEL); |
| 338 | ports[1] = kmalloc(sizeof **ports, GFP_KERNEL); | 335 | ports[1] = kmalloc(sizeof **ports, GFP_KERNEL); |
| 339 | if (!ports[0] || !ports[1]) | 336 | if (!ports[0] || !ports[1]) |
| 340 | goto err_free_tty; | 337 | goto err; |
| 341 | if (!try_module_get(driver->other->owner)) { | 338 | if (!try_module_get(driver->other->owner)) { |
| 342 | /* This cannot in fact currently happen */ | 339 | /* This cannot in fact currently happen */ |
| 343 | goto err_free_tty; | 340 | goto err; |
| 344 | } | 341 | } |
| 345 | initialize_tty_struct(o_tty, driver->other, idx); | 342 | o_tty = alloc_tty_struct(driver->other, idx); |
| 343 | if (!o_tty) | ||
| 344 | goto err_put_module; | ||
| 346 | 345 | ||
| 347 | if (legacy) { | 346 | if (legacy) { |
| 348 | /* We always use new tty termios data so we can do this | 347 | /* We always use new tty termios data so we can do this |
| @@ -387,12 +386,12 @@ err_free_termios: | |||
| 387 | tty_free_termios(tty); | 386 | tty_free_termios(tty); |
| 388 | err_deinit_tty: | 387 | err_deinit_tty: |
| 389 | deinitialize_tty_struct(o_tty); | 388 | deinitialize_tty_struct(o_tty); |
| 390 | module_put(o_tty->driver->owner); | ||
| 391 | err_free_tty: | ||
| 392 | kfree(ports[0]); | ||
| 393 | kfree(ports[1]); | ||
| 394 | free_tty_struct(o_tty); | 389 | free_tty_struct(o_tty); |
| 390 | err_put_module: | ||
| 391 | module_put(driver->other->owner); | ||
| 395 | err: | 392 | err: |
| 393 | kfree(ports[0]); | ||
| 394 | kfree(ports[1]); | ||
| 396 | return retval; | 395 | return retval; |
| 397 | } | 396 | } |
| 398 | 397 | ||
diff --git a/drivers/tty/serial/21285.c b/drivers/tty/serial/21285.c index c7e8b60b6177..9b208bd686e6 100644 --- a/drivers/tty/serial/21285.c +++ b/drivers/tty/serial/21285.c | |||
| @@ -78,10 +78,6 @@ static void serial21285_stop_rx(struct uart_port *port) | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static void serial21285_enable_ms(struct uart_port *port) | ||
| 82 | { | ||
| 83 | } | ||
| 84 | |||
| 85 | static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) | 81 | static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) |
| 86 | { | 82 | { |
| 87 | struct uart_port *port = dev_id; | 83 | struct uart_port *port = dev_id; |
| @@ -345,7 +341,6 @@ static struct uart_ops serial21285_ops = { | |||
| 345 | .stop_tx = serial21285_stop_tx, | 341 | .stop_tx = serial21285_stop_tx, |
| 346 | .start_tx = serial21285_start_tx, | 342 | .start_tx = serial21285_start_tx, |
| 347 | .stop_rx = serial21285_stop_rx, | 343 | .stop_rx = serial21285_stop_rx, |
| 348 | .enable_ms = serial21285_enable_ms, | ||
| 349 | .break_ctl = serial21285_break_ctl, | 344 | .break_ctl = serial21285_break_ctl, |
| 350 | .startup = serial21285_startup, | 345 | .startup = serial21285_startup, |
| 351 | .shutdown = serial21285_shutdown, | 346 | .shutdown = serial21285_shutdown, |
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 1ebf8538b4fa..1b08c918cd51 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/serial_8250.h> | 14 | #include <linux/serial_8250.h> |
| 15 | #include <linux/serial_reg.h> | ||
| 15 | #include <linux/dmaengine.h> | 16 | #include <linux/dmaengine.h> |
| 16 | 17 | ||
| 17 | struct uart_8250_dma { | 18 | struct uart_8250_dma { |
| @@ -60,6 +61,7 @@ struct serial8250_config { | |||
| 60 | unsigned short fifo_size; | 61 | unsigned short fifo_size; |
| 61 | unsigned short tx_loadsz; | 62 | unsigned short tx_loadsz; |
| 62 | unsigned char fcr; | 63 | unsigned char fcr; |
| 64 | unsigned char rxtrig_bytes[UART_FCR_R_TRIG_MAX_STATE]; | ||
| 63 | unsigned int flags; | 65 | unsigned int flags; |
| 64 | }; | 66 | }; |
| 65 | 67 | ||
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 7a91c6d1eb7d..1d42dba6121d 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/tty.h> | 31 | #include <linux/tty.h> |
| 32 | #include <linux/ratelimit.h> | 32 | #include <linux/ratelimit.h> |
| 33 | #include <linux/tty_flip.h> | 33 | #include <linux/tty_flip.h> |
| 34 | #include <linux/serial_reg.h> | ||
| 35 | #include <linux/serial_core.h> | 34 | #include <linux/serial_core.h> |
| 36 | #include <linux/serial.h> | 35 | #include <linux/serial.h> |
| 37 | #include <linux/serial_8250.h> | 36 | #include <linux/serial_8250.h> |
| @@ -161,6 +160,7 @@ static const struct serial8250_config uart_config[] = { | |||
| 161 | .fifo_size = 16, | 160 | .fifo_size = 16, |
| 162 | .tx_loadsz = 16, | 161 | .tx_loadsz = 16, |
| 163 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | 162 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
| 163 | .rxtrig_bytes = {1, 4, 8, 14}, | ||
| 164 | .flags = UART_CAP_FIFO, | 164 | .flags = UART_CAP_FIFO, |
| 165 | }, | 165 | }, |
| 166 | [PORT_CIRRUS] = { | 166 | [PORT_CIRRUS] = { |
| @@ -180,6 +180,7 @@ static const struct serial8250_config uart_config[] = { | |||
| 180 | .tx_loadsz = 16, | 180 | .tx_loadsz = 16, |
| 181 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01 | | 181 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01 | |
| 182 | UART_FCR_T_TRIG_00, | 182 | UART_FCR_T_TRIG_00, |
| 183 | .rxtrig_bytes = {8, 16, 24, 28}, | ||
| 183 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, | 184 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, |
| 184 | }, | 185 | }, |
| 185 | [PORT_16750] = { | 186 | [PORT_16750] = { |
| @@ -188,6 +189,7 @@ static const struct serial8250_config uart_config[] = { | |||
| 188 | .tx_loadsz = 64, | 189 | .tx_loadsz = 64, |
| 189 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 | | 190 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 | |
| 190 | UART_FCR7_64BYTE, | 191 | UART_FCR7_64BYTE, |
| 192 | .rxtrig_bytes = {1, 16, 32, 56}, | ||
| 191 | .flags = UART_CAP_FIFO | UART_CAP_SLEEP | UART_CAP_AFE, | 193 | .flags = UART_CAP_FIFO | UART_CAP_SLEEP | UART_CAP_AFE, |
| 192 | }, | 194 | }, |
| 193 | [PORT_STARTECH] = { | 195 | [PORT_STARTECH] = { |
| @@ -209,6 +211,7 @@ static const struct serial8250_config uart_config[] = { | |||
| 209 | .tx_loadsz = 32, | 211 | .tx_loadsz = 32, |
| 210 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01 | | 212 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01 | |
| 211 | UART_FCR_T_TRIG_10, | 213 | UART_FCR_T_TRIG_10, |
| 214 | .rxtrig_bytes = {8, 16, 56, 60}, | ||
| 212 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, | 215 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, |
| 213 | }, | 216 | }, |
| 214 | [PORT_16850] = { | 217 | [PORT_16850] = { |
| @@ -266,6 +269,7 @@ static const struct serial8250_config uart_config[] = { | |||
| 266 | .tx_loadsz = 8, | 269 | .tx_loadsz = 8, |
| 267 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01 | | 270 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01 | |
| 268 | UART_FCR_T_TRIG_01, | 271 | UART_FCR_T_TRIG_01, |
| 272 | .rxtrig_bytes = {1, 4, 8, 14}, | ||
| 269 | .flags = UART_CAP_FIFO | UART_CAP_RTOIE, | 273 | .flags = UART_CAP_FIFO | UART_CAP_RTOIE, |
| 270 | }, | 274 | }, |
| 271 | [PORT_XR17D15X] = { | 275 | [PORT_XR17D15X] = { |
| @@ -439,8 +443,7 @@ static int exar_handle_irq(struct uart_port *port); | |||
| 439 | 443 | ||
| 440 | static void set_io_from_upio(struct uart_port *p) | 444 | static void set_io_from_upio(struct uart_port *p) |
| 441 | { | 445 | { |
| 442 | struct uart_8250_port *up = | 446 | struct uart_8250_port *up = up_to_u8250p(p); |
| 443 | container_of(p, struct uart_8250_port, port); | ||
| 444 | 447 | ||
| 445 | up->dl_read = default_serial_dl_read; | 448 | up->dl_read = default_serial_dl_read; |
| 446 | up->dl_write = default_serial_dl_write; | 449 | up->dl_write = default_serial_dl_write; |
| @@ -531,11 +534,8 @@ static void serial8250_clear_fifos(struct uart_8250_port *p) | |||
| 531 | 534 | ||
| 532 | void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p) | 535 | void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p) |
| 533 | { | 536 | { |
| 534 | unsigned char fcr; | ||
| 535 | |||
| 536 | serial8250_clear_fifos(p); | 537 | serial8250_clear_fifos(p); |
| 537 | fcr = uart_config[p->port.type].fcr; | 538 | serial_out(p, UART_FCR, p->fcr); |
| 538 | serial_out(p, UART_FCR, fcr); | ||
| 539 | } | 539 | } |
| 540 | EXPORT_SYMBOL_GPL(serial8250_clear_and_reinit_fifos); | 540 | EXPORT_SYMBOL_GPL(serial8250_clear_and_reinit_fifos); |
| 541 | 541 | ||
| @@ -1277,8 +1277,7 @@ static inline void __stop_tx(struct uart_8250_port *p) | |||
| 1277 | 1277 | ||
| 1278 | static void serial8250_stop_tx(struct uart_port *port) | 1278 | static void serial8250_stop_tx(struct uart_port *port) |
| 1279 | { | 1279 | { |
| 1280 | struct uart_8250_port *up = | 1280 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1281 | container_of(port, struct uart_8250_port, port); | ||
| 1282 | 1281 | ||
| 1283 | __stop_tx(up); | 1282 | __stop_tx(up); |
| 1284 | 1283 | ||
| @@ -1293,8 +1292,7 @@ static void serial8250_stop_tx(struct uart_port *port) | |||
| 1293 | 1292 | ||
| 1294 | static void serial8250_start_tx(struct uart_port *port) | 1293 | static void serial8250_start_tx(struct uart_port *port) |
| 1295 | { | 1294 | { |
| 1296 | struct uart_8250_port *up = | 1295 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1297 | container_of(port, struct uart_8250_port, port); | ||
| 1298 | 1296 | ||
| 1299 | if (up->dma && !serial8250_tx_dma(up)) { | 1297 | if (up->dma && !serial8250_tx_dma(up)) { |
| 1300 | return; | 1298 | return; |
| @@ -1322,8 +1320,7 @@ static void serial8250_start_tx(struct uart_port *port) | |||
| 1322 | 1320 | ||
| 1323 | static void serial8250_stop_rx(struct uart_port *port) | 1321 | static void serial8250_stop_rx(struct uart_port *port) |
| 1324 | { | 1322 | { |
| 1325 | struct uart_8250_port *up = | 1323 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1326 | container_of(port, struct uart_8250_port, port); | ||
| 1327 | 1324 | ||
| 1328 | up->ier &= ~UART_IER_RLSI; | 1325 | up->ier &= ~UART_IER_RLSI; |
| 1329 | up->port.read_status_mask &= ~UART_LSR_DR; | 1326 | up->port.read_status_mask &= ~UART_LSR_DR; |
| @@ -1332,8 +1329,7 @@ static void serial8250_stop_rx(struct uart_port *port) | |||
| 1332 | 1329 | ||
| 1333 | static void serial8250_enable_ms(struct uart_port *port) | 1330 | static void serial8250_enable_ms(struct uart_port *port) |
| 1334 | { | 1331 | { |
| 1335 | struct uart_8250_port *up = | 1332 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1336 | container_of(port, struct uart_8250_port, port); | ||
| 1337 | 1333 | ||
| 1338 | /* no MSR capabilities */ | 1334 | /* no MSR capabilities */ |
| 1339 | if (up->bugs & UART_BUG_NOMSR) | 1335 | if (up->bugs & UART_BUG_NOMSR) |
| @@ -1499,8 +1495,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) | |||
| 1499 | { | 1495 | { |
| 1500 | unsigned char status; | 1496 | unsigned char status; |
| 1501 | unsigned long flags; | 1497 | unsigned long flags; |
| 1502 | struct uart_8250_port *up = | 1498 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1503 | container_of(port, struct uart_8250_port, port); | ||
| 1504 | int dma_err = 0; | 1499 | int dma_err = 0; |
| 1505 | 1500 | ||
| 1506 | if (iir & UART_IIR_NO_INT) | 1501 | if (iir & UART_IIR_NO_INT) |
| @@ -1785,8 +1780,7 @@ static void serial8250_backup_timeout(unsigned long data) | |||
| 1785 | 1780 | ||
| 1786 | static unsigned int serial8250_tx_empty(struct uart_port *port) | 1781 | static unsigned int serial8250_tx_empty(struct uart_port *port) |
| 1787 | { | 1782 | { |
| 1788 | struct uart_8250_port *up = | 1783 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1789 | container_of(port, struct uart_8250_port, port); | ||
| 1790 | unsigned long flags; | 1784 | unsigned long flags; |
| 1791 | unsigned int lsr; | 1785 | unsigned int lsr; |
| 1792 | 1786 | ||
| @@ -1800,8 +1794,7 @@ static unsigned int serial8250_tx_empty(struct uart_port *port) | |||
| 1800 | 1794 | ||
| 1801 | static unsigned int serial8250_get_mctrl(struct uart_port *port) | 1795 | static unsigned int serial8250_get_mctrl(struct uart_port *port) |
| 1802 | { | 1796 | { |
| 1803 | struct uart_8250_port *up = | 1797 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1804 | container_of(port, struct uart_8250_port, port); | ||
| 1805 | unsigned int status; | 1798 | unsigned int status; |
| 1806 | unsigned int ret; | 1799 | unsigned int ret; |
| 1807 | 1800 | ||
| @@ -1821,8 +1814,7 @@ static unsigned int serial8250_get_mctrl(struct uart_port *port) | |||
| 1821 | 1814 | ||
| 1822 | static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl) | 1815 | static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl) |
| 1823 | { | 1816 | { |
| 1824 | struct uart_8250_port *up = | 1817 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1825 | container_of(port, struct uart_8250_port, port); | ||
| 1826 | unsigned char mcr = 0; | 1818 | unsigned char mcr = 0; |
| 1827 | 1819 | ||
| 1828 | if (mctrl & TIOCM_RTS) | 1820 | if (mctrl & TIOCM_RTS) |
| @@ -1843,8 +1835,7 @@ static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
| 1843 | 1835 | ||
| 1844 | static void serial8250_break_ctl(struct uart_port *port, int break_state) | 1836 | static void serial8250_break_ctl(struct uart_port *port, int break_state) |
| 1845 | { | 1837 | { |
| 1846 | struct uart_8250_port *up = | 1838 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1847 | container_of(port, struct uart_8250_port, port); | ||
| 1848 | unsigned long flags; | 1839 | unsigned long flags; |
| 1849 | 1840 | ||
| 1850 | spin_lock_irqsave(&port->lock, flags); | 1841 | spin_lock_irqsave(&port->lock, flags); |
| @@ -1911,8 +1902,7 @@ static void serial8250_put_poll_char(struct uart_port *port, | |||
| 1911 | unsigned char c) | 1902 | unsigned char c) |
| 1912 | { | 1903 | { |
| 1913 | unsigned int ier; | 1904 | unsigned int ier; |
| 1914 | struct uart_8250_port *up = | 1905 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1915 | container_of(port, struct uart_8250_port, port); | ||
| 1916 | 1906 | ||
| 1917 | /* | 1907 | /* |
| 1918 | * First save the IER then disable the interrupts | 1908 | * First save the IER then disable the interrupts |
| @@ -1941,8 +1931,7 @@ static void serial8250_put_poll_char(struct uart_port *port, | |||
| 1941 | 1931 | ||
| 1942 | static int serial8250_startup(struct uart_port *port) | 1932 | static int serial8250_startup(struct uart_port *port) |
| 1943 | { | 1933 | { |
| 1944 | struct uart_8250_port *up = | 1934 | struct uart_8250_port *up = up_to_u8250p(port); |
| 1945 | container_of(port, struct uart_8250_port, port); | ||
| 1946 | unsigned long flags; | 1935 | unsigned long flags; |
| 1947 | unsigned char lsr, iir; | 1936 | unsigned char lsr, iir; |
| 1948 | int retval; | 1937 | int retval; |
| @@ -2194,8 +2183,7 @@ dont_test_tx_en: | |||
| 2194 | 2183 | ||
| 2195 | static void serial8250_shutdown(struct uart_port *port) | 2184 | static void serial8250_shutdown(struct uart_port *port) |
| 2196 | { | 2185 | { |
| 2197 | struct uart_8250_port *up = | 2186 | struct uart_8250_port *up = up_to_u8250p(port); |
| 2198 | container_of(port, struct uart_8250_port, port); | ||
| 2199 | unsigned long flags; | 2187 | unsigned long flags; |
| 2200 | 2188 | ||
| 2201 | /* | 2189 | /* |
| @@ -2268,12 +2256,10 @@ void | |||
| 2268 | serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | 2256 | serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, |
| 2269 | struct ktermios *old) | 2257 | struct ktermios *old) |
| 2270 | { | 2258 | { |
| 2271 | struct uart_8250_port *up = | 2259 | struct uart_8250_port *up = up_to_u8250p(port); |
| 2272 | container_of(port, struct uart_8250_port, port); | 2260 | unsigned char cval; |
| 2273 | unsigned char cval, fcr = 0; | ||
| 2274 | unsigned long flags; | 2261 | unsigned long flags; |
| 2275 | unsigned int baud, quot; | 2262 | unsigned int baud, quot; |
| 2276 | int fifo_bug = 0; | ||
| 2277 | 2263 | ||
| 2278 | switch (termios->c_cflag & CSIZE) { | 2264 | switch (termios->c_cflag & CSIZE) { |
| 2279 | case CS5: | 2265 | case CS5: |
| @@ -2296,7 +2282,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 2296 | if (termios->c_cflag & PARENB) { | 2282 | if (termios->c_cflag & PARENB) { |
| 2297 | cval |= UART_LCR_PARITY; | 2283 | cval |= UART_LCR_PARITY; |
| 2298 | if (up->bugs & UART_BUG_PARITY) | 2284 | if (up->bugs & UART_BUG_PARITY) |
| 2299 | fifo_bug = 1; | 2285 | up->fifo_bug = true; |
| 2300 | } | 2286 | } |
| 2301 | if (!(termios->c_cflag & PARODD)) | 2287 | if (!(termios->c_cflag & PARODD)) |
| 2302 | cval |= UART_LCR_EPAR; | 2288 | cval |= UART_LCR_EPAR; |
| @@ -2320,10 +2306,10 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 2320 | quot++; | 2306 | quot++; |
| 2321 | 2307 | ||
| 2322 | if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { | 2308 | if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { |
| 2323 | fcr = uart_config[port->type].fcr; | 2309 | /* NOTE: If fifo_bug is not set, a user can set RX_trigger. */ |
| 2324 | if ((baud < 2400 && !up->dma) || fifo_bug) { | 2310 | if ((baud < 2400 && !up->dma) || up->fifo_bug) { |
| 2325 | fcr &= ~UART_FCR_TRIGGER_MASK; | 2311 | up->fcr &= ~UART_FCR_TRIGGER_MASK; |
| 2326 | fcr |= UART_FCR_TRIGGER_1; | 2312 | up->fcr |= UART_FCR_TRIGGER_1; |
| 2327 | } | 2313 | } |
| 2328 | } | 2314 | } |
| 2329 | 2315 | ||
| @@ -2456,15 +2442,15 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 2456 | * is written without DLAB set, this mode will be disabled. | 2442 | * is written without DLAB set, this mode will be disabled. |
| 2457 | */ | 2443 | */ |
| 2458 | if (port->type == PORT_16750) | 2444 | if (port->type == PORT_16750) |
| 2459 | serial_port_out(port, UART_FCR, fcr); | 2445 | serial_port_out(port, UART_FCR, up->fcr); |
| 2460 | 2446 | ||
| 2461 | serial_port_out(port, UART_LCR, cval); /* reset DLAB */ | 2447 | serial_port_out(port, UART_LCR, cval); /* reset DLAB */ |
| 2462 | up->lcr = cval; /* Save LCR */ | 2448 | up->lcr = cval; /* Save LCR */ |
| 2463 | if (port->type != PORT_16750) { | 2449 | if (port->type != PORT_16750) { |
| 2464 | /* emulated UARTs (Lucent Venus 167x) need two steps */ | 2450 | /* emulated UARTs (Lucent Venus 167x) need two steps */ |
| 2465 | if (fcr & UART_FCR_ENABLE_FIFO) | 2451 | if (up->fcr & UART_FCR_ENABLE_FIFO) |
| 2466 | serial_port_out(port, UART_FCR, UART_FCR_ENABLE_FIFO); | 2452 | serial_port_out(port, UART_FCR, UART_FCR_ENABLE_FIFO); |
| 2467 | serial_port_out(port, UART_FCR, fcr); /* set fcr */ | 2453 | serial_port_out(port, UART_FCR, up->fcr); /* set fcr */ |
| 2468 | } | 2454 | } |
| 2469 | serial8250_set_mctrl(port, port->mctrl); | 2455 | serial8250_set_mctrl(port, port->mctrl); |
| 2470 | spin_unlock_irqrestore(&port->lock, flags); | 2456 | spin_unlock_irqrestore(&port->lock, flags); |
| @@ -2498,8 +2484,7 @@ serial8250_set_ldisc(struct uart_port *port, int new) | |||
| 2498 | void serial8250_do_pm(struct uart_port *port, unsigned int state, | 2484 | void serial8250_do_pm(struct uart_port *port, unsigned int state, |
| 2499 | unsigned int oldstate) | 2485 | unsigned int oldstate) |
| 2500 | { | 2486 | { |
| 2501 | struct uart_8250_port *p = | 2487 | struct uart_8250_port *p = up_to_u8250p(port); |
| 2502 | container_of(port, struct uart_8250_port, port); | ||
| 2503 | 2488 | ||
| 2504 | serial8250_set_sleep(p, state != 0); | 2489 | serial8250_set_sleep(p, state != 0); |
| 2505 | } | 2490 | } |
| @@ -2630,8 +2615,7 @@ static void serial8250_release_rsa_resource(struct uart_8250_port *up) | |||
| 2630 | 2615 | ||
| 2631 | static void serial8250_release_port(struct uart_port *port) | 2616 | static void serial8250_release_port(struct uart_port *port) |
| 2632 | { | 2617 | { |
| 2633 | struct uart_8250_port *up = | 2618 | struct uart_8250_port *up = up_to_u8250p(port); |
| 2634 | container_of(port, struct uart_8250_port, port); | ||
| 2635 | 2619 | ||
| 2636 | serial8250_release_std_resource(up); | 2620 | serial8250_release_std_resource(up); |
| 2637 | if (port->type == PORT_RSA) | 2621 | if (port->type == PORT_RSA) |
| @@ -2640,8 +2624,7 @@ static void serial8250_release_port(struct uart_port *port) | |||
| 2640 | 2624 | ||
| 2641 | static int serial8250_request_port(struct uart_port *port) | 2625 | static int serial8250_request_port(struct uart_port *port) |
| 2642 | { | 2626 | { |
| 2643 | struct uart_8250_port *up = | 2627 | struct uart_8250_port *up = up_to_u8250p(port); |
| 2644 | container_of(port, struct uart_8250_port, port); | ||
| 2645 | int ret; | 2628 | int ret; |
| 2646 | 2629 | ||
| 2647 | if (port->type == PORT_8250_CIR) | 2630 | if (port->type == PORT_8250_CIR) |
| @@ -2657,10 +2640,149 @@ static int serial8250_request_port(struct uart_port *port) | |||
| 2657 | return ret; | 2640 | return ret; |
| 2658 | } | 2641 | } |
| 2659 | 2642 | ||
| 2660 | static void serial8250_config_port(struct uart_port *port, int flags) | 2643 | static int fcr_get_rxtrig_bytes(struct uart_8250_port *up) |
| 2644 | { | ||
| 2645 | const struct serial8250_config *conf_type = &uart_config[up->port.type]; | ||
| 2646 | unsigned char bytes; | ||
| 2647 | |||
| 2648 | bytes = conf_type->rxtrig_bytes[UART_FCR_R_TRIG_BITS(up->fcr)]; | ||
| 2649 | |||
| 2650 | return bytes ? bytes : -EOPNOTSUPP; | ||
| 2651 | } | ||
| 2652 | |||
| 2653 | static int bytes_to_fcr_rxtrig(struct uart_8250_port *up, unsigned char bytes) | ||
| 2654 | { | ||
| 2655 | const struct serial8250_config *conf_type = &uart_config[up->port.type]; | ||
| 2656 | int i; | ||
| 2657 | |||
| 2658 | if (!conf_type->rxtrig_bytes[UART_FCR_R_TRIG_BITS(UART_FCR_R_TRIG_00)]) | ||
| 2659 | return -EOPNOTSUPP; | ||
| 2660 | |||
| 2661 | for (i = 1; i < UART_FCR_R_TRIG_MAX_STATE; i++) { | ||
| 2662 | if (bytes < conf_type->rxtrig_bytes[i]) | ||
| 2663 | /* Use the nearest lower value */ | ||
| 2664 | return (--i) << UART_FCR_R_TRIG_SHIFT; | ||
| 2665 | } | ||
| 2666 | |||
| 2667 | return UART_FCR_R_TRIG_11; | ||
| 2668 | } | ||
| 2669 | |||
| 2670 | static int do_get_rxtrig(struct tty_port *port) | ||
| 2671 | { | ||
| 2672 | struct uart_state *state = container_of(port, struct uart_state, port); | ||
| 2673 | struct uart_port *uport = state->uart_port; | ||
| 2674 | struct uart_8250_port *up = | ||
| 2675 | container_of(uport, struct uart_8250_port, port); | ||
| 2676 | |||
| 2677 | if (!(up->capabilities & UART_CAP_FIFO) || uport->fifosize <= 1) | ||
| 2678 | return -EINVAL; | ||
| 2679 | |||
| 2680 | return fcr_get_rxtrig_bytes(up); | ||
| 2681 | } | ||
| 2682 | |||
| 2683 | static int do_serial8250_get_rxtrig(struct tty_port *port) | ||
| 2684 | { | ||
| 2685 | int rxtrig_bytes; | ||
| 2686 | |||
| 2687 | mutex_lock(&port->mutex); | ||
| 2688 | rxtrig_bytes = do_get_rxtrig(port); | ||
| 2689 | mutex_unlock(&port->mutex); | ||
| 2690 | |||
| 2691 | return rxtrig_bytes; | ||
| 2692 | } | ||
| 2693 | |||
| 2694 | static ssize_t serial8250_get_attr_rx_trig_bytes(struct device *dev, | ||
| 2695 | struct device_attribute *attr, char *buf) | ||
| 2661 | { | 2696 | { |
| 2697 | struct tty_port *port = dev_get_drvdata(dev); | ||
| 2698 | int rxtrig_bytes; | ||
| 2699 | |||
| 2700 | rxtrig_bytes = do_serial8250_get_rxtrig(port); | ||
| 2701 | if (rxtrig_bytes < 0) | ||
| 2702 | return rxtrig_bytes; | ||
| 2703 | |||
| 2704 | return snprintf(buf, PAGE_SIZE, "%d\n", rxtrig_bytes); | ||
| 2705 | } | ||
| 2706 | |||
| 2707 | static int do_set_rxtrig(struct tty_port *port, unsigned char bytes) | ||
| 2708 | { | ||
| 2709 | struct uart_state *state = container_of(port, struct uart_state, port); | ||
| 2710 | struct uart_port *uport = state->uart_port; | ||
| 2662 | struct uart_8250_port *up = | 2711 | struct uart_8250_port *up = |
| 2663 | container_of(port, struct uart_8250_port, port); | 2712 | container_of(uport, struct uart_8250_port, port); |
| 2713 | int rxtrig; | ||
| 2714 | |||
| 2715 | if (!(up->capabilities & UART_CAP_FIFO) || uport->fifosize <= 1 || | ||
| 2716 | up->fifo_bug) | ||
| 2717 | return -EINVAL; | ||
| 2718 | |||
| 2719 | rxtrig = bytes_to_fcr_rxtrig(up, bytes); | ||
| 2720 | if (rxtrig < 0) | ||
| 2721 | return rxtrig; | ||
| 2722 | |||
| 2723 | serial8250_clear_fifos(up); | ||
| 2724 | up->fcr &= ~UART_FCR_TRIGGER_MASK; | ||
| 2725 | up->fcr |= (unsigned char)rxtrig; | ||
| 2726 | serial_out(up, UART_FCR, up->fcr); | ||
| 2727 | return 0; | ||
| 2728 | } | ||
| 2729 | |||
| 2730 | static int do_serial8250_set_rxtrig(struct tty_port *port, unsigned char bytes) | ||
| 2731 | { | ||
| 2732 | int ret; | ||
| 2733 | |||
| 2734 | mutex_lock(&port->mutex); | ||
| 2735 | ret = do_set_rxtrig(port, bytes); | ||
| 2736 | mutex_unlock(&port->mutex); | ||
| 2737 | |||
| 2738 | return ret; | ||
| 2739 | } | ||
| 2740 | |||
| 2741 | static ssize_t serial8250_set_attr_rx_trig_bytes(struct device *dev, | ||
| 2742 | struct device_attribute *attr, const char *buf, size_t count) | ||
| 2743 | { | ||
| 2744 | struct tty_port *port = dev_get_drvdata(dev); | ||
| 2745 | unsigned char bytes; | ||
| 2746 | int ret; | ||
| 2747 | |||
| 2748 | if (!count) | ||
| 2749 | return -EINVAL; | ||
| 2750 | |||
| 2751 | ret = kstrtou8(buf, 10, &bytes); | ||
| 2752 | if (ret < 0) | ||
| 2753 | return ret; | ||
| 2754 | |||
| 2755 | ret = do_serial8250_set_rxtrig(port, bytes); | ||
| 2756 | if (ret < 0) | ||
| 2757 | return ret; | ||
| 2758 | |||
| 2759 | return count; | ||
| 2760 | } | ||
| 2761 | |||
| 2762 | static DEVICE_ATTR(rx_trig_bytes, S_IRUSR | S_IWUSR | S_IRGRP, | ||
| 2763 | serial8250_get_attr_rx_trig_bytes, | ||
| 2764 | serial8250_set_attr_rx_trig_bytes); | ||
| 2765 | |||
| 2766 | static struct attribute *serial8250_dev_attrs[] = { | ||
| 2767 | &dev_attr_rx_trig_bytes.attr, | ||
| 2768 | NULL, | ||
| 2769 | }; | ||
| 2770 | |||
| 2771 | static struct attribute_group serial8250_dev_attr_group = { | ||
| 2772 | .attrs = serial8250_dev_attrs, | ||
| 2773 | }; | ||
| 2774 | |||
| 2775 | static void register_dev_spec_attr_grp(struct uart_8250_port *up) | ||
| 2776 | { | ||
| 2777 | const struct serial8250_config *conf_type = &uart_config[up->port.type]; | ||
| 2778 | |||
| 2779 | if (conf_type->rxtrig_bytes[0]) | ||
| 2780 | up->port.attr_group = &serial8250_dev_attr_group; | ||
| 2781 | } | ||
| 2782 | |||
| 2783 | static void serial8250_config_port(struct uart_port *port, int flags) | ||
| 2784 | { | ||
| 2785 | struct uart_8250_port *up = up_to_u8250p(port); | ||
| 2664 | int probeflags = PROBE_ANY; | 2786 | int probeflags = PROBE_ANY; |
| 2665 | int ret; | 2787 | int ret; |
| 2666 | 2788 | ||
| @@ -2705,6 +2827,9 @@ static void serial8250_config_port(struct uart_port *port, int flags) | |||
| 2705 | if ((port->type == PORT_XR17V35X) || | 2827 | if ((port->type == PORT_XR17V35X) || |
| 2706 | (port->type == PORT_XR17D15X)) | 2828 | (port->type == PORT_XR17D15X)) |
| 2707 | port->handle_irq = exar_handle_irq; | 2829 | port->handle_irq = exar_handle_irq; |
| 2830 | |||
| 2831 | register_dev_spec_attr_grp(up); | ||
| 2832 | up->fcr = uart_config[up->port.type].fcr; | ||
| 2708 | } | 2833 | } |
| 2709 | 2834 | ||
| 2710 | static int | 2835 | static int |
| @@ -2859,8 +2984,7 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev) | |||
| 2859 | 2984 | ||
| 2860 | static void serial8250_console_putchar(struct uart_port *port, int ch) | 2985 | static void serial8250_console_putchar(struct uart_port *port, int ch) |
| 2861 | { | 2986 | { |
| 2862 | struct uart_8250_port *up = | 2987 | struct uart_8250_port *up = up_to_u8250p(port); |
| 2863 | container_of(port, struct uart_8250_port, port); | ||
| 2864 | 2988 | ||
| 2865 | wait_for_xmitr(up, UART_LSR_THRE); | 2989 | wait_for_xmitr(up, UART_LSR_THRE); |
| 2866 | serial_port_out(port, UART_TX, ch); | 2990 | serial_port_out(port, UART_TX, ch); |
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 51b307aab75e..4db7987ec225 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/acpi.h> | 27 | #include <linux/acpi.h> |
| 28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
| 29 | #include <linux/reset.h> | ||
| 29 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
| 30 | 31 | ||
| 31 | #include <asm/byteorder.h> | 32 | #include <asm/byteorder.h> |
| @@ -59,73 +60,17 @@ struct dw8250_data { | |||
| 59 | int last_mcr; | 60 | int last_mcr; |
| 60 | int line; | 61 | int line; |
| 61 | struct clk *clk; | 62 | struct clk *clk; |
| 63 | struct clk *pclk; | ||
| 64 | struct reset_control *rst; | ||
| 62 | struct uart_8250_dma dma; | 65 | struct uart_8250_dma dma; |
| 63 | }; | 66 | }; |
| 64 | 67 | ||
| 65 | struct dw8250_acpi_desc { | ||
| 66 | void (*set_termios)(struct uart_port *p, struct ktermios *termios, | ||
| 67 | struct ktermios *old); | ||
| 68 | }; | ||
| 69 | |||
| 70 | #define BYT_PRV_CLK 0x800 | 68 | #define BYT_PRV_CLK 0x800 |
| 71 | #define BYT_PRV_CLK_EN (1 << 0) | 69 | #define BYT_PRV_CLK_EN (1 << 0) |
| 72 | #define BYT_PRV_CLK_M_VAL_SHIFT 1 | 70 | #define BYT_PRV_CLK_M_VAL_SHIFT 1 |
| 73 | #define BYT_PRV_CLK_N_VAL_SHIFT 16 | 71 | #define BYT_PRV_CLK_N_VAL_SHIFT 16 |
| 74 | #define BYT_PRV_CLK_UPDATE (1 << 31) | 72 | #define BYT_PRV_CLK_UPDATE (1 << 31) |
| 75 | 73 | ||
| 76 | static void byt_set_termios(struct uart_port *p, struct ktermios *termios, | ||
| 77 | struct ktermios *old) | ||
| 78 | { | ||
| 79 | unsigned int baud = tty_termios_baud_rate(termios); | ||
| 80 | unsigned int m, n; | ||
| 81 | u32 reg; | ||
| 82 | |||
| 83 | /* | ||
| 84 | * For baud rates 0.5M, 1M, 1.5M, 2M, 2.5M, 3M, 3.5M and 4M the | ||
| 85 | * dividers must be adjusted. | ||
| 86 | * | ||
| 87 | * uartclk = (m / n) * 100 MHz, where m <= n | ||
| 88 | */ | ||
| 89 | switch (baud) { | ||
| 90 | case 500000: | ||
| 91 | case 1000000: | ||
| 92 | case 2000000: | ||
| 93 | case 4000000: | ||
| 94 | m = 64; | ||
| 95 | n = 100; | ||
| 96 | p->uartclk = 64000000; | ||
| 97 | break; | ||
| 98 | case 3500000: | ||
| 99 | m = 56; | ||
| 100 | n = 100; | ||
| 101 | p->uartclk = 56000000; | ||
| 102 | break; | ||
| 103 | case 1500000: | ||
| 104 | case 3000000: | ||
| 105 | m = 48; | ||
| 106 | n = 100; | ||
| 107 | p->uartclk = 48000000; | ||
| 108 | break; | ||
| 109 | case 2500000: | ||
| 110 | m = 40; | ||
| 111 | n = 100; | ||
| 112 | p->uartclk = 40000000; | ||
| 113 | break; | ||
| 114 | default: | ||
| 115 | m = 2304; | ||
| 116 | n = 3125; | ||
| 117 | p->uartclk = 73728000; | ||
| 118 | } | ||
| 119 | |||
| 120 | /* Reset the clock */ | ||
| 121 | reg = (m << BYT_PRV_CLK_M_VAL_SHIFT) | (n << BYT_PRV_CLK_N_VAL_SHIFT); | ||
| 122 | writel(reg, p->membase + BYT_PRV_CLK); | ||
| 123 | reg |= BYT_PRV_CLK_EN | BYT_PRV_CLK_UPDATE; | ||
| 124 | writel(reg, p->membase + BYT_PRV_CLK); | ||
| 125 | |||
| 126 | serial8250_do_set_termios(p, termios, old); | ||
| 127 | } | ||
| 128 | |||
| 129 | static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value) | 74 | static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value) |
| 130 | { | 75 | { |
| 131 | struct dw8250_data *d = p->private_data; | 76 | struct dw8250_data *d = p->private_data; |
| @@ -141,8 +86,9 @@ static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value) | |||
| 141 | 86 | ||
| 142 | static void dw8250_force_idle(struct uart_port *p) | 87 | static void dw8250_force_idle(struct uart_port *p) |
| 143 | { | 88 | { |
| 144 | serial8250_clear_and_reinit_fifos(container_of | 89 | struct uart_8250_port *up = up_to_u8250p(p); |
| 145 | (p, struct uart_8250_port, port)); | 90 | |
| 91 | serial8250_clear_and_reinit_fifos(up); | ||
| 146 | (void)p->serial_in(p, UART_RX); | 92 | (void)p->serial_in(p, UART_RX); |
| 147 | } | 93 | } |
| 148 | 94 | ||
| @@ -242,6 +188,32 @@ dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old) | |||
| 242 | pm_runtime_put_sync_suspend(port->dev); | 188 | pm_runtime_put_sync_suspend(port->dev); |
| 243 | } | 189 | } |
| 244 | 190 | ||
| 191 | static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, | ||
| 192 | struct ktermios *old) | ||
| 193 | { | ||
| 194 | unsigned int baud = tty_termios_baud_rate(termios); | ||
| 195 | struct dw8250_data *d = p->private_data; | ||
| 196 | unsigned int rate; | ||
| 197 | int ret; | ||
| 198 | |||
| 199 | if (IS_ERR(d->clk) || !old) | ||
| 200 | goto out; | ||
| 201 | |||
| 202 | /* Not requesting clock rates below 1.8432Mhz */ | ||
| 203 | if (baud < 115200) | ||
| 204 | baud = 115200; | ||
| 205 | |||
| 206 | clk_disable_unprepare(d->clk); | ||
| 207 | rate = clk_round_rate(d->clk, baud * 16); | ||
| 208 | ret = clk_set_rate(d->clk, rate); | ||
| 209 | clk_prepare_enable(d->clk); | ||
| 210 | |||
| 211 | if (!ret) | ||
| 212 | p->uartclk = rate; | ||
| 213 | out: | ||
| 214 | serial8250_do_set_termios(p, termios, old); | ||
| 215 | } | ||
| 216 | |||
| 245 | static bool dw8250_dma_filter(struct dma_chan *chan, void *param) | 217 | static bool dw8250_dma_filter(struct dma_chan *chan, void *param) |
| 246 | { | 218 | { |
| 247 | struct dw8250_data *data = param; | 219 | struct dw8250_data *data = param; |
| @@ -286,6 +258,7 @@ static int dw8250_probe_of(struct uart_port *p, | |||
| 286 | struct dw8250_data *data) | 258 | struct dw8250_data *data) |
| 287 | { | 259 | { |
| 288 | struct device_node *np = p->dev->of_node; | 260 | struct device_node *np = p->dev->of_node; |
| 261 | struct uart_8250_port *up = up_to_u8250p(p); | ||
| 289 | u32 val; | 262 | u32 val; |
| 290 | bool has_ucv = true; | 263 | bool has_ucv = true; |
| 291 | 264 | ||
| @@ -299,7 +272,7 @@ static int dw8250_probe_of(struct uart_port *p, | |||
| 299 | p->membase += 7; | 272 | p->membase += 7; |
| 300 | #endif | 273 | #endif |
| 301 | p->serial_out = dw8250_serial_out_rb; | 274 | p->serial_out = dw8250_serial_out_rb; |
| 302 | p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; | 275 | p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; |
| 303 | p->type = PORT_OCTEON; | 276 | p->type = PORT_OCTEON; |
| 304 | data->usr_reg = 0x27; | 277 | data->usr_reg = 0x27; |
| 305 | has_ucv = false; | 278 | has_ucv = false; |
| @@ -318,7 +291,7 @@ static int dw8250_probe_of(struct uart_port *p, | |||
| 318 | } | 291 | } |
| 319 | } | 292 | } |
| 320 | if (has_ucv) | 293 | if (has_ucv) |
| 321 | dw8250_setup_port(container_of(p, struct uart_8250_port, port)); | 294 | dw8250_setup_port(up); |
| 322 | 295 | ||
| 323 | if (!of_property_read_u32(np, "reg-shift", &val)) | 296 | if (!of_property_read_u32(np, "reg-shift", &val)) |
| 324 | p->regshift = val; | 297 | p->regshift = val; |
| @@ -340,16 +313,10 @@ static int dw8250_probe_of(struct uart_port *p, | |||
| 340 | static int dw8250_probe_acpi(struct uart_8250_port *up, | 313 | static int dw8250_probe_acpi(struct uart_8250_port *up, |
| 341 | struct dw8250_data *data) | 314 | struct dw8250_data *data) |
| 342 | { | 315 | { |
| 343 | const struct acpi_device_id *id; | ||
| 344 | struct uart_port *p = &up->port; | 316 | struct uart_port *p = &up->port; |
| 345 | struct dw8250_acpi_desc *acpi_desc; | ||
| 346 | 317 | ||
| 347 | dw8250_setup_port(up); | 318 | dw8250_setup_port(up); |
| 348 | 319 | ||
| 349 | id = acpi_match_device(p->dev->driver->acpi_match_table, p->dev); | ||
| 350 | if (!id) | ||
| 351 | return -ENODEV; | ||
| 352 | |||
| 353 | p->iotype = UPIO_MEM32; | 320 | p->iotype = UPIO_MEM32; |
| 354 | p->serial_in = dw8250_serial_in32; | 321 | p->serial_in = dw8250_serial_in32; |
| 355 | p->serial_out = dw8250_serial_out32; | 322 | p->serial_out = dw8250_serial_out32; |
| @@ -360,12 +327,7 @@ static int dw8250_probe_acpi(struct uart_8250_port *up, | |||
| 360 | up->dma->rxconf.src_maxburst = p->fifosize / 4; | 327 | up->dma->rxconf.src_maxburst = p->fifosize / 4; |
| 361 | up->dma->txconf.dst_maxburst = p->fifosize / 4; | 328 | up->dma->txconf.dst_maxburst = p->fifosize / 4; |
| 362 | 329 | ||
| 363 | acpi_desc = (struct dw8250_acpi_desc *)id->driver_data; | 330 | up->port.set_termios = dw8250_set_termios; |
| 364 | if (!acpi_desc) | ||
| 365 | return 0; | ||
| 366 | |||
| 367 | if (acpi_desc->set_termios) | ||
| 368 | p->set_termios = acpi_desc->set_termios; | ||
| 369 | 331 | ||
| 370 | return 0; | 332 | return 0; |
| 371 | } | 333 | } |
| @@ -402,11 +364,40 @@ static int dw8250_probe(struct platform_device *pdev) | |||
| 402 | return -ENOMEM; | 364 | return -ENOMEM; |
| 403 | 365 | ||
| 404 | data->usr_reg = DW_UART_USR; | 366 | data->usr_reg = DW_UART_USR; |
| 405 | data->clk = devm_clk_get(&pdev->dev, NULL); | 367 | data->clk = devm_clk_get(&pdev->dev, "baudclk"); |
| 368 | if (IS_ERR(data->clk) && PTR_ERR(data->clk) != -EPROBE_DEFER) | ||
| 369 | data->clk = devm_clk_get(&pdev->dev, NULL); | ||
| 370 | if (IS_ERR(data->clk) && PTR_ERR(data->clk) == -EPROBE_DEFER) | ||
| 371 | return -EPROBE_DEFER; | ||
| 406 | if (!IS_ERR(data->clk)) { | 372 | if (!IS_ERR(data->clk)) { |
| 407 | clk_prepare_enable(data->clk); | 373 | err = clk_prepare_enable(data->clk); |
| 408 | uart.port.uartclk = clk_get_rate(data->clk); | 374 | if (err) |
| 375 | dev_warn(&pdev->dev, "could not enable optional baudclk: %d\n", | ||
| 376 | err); | ||
| 377 | else | ||
| 378 | uart.port.uartclk = clk_get_rate(data->clk); | ||
| 379 | } | ||
| 380 | |||
| 381 | data->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); | ||
| 382 | if (IS_ERR(data->clk) && PTR_ERR(data->clk) == -EPROBE_DEFER) { | ||
| 383 | err = -EPROBE_DEFER; | ||
| 384 | goto err_clk; | ||
| 409 | } | 385 | } |
| 386 | if (!IS_ERR(data->pclk)) { | ||
| 387 | err = clk_prepare_enable(data->pclk); | ||
| 388 | if (err) { | ||
| 389 | dev_err(&pdev->dev, "could not enable apb_pclk\n"); | ||
| 390 | goto err_clk; | ||
| 391 | } | ||
| 392 | } | ||
| 393 | |||
| 394 | data->rst = devm_reset_control_get_optional(&pdev->dev, NULL); | ||
| 395 | if (IS_ERR(data->rst) && PTR_ERR(data->rst) == -EPROBE_DEFER) { | ||
| 396 | err = -EPROBE_DEFER; | ||
| 397 | goto err_pclk; | ||
| 398 | } | ||
| 399 | if (!IS_ERR(data->rst)) | ||
| 400 | reset_control_deassert(data->rst); | ||
| 410 | 401 | ||
| 411 | data->dma.rx_chan_id = -1; | 402 | data->dma.rx_chan_id = -1; |
| 412 | data->dma.tx_chan_id = -1; | 403 | data->dma.tx_chan_id = -1; |
| @@ -422,18 +413,21 @@ static int dw8250_probe(struct platform_device *pdev) | |||
| 422 | if (pdev->dev.of_node) { | 413 | if (pdev->dev.of_node) { |
| 423 | err = dw8250_probe_of(&uart.port, data); | 414 | err = dw8250_probe_of(&uart.port, data); |
| 424 | if (err) | 415 | if (err) |
| 425 | return err; | 416 | goto err_reset; |
| 426 | } else if (ACPI_HANDLE(&pdev->dev)) { | 417 | } else if (ACPI_HANDLE(&pdev->dev)) { |
| 427 | err = dw8250_probe_acpi(&uart, data); | 418 | err = dw8250_probe_acpi(&uart, data); |
| 428 | if (err) | 419 | if (err) |
| 429 | return err; | 420 | goto err_reset; |
| 430 | } else { | 421 | } else { |
| 431 | return -ENODEV; | 422 | err = -ENODEV; |
| 423 | goto err_reset; | ||
| 432 | } | 424 | } |
| 433 | 425 | ||
| 434 | data->line = serial8250_register_8250_port(&uart); | 426 | data->line = serial8250_register_8250_port(&uart); |
| 435 | if (data->line < 0) | 427 | if (data->line < 0) { |
| 436 | return data->line; | 428 | err = data->line; |
| 429 | goto err_reset; | ||
| 430 | } | ||
| 437 | 431 | ||
| 438 | platform_set_drvdata(pdev, data); | 432 | platform_set_drvdata(pdev, data); |
| 439 | 433 | ||
| @@ -441,6 +435,20 @@ static int dw8250_probe(struct platform_device *pdev) | |||
| 441 | pm_runtime_enable(&pdev->dev); | 435 | pm_runtime_enable(&pdev->dev); |
| 442 | 436 | ||
| 443 | return 0; | 437 | return 0; |
| 438 | |||
| 439 | err_reset: | ||
| 440 | if (!IS_ERR(data->rst)) | ||
| 441 | reset_control_assert(data->rst); | ||
| 442 | |||
| 443 | err_pclk: | ||
| 444 | if (!IS_ERR(data->pclk)) | ||
| 445 | clk_disable_unprepare(data->pclk); | ||
| 446 | |||
| 447 | err_clk: | ||
| 448 | if (!IS_ERR(data->clk)) | ||
| 449 | clk_disable_unprepare(data->clk); | ||
| 450 | |||
| 451 | return err; | ||
| 444 | } | 452 | } |
| 445 | 453 | ||
| 446 | static int dw8250_remove(struct platform_device *pdev) | 454 | static int dw8250_remove(struct platform_device *pdev) |
| @@ -451,6 +459,12 @@ static int dw8250_remove(struct platform_device *pdev) | |||
| 451 | 459 | ||
| 452 | serial8250_unregister_port(data->line); | 460 | serial8250_unregister_port(data->line); |
| 453 | 461 | ||
| 462 | if (!IS_ERR(data->rst)) | ||
| 463 | reset_control_assert(data->rst); | ||
| 464 | |||
| 465 | if (!IS_ERR(data->pclk)) | ||
| 466 | clk_disable_unprepare(data->pclk); | ||
| 467 | |||
| 454 | if (!IS_ERR(data->clk)) | 468 | if (!IS_ERR(data->clk)) |
| 455 | clk_disable_unprepare(data->clk); | 469 | clk_disable_unprepare(data->clk); |
| 456 | 470 | ||
| @@ -488,6 +502,9 @@ static int dw8250_runtime_suspend(struct device *dev) | |||
| 488 | if (!IS_ERR(data->clk)) | 502 | if (!IS_ERR(data->clk)) |
| 489 | clk_disable_unprepare(data->clk); | 503 | clk_disable_unprepare(data->clk); |
| 490 | 504 | ||
| 505 | if (!IS_ERR(data->pclk)) | ||
| 506 | clk_disable_unprepare(data->pclk); | ||
| 507 | |||
| 491 | return 0; | 508 | return 0; |
| 492 | } | 509 | } |
| 493 | 510 | ||
| @@ -495,6 +512,9 @@ static int dw8250_runtime_resume(struct device *dev) | |||
| 495 | { | 512 | { |
| 496 | struct dw8250_data *data = dev_get_drvdata(dev); | 513 | struct dw8250_data *data = dev_get_drvdata(dev); |
| 497 | 514 | ||
| 515 | if (!IS_ERR(data->pclk)) | ||
| 516 | clk_prepare_enable(data->pclk); | ||
| 517 | |||
| 498 | if (!IS_ERR(data->clk)) | 518 | if (!IS_ERR(data->clk)) |
| 499 | clk_prepare_enable(data->clk); | 519 | clk_prepare_enable(data->clk); |
| 500 | 520 | ||
| @@ -514,16 +534,12 @@ static const struct of_device_id dw8250_of_match[] = { | |||
| 514 | }; | 534 | }; |
| 515 | MODULE_DEVICE_TABLE(of, dw8250_of_match); | 535 | MODULE_DEVICE_TABLE(of, dw8250_of_match); |
| 516 | 536 | ||
| 517 | static struct dw8250_acpi_desc byt_8250_desc = { | ||
| 518 | .set_termios = byt_set_termios, | ||
| 519 | }; | ||
| 520 | |||
| 521 | static const struct acpi_device_id dw8250_acpi_match[] = { | 537 | static const struct acpi_device_id dw8250_acpi_match[] = { |
| 522 | { "INT33C4", 0 }, | 538 | { "INT33C4", 0 }, |
| 523 | { "INT33C5", 0 }, | 539 | { "INT33C5", 0 }, |
| 524 | { "INT3434", 0 }, | 540 | { "INT3434", 0 }, |
| 525 | { "INT3435", 0 }, | 541 | { "INT3435", 0 }, |
| 526 | { "80860F0A", (kernel_ulong_t)&byt_8250_desc}, | 542 | { "80860F0A", 0 }, |
| 527 | { }, | 543 | { }, |
| 528 | }; | 544 | }; |
| 529 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); | 545 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); |
diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c index f4d3c47b88e8..c0533a57ec53 100644 --- a/drivers/tty/serial/8250/8250_fsl.c +++ b/drivers/tty/serial/8250/8250_fsl.c | |||
| @@ -28,8 +28,7 @@ int fsl8250_handle_irq(struct uart_port *port) | |||
| 28 | unsigned char lsr, orig_lsr; | 28 | unsigned char lsr, orig_lsr; |
| 29 | unsigned long flags; | 29 | unsigned long flags; |
| 30 | unsigned int iir; | 30 | unsigned int iir; |
| 31 | struct uart_8250_port *up = | 31 | struct uart_8250_port *up = up_to_u8250p(port); |
| 32 | container_of(port, struct uart_8250_port, port); | ||
| 33 | 32 | ||
| 34 | spin_lock_irqsave(&up->port.lock, flags); | 33 | spin_lock_irqsave(&up->port.lock, flags); |
| 35 | 34 | ||
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 33137b3ba94d..61830b1792eb 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
| @@ -1581,8 +1581,7 @@ static int skip_tx_en_setup(struct serial_private *priv, | |||
| 1581 | 1581 | ||
| 1582 | static void kt_handle_break(struct uart_port *p) | 1582 | static void kt_handle_break(struct uart_port *p) |
| 1583 | { | 1583 | { |
| 1584 | struct uart_8250_port *up = | 1584 | struct uart_8250_port *up = up_to_u8250p(p); |
| 1585 | container_of(p, struct uart_8250_port, port); | ||
| 1586 | /* | 1585 | /* |
| 1587 | * On receipt of a BI, serial device in Intel ME (Intel | 1586 | * On receipt of a BI, serial device in Intel ME (Intel |
| 1588 | * management engine) needs to have its fifos cleared for sane | 1587 | * management engine) needs to have its fifos cleared for sane |
| @@ -1593,8 +1592,7 @@ static void kt_handle_break(struct uart_port *p) | |||
| 1593 | 1592 | ||
| 1594 | static unsigned int kt_serial_in(struct uart_port *p, int offset) | 1593 | static unsigned int kt_serial_in(struct uart_port *p, int offset) |
| 1595 | { | 1594 | { |
| 1596 | struct uart_8250_port *up = | 1595 | struct uart_8250_port *up = up_to_u8250p(p); |
| 1597 | container_of(p, struct uart_8250_port, port); | ||
| 1598 | unsigned int val; | 1596 | unsigned int val; |
| 1599 | 1597 | ||
| 1600 | /* | 1598 | /* |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index fb57159bad3a..26cec64dadd7 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
| @@ -238,7 +238,6 @@ config SERIAL_SAMSUNG_UARTS_4 | |||
| 238 | config SERIAL_SAMSUNG_UARTS | 238 | config SERIAL_SAMSUNG_UARTS |
| 239 | int | 239 | int |
| 240 | depends on PLAT_SAMSUNG | 240 | depends on PLAT_SAMSUNG |
| 241 | default 6 if CPU_S5P6450 | ||
| 242 | default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 | 241 | default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 |
| 243 | default 3 | 242 | default 3 |
| 244 | help | 243 | help |
| @@ -774,7 +773,7 @@ config SERIAL_HS_LPC32XX | |||
| 774 | 773 | ||
| 775 | config SERIAL_HS_LPC32XX_CONSOLE | 774 | config SERIAL_HS_LPC32XX_CONSOLE |
| 776 | bool "Enable LPC32XX high speed UART serial console" | 775 | bool "Enable LPC32XX high speed UART serial console" |
| 777 | depends on SERIAL_HS_LPC32XX | 776 | depends on SERIAL_HS_LPC32XX=y |
| 778 | select SERIAL_CORE_CONSOLE | 777 | select SERIAL_CORE_CONSOLE |
| 779 | help | 778 | help |
| 780 | If you would like to be able to use one of the high speed serial | 779 | If you would like to be able to use one of the high speed serial |
| @@ -1473,6 +1472,7 @@ config SERIAL_ARC_CONSOLE | |||
| 1473 | bool "Console on ARC UART" | 1472 | bool "Console on ARC UART" |
| 1474 | depends on SERIAL_ARC=y | 1473 | depends on SERIAL_ARC=y |
| 1475 | select SERIAL_CORE_CONSOLE | 1474 | select SERIAL_CORE_CONSOLE |
| 1475 | select SERIAL_EARLYCON | ||
| 1476 | help | 1476 | help |
| 1477 | Enable system Console on ARC UART | 1477 | Enable system Console on ARC UART |
| 1478 | 1478 | ||
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index 59b3da9bcc3f..d22e3d98ae23 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c | |||
| @@ -109,10 +109,6 @@ static void altera_jtaguart_break_ctl(struct uart_port *port, int break_state) | |||
| 109 | { | 109 | { |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | static void altera_jtaguart_enable_ms(struct uart_port *port) | ||
| 113 | { | ||
| 114 | } | ||
| 115 | |||
| 116 | static void altera_jtaguart_set_termios(struct uart_port *port, | 112 | static void altera_jtaguart_set_termios(struct uart_port *port, |
| 117 | struct ktermios *termios, | 113 | struct ktermios *termios, |
| 118 | struct ktermios *old) | 114 | struct ktermios *old) |
| @@ -291,7 +287,6 @@ static struct uart_ops altera_jtaguart_ops = { | |||
| 291 | .start_tx = altera_jtaguart_start_tx, | 287 | .start_tx = altera_jtaguart_start_tx, |
| 292 | .stop_tx = altera_jtaguart_stop_tx, | 288 | .stop_tx = altera_jtaguart_stop_tx, |
| 293 | .stop_rx = altera_jtaguart_stop_rx, | 289 | .stop_rx = altera_jtaguart_stop_rx, |
| 294 | .enable_ms = altera_jtaguart_enable_ms, | ||
| 295 | .break_ctl = altera_jtaguart_break_ctl, | 290 | .break_ctl = altera_jtaguart_break_ctl, |
| 296 | .startup = altera_jtaguart_startup, | 291 | .startup = altera_jtaguart_startup, |
| 297 | .shutdown = altera_jtaguart_shutdown, | 292 | .shutdown = altera_jtaguart_shutdown, |
| @@ -309,9 +304,8 @@ static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS]; | |||
| 309 | #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) | 304 | #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) |
| 310 | 305 | ||
| 311 | #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) | 306 | #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) |
| 312 | static void altera_jtaguart_console_putc(struct console *co, const char c) | 307 | static void altera_jtaguart_console_putc(struct uart_port *port, int c) |
| 313 | { | 308 | { |
| 314 | struct uart_port *port = &(altera_jtaguart_ports + co->index)->port; | ||
| 315 | unsigned long status; | 309 | unsigned long status; |
| 316 | unsigned long flags; | 310 | unsigned long flags; |
| 317 | 311 | ||
| @@ -330,9 +324,8 @@ static void altera_jtaguart_console_putc(struct console *co, const char c) | |||
| 330 | spin_unlock_irqrestore(&port->lock, flags); | 324 | spin_unlock_irqrestore(&port->lock, flags); |
| 331 | } | 325 | } |
| 332 | #else | 326 | #else |
| 333 | static void altera_jtaguart_console_putc(struct console *co, const char c) | 327 | static void altera_jtaguart_console_putc(struct uart_port *port, int c) |
| 334 | { | 328 | { |
| 335 | struct uart_port *port = &(altera_jtaguart_ports + co->index)->port; | ||
| 336 | unsigned long flags; | 329 | unsigned long flags; |
| 337 | 330 | ||
| 338 | spin_lock_irqsave(&port->lock, flags); | 331 | spin_lock_irqsave(&port->lock, flags); |
| @@ -350,11 +343,9 @@ static void altera_jtaguart_console_putc(struct console *co, const char c) | |||
| 350 | static void altera_jtaguart_console_write(struct console *co, const char *s, | 343 | static void altera_jtaguart_console_write(struct console *co, const char *s, |
| 351 | unsigned int count) | 344 | unsigned int count) |
| 352 | { | 345 | { |
| 353 | for (; count; count--, s++) { | 346 | struct uart_port *port = &(altera_jtaguart_ports + co->index)->port; |
| 354 | altera_jtaguart_console_putc(co, *s); | 347 | |
| 355 | if (*s == '\n') | 348 | uart_console_write(port, s, count, altera_jtaguart_console_putc); |
| 356 | altera_jtaguart_console_putc(co, '\r'); | ||
| 357 | } | ||
| 358 | } | 349 | } |
| 359 | 350 | ||
| 360 | static int __init altera_jtaguart_console_setup(struct console *co, | 351 | static int __init altera_jtaguart_console_setup(struct console *co, |
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 323376668b72..6a243239dbef 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
| @@ -163,10 +163,6 @@ static void altera_uart_break_ctl(struct uart_port *port, int break_state) | |||
| 163 | spin_unlock_irqrestore(&port->lock, flags); | 163 | spin_unlock_irqrestore(&port->lock, flags); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | static void altera_uart_enable_ms(struct uart_port *port) | ||
| 167 | { | ||
| 168 | } | ||
| 169 | |||
| 170 | static void altera_uart_set_termios(struct uart_port *port, | 166 | static void altera_uart_set_termios(struct uart_port *port, |
| 171 | struct ktermios *termios, | 167 | struct ktermios *termios, |
| 172 | struct ktermios *old) | 168 | struct ktermios *old) |
| @@ -415,7 +411,6 @@ static struct uart_ops altera_uart_ops = { | |||
| 415 | .start_tx = altera_uart_start_tx, | 411 | .start_tx = altera_uart_start_tx, |
| 416 | .stop_tx = altera_uart_stop_tx, | 412 | .stop_tx = altera_uart_stop_tx, |
| 417 | .stop_rx = altera_uart_stop_rx, | 413 | .stop_rx = altera_uart_stop_rx, |
| 418 | .enable_ms = altera_uart_enable_ms, | ||
| 419 | .break_ctl = altera_uart_break_ctl, | 414 | .break_ctl = altera_uart_break_ctl, |
| 420 | .startup = altera_uart_startup, | 415 | .startup = altera_uart_startup, |
| 421 | .shutdown = altera_uart_shutdown, | 416 | .shutdown = altera_uart_shutdown, |
| @@ -435,7 +430,7 @@ static struct altera_uart altera_uart_ports[CONFIG_SERIAL_ALTERA_UART_MAXPORTS]; | |||
| 435 | 430 | ||
| 436 | #if defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) | 431 | #if defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) |
| 437 | 432 | ||
| 438 | static void altera_uart_console_putc(struct uart_port *port, const char c) | 433 | static void altera_uart_console_putc(struct uart_port *port, int c) |
| 439 | { | 434 | { |
| 440 | while (!(altera_uart_readl(port, ALTERA_UART_STATUS_REG) & | 435 | while (!(altera_uart_readl(port, ALTERA_UART_STATUS_REG) & |
| 441 | ALTERA_UART_STATUS_TRDY_MSK)) | 436 | ALTERA_UART_STATUS_TRDY_MSK)) |
| @@ -449,11 +444,7 @@ static void altera_uart_console_write(struct console *co, const char *s, | |||
| 449 | { | 444 | { |
| 450 | struct uart_port *port = &(altera_uart_ports + co->index)->port; | 445 | struct uart_port *port = &(altera_uart_ports + co->index)->port; |
| 451 | 446 | ||
| 452 | for (; count; count--, s++) { | 447 | uart_console_write(port, s, count, altera_uart_console_putc); |
| 453 | altera_uart_console_putc(port, *s); | ||
| 454 | if (*s == '\n') | ||
| 455 | altera_uart_console_putc(port, '\r'); | ||
| 456 | } | ||
| 457 | } | 448 | } |
| 458 | 449 | ||
| 459 | static int __init altera_uart_console_setup(struct console *co, char *options) | 450 | static int __init altera_uart_console_setup(struct console *co, char *options) |
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index 971af1e22d0f..2064d31d0c8b 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c | |||
| @@ -46,8 +46,7 @@ | |||
| 46 | #include <linux/amba/serial.h> | 46 | #include <linux/amba/serial.h> |
| 47 | #include <linux/clk.h> | 47 | #include <linux/clk.h> |
| 48 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
| 49 | 49 | #include <linux/io.h> | |
| 50 | #include <asm/io.h> | ||
| 51 | 50 | ||
| 52 | #define UART_NR 8 | 51 | #define UART_NR 8 |
| 53 | 52 | ||
| @@ -688,28 +687,22 @@ static int pl010_probe(struct amba_device *dev, const struct amba_id *id) | |||
| 688 | if (amba_ports[i] == NULL) | 687 | if (amba_ports[i] == NULL) |
| 689 | break; | 688 | break; |
| 690 | 689 | ||
| 691 | if (i == ARRAY_SIZE(amba_ports)) { | 690 | if (i == ARRAY_SIZE(amba_ports)) |
| 692 | ret = -EBUSY; | 691 | return -EBUSY; |
| 693 | goto out; | ||
| 694 | } | ||
| 695 | 692 | ||
| 696 | uap = kzalloc(sizeof(struct uart_amba_port), GFP_KERNEL); | 693 | uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port), |
| 697 | if (!uap) { | 694 | GFP_KERNEL); |
| 698 | ret = -ENOMEM; | 695 | if (!uap) |
| 699 | goto out; | 696 | return -ENOMEM; |
| 700 | } | ||
| 701 | 697 | ||
| 702 | base = ioremap(dev->res.start, resource_size(&dev->res)); | 698 | base = devm_ioremap(&dev->dev, dev->res.start, |
| 703 | if (!base) { | 699 | resource_size(&dev->res)); |
| 704 | ret = -ENOMEM; | 700 | if (!base) |
| 705 | goto free; | 701 | return -ENOMEM; |
| 706 | } | ||
| 707 | 702 | ||
| 708 | uap->clk = clk_get(&dev->dev, NULL); | 703 | uap->clk = devm_clk_get(&dev->dev, NULL); |
| 709 | if (IS_ERR(uap->clk)) { | 704 | if (IS_ERR(uap->clk)) |
| 710 | ret = PTR_ERR(uap->clk); | 705 | return PTR_ERR(uap->clk); |
| 711 | goto unmap; | ||
| 712 | } | ||
| 713 | 706 | ||
| 714 | uap->port.dev = &dev->dev; | 707 | uap->port.dev = &dev->dev; |
| 715 | uap->port.mapbase = dev->res.start; | 708 | uap->port.mapbase = dev->res.start; |
| @@ -727,15 +720,9 @@ static int pl010_probe(struct amba_device *dev, const struct amba_id *id) | |||
| 727 | 720 | ||
| 728 | amba_set_drvdata(dev, uap); | 721 | amba_set_drvdata(dev, uap); |
| 729 | ret = uart_add_one_port(&amba_reg, &uap->port); | 722 | ret = uart_add_one_port(&amba_reg, &uap->port); |
| 730 | if (ret) { | 723 | if (ret) |
| 731 | amba_ports[i] = NULL; | 724 | amba_ports[i] = NULL; |
| 732 | clk_put(uap->clk); | 725 | |
| 733 | unmap: | ||
| 734 | iounmap(base); | ||
| 735 | free: | ||
| 736 | kfree(uap); | ||
| 737 | } | ||
| 738 | out: | ||
| 739 | return ret; | 726 | return ret; |
| 740 | } | 727 | } |
| 741 | 728 | ||
| @@ -750,9 +737,6 @@ static int pl010_remove(struct amba_device *dev) | |||
| 750 | if (amba_ports[i] == uap) | 737 | if (amba_ports[i] == uap) |
| 751 | amba_ports[i] = NULL; | 738 | amba_ports[i] = NULL; |
| 752 | 739 | ||
| 753 | iounmap(uap->port.membase); | ||
| 754 | clk_put(uap->clk); | ||
| 755 | kfree(uap); | ||
| 756 | return 0; | 740 | return 0; |
| 757 | } | 741 | } |
| 758 | 742 | ||
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 0e26dcbd5ea4..8572f2a57fc8 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
| @@ -1484,7 +1484,7 @@ static int pl011_hwinit(struct uart_port *port) | |||
| 1484 | */ | 1484 | */ |
| 1485 | retval = clk_prepare_enable(uap->clk); | 1485 | retval = clk_prepare_enable(uap->clk); |
| 1486 | if (retval) | 1486 | if (retval) |
| 1487 | goto out; | 1487 | return retval; |
| 1488 | 1488 | ||
| 1489 | uap->port.uartclk = clk_get_rate(uap->clk); | 1489 | uap->port.uartclk = clk_get_rate(uap->clk); |
| 1490 | 1490 | ||
| @@ -1507,8 +1507,6 @@ static int pl011_hwinit(struct uart_port *port) | |||
| 1507 | plat->init(); | 1507 | plat->init(); |
| 1508 | } | 1508 | } |
| 1509 | return 0; | 1509 | return 0; |
| 1510 | out: | ||
| 1511 | return retval; | ||
| 1512 | } | 1510 | } |
| 1513 | 1511 | ||
| 1514 | static void pl011_write_lcr_h(struct uart_amba_port *uap, unsigned int lcr_h) | 1512 | static void pl011_write_lcr_h(struct uart_amba_port *uap, unsigned int lcr_h) |
| @@ -2131,32 +2129,24 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
| 2131 | if (amba_ports[i] == NULL) | 2129 | if (amba_ports[i] == NULL) |
| 2132 | break; | 2130 | break; |
| 2133 | 2131 | ||
| 2134 | if (i == ARRAY_SIZE(amba_ports)) { | 2132 | if (i == ARRAY_SIZE(amba_ports)) |
| 2135 | ret = -EBUSY; | 2133 | return -EBUSY; |
| 2136 | goto out; | ||
| 2137 | } | ||
| 2138 | 2134 | ||
| 2139 | uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port), | 2135 | uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port), |
| 2140 | GFP_KERNEL); | 2136 | GFP_KERNEL); |
| 2141 | if (uap == NULL) { | 2137 | if (uap == NULL) |
| 2142 | ret = -ENOMEM; | 2138 | return -ENOMEM; |
| 2143 | goto out; | ||
| 2144 | } | ||
| 2145 | 2139 | ||
| 2146 | i = pl011_probe_dt_alias(i, &dev->dev); | 2140 | i = pl011_probe_dt_alias(i, &dev->dev); |
| 2147 | 2141 | ||
| 2148 | base = devm_ioremap(&dev->dev, dev->res.start, | 2142 | base = devm_ioremap(&dev->dev, dev->res.start, |
| 2149 | resource_size(&dev->res)); | 2143 | resource_size(&dev->res)); |
| 2150 | if (!base) { | 2144 | if (!base) |
| 2151 | ret = -ENOMEM; | 2145 | return -ENOMEM; |
| 2152 | goto out; | ||
| 2153 | } | ||
| 2154 | 2146 | ||
| 2155 | uap->clk = devm_clk_get(&dev->dev, NULL); | 2147 | uap->clk = devm_clk_get(&dev->dev, NULL); |
| 2156 | if (IS_ERR(uap->clk)) { | 2148 | if (IS_ERR(uap->clk)) |
| 2157 | ret = PTR_ERR(uap->clk); | 2149 | return PTR_ERR(uap->clk); |
| 2158 | goto out; | ||
| 2159 | } | ||
| 2160 | 2150 | ||
| 2161 | uap->vendor = vendor; | 2151 | uap->vendor = vendor; |
| 2162 | uap->lcrh_rx = vendor->lcrh_rx; | 2152 | uap->lcrh_rx = vendor->lcrh_rx; |
| @@ -2198,7 +2188,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
| 2198 | uart_unregister_driver(&amba_reg); | 2188 | uart_unregister_driver(&amba_reg); |
| 2199 | pl011_dma_remove(uap); | 2189 | pl011_dma_remove(uap); |
| 2200 | } | 2190 | } |
| 2201 | out: | 2191 | |
| 2202 | return ret; | 2192 | return ret; |
| 2203 | } | 2193 | } |
| 2204 | 2194 | ||
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index de11ab8ffd91..a34a0cec1685 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c | |||
| @@ -71,11 +71,6 @@ static void apbuart_stop_rx(struct uart_port *port) | |||
| 71 | UART_PUT_CTRL(port, cr); | 71 | UART_PUT_CTRL(port, cr); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static void apbuart_enable_ms(struct uart_port *port) | ||
| 75 | { | ||
| 76 | /* No modem status change interrupts for APBUART */ | ||
| 77 | } | ||
| 78 | |||
| 79 | static void apbuart_rx_chars(struct uart_port *port) | 74 | static void apbuart_rx_chars(struct uart_port *port) |
| 80 | { | 75 | { |
| 81 | unsigned int status, ch, rsr, flag; | 76 | unsigned int status, ch, rsr, flag; |
| @@ -337,7 +332,6 @@ static struct uart_ops grlib_apbuart_ops = { | |||
| 337 | .stop_tx = apbuart_stop_tx, | 332 | .stop_tx = apbuart_stop_tx, |
| 338 | .start_tx = apbuart_start_tx, | 333 | .start_tx = apbuart_start_tx, |
| 339 | .stop_rx = apbuart_stop_rx, | 334 | .stop_rx = apbuart_stop_rx, |
| 340 | .enable_ms = apbuart_enable_ms, | ||
| 341 | .break_ctl = apbuart_break_ctl, | 335 | .break_ctl = apbuart_break_ctl, |
| 342 | .startup = apbuart_startup, | 336 | .startup = apbuart_startup, |
| 343 | .shutdown = apbuart_shutdown, | 337 | .shutdown = apbuart_shutdown, |
diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c index acd03af7cd52..0be1c45efd65 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c | |||
| @@ -176,10 +176,6 @@ static void ar933x_uart_break_ctl(struct uart_port *port, int break_state) | |||
| 176 | spin_unlock_irqrestore(&up->port.lock, flags); | 176 | spin_unlock_irqrestore(&up->port.lock, flags); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static void ar933x_uart_enable_ms(struct uart_port *port) | ||
| 180 | { | ||
| 181 | } | ||
| 182 | |||
| 183 | /* | 179 | /* |
| 184 | * baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) | 180 | * baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) |
| 185 | */ | 181 | */ |
| @@ -495,7 +491,6 @@ static struct uart_ops ar933x_uart_ops = { | |||
| 495 | .stop_tx = ar933x_uart_stop_tx, | 491 | .stop_tx = ar933x_uart_stop_tx, |
| 496 | .start_tx = ar933x_uart_start_tx, | 492 | .start_tx = ar933x_uart_start_tx, |
| 497 | .stop_rx = ar933x_uart_stop_rx, | 493 | .stop_rx = ar933x_uart_stop_rx, |
| 498 | .enable_ms = ar933x_uart_enable_ms, | ||
| 499 | .break_ctl = ar933x_uart_break_ctl, | 494 | .break_ctl = ar933x_uart_break_ctl, |
| 500 | .startup = ar933x_uart_startup, | 495 | .startup = ar933x_uart_startup, |
| 501 | .shutdown = ar933x_uart_shutdown, | 496 | .shutdown = ar933x_uart_shutdown, |
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index 008c223eaf26..a59d1d77e750 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
| @@ -37,8 +37,8 @@ | |||
| 37 | #include <linux/tty_flip.h> | 37 | #include <linux/tty_flip.h> |
| 38 | #include <linux/serial_core.h> | 38 | #include <linux/serial_core.h> |
| 39 | #include <linux/io.h> | 39 | #include <linux/io.h> |
| 40 | #include <linux/of.h> | 40 | #include <linux/of_irq.h> |
| 41 | #include <linux/of_platform.h> | 41 | #include <linux/of_address.h> |
| 42 | 42 | ||
| 43 | /************************************* | 43 | /************************************* |
| 44 | * ARC UART Hardware Specs | 44 | * ARC UART Hardware Specs |
| @@ -72,7 +72,7 @@ | |||
| 72 | #define RXOERR 0x02 /* OverFlow Err: Char recv but RXFULL still set */ | 72 | #define RXOERR 0x02 /* OverFlow Err: Char recv but RXFULL still set */ |
| 73 | 73 | ||
| 74 | /* Uart bit fiddling helpers: lowest level */ | 74 | /* Uart bit fiddling helpers: lowest level */ |
| 75 | #define RBASE(uart, reg) (uart->port.membase + reg) | 75 | #define RBASE(port, reg) (port->membase + reg) |
| 76 | #define UART_REG_SET(u, r, v) writeb((v), RBASE(u, r)) | 76 | #define UART_REG_SET(u, r, v) writeb((v), RBASE(u, r)) |
| 77 | #define UART_REG_GET(u, r) readb(RBASE(u, r)) | 77 | #define UART_REG_GET(u, r) readb(RBASE(u, r)) |
| 78 | 78 | ||
| @@ -102,7 +102,6 @@ | |||
| 102 | struct arc_uart_port { | 102 | struct arc_uart_port { |
| 103 | struct uart_port port; | 103 | struct uart_port port; |
| 104 | unsigned long baud; | 104 | unsigned long baud; |
| 105 | int is_emulated; /* H/w vs. Instruction Set Simulator */ | ||
| 106 | }; | 105 | }; |
| 107 | 106 | ||
| 108 | #define to_arc_port(uport) container_of(uport, struct arc_uart_port, port) | 107 | #define to_arc_port(uport) container_of(uport, struct arc_uart_port, port) |
| @@ -129,19 +128,15 @@ static struct uart_driver arc_uart_driver = { | |||
| 129 | 128 | ||
| 130 | static void arc_serial_stop_rx(struct uart_port *port) | 129 | static void arc_serial_stop_rx(struct uart_port *port) |
| 131 | { | 130 | { |
| 132 | struct arc_uart_port *uart = to_arc_port(port); | 131 | UART_RX_IRQ_DISABLE(port); |
| 133 | |||
| 134 | UART_RX_IRQ_DISABLE(uart); | ||
| 135 | } | 132 | } |
| 136 | 133 | ||
| 137 | static void arc_serial_stop_tx(struct uart_port *port) | 134 | static void arc_serial_stop_tx(struct uart_port *port) |
| 138 | { | 135 | { |
| 139 | struct arc_uart_port *uart = to_arc_port(port); | 136 | while (!(UART_GET_STATUS(port) & TXEMPTY)) |
| 140 | |||
| 141 | while (!(UART_GET_STATUS(uart) & TXEMPTY)) | ||
| 142 | cpu_relax(); | 137 | cpu_relax(); |
| 143 | 138 | ||
| 144 | UART_TX_IRQ_DISABLE(uart); | 139 | UART_TX_IRQ_DISABLE(port); |
| 145 | } | 140 | } |
| 146 | 141 | ||
| 147 | /* | 142 | /* |
| @@ -149,10 +144,9 @@ static void arc_serial_stop_tx(struct uart_port *port) | |||
| 149 | */ | 144 | */ |
| 150 | static unsigned int arc_serial_tx_empty(struct uart_port *port) | 145 | static unsigned int arc_serial_tx_empty(struct uart_port *port) |
| 151 | { | 146 | { |
| 152 | struct arc_uart_port *uart = to_arc_port(port); | ||
| 153 | unsigned int stat; | 147 | unsigned int stat; |
| 154 | 148 | ||
| 155 | stat = UART_GET_STATUS(uart); | 149 | stat = UART_GET_STATUS(port); |
| 156 | if (stat & TXEMPTY) | 150 | if (stat & TXEMPTY) |
| 157 | return TIOCSER_TEMT; | 151 | return TIOCSER_TEMT; |
| 158 | 152 | ||
| @@ -166,24 +160,24 @@ static unsigned int arc_serial_tx_empty(struct uart_port *port) | |||
| 166 | * = by uart_start( ) before calling us | 160 | * = by uart_start( ) before calling us |
| 167 | * = tx_ist checks that too before calling | 161 | * = tx_ist checks that too before calling |
| 168 | */ | 162 | */ |
| 169 | static void arc_serial_tx_chars(struct arc_uart_port *uart) | 163 | static void arc_serial_tx_chars(struct uart_port *port) |
| 170 | { | 164 | { |
| 171 | struct circ_buf *xmit = &uart->port.state->xmit; | 165 | struct circ_buf *xmit = &port->state->xmit; |
| 172 | int sent = 0; | 166 | int sent = 0; |
| 173 | unsigned char ch; | 167 | unsigned char ch; |
| 174 | 168 | ||
| 175 | if (unlikely(uart->port.x_char)) { | 169 | if (unlikely(port->x_char)) { |
| 176 | UART_SET_DATA(uart, uart->port.x_char); | 170 | UART_SET_DATA(port, port->x_char); |
| 177 | uart->port.icount.tx++; | 171 | port->icount.tx++; |
| 178 | uart->port.x_char = 0; | 172 | port->x_char = 0; |
| 179 | sent = 1; | 173 | sent = 1; |
| 180 | } else if (!uart_circ_empty(xmit)) { | 174 | } else if (!uart_circ_empty(xmit)) { |
| 181 | ch = xmit->buf[xmit->tail]; | 175 | ch = xmit->buf[xmit->tail]; |
| 182 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 176 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
| 183 | uart->port.icount.tx++; | 177 | port->icount.tx++; |
| 184 | while (!(UART_GET_STATUS(uart) & TXEMPTY)) | 178 | while (!(UART_GET_STATUS(port) & TXEMPTY)) |
| 185 | cpu_relax(); | 179 | cpu_relax(); |
| 186 | UART_SET_DATA(uart, ch); | 180 | UART_SET_DATA(port, ch); |
| 187 | sent = 1; | 181 | sent = 1; |
| 188 | } | 182 | } |
| 189 | 183 | ||
| @@ -192,10 +186,10 @@ static void arc_serial_tx_chars(struct arc_uart_port *uart) | |||
| 192 | * By Hard ISR to schedule processing in software interrupt part | 186 | * By Hard ISR to schedule processing in software interrupt part |
| 193 | */ | 187 | */ |
| 194 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 188 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
| 195 | uart_write_wakeup(&uart->port); | 189 | uart_write_wakeup(port); |
| 196 | 190 | ||
| 197 | if (sent) | 191 | if (sent) |
| 198 | UART_TX_IRQ_ENABLE(uart); | 192 | UART_TX_IRQ_ENABLE(port); |
| 199 | } | 193 | } |
| 200 | 194 | ||
| 201 | /* | 195 | /* |
| @@ -204,12 +198,10 @@ static void arc_serial_tx_chars(struct arc_uart_port *uart) | |||
| 204 | */ | 198 | */ |
| 205 | static void arc_serial_start_tx(struct uart_port *port) | 199 | static void arc_serial_start_tx(struct uart_port *port) |
| 206 | { | 200 | { |
| 207 | struct arc_uart_port *uart = to_arc_port(port); | 201 | arc_serial_tx_chars(port); |
| 208 | |||
| 209 | arc_serial_tx_chars(uart); | ||
| 210 | } | 202 | } |
| 211 | 203 | ||
| 212 | static void arc_serial_rx_chars(struct arc_uart_port *uart, unsigned int status) | 204 | static void arc_serial_rx_chars(struct uart_port *port, unsigned int status) |
| 213 | { | 205 | { |
| 214 | unsigned int ch, flg = 0; | 206 | unsigned int ch, flg = 0; |
| 215 | 207 | ||
| @@ -229,15 +221,15 @@ static void arc_serial_rx_chars(struct arc_uart_port *uart, unsigned int status) | |||
| 229 | */ | 221 | */ |
| 230 | if (unlikely(status & (RXOERR | RXFERR))) { | 222 | if (unlikely(status & (RXOERR | RXFERR))) { |
| 231 | if (status & RXOERR) { | 223 | if (status & RXOERR) { |
| 232 | uart->port.icount.overrun++; | 224 | port->icount.overrun++; |
| 233 | flg = TTY_OVERRUN; | 225 | flg = TTY_OVERRUN; |
| 234 | UART_CLR_STATUS(uart, RXOERR); | 226 | UART_CLR_STATUS(port, RXOERR); |
| 235 | } | 227 | } |
| 236 | 228 | ||
| 237 | if (status & RXFERR) { | 229 | if (status & RXFERR) { |
| 238 | uart->port.icount.frame++; | 230 | port->icount.frame++; |
| 239 | flg = TTY_FRAME; | 231 | flg = TTY_FRAME; |
| 240 | UART_CLR_STATUS(uart, RXFERR); | 232 | UART_CLR_STATUS(port, RXFERR); |
| 241 | } | 233 | } |
| 242 | } else | 234 | } else |
| 243 | flg = TTY_NORMAL; | 235 | flg = TTY_NORMAL; |
| @@ -245,16 +237,16 @@ static void arc_serial_rx_chars(struct arc_uart_port *uart, unsigned int status) | |||
| 245 | if (status & RXEMPTY) | 237 | if (status & RXEMPTY) |
| 246 | continue; | 238 | continue; |
| 247 | 239 | ||
| 248 | ch = UART_GET_DATA(uart); | 240 | ch = UART_GET_DATA(port); |
| 249 | uart->port.icount.rx++; | 241 | port->icount.rx++; |
| 250 | 242 | ||
| 251 | if (!(uart_handle_sysrq_char(&uart->port, ch))) | 243 | if (!(uart_handle_sysrq_char(port, ch))) |
| 252 | uart_insert_char(&uart->port, status, RXOERR, ch, flg); | 244 | uart_insert_char(port, status, RXOERR, ch, flg); |
| 253 | 245 | ||
| 254 | spin_unlock(&uart->port.lock); | 246 | spin_unlock(&port->lock); |
| 255 | tty_flip_buffer_push(&uart->port.state->port); | 247 | tty_flip_buffer_push(&port->state->port); |
| 256 | spin_lock(&uart->port.lock); | 248 | spin_lock(&port->lock); |
| 257 | } while (!((status = UART_GET_STATUS(uart)) & RXEMPTY)); | 249 | } while (!((status = UART_GET_STATUS(port)) & RXEMPTY)); |
| 258 | } | 250 | } |
| 259 | 251 | ||
| 260 | /* | 252 | /* |
| @@ -287,10 +279,10 @@ static void arc_serial_rx_chars(struct arc_uart_port *uart, unsigned int status) | |||
| 287 | 279 | ||
| 288 | static irqreturn_t arc_serial_isr(int irq, void *dev_id) | 280 | static irqreturn_t arc_serial_isr(int irq, void *dev_id) |
| 289 | { | 281 | { |
| 290 | struct arc_uart_port *uart = dev_id; | 282 | struct uart_port *port = dev_id; |
| 291 | unsigned int status; | 283 | unsigned int status; |
| 292 | 284 | ||
| 293 | status = UART_GET_STATUS(uart); | 285 | status = UART_GET_STATUS(port); |
| 294 | 286 | ||
| 295 | /* | 287 | /* |
| 296 | * Single IRQ for both Rx (data available) Tx (room available) Interrupt | 288 | * Single IRQ for both Rx (data available) Tx (room available) Interrupt |
| @@ -300,9 +292,9 @@ static irqreturn_t arc_serial_isr(int irq, void *dev_id) | |||
| 300 | if (status & RXIENB) { | 292 | if (status & RXIENB) { |
| 301 | 293 | ||
| 302 | /* already in ISR, no need of xx_irqsave */ | 294 | /* already in ISR, no need of xx_irqsave */ |
| 303 | spin_lock(&uart->port.lock); | 295 | spin_lock(&port->lock); |
| 304 | arc_serial_rx_chars(uart, status); | 296 | arc_serial_rx_chars(port, status); |
| 305 | spin_unlock(&uart->port.lock); | 297 | spin_unlock(&port->lock); |
| 306 | } | 298 | } |
| 307 | 299 | ||
| 308 | if ((status & TXIENB) && (status & TXEMPTY)) { | 300 | if ((status & TXIENB) && (status & TXEMPTY)) { |
| @@ -310,14 +302,14 @@ static irqreturn_t arc_serial_isr(int irq, void *dev_id) | |||
| 310 | /* Unconditionally disable further Tx-Interrupts. | 302 | /* Unconditionally disable further Tx-Interrupts. |
| 311 | * will be enabled by tx_chars() if needed. | 303 | * will be enabled by tx_chars() if needed. |
| 312 | */ | 304 | */ |
| 313 | UART_TX_IRQ_DISABLE(uart); | 305 | UART_TX_IRQ_DISABLE(port); |
| 314 | 306 | ||
| 315 | spin_lock(&uart->port.lock); | 307 | spin_lock(&port->lock); |
| 316 | 308 | ||
| 317 | if (!uart_tx_stopped(&uart->port)) | 309 | if (!uart_tx_stopped(port)) |
| 318 | arc_serial_tx_chars(uart); | 310 | arc_serial_tx_chars(port); |
| 319 | 311 | ||
| 320 | spin_unlock(&uart->port.lock); | 312 | spin_unlock(&port->lock); |
| 321 | } | 313 | } |
| 322 | 314 | ||
| 323 | return IRQ_HANDLED; | 315 | return IRQ_HANDLED; |
| @@ -340,13 +332,6 @@ static void arc_serial_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
| 340 | /* MCR not present */ | 332 | /* MCR not present */ |
| 341 | } | 333 | } |
| 342 | 334 | ||
| 343 | /* Enable Modem Status Interrupts */ | ||
| 344 | |||
| 345 | static void arc_serial_enable_ms(struct uart_port *port) | ||
| 346 | { | ||
| 347 | /* MSR not present */ | ||
| 348 | } | ||
| 349 | |||
| 350 | static void arc_serial_break_ctl(struct uart_port *port, int break_state) | 335 | static void arc_serial_break_ctl(struct uart_port *port, int break_state) |
| 351 | { | 336 | { |
| 352 | /* ARC UART doesn't support sending Break signal */ | 337 | /* ARC UART doesn't support sending Break signal */ |
| @@ -354,18 +339,15 @@ static void arc_serial_break_ctl(struct uart_port *port, int break_state) | |||
| 354 | 339 | ||
| 355 | static int arc_serial_startup(struct uart_port *port) | 340 | static int arc_serial_startup(struct uart_port *port) |
| 356 | { | 341 | { |
| 357 | struct arc_uart_port *uart = to_arc_port(port); | ||
| 358 | |||
| 359 | /* Before we hook up the ISR, Disable all UART Interrupts */ | 342 | /* Before we hook up the ISR, Disable all UART Interrupts */ |
| 360 | UART_ALL_IRQ_DISABLE(uart); | 343 | UART_ALL_IRQ_DISABLE(port); |
| 361 | 344 | ||
| 362 | if (request_irq(uart->port.irq, arc_serial_isr, 0, "arc uart rx-tx", | 345 | if (request_irq(port->irq, arc_serial_isr, 0, "arc uart rx-tx", port)) { |
| 363 | uart)) { | 346 | dev_warn(port->dev, "Unable to attach ARC UART intr\n"); |
| 364 | dev_warn(uart->port.dev, "Unable to attach ARC UART intr\n"); | ||
| 365 | return -EBUSY; | 347 | return -EBUSY; |
| 366 | } | 348 | } |
| 367 | 349 | ||
| 368 | UART_RX_IRQ_ENABLE(uart); /* Only Rx IRQ enabled to begin with */ | 350 | UART_RX_IRQ_ENABLE(port); /* Only Rx IRQ enabled to begin with */ |
| 369 | 351 | ||
| 370 | return 0; | 352 | return 0; |
| 371 | } | 353 | } |
| @@ -373,8 +355,7 @@ static int arc_serial_startup(struct uart_port *port) | |||
| 373 | /* This is not really needed */ | 355 | /* This is not really needed */ |
| 374 | static void arc_serial_shutdown(struct uart_port *port) | 356 | static void arc_serial_shutdown(struct uart_port *port) |
| 375 | { | 357 | { |
| 376 | struct arc_uart_port *uart = to_arc_port(port); | 358 | free_irq(port->irq, port); |
| 377 | free_irq(uart->port.irq, uart); | ||
| 378 | } | 359 | } |
| 379 | 360 | ||
| 380 | static void | 361 | static void |
| @@ -398,25 +379,14 @@ arc_serial_set_termios(struct uart_port *port, struct ktermios *new, | |||
| 398 | uartl = hw_val & 0xFF; | 379 | uartl = hw_val & 0xFF; |
| 399 | uarth = (hw_val >> 8) & 0xFF; | 380 | uarth = (hw_val >> 8) & 0xFF; |
| 400 | 381 | ||
| 401 | /* | ||
| 402 | * UART ISS(Instruction Set simulator) emulation has a subtle bug: | ||
| 403 | * A existing value of Baudh = 0 is used as a indication to startup | ||
| 404 | * it's internal state machine. | ||
| 405 | * Thus if baudh is set to 0, 2 times, it chokes. | ||
| 406 | * This happens with BAUD=115200 and the formaula above | ||
| 407 | * Until that is fixed, when running on ISS, we will set baudh to !0 | ||
| 408 | */ | ||
| 409 | if (uart->is_emulated) | ||
| 410 | uarth = 1; | ||
| 411 | |||
| 412 | spin_lock_irqsave(&port->lock, flags); | 382 | spin_lock_irqsave(&port->lock, flags); |
| 413 | 383 | ||
| 414 | UART_ALL_IRQ_DISABLE(uart); | 384 | UART_ALL_IRQ_DISABLE(port); |
| 415 | 385 | ||
| 416 | UART_SET_BAUDL(uart, uartl); | 386 | UART_SET_BAUDL(port, uartl); |
| 417 | UART_SET_BAUDH(uart, uarth); | 387 | UART_SET_BAUDH(port, uarth); |
| 418 | 388 | ||
| 419 | UART_RX_IRQ_ENABLE(uart); | 389 | UART_RX_IRQ_ENABLE(port); |
| 420 | 390 | ||
| 421 | /* | 391 | /* |
| 422 | * UART doesn't support Parity/Hardware Flow Control; | 392 | * UART doesn't support Parity/Hardware Flow Control; |
| @@ -439,9 +409,7 @@ arc_serial_set_termios(struct uart_port *port, struct ktermios *new, | |||
| 439 | 409 | ||
| 440 | static const char *arc_serial_type(struct uart_port *port) | 410 | static const char *arc_serial_type(struct uart_port *port) |
| 441 | { | 411 | { |
| 442 | struct arc_uart_port *uart = to_arc_port(port); | 412 | return port->type == PORT_ARC ? DRIVER_NAME : NULL; |
| 443 | |||
| 444 | return uart->port.type == PORT_ARC ? DRIVER_NAME : NULL; | ||
| 445 | } | 413 | } |
| 446 | 414 | ||
| 447 | static void arc_serial_release_port(struct uart_port *port) | 415 | static void arc_serial_release_port(struct uart_port *port) |
| @@ -470,35 +438,28 @@ arc_serial_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
| 470 | */ | 438 | */ |
| 471 | static void arc_serial_config_port(struct uart_port *port, int flags) | 439 | static void arc_serial_config_port(struct uart_port *port, int flags) |
| 472 | { | 440 | { |
| 473 | struct arc_uart_port *uart = to_arc_port(port); | ||
| 474 | |||
| 475 | if (flags & UART_CONFIG_TYPE) | 441 | if (flags & UART_CONFIG_TYPE) |
| 476 | uart->port.type = PORT_ARC; | 442 | port->type = PORT_ARC; |
| 477 | } | 443 | } |
| 478 | 444 | ||
| 479 | #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_ARC_CONSOLE) | 445 | #ifdef CONFIG_CONSOLE_POLL |
| 480 | 446 | ||
| 481 | static void arc_serial_poll_putchar(struct uart_port *port, unsigned char chr) | 447 | static void arc_serial_poll_putchar(struct uart_port *port, unsigned char chr) |
| 482 | { | 448 | { |
| 483 | struct arc_uart_port *uart = to_arc_port(port); | 449 | while (!(UART_GET_STATUS(port) & TXEMPTY)) |
| 484 | |||
| 485 | while (!(UART_GET_STATUS(uart) & TXEMPTY)) | ||
| 486 | cpu_relax(); | 450 | cpu_relax(); |
| 487 | 451 | ||
| 488 | UART_SET_DATA(uart, chr); | 452 | UART_SET_DATA(port, chr); |
| 489 | } | 453 | } |
| 490 | #endif | ||
| 491 | 454 | ||
| 492 | #ifdef CONFIG_CONSOLE_POLL | ||
| 493 | static int arc_serial_poll_getchar(struct uart_port *port) | 455 | static int arc_serial_poll_getchar(struct uart_port *port) |
| 494 | { | 456 | { |
| 495 | struct arc_uart_port *uart = to_arc_port(port); | ||
| 496 | unsigned char chr; | 457 | unsigned char chr; |
| 497 | 458 | ||
| 498 | while (!(UART_GET_STATUS(uart) & RXEMPTY)) | 459 | while (!(UART_GET_STATUS(port) & RXEMPTY)) |
| 499 | cpu_relax(); | 460 | cpu_relax(); |
| 500 | 461 | ||
| 501 | chr = UART_GET_DATA(uart); | 462 | chr = UART_GET_DATA(port); |
| 502 | return chr; | 463 | return chr; |
| 503 | } | 464 | } |
| 504 | #endif | 465 | #endif |
| @@ -510,7 +471,6 @@ static struct uart_ops arc_serial_pops = { | |||
| 510 | .stop_tx = arc_serial_stop_tx, | 471 | .stop_tx = arc_serial_stop_tx, |
| 511 | .start_tx = arc_serial_start_tx, | 472 | .start_tx = arc_serial_start_tx, |
| 512 | .stop_rx = arc_serial_stop_rx, | 473 | .stop_rx = arc_serial_stop_rx, |
| 513 | .enable_ms = arc_serial_enable_ms, | ||
| 514 | .break_ctl = arc_serial_break_ctl, | 474 | .break_ctl = arc_serial_break_ctl, |
| 515 | .startup = arc_serial_startup, | 475 | .startup = arc_serial_startup, |
| 516 | .shutdown = arc_serial_shutdown, | 476 | .shutdown = arc_serial_shutdown, |
| @@ -526,71 +486,6 @@ static struct uart_ops arc_serial_pops = { | |||
| 526 | #endif | 486 | #endif |
| 527 | }; | 487 | }; |
| 528 | 488 | ||
| 529 | static int | ||
| 530 | arc_uart_init_one(struct platform_device *pdev, int dev_id) | ||
| 531 | { | ||
| 532 | struct resource *res, *res2; | ||
| 533 | unsigned long *plat_data; | ||
| 534 | struct arc_uart_port *uart = &arc_uart_ports[dev_id]; | ||
| 535 | |||
| 536 | plat_data = dev_get_platdata(&pdev->dev); | ||
| 537 | if (!plat_data) | ||
| 538 | return -ENODEV; | ||
| 539 | |||
| 540 | uart->is_emulated = !!plat_data[0]; /* workaround ISS bug */ | ||
| 541 | |||
| 542 | if (is_early_platform_device(pdev)) { | ||
| 543 | uart->port.uartclk = plat_data[1]; | ||
| 544 | uart->baud = plat_data[2]; | ||
| 545 | } else { | ||
| 546 | struct device_node *np = pdev->dev.of_node; | ||
| 547 | u32 val; | ||
| 548 | |||
| 549 | if (of_property_read_u32(np, "clock-frequency", &val)) { | ||
| 550 | dev_err(&pdev->dev, "clock-frequency property NOTset\n"); | ||
| 551 | return -EINVAL; | ||
| 552 | } | ||
| 553 | uart->port.uartclk = val; | ||
| 554 | |||
| 555 | if (of_property_read_u32(np, "current-speed", &val)) { | ||
| 556 | dev_err(&pdev->dev, "current-speed property NOT set\n"); | ||
| 557 | return -EINVAL; | ||
| 558 | } | ||
| 559 | uart->baud = val; | ||
| 560 | } | ||
| 561 | |||
| 562 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 563 | if (!res) | ||
| 564 | return -ENODEV; | ||
| 565 | |||
| 566 | res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
| 567 | if (!res2) | ||
| 568 | return -ENODEV; | ||
| 569 | |||
| 570 | uart->port.mapbase = res->start; | ||
| 571 | uart->port.membase = ioremap_nocache(res->start, resource_size(res)); | ||
| 572 | if (!uart->port.membase) | ||
| 573 | /* No point of dev_err since UART itself is hosed here */ | ||
| 574 | return -ENXIO; | ||
| 575 | |||
| 576 | uart->port.irq = res2->start; | ||
| 577 | uart->port.dev = &pdev->dev; | ||
| 578 | uart->port.iotype = UPIO_MEM; | ||
| 579 | uart->port.flags = UPF_BOOT_AUTOCONF; | ||
| 580 | uart->port.line = dev_id; | ||
| 581 | uart->port.ops = &arc_serial_pops; | ||
| 582 | |||
| 583 | uart->port.fifosize = ARC_UART_TX_FIFO_SIZE; | ||
| 584 | |||
| 585 | /* | ||
| 586 | * uart_insert_char( ) uses it in decideding whether to ignore a | ||
| 587 | * char or not. Explicitly setting it here, removes the subtelty | ||
| 588 | */ | ||
| 589 | uart->port.ignore_status_mask = 0; | ||
| 590 | |||
| 591 | return 0; | ||
| 592 | } | ||
| 593 | |||
| 594 | #ifdef CONFIG_SERIAL_ARC_CONSOLE | 489 | #ifdef CONFIG_SERIAL_ARC_CONSOLE |
| 595 | 490 | ||
| 596 | static int arc_serial_console_setup(struct console *co, char *options) | 491 | static int arc_serial_console_setup(struct console *co, char *options) |
| @@ -624,7 +519,10 @@ static int arc_serial_console_setup(struct console *co, char *options) | |||
| 624 | 519 | ||
| 625 | static void arc_serial_console_putchar(struct uart_port *port, int ch) | 520 | static void arc_serial_console_putchar(struct uart_port *port, int ch) |
| 626 | { | 521 | { |
| 627 | arc_serial_poll_putchar(port, (unsigned char)ch); | 522 | while (!(UART_GET_STATUS(port) & TXEMPTY)) |
| 523 | cpu_relax(); | ||
| 524 | |||
| 525 | UART_SET_DATA(port, (unsigned char)ch); | ||
| 628 | } | 526 | } |
| 629 | 527 | ||
| 630 | /* | 528 | /* |
| @@ -651,48 +549,45 @@ static struct console arc_console = { | |||
| 651 | .data = &arc_uart_driver | 549 | .data = &arc_uart_driver |
| 652 | }; | 550 | }; |
| 653 | 551 | ||
| 654 | static __init void early_serial_write(struct console *con, const char *s, | 552 | static __init void arc_early_serial_write(struct console *con, const char *s, |
| 655 | unsigned int n) | 553 | unsigned int n) |
| 656 | { | 554 | { |
| 657 | struct uart_port *port = &arc_uart_ports[con->index].port; | 555 | struct earlycon_device *dev = con->data; |
| 658 | unsigned int i; | ||
| 659 | 556 | ||
| 660 | for (i = 0; i < n; i++, s++) { | 557 | uart_console_write(&dev->port, s, n, arc_serial_console_putchar); |
| 661 | if (*s == '\n') | ||
| 662 | arc_serial_poll_putchar(port, '\r'); | ||
| 663 | arc_serial_poll_putchar(port, *s); | ||
| 664 | } | ||
| 665 | } | 558 | } |
| 666 | 559 | ||
| 667 | static struct console arc_early_serial_console __initdata = { | 560 | static int __init arc_early_console_setup(struct earlycon_device *dev, |
| 668 | .name = "early_ARCuart", | 561 | const char *opt) |
| 669 | .write = early_serial_write, | ||
| 670 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
| 671 | .index = -1 | ||
| 672 | }; | ||
| 673 | |||
| 674 | static int __init arc_serial_probe_earlyprintk(struct platform_device *pdev) | ||
| 675 | { | 562 | { |
| 676 | int dev_id = pdev->id < 0 ? 0 : pdev->id; | 563 | struct uart_port *port = &dev->port; |
| 677 | int rc; | 564 | unsigned int l, h, hw_val; |
| 678 | 565 | ||
| 679 | arc_early_serial_console.index = dev_id; | 566 | if (!dev->port.membase) |
| 567 | return -ENODEV; | ||
| 680 | 568 | ||
| 681 | rc = arc_uart_init_one(pdev, dev_id); | 569 | hw_val = port->uartclk / (dev->baud * 4) - 1; |
| 682 | if (rc) | 570 | l = hw_val & 0xFF; |
| 683 | panic("early console init failed\n"); | 571 | h = (hw_val >> 8) & 0xFF; |
| 684 | 572 | ||
| 685 | arc_serial_console_setup(&arc_early_serial_console, NULL); | 573 | UART_SET_BAUDL(port, l); |
| 574 | UART_SET_BAUDH(port, h); | ||
| 686 | 575 | ||
| 687 | register_console(&arc_early_serial_console); | 576 | dev->con->write = arc_early_serial_write; |
| 688 | return 0; | 577 | return 0; |
| 689 | } | 578 | } |
| 579 | EARLYCON_DECLARE(arc_uart, arc_early_console_setup); | ||
| 580 | OF_EARLYCON_DECLARE(arc_uart, "snps,arc-uart", arc_early_console_setup); | ||
| 581 | |||
| 690 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ | 582 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ |
| 691 | 583 | ||
| 692 | static int arc_serial_probe(struct platform_device *pdev) | 584 | static int arc_serial_probe(struct platform_device *pdev) |
| 693 | { | 585 | { |
| 694 | int rc, dev_id; | ||
| 695 | struct device_node *np = pdev->dev.of_node; | 586 | struct device_node *np = pdev->dev.of_node; |
| 587 | struct arc_uart_port *uart; | ||
| 588 | struct uart_port *port; | ||
| 589 | int dev_id; | ||
| 590 | u32 val; | ||
| 696 | 591 | ||
| 697 | /* no device tree device */ | 592 | /* no device tree device */ |
| 698 | if (!np) | 593 | if (!np) |
| @@ -702,12 +597,43 @@ static int arc_serial_probe(struct platform_device *pdev) | |||
| 702 | if (dev_id < 0) | 597 | if (dev_id < 0) |
| 703 | dev_id = 0; | 598 | dev_id = 0; |
| 704 | 599 | ||
| 705 | rc = arc_uart_init_one(pdev, dev_id); | 600 | uart = &arc_uart_ports[dev_id]; |
| 706 | if (rc) | 601 | port = &uart->port; |
| 707 | return rc; | 602 | |
| 603 | if (of_property_read_u32(np, "clock-frequency", &val)) { | ||
| 604 | dev_err(&pdev->dev, "clock-frequency property NOTset\n"); | ||
| 605 | return -EINVAL; | ||
| 606 | } | ||
| 607 | port->uartclk = val; | ||
| 608 | |||
| 609 | if (of_property_read_u32(np, "current-speed", &val)) { | ||
| 610 | dev_err(&pdev->dev, "current-speed property NOT set\n"); | ||
| 611 | return -EINVAL; | ||
| 612 | } | ||
| 613 | uart->baud = val; | ||
| 614 | |||
| 615 | port->membase = of_iomap(np, 0); | ||
| 616 | if (!port->membase) | ||
| 617 | /* No point of dev_err since UART itself is hosed here */ | ||
| 618 | return -ENXIO; | ||
| 619 | |||
| 620 | port->irq = irq_of_parse_and_map(np, 0); | ||
| 708 | 621 | ||
| 709 | rc = uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port); | 622 | port->dev = &pdev->dev; |
| 710 | return rc; | 623 | port->iotype = UPIO_MEM; |
| 624 | port->flags = UPF_BOOT_AUTOCONF; | ||
| 625 | port->line = dev_id; | ||
| 626 | port->ops = &arc_serial_pops; | ||
| 627 | |||
| 628 | port->fifosize = ARC_UART_TX_FIFO_SIZE; | ||
| 629 | |||
| 630 | /* | ||
| 631 | * uart_insert_char( ) uses it in decideding whether to ignore a | ||
| 632 | * char or not. Explicitly setting it here, removes the subtelty | ||
| 633 | */ | ||
| 634 | port->ignore_status_mask = 0; | ||
| 635 | |||
| 636 | return uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port); | ||
| 711 | } | 637 | } |
| 712 | 638 | ||
| 713 | static int arc_serial_remove(struct platform_device *pdev) | 639 | static int arc_serial_remove(struct platform_device *pdev) |
| @@ -732,27 +658,6 @@ static struct platform_driver arc_platform_driver = { | |||
| 732 | }, | 658 | }, |
| 733 | }; | 659 | }; |
| 734 | 660 | ||
| 735 | #ifdef CONFIG_SERIAL_ARC_CONSOLE | ||
| 736 | |||
| 737 | static struct platform_driver early_arc_platform_driver __initdata = { | ||
| 738 | .probe = arc_serial_probe_earlyprintk, | ||
| 739 | .remove = arc_serial_remove, | ||
| 740 | .driver = { | ||
| 741 | .name = DRIVER_NAME, | ||
| 742 | .owner = THIS_MODULE, | ||
| 743 | }, | ||
| 744 | }; | ||
| 745 | /* | ||
| 746 | * Register an early platform driver of "earlyprintk" class. | ||
| 747 | * ARCH platform code installs the driver and probes the early devices | ||
| 748 | * The installation could rely on user specifying earlyprintk=xyx in cmd line | ||
| 749 | * or it could be done independently, for all "earlyprintk" class drivers. | ||
| 750 | * [see arch/arc/plat-arcfpga/platform.c] | ||
| 751 | */ | ||
| 752 | early_platform_init("earlyprintk", &early_arc_platform_driver); | ||
| 753 | |||
| 754 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ | ||
| 755 | |||
| 756 | static int __init arc_serial_init(void) | 661 | static int __init arc_serial_init(void) |
| 757 | { | 662 | { |
| 758 | int ret; | 663 | int ret; |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index c4f750314100..7b63677475c1 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
| @@ -706,7 +706,7 @@ static void atmel_release_tx_dma(struct uart_port *port) | |||
| 706 | dmaengine_terminate_all(chan); | 706 | dmaengine_terminate_all(chan); |
| 707 | dma_release_channel(chan); | 707 | dma_release_channel(chan); |
| 708 | dma_unmap_sg(port->dev, &atmel_port->sg_tx, 1, | 708 | dma_unmap_sg(port->dev, &atmel_port->sg_tx, 1, |
| 709 | DMA_MEM_TO_DEV); | 709 | DMA_TO_DEVICE); |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | atmel_port->desc_tx = NULL; | 712 | atmel_port->desc_tx = NULL; |
| @@ -804,7 +804,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port) | |||
| 804 | nent = dma_map_sg(port->dev, | 804 | nent = dma_map_sg(port->dev, |
| 805 | &atmel_port->sg_tx, | 805 | &atmel_port->sg_tx, |
| 806 | 1, | 806 | 1, |
| 807 | DMA_MEM_TO_DEV); | 807 | DMA_TO_DEVICE); |
| 808 | 808 | ||
| 809 | if (!nent) { | 809 | if (!nent) { |
| 810 | dev_dbg(port->dev, "need to release resource of dma\n"); | 810 | dev_dbg(port->dev, "need to release resource of dma\n"); |
| @@ -883,7 +883,7 @@ static void atmel_release_rx_dma(struct uart_port *port) | |||
| 883 | dmaengine_terminate_all(chan); | 883 | dmaengine_terminate_all(chan); |
| 884 | dma_release_channel(chan); | 884 | dma_release_channel(chan); |
| 885 | dma_unmap_sg(port->dev, &atmel_port->sg_rx, 1, | 885 | dma_unmap_sg(port->dev, &atmel_port->sg_rx, 1, |
| 886 | DMA_DEV_TO_MEM); | 886 | DMA_FROM_DEVICE); |
| 887 | } | 887 | } |
| 888 | 888 | ||
| 889 | atmel_port->desc_rx = NULL; | 889 | atmel_port->desc_rx = NULL; |
| @@ -968,7 +968,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port) | |||
| 968 | nent = dma_map_sg(port->dev, | 968 | nent = dma_map_sg(port->dev, |
| 969 | &atmel_port->sg_rx, | 969 | &atmel_port->sg_rx, |
| 970 | 1, | 970 | 1, |
| 971 | DMA_DEV_TO_MEM); | 971 | DMA_FROM_DEVICE); |
| 972 | 972 | ||
| 973 | if (!nent) { | 973 | if (!nent) { |
| 974 | dev_dbg(port->dev, "need to release resource of dma\n"); | 974 | dev_dbg(port->dev, "need to release resource of dma\n"); |
diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c index 4f229703328b..7810aa290edf 100644 --- a/drivers/tty/serial/bfin_sport_uart.c +++ b/drivers/tty/serial/bfin_sport_uart.c | |||
| @@ -426,11 +426,6 @@ static void sport_stop_rx(struct uart_port *port) | |||
| 426 | SSYNC(); | 426 | SSYNC(); |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | static void sport_enable_ms(struct uart_port *port) | ||
| 430 | { | ||
| 431 | pr_debug("%s enter\n", __func__); | ||
| 432 | } | ||
| 433 | |||
| 434 | static void sport_break_ctl(struct uart_port *port, int break_state) | 429 | static void sport_break_ctl(struct uart_port *port, int break_state) |
| 435 | { | 430 | { |
| 436 | pr_debug("%s enter\n", __func__); | 431 | pr_debug("%s enter\n", __func__); |
| @@ -500,6 +495,13 @@ static void sport_set_termios(struct uart_port *port, | |||
| 500 | 495 | ||
| 501 | pr_debug("%s enter, c_cflag:%08x\n", __func__, termios->c_cflag); | 496 | pr_debug("%s enter, c_cflag:%08x\n", __func__, termios->c_cflag); |
| 502 | 497 | ||
| 498 | #ifdef CONFIG_SERIAL_BFIN_SPORT_CTSRTS | ||
| 499 | if (old == NULL && up->cts_pin != -1) | ||
| 500 | termios->c_cflag |= CRTSCTS; | ||
| 501 | else if (up->cts_pin == -1) | ||
| 502 | termios->c_cflag &= ~CRTSCTS; | ||
| 503 | #endif | ||
| 504 | |||
| 503 | switch (termios->c_cflag & CSIZE) { | 505 | switch (termios->c_cflag & CSIZE) { |
| 504 | case CS8: | 506 | case CS8: |
| 505 | up->csize = 8; | 507 | up->csize = 8; |
| @@ -587,7 +589,6 @@ struct uart_ops sport_uart_ops = { | |||
| 587 | .stop_tx = sport_stop_tx, | 589 | .stop_tx = sport_stop_tx, |
| 588 | .start_tx = sport_start_tx, | 590 | .start_tx = sport_start_tx, |
| 589 | .stop_rx = sport_stop_rx, | 591 | .stop_rx = sport_stop_rx, |
| 590 | .enable_ms = sport_enable_ms, | ||
| 591 | .break_ctl = sport_break_ctl, | 592 | .break_ctl = sport_break_ctl, |
| 592 | .startup = sport_startup, | 593 | .startup = sport_startup, |
| 593 | .shutdown = sport_shutdown, | 594 | .shutdown = sport_shutdown, |
| @@ -813,10 +814,8 @@ static int sport_uart_probe(struct platform_device *pdev) | |||
| 813 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 814 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
| 814 | if (res == NULL) | 815 | if (res == NULL) |
| 815 | sport->cts_pin = -1; | 816 | sport->cts_pin = -1; |
| 816 | else { | 817 | else |
| 817 | sport->cts_pin = res->start; | 818 | sport->cts_pin = res->start; |
| 818 | sport->port.flags |= ASYNC_CTS_FLOW; | ||
| 819 | } | ||
| 820 | 819 | ||
| 821 | res = platform_get_resource(pdev, IORESOURCE_IO, 1); | 820 | res = platform_get_resource(pdev, IORESOURCE_IO, 1); |
| 822 | if (res == NULL) | 821 | if (res == NULL) |
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c index ac86a20992e9..dec0fd725d80 100644 --- a/drivers/tty/serial/bfin_uart.c +++ b/drivers/tty/serial/bfin_uart.c | |||
| @@ -200,14 +200,6 @@ static void bfin_serial_stop_rx(struct uart_port *port) | |||
| 200 | UART_CLEAR_IER(uart, ERBFI); | 200 | UART_CLEAR_IER(uart, ERBFI); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | /* | ||
| 204 | * Set the modem control timer to fire immediately. | ||
| 205 | */ | ||
| 206 | static void bfin_serial_enable_ms(struct uart_port *port) | ||
| 207 | { | ||
| 208 | } | ||
| 209 | |||
| 210 | |||
| 211 | #if ANOMALY_05000363 && defined(CONFIG_SERIAL_BFIN_PIO) | 203 | #if ANOMALY_05000363 && defined(CONFIG_SERIAL_BFIN_PIO) |
| 212 | # define UART_GET_ANOMALY_THRESHOLD(uart) ((uart)->anomaly_threshold) | 204 | # define UART_GET_ANOMALY_THRESHOLD(uart) ((uart)->anomaly_threshold) |
| 213 | # define UART_SET_ANOMALY_THRESHOLD(uart, v) ((uart)->anomaly_threshold = (v)) | 205 | # define UART_SET_ANOMALY_THRESHOLD(uart, v) ((uart)->anomaly_threshold = (v)) |
| @@ -793,6 +785,13 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 793 | unsigned int ier, lcr = 0; | 785 | unsigned int ier, lcr = 0; |
| 794 | unsigned long timeout; | 786 | unsigned long timeout; |
| 795 | 787 | ||
| 788 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS | ||
| 789 | if (old == NULL && uart->cts_pin != -1) | ||
| 790 | termios->c_cflag |= CRTSCTS; | ||
| 791 | else if (uart->cts_pin == -1) | ||
| 792 | termios->c_cflag &= ~CRTSCTS; | ||
| 793 | #endif | ||
| 794 | |||
| 796 | switch (termios->c_cflag & CSIZE) { | 795 | switch (termios->c_cflag & CSIZE) { |
| 797 | case CS8: | 796 | case CS8: |
| 798 | lcr = WLS(8); | 797 | lcr = WLS(8); |
| @@ -1014,7 +1013,6 @@ static struct uart_ops bfin_serial_pops = { | |||
| 1014 | .stop_tx = bfin_serial_stop_tx, | 1013 | .stop_tx = bfin_serial_stop_tx, |
| 1015 | .start_tx = bfin_serial_start_tx, | 1014 | .start_tx = bfin_serial_start_tx, |
| 1016 | .stop_rx = bfin_serial_stop_rx, | 1015 | .stop_rx = bfin_serial_stop_rx, |
| 1017 | .enable_ms = bfin_serial_enable_ms, | ||
| 1018 | .break_ctl = bfin_serial_break_ctl, | 1016 | .break_ctl = bfin_serial_break_ctl, |
| 1019 | .startup = bfin_serial_startup, | 1017 | .startup = bfin_serial_startup, |
| 1020 | .shutdown = bfin_serial_shutdown, | 1018 | .shutdown = bfin_serial_shutdown, |
| @@ -1325,12 +1323,8 @@ static int bfin_serial_probe(struct platform_device *pdev) | |||
| 1325 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1323 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
| 1326 | if (res == NULL) | 1324 | if (res == NULL) |
| 1327 | uart->cts_pin = -1; | 1325 | uart->cts_pin = -1; |
| 1328 | else { | 1326 | else |
| 1329 | uart->cts_pin = res->start; | 1327 | uart->cts_pin = res->start; |
| 1330 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS | ||
| 1331 | uart->port.flags |= ASYNC_CTS_FLOW; | ||
| 1332 | #endif | ||
| 1333 | } | ||
| 1334 | 1328 | ||
| 1335 | res = platform_get_resource(pdev, IORESOURCE_IO, 1); | 1329 | res = platform_get_resource(pdev, IORESOURCE_IO, 1); |
| 1336 | if (res == NULL) | 1330 | if (res == NULL) |
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index 14aaea0d4131..f5b4c3d7e38f 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
| @@ -352,7 +352,6 @@ static const struct uart_ops uart_clps711x_ops = { | |||
| 352 | .stop_tx = uart_clps711x_stop_tx, | 352 | .stop_tx = uart_clps711x_stop_tx, |
| 353 | .start_tx = uart_clps711x_start_tx, | 353 | .start_tx = uart_clps711x_start_tx, |
| 354 | .stop_rx = uart_clps711x_nop_void, | 354 | .stop_rx = uart_clps711x_nop_void, |
| 355 | .enable_ms = uart_clps711x_nop_void, | ||
| 356 | .break_ctl = uart_clps711x_break_ctl, | 355 | .break_ctl = uart_clps711x_break_ctl, |
| 357 | .set_ldisc = uart_clps711x_set_ldisc, | 356 | .set_ldisc = uart_clps711x_set_ldisc, |
| 358 | .startup = uart_clps711x_startup, | 357 | .startup = uart_clps711x_startup, |
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index aa60e6d13eca..533852eb8778 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c | |||
| @@ -202,14 +202,6 @@ static void cpm_uart_stop_rx(struct uart_port *port) | |||
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | /* | 204 | /* |
| 205 | * Enable Modem status interrupts | ||
| 206 | */ | ||
| 207 | static void cpm_uart_enable_ms(struct uart_port *port) | ||
| 208 | { | ||
| 209 | pr_debug("CPM uart[%d]:enable ms\n", port->line); | ||
| 210 | } | ||
| 211 | |||
| 212 | /* | ||
| 213 | * Generate a break. | 205 | * Generate a break. |
| 214 | */ | 206 | */ |
| 215 | static void cpm_uart_break_ctl(struct uart_port *port, int break_state) | 207 | static void cpm_uart_break_ctl(struct uart_port *port, int break_state) |
| @@ -1122,7 +1114,6 @@ static struct uart_ops cpm_uart_pops = { | |||
| 1122 | .stop_tx = cpm_uart_stop_tx, | 1114 | .stop_tx = cpm_uart_stop_tx, |
| 1123 | .start_tx = cpm_uart_start_tx, | 1115 | .start_tx = cpm_uart_start_tx, |
| 1124 | .stop_rx = cpm_uart_stop_rx, | 1116 | .stop_rx = cpm_uart_stop_rx, |
| 1125 | .enable_ms = cpm_uart_enable_ms, | ||
| 1126 | .break_ctl = cpm_uart_break_ctl, | 1117 | .break_ctl = cpm_uart_break_ctl, |
| 1127 | .startup = cpm_uart_startup, | 1118 | .startup = cpm_uart_startup, |
| 1128 | .shutdown = cpm_uart_shutdown, | 1119 | .shutdown = cpm_uart_shutdown, |
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index d567ac5d3af4..58e6f61a87e4 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
| @@ -3831,14 +3831,13 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
| 3831 | DECLARE_WAITQUEUE(wait, current); | 3831 | DECLARE_WAITQUEUE(wait, current); |
| 3832 | unsigned long flags; | 3832 | unsigned long flags; |
| 3833 | int retval; | 3833 | int retval; |
| 3834 | int do_clocal = 0, extra_count = 0; | 3834 | int do_clocal = 0; |
| 3835 | 3835 | ||
| 3836 | /* | 3836 | /* |
| 3837 | * If the device is in the middle of being closed, then block | 3837 | * If the device is in the middle of being closed, then block |
| 3838 | * until it's done, and then try again. | 3838 | * until it's done, and then try again. |
| 3839 | */ | 3839 | */ |
| 3840 | if (tty_hung_up_p(filp) || | 3840 | if (info->port.flags & ASYNC_CLOSING) { |
| 3841 | (info->port.flags & ASYNC_CLOSING)) { | ||
| 3842 | wait_event_interruptible_tty(tty, info->port.close_wait, | 3841 | wait_event_interruptible_tty(tty, info->port.close_wait, |
| 3843 | !(info->port.flags & ASYNC_CLOSING)); | 3842 | !(info->port.flags & ASYNC_CLOSING)); |
| 3844 | #ifdef SERIAL_DO_RESTART | 3843 | #ifdef SERIAL_DO_RESTART |
| @@ -3879,10 +3878,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
| 3879 | info->line, info->port.count); | 3878 | info->line, info->port.count); |
| 3880 | #endif | 3879 | #endif |
| 3881 | local_irq_save(flags); | 3880 | local_irq_save(flags); |
| 3882 | if (!tty_hung_up_p(filp)) { | 3881 | info->port.count--; |
| 3883 | extra_count++; | ||
| 3884 | info->port.count--; | ||
| 3885 | } | ||
| 3886 | local_irq_restore(flags); | 3882 | local_irq_restore(flags); |
| 3887 | info->port.blocked_open++; | 3883 | info->port.blocked_open++; |
| 3888 | while (1) { | 3884 | while (1) { |
| @@ -3921,7 +3917,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
| 3921 | } | 3917 | } |
| 3922 | set_current_state(TASK_RUNNING); | 3918 | set_current_state(TASK_RUNNING); |
| 3923 | remove_wait_queue(&info->port.open_wait, &wait); | 3919 | remove_wait_queue(&info->port.open_wait, &wait); |
| 3924 | if (extra_count) | 3920 | if (!tty_hung_up_p(filp)) |
| 3925 | info->port.count++; | 3921 | info->port.count++; |
| 3926 | info->port.blocked_open--; | 3922 | info->port.blocked_open--; |
| 3927 | #ifdef SERIAL_DEBUG_OPEN | 3923 | #ifdef SERIAL_DEBUG_OPEN |
| @@ -3976,8 +3972,7 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
| 3976 | /* | 3972 | /* |
| 3977 | * If the port is in the middle of closing, bail out now | 3973 | * If the port is in the middle of closing, bail out now |
| 3978 | */ | 3974 | */ |
| 3979 | if (tty_hung_up_p(filp) || | 3975 | if (info->port.flags & ASYNC_CLOSING) { |
| 3980 | (info->port.flags & ASYNC_CLOSING)) { | ||
| 3981 | wait_event_interruptible_tty(tty, info->port.close_wait, | 3976 | wait_event_interruptible_tty(tty, info->port.close_wait, |
| 3982 | !(info->port.flags & ASYNC_CLOSING)); | 3977 | !(info->port.flags & ASYNC_CLOSING)); |
| 3983 | #ifdef SERIAL_DO_RESTART | 3978 | #ifdef SERIAL_DO_RESTART |
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c index cdbbc788230a..c121f16a973f 100644 --- a/drivers/tty/serial/dz.c +++ b/drivers/tty/serial/dz.c | |||
| @@ -151,11 +151,6 @@ static void dz_stop_rx(struct uart_port *uport) | |||
| 151 | dz_out(dport, DZ_LPR, dport->cflag); | 151 | dz_out(dport, DZ_LPR, dport->cflag); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static void dz_enable_ms(struct uart_port *uport) | ||
| 155 | { | ||
| 156 | /* nothing to do */ | ||
| 157 | } | ||
| 158 | |||
| 159 | /* | 154 | /* |
| 160 | * ------------------------------------------------------------ | 155 | * ------------------------------------------------------------ |
| 161 | * | 156 | * |
| @@ -751,7 +746,6 @@ static struct uart_ops dz_ops = { | |||
| 751 | .stop_tx = dz_stop_tx, | 746 | .stop_tx = dz_stop_tx, |
| 752 | .start_tx = dz_start_tx, | 747 | .start_tx = dz_start_tx, |
| 753 | .stop_rx = dz_stop_rx, | 748 | .stop_rx = dz_stop_rx, |
| 754 | .enable_ms = dz_enable_ms, | ||
| 755 | .break_ctl = dz_break_ctl, | 749 | .break_ctl = dz_break_ctl, |
| 756 | .startup = dz_startup, | 750 | .startup = dz_startup, |
| 757 | .shutdown = dz_shutdown, | 751 | .shutdown = dz_shutdown, |
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index 3b0ee9afd76f..55d9c00112cc 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c | |||
| @@ -185,11 +185,6 @@ static void efm32_uart_stop_rx(struct uart_port *port) | |||
| 185 | efm32_uart_write32(efm_port, UARTn_CMD_RXDIS, UARTn_CMD); | 185 | efm32_uart_write32(efm_port, UARTn_CMD_RXDIS, UARTn_CMD); |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | static void efm32_uart_enable_ms(struct uart_port *port) | ||
| 189 | { | ||
| 190 | /* no handshake lines, no modem status interrupts */ | ||
| 191 | } | ||
| 192 | |||
| 193 | static void efm32_uart_break_ctl(struct uart_port *port, int ctl) | 188 | static void efm32_uart_break_ctl(struct uart_port *port, int ctl) |
| 194 | { | 189 | { |
| 195 | /* not possible without fiddling with gpios */ | 190 | /* not possible without fiddling with gpios */ |
| @@ -499,7 +494,6 @@ static struct uart_ops efm32_uart_pops = { | |||
| 499 | .stop_tx = efm32_uart_stop_tx, | 494 | .stop_tx = efm32_uart_stop_tx, |
| 500 | .start_tx = efm32_uart_start_tx, | 495 | .start_tx = efm32_uart_start_tx, |
| 501 | .stop_rx = efm32_uart_stop_rx, | 496 | .stop_rx = efm32_uart_stop_rx, |
| 502 | .enable_ms = efm32_uart_enable_ms, | ||
| 503 | .break_ctl = efm32_uart_break_ctl, | 497 | .break_ctl = efm32_uart_break_ctl, |
| 504 | .startup = efm32_uart_startup, | 498 | .startup = efm32_uart_startup, |
| 505 | .shutdown = efm32_uart_shutdown, | 499 | .shutdown = efm32_uart_shutdown, |
| @@ -671,10 +665,16 @@ static int efm32_uart_probe_dt(struct platform_device *pdev, | |||
| 671 | if (!np) | 665 | if (!np) |
| 672 | return 1; | 666 | return 1; |
| 673 | 667 | ||
| 674 | ret = of_property_read_u32(np, "efm32,location", &location); | 668 | ret = of_property_read_u32(np, "energymicro,location", &location); |
| 669 | |||
| 670 | if (ret) | ||
| 671 | /* fall back to wrongly namespaced property */ | ||
| 672 | ret = of_property_read_u32(np, "efm32,location", &location); | ||
| 673 | |||
| 675 | if (ret) | 674 | if (ret) |
| 676 | /* fall back to old and (wrongly) generic property "location" */ | 675 | /* fall back to old and (wrongly) generic property "location" */ |
| 677 | ret = of_property_read_u32(np, "location", &location); | 676 | ret = of_property_read_u32(np, "location", &location); |
| 677 | |||
| 678 | if (!ret) { | 678 | if (!ret) { |
| 679 | if (location > 5) { | 679 | if (location > 5) { |
| 680 | dev_err(&pdev->dev, "invalid location\n"); | 680 | dev_err(&pdev->dev, "invalid location\n"); |
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 49385c86cfba..6dd53af546a3 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Freescale lpuart serial port driver | 2 | * Freescale lpuart serial port driver |
| 3 | * | 3 | * |
| 4 | * Copyright 2012-2013 Freescale Semiconductor, Inc. | 4 | * Copyright 2012-2014 Freescale Semiconductor, Inc. |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -117,8 +117,113 @@ | |||
| 117 | #define UARTSFIFO_TXOF 0x02 | 117 | #define UARTSFIFO_TXOF 0x02 |
| 118 | #define UARTSFIFO_RXUF 0x01 | 118 | #define UARTSFIFO_RXUF 0x01 |
| 119 | 119 | ||
| 120 | #define DMA_MAXBURST 16 | 120 | /* 32-bit register defination */ |
| 121 | #define DMA_MAXBURST_MASK (DMA_MAXBURST - 1) | 121 | #define UARTBAUD 0x00 |
| 122 | #define UARTSTAT 0x04 | ||
| 123 | #define UARTCTRL 0x08 | ||
| 124 | #define UARTDATA 0x0C | ||
| 125 | #define UARTMATCH 0x10 | ||
| 126 | #define UARTMODIR 0x14 | ||
| 127 | #define UARTFIFO 0x18 | ||
| 128 | #define UARTWATER 0x1c | ||
| 129 | |||
| 130 | #define UARTBAUD_MAEN1 0x80000000 | ||
| 131 | #define UARTBAUD_MAEN2 0x40000000 | ||
| 132 | #define UARTBAUD_M10 0x20000000 | ||
| 133 | #define UARTBAUD_TDMAE 0x00800000 | ||
| 134 | #define UARTBAUD_RDMAE 0x00200000 | ||
| 135 | #define UARTBAUD_MATCFG 0x00400000 | ||
| 136 | #define UARTBAUD_BOTHEDGE 0x00020000 | ||
| 137 | #define UARTBAUD_RESYNCDIS 0x00010000 | ||
| 138 | #define UARTBAUD_LBKDIE 0x00008000 | ||
| 139 | #define UARTBAUD_RXEDGIE 0x00004000 | ||
| 140 | #define UARTBAUD_SBNS 0x00002000 | ||
| 141 | #define UARTBAUD_SBR 0x00000000 | ||
| 142 | #define UARTBAUD_SBR_MASK 0x1fff | ||
| 143 | |||
| 144 | #define UARTSTAT_LBKDIF 0x80000000 | ||
| 145 | #define UARTSTAT_RXEDGIF 0x40000000 | ||
| 146 | #define UARTSTAT_MSBF 0x20000000 | ||
| 147 | #define UARTSTAT_RXINV 0x10000000 | ||
| 148 | #define UARTSTAT_RWUID 0x08000000 | ||
| 149 | #define UARTSTAT_BRK13 0x04000000 | ||
| 150 | #define UARTSTAT_LBKDE 0x02000000 | ||
| 151 | #define UARTSTAT_RAF 0x01000000 | ||
| 152 | #define UARTSTAT_TDRE 0x00800000 | ||
| 153 | #define UARTSTAT_TC 0x00400000 | ||
| 154 | #define UARTSTAT_RDRF 0x00200000 | ||
| 155 | #define UARTSTAT_IDLE 0x00100000 | ||
| 156 | #define UARTSTAT_OR 0x00080000 | ||
| 157 | #define UARTSTAT_NF 0x00040000 | ||
| 158 | #define UARTSTAT_FE 0x00020000 | ||
| 159 | #define UARTSTAT_PE 0x00010000 | ||
| 160 | #define UARTSTAT_MA1F 0x00008000 | ||
| 161 | #define UARTSTAT_M21F 0x00004000 | ||
| 162 | |||
| 163 | #define UARTCTRL_R8T9 0x80000000 | ||
| 164 | #define UARTCTRL_R9T8 0x40000000 | ||
| 165 | #define UARTCTRL_TXDIR 0x20000000 | ||
| 166 | #define UARTCTRL_TXINV 0x10000000 | ||
| 167 | #define UARTCTRL_ORIE 0x08000000 | ||
| 168 | #define UARTCTRL_NEIE 0x04000000 | ||
| 169 | #define UARTCTRL_FEIE 0x02000000 | ||
| 170 | #define UARTCTRL_PEIE 0x01000000 | ||
| 171 | #define UARTCTRL_TIE 0x00800000 | ||
| 172 | #define UARTCTRL_TCIE 0x00400000 | ||
| 173 | #define UARTCTRL_RIE 0x00200000 | ||
| 174 | #define UARTCTRL_ILIE 0x00100000 | ||
| 175 | #define UARTCTRL_TE 0x00080000 | ||
| 176 | #define UARTCTRL_RE 0x00040000 | ||
| 177 | #define UARTCTRL_RWU 0x00020000 | ||
| 178 | #define UARTCTRL_SBK 0x00010000 | ||
| 179 | #define UARTCTRL_MA1IE 0x00008000 | ||
| 180 | #define UARTCTRL_MA2IE 0x00004000 | ||
| 181 | #define UARTCTRL_IDLECFG 0x00000100 | ||
| 182 | #define UARTCTRL_LOOPS 0x00000080 | ||
| 183 | #define UARTCTRL_DOZEEN 0x00000040 | ||
| 184 | #define UARTCTRL_RSRC 0x00000020 | ||
| 185 | #define UARTCTRL_M 0x00000010 | ||
| 186 | #define UARTCTRL_WAKE 0x00000008 | ||
| 187 | #define UARTCTRL_ILT 0x00000004 | ||
| 188 | #define UARTCTRL_PE 0x00000002 | ||
| 189 | #define UARTCTRL_PT 0x00000001 | ||
| 190 | |||
| 191 | #define UARTDATA_NOISY 0x00008000 | ||
| 192 | #define UARTDATA_PARITYE 0x00004000 | ||
| 193 | #define UARTDATA_FRETSC 0x00002000 | ||
| 194 | #define UARTDATA_RXEMPT 0x00001000 | ||
| 195 | #define UARTDATA_IDLINE 0x00000800 | ||
| 196 | #define UARTDATA_MASK 0x3ff | ||
| 197 | |||
| 198 | #define UARTMODIR_IREN 0x00020000 | ||
| 199 | #define UARTMODIR_TXCTSSRC 0x00000020 | ||
| 200 | #define UARTMODIR_TXCTSC 0x00000010 | ||
| 201 | #define UARTMODIR_RXRTSE 0x00000008 | ||
| 202 | #define UARTMODIR_TXRTSPOL 0x00000004 | ||
| 203 | #define UARTMODIR_TXRTSE 0x00000002 | ||
| 204 | #define UARTMODIR_TXCTSE 0x00000001 | ||
| 205 | |||
| 206 | #define UARTFIFO_TXEMPT 0x00800000 | ||
| 207 | #define UARTFIFO_RXEMPT 0x00400000 | ||
| 208 | #define UARTFIFO_TXOF 0x00020000 | ||
| 209 | #define UARTFIFO_RXUF 0x00010000 | ||
| 210 | #define UARTFIFO_TXFLUSH 0x00008000 | ||
| 211 | #define UARTFIFO_RXFLUSH 0x00004000 | ||
| 212 | #define UARTFIFO_TXOFE 0x00000200 | ||
| 213 | #define UARTFIFO_RXUFE 0x00000100 | ||
| 214 | #define UARTFIFO_TXFE 0x00000080 | ||
| 215 | #define UARTFIFO_FIFOSIZE_MASK 0x7 | ||
| 216 | #define UARTFIFO_TXSIZE_OFF 4 | ||
| 217 | #define UARTFIFO_RXFE 0x00000008 | ||
| 218 | #define UARTFIFO_RXSIZE_OFF 0 | ||
| 219 | |||
| 220 | #define UARTWATER_COUNT_MASK 0xff | ||
| 221 | #define UARTWATER_TXCNT_OFF 8 | ||
| 222 | #define UARTWATER_RXCNT_OFF 24 | ||
| 223 | #define UARTWATER_WATER_MASK 0xff | ||
| 224 | #define UARTWATER_TXWATER_OFF 0 | ||
| 225 | #define UARTWATER_RXWATER_OFF 16 | ||
| 226 | |||
| 122 | #define FSL_UART_RX_DMA_BUFFER_SIZE 64 | 227 | #define FSL_UART_RX_DMA_BUFFER_SIZE 64 |
| 123 | 228 | ||
| 124 | #define DRIVER_NAME "fsl-lpuart" | 229 | #define DRIVER_NAME "fsl-lpuart" |
| @@ -130,6 +235,7 @@ struct lpuart_port { | |||
| 130 | struct clk *clk; | 235 | struct clk *clk; |
| 131 | unsigned int txfifo_size; | 236 | unsigned int txfifo_size; |
| 132 | unsigned int rxfifo_size; | 237 | unsigned int rxfifo_size; |
| 238 | bool lpuart32; | ||
| 133 | 239 | ||
| 134 | bool lpuart_dma_use; | 240 | bool lpuart_dma_use; |
| 135 | struct dma_chan *dma_tx_chan; | 241 | struct dma_chan *dma_tx_chan; |
| @@ -154,6 +260,9 @@ static struct of_device_id lpuart_dt_ids[] = { | |||
| 154 | { | 260 | { |
| 155 | .compatible = "fsl,vf610-lpuart", | 261 | .compatible = "fsl,vf610-lpuart", |
| 156 | }, | 262 | }, |
| 263 | { | ||
| 264 | .compatible = "fsl,ls1021a-lpuart", | ||
| 265 | }, | ||
| 157 | { /* sentinel */ } | 266 | { /* sentinel */ } |
| 158 | }; | 267 | }; |
| 159 | MODULE_DEVICE_TABLE(of, lpuart_dt_ids); | 268 | MODULE_DEVICE_TABLE(of, lpuart_dt_ids); |
| @@ -162,6 +271,16 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids); | |||
| 162 | static void lpuart_dma_tx_complete(void *arg); | 271 | static void lpuart_dma_tx_complete(void *arg); |
| 163 | static void lpuart_dma_rx_complete(void *arg); | 272 | static void lpuart_dma_rx_complete(void *arg); |
| 164 | 273 | ||
| 274 | static u32 lpuart32_read(void __iomem *addr) | ||
| 275 | { | ||
| 276 | return ioread32be(addr); | ||
| 277 | } | ||
| 278 | |||
| 279 | static void lpuart32_write(u32 val, void __iomem *addr) | ||
| 280 | { | ||
| 281 | iowrite32be(val, addr); | ||
| 282 | } | ||
| 283 | |||
| 165 | static void lpuart_stop_tx(struct uart_port *port) | 284 | static void lpuart_stop_tx(struct uart_port *port) |
| 166 | { | 285 | { |
| 167 | unsigned char temp; | 286 | unsigned char temp; |
| @@ -171,6 +290,15 @@ static void lpuart_stop_tx(struct uart_port *port) | |||
| 171 | writeb(temp, port->membase + UARTCR2); | 290 | writeb(temp, port->membase + UARTCR2); |
| 172 | } | 291 | } |
| 173 | 292 | ||
| 293 | static void lpuart32_stop_tx(struct uart_port *port) | ||
| 294 | { | ||
| 295 | unsigned long temp; | ||
| 296 | |||
| 297 | temp = lpuart32_read(port->membase + UARTCTRL); | ||
| 298 | temp &= ~(UARTCTRL_TIE | UARTCTRL_TCIE); | ||
| 299 | lpuart32_write(temp, port->membase + UARTCTRL); | ||
| 300 | } | ||
| 301 | |||
| 174 | static void lpuart_stop_rx(struct uart_port *port) | 302 | static void lpuart_stop_rx(struct uart_port *port) |
| 175 | { | 303 | { |
| 176 | unsigned char temp; | 304 | unsigned char temp; |
| @@ -179,8 +307,12 @@ static void lpuart_stop_rx(struct uart_port *port) | |||
| 179 | writeb(temp & ~UARTCR2_RE, port->membase + UARTCR2); | 307 | writeb(temp & ~UARTCR2_RE, port->membase + UARTCR2); |
| 180 | } | 308 | } |
| 181 | 309 | ||
| 182 | static void lpuart_enable_ms(struct uart_port *port) | 310 | static void lpuart32_stop_rx(struct uart_port *port) |
| 183 | { | 311 | { |
| 312 | unsigned long temp; | ||
| 313 | |||
| 314 | temp = lpuart32_read(port->membase + UARTCTRL); | ||
| 315 | lpuart32_write(temp & ~UARTCTRL_RE, port->membase + UARTCTRL); | ||
| 184 | } | 316 | } |
| 185 | 317 | ||
| 186 | static void lpuart_copy_rx_to_tty(struct lpuart_port *sport, | 318 | static void lpuart_copy_rx_to_tty(struct lpuart_port *sport, |
| @@ -240,7 +372,7 @@ static int lpuart_dma_tx(struct lpuart_port *sport, unsigned long count) | |||
| 240 | 372 | ||
| 241 | dma_sync_single_for_device(sport->port.dev, sport->dma_tx_buf_bus, | 373 | dma_sync_single_for_device(sport->port.dev, sport->dma_tx_buf_bus, |
| 242 | UART_XMIT_SIZE, DMA_TO_DEVICE); | 374 | UART_XMIT_SIZE, DMA_TO_DEVICE); |
| 243 | sport->dma_tx_bytes = count & ~(DMA_MAXBURST_MASK); | 375 | sport->dma_tx_bytes = count & ~(sport->txfifo_size - 1); |
| 244 | tx_bus_addr = sport->dma_tx_buf_bus + xmit->tail; | 376 | tx_bus_addr = sport->dma_tx_buf_bus + xmit->tail; |
| 245 | sport->dma_tx_desc = dmaengine_prep_slave_single(sport->dma_tx_chan, | 377 | sport->dma_tx_desc = dmaengine_prep_slave_single(sport->dma_tx_chan, |
| 246 | tx_bus_addr, sport->dma_tx_bytes, | 378 | tx_bus_addr, sport->dma_tx_bytes, |
| @@ -269,7 +401,7 @@ static void lpuart_prepare_tx(struct lpuart_port *sport) | |||
| 269 | if (!count) | 401 | if (!count) |
| 270 | return; | 402 | return; |
| 271 | 403 | ||
| 272 | if (count < DMA_MAXBURST) | 404 | if (count < sport->txfifo_size) |
| 273 | writeb(readb(sport->port.membase + UARTCR5) & ~UARTCR5_TDMAS, | 405 | writeb(readb(sport->port.membase + UARTCR5) & ~UARTCR5_TDMAS, |
| 274 | sport->port.membase + UARTCR5); | 406 | sport->port.membase + UARTCR5); |
| 275 | else { | 407 | else { |
| @@ -405,6 +537,30 @@ static inline void lpuart_transmit_buffer(struct lpuart_port *sport) | |||
| 405 | lpuart_stop_tx(&sport->port); | 537 | lpuart_stop_tx(&sport->port); |
| 406 | } | 538 | } |
| 407 | 539 | ||
| 540 | static inline void lpuart32_transmit_buffer(struct lpuart_port *sport) | ||
| 541 | { | ||
| 542 | struct circ_buf *xmit = &sport->port.state->xmit; | ||
| 543 | unsigned long txcnt; | ||
| 544 | |||
| 545 | txcnt = lpuart32_read(sport->port.membase + UARTWATER); | ||
| 546 | txcnt = txcnt >> UARTWATER_TXCNT_OFF; | ||
| 547 | txcnt &= UARTWATER_COUNT_MASK; | ||
| 548 | while (!uart_circ_empty(xmit) && (txcnt < sport->txfifo_size)) { | ||
| 549 | lpuart32_write(xmit->buf[xmit->tail], sport->port.membase + UARTDATA); | ||
| 550 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | ||
| 551 | sport->port.icount.tx++; | ||
| 552 | txcnt = lpuart32_read(sport->port.membase + UARTWATER); | ||
| 553 | txcnt = txcnt >> UARTWATER_TXCNT_OFF; | ||
| 554 | txcnt &= UARTWATER_COUNT_MASK; | ||
| 555 | } | ||
| 556 | |||
| 557 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
| 558 | uart_write_wakeup(&sport->port); | ||
| 559 | |||
| 560 | if (uart_circ_empty(xmit)) | ||
| 561 | lpuart32_stop_tx(&sport->port); | ||
| 562 | } | ||
| 563 | |||
| 408 | static void lpuart_start_tx(struct uart_port *port) | 564 | static void lpuart_start_tx(struct uart_port *port) |
| 409 | { | 565 | { |
| 410 | struct lpuart_port *sport = container_of(port, | 566 | struct lpuart_port *sport = container_of(port, |
| @@ -424,6 +580,18 @@ static void lpuart_start_tx(struct uart_port *port) | |||
| 424 | } | 580 | } |
| 425 | } | 581 | } |
| 426 | 582 | ||
| 583 | static void lpuart32_start_tx(struct uart_port *port) | ||
| 584 | { | ||
| 585 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | ||
| 586 | unsigned long temp; | ||
| 587 | |||
| 588 | temp = lpuart32_read(port->membase + UARTCTRL); | ||
| 589 | lpuart32_write(temp | UARTCTRL_TIE, port->membase + UARTCTRL); | ||
| 590 | |||
| 591 | if (lpuart32_read(port->membase + UARTSTAT) & UARTSTAT_TDRE) | ||
| 592 | lpuart32_transmit_buffer(sport); | ||
| 593 | } | ||
| 594 | |||
| 427 | static irqreturn_t lpuart_txint(int irq, void *dev_id) | 595 | static irqreturn_t lpuart_txint(int irq, void *dev_id) |
| 428 | { | 596 | { |
| 429 | struct lpuart_port *sport = dev_id; | 597 | struct lpuart_port *sport = dev_id; |
| @@ -432,16 +600,25 @@ static irqreturn_t lpuart_txint(int irq, void *dev_id) | |||
| 432 | 600 | ||
| 433 | spin_lock_irqsave(&sport->port.lock, flags); | 601 | spin_lock_irqsave(&sport->port.lock, flags); |
| 434 | if (sport->port.x_char) { | 602 | if (sport->port.x_char) { |
| 435 | writeb(sport->port.x_char, sport->port.membase + UARTDR); | 603 | if (sport->lpuart32) |
| 604 | lpuart32_write(sport->port.x_char, sport->port.membase + UARTDATA); | ||
| 605 | else | ||
| 606 | writeb(sport->port.x_char, sport->port.membase + UARTDR); | ||
| 436 | goto out; | 607 | goto out; |
| 437 | } | 608 | } |
| 438 | 609 | ||
| 439 | if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) { | 610 | if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) { |
| 440 | lpuart_stop_tx(&sport->port); | 611 | if (sport->lpuart32) |
| 612 | lpuart32_stop_tx(&sport->port); | ||
| 613 | else | ||
| 614 | lpuart_stop_tx(&sport->port); | ||
| 441 | goto out; | 615 | goto out; |
| 442 | } | 616 | } |
| 443 | 617 | ||
| 444 | lpuart_transmit_buffer(sport); | 618 | if (sport->lpuart32) |
| 619 | lpuart32_transmit_buffer(sport); | ||
| 620 | else | ||
| 621 | lpuart_transmit_buffer(sport); | ||
| 445 | 622 | ||
| 446 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 623 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
| 447 | uart_write_wakeup(&sport->port); | 624 | uart_write_wakeup(&sport->port); |
| @@ -514,6 +691,70 @@ out: | |||
| 514 | return IRQ_HANDLED; | 691 | return IRQ_HANDLED; |
| 515 | } | 692 | } |
| 516 | 693 | ||
| 694 | static irqreturn_t lpuart32_rxint(int irq, void *dev_id) | ||
| 695 | { | ||
| 696 | struct lpuart_port *sport = dev_id; | ||
| 697 | unsigned int flg, ignored = 0; | ||
| 698 | struct tty_port *port = &sport->port.state->port; | ||
| 699 | unsigned long flags; | ||
| 700 | unsigned long rx, sr; | ||
| 701 | |||
| 702 | spin_lock_irqsave(&sport->port.lock, flags); | ||
| 703 | |||
| 704 | while (!(lpuart32_read(sport->port.membase + UARTFIFO) & UARTFIFO_RXEMPT)) { | ||
| 705 | flg = TTY_NORMAL; | ||
| 706 | sport->port.icount.rx++; | ||
| 707 | /* | ||
| 708 | * to clear the FE, OR, NF, FE, PE flags, | ||
| 709 | * read STAT then read DATA reg | ||
| 710 | */ | ||
| 711 | sr = lpuart32_read(sport->port.membase + UARTSTAT); | ||
| 712 | rx = lpuart32_read(sport->port.membase + UARTDATA); | ||
| 713 | rx &= 0x3ff; | ||
| 714 | |||
| 715 | if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) | ||
| 716 | continue; | ||
| 717 | |||
| 718 | if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) { | ||
| 719 | if (sr & UARTSTAT_PE) | ||
| 720 | sport->port.icount.parity++; | ||
| 721 | else if (sr & UARTSTAT_FE) | ||
| 722 | sport->port.icount.frame++; | ||
| 723 | |||
| 724 | if (sr & UARTSTAT_OR) | ||
| 725 | sport->port.icount.overrun++; | ||
| 726 | |||
| 727 | if (sr & sport->port.ignore_status_mask) { | ||
| 728 | if (++ignored > 100) | ||
| 729 | goto out; | ||
| 730 | continue; | ||
| 731 | } | ||
| 732 | |||
| 733 | sr &= sport->port.read_status_mask; | ||
| 734 | |||
| 735 | if (sr & UARTSTAT_PE) | ||
| 736 | flg = TTY_PARITY; | ||
| 737 | else if (sr & UARTSTAT_FE) | ||
| 738 | flg = TTY_FRAME; | ||
| 739 | |||
| 740 | if (sr & UARTSTAT_OR) | ||
| 741 | flg = TTY_OVERRUN; | ||
| 742 | |||
| 743 | #ifdef SUPPORT_SYSRQ | ||
| 744 | sport->port.sysrq = 0; | ||
| 745 | #endif | ||
| 746 | } | ||
| 747 | |||
| 748 | tty_insert_flip_char(port, rx, flg); | ||
| 749 | } | ||
| 750 | |||
| 751 | out: | ||
| 752 | spin_unlock_irqrestore(&sport->port.lock, flags); | ||
| 753 | |||
| 754 | tty_flip_buffer_push(port); | ||
| 755 | return IRQ_HANDLED; | ||
| 756 | } | ||
| 757 | |||
| 517 | static irqreturn_t lpuart_int(int irq, void *dev_id) | 758 | static irqreturn_t lpuart_int(int irq, void *dev_id) |
| 518 | { | 759 | { |
| 519 | struct lpuart_port *sport = dev_id; | 760 | struct lpuart_port *sport = dev_id; |
| @@ -538,6 +779,26 @@ static irqreturn_t lpuart_int(int irq, void *dev_id) | |||
| 538 | return IRQ_HANDLED; | 779 | return IRQ_HANDLED; |
| 539 | } | 780 | } |
| 540 | 781 | ||
| 782 | static irqreturn_t lpuart32_int(int irq, void *dev_id) | ||
| 783 | { | ||
| 784 | struct lpuart_port *sport = dev_id; | ||
| 785 | unsigned long sts, rxcount; | ||
| 786 | |||
| 787 | sts = lpuart32_read(sport->port.membase + UARTSTAT); | ||
| 788 | rxcount = lpuart32_read(sport->port.membase + UARTWATER); | ||
| 789 | rxcount = rxcount >> UARTWATER_RXCNT_OFF; | ||
| 790 | |||
| 791 | if (sts & UARTSTAT_RDRF || rxcount > 0) | ||
| 792 | lpuart32_rxint(irq, dev_id); | ||
| 793 | |||
| 794 | if ((sts & UARTSTAT_TDRE) && | ||
| 795 | !(lpuart32_read(sport->port.membase + UARTBAUD) & UARTBAUD_TDMAE)) | ||
| 796 | lpuart_txint(irq, dev_id); | ||
| 797 | |||
| 798 | lpuart32_write(sts, sport->port.membase + UARTSTAT); | ||
| 799 | return IRQ_HANDLED; | ||
| 800 | } | ||
| 801 | |||
| 541 | /* return TIOCSER_TEMT when transmitter is not busy */ | 802 | /* return TIOCSER_TEMT when transmitter is not busy */ |
| 542 | static unsigned int lpuart_tx_empty(struct uart_port *port) | 803 | static unsigned int lpuart_tx_empty(struct uart_port *port) |
| 543 | { | 804 | { |
| @@ -545,6 +806,12 @@ static unsigned int lpuart_tx_empty(struct uart_port *port) | |||
| 545 | TIOCSER_TEMT : 0; | 806 | TIOCSER_TEMT : 0; |
| 546 | } | 807 | } |
| 547 | 808 | ||
| 809 | static unsigned int lpuart32_tx_empty(struct uart_port *port) | ||
| 810 | { | ||
| 811 | return (lpuart32_read(port->membase + UARTSTAT) & UARTSTAT_TC) ? | ||
| 812 | TIOCSER_TEMT : 0; | ||
| 813 | } | ||
| 814 | |||
| 548 | static unsigned int lpuart_get_mctrl(struct uart_port *port) | 815 | static unsigned int lpuart_get_mctrl(struct uart_port *port) |
| 549 | { | 816 | { |
| 550 | unsigned int temp = 0; | 817 | unsigned int temp = 0; |
| @@ -560,6 +827,21 @@ static unsigned int lpuart_get_mctrl(struct uart_port *port) | |||
| 560 | return temp; | 827 | return temp; |
| 561 | } | 828 | } |
| 562 | 829 | ||
| 830 | static unsigned int lpuart32_get_mctrl(struct uart_port *port) | ||
| 831 | { | ||
| 832 | unsigned int temp = 0; | ||
| 833 | unsigned long reg; | ||
| 834 | |||
| 835 | reg = lpuart32_read(port->membase + UARTMODIR); | ||
| 836 | if (reg & UARTMODIR_TXCTSE) | ||
| 837 | temp |= TIOCM_CTS; | ||
| 838 | |||
| 839 | if (reg & UARTMODIR_RXRTSE) | ||
| 840 | temp |= TIOCM_RTS; | ||
| 841 | |||
| 842 | return temp; | ||
| 843 | } | ||
| 844 | |||
| 563 | static void lpuart_set_mctrl(struct uart_port *port, unsigned int mctrl) | 845 | static void lpuart_set_mctrl(struct uart_port *port, unsigned int mctrl) |
| 564 | { | 846 | { |
| 565 | unsigned char temp; | 847 | unsigned char temp; |
| @@ -576,6 +858,22 @@ static void lpuart_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
| 576 | writeb(temp, port->membase + UARTMODEM); | 858 | writeb(temp, port->membase + UARTMODEM); |
| 577 | } | 859 | } |
| 578 | 860 | ||
| 861 | static void lpuart32_set_mctrl(struct uart_port *port, unsigned int mctrl) | ||
| 862 | { | ||
| 863 | unsigned long temp; | ||
| 864 | |||
| 865 | temp = lpuart32_read(port->membase + UARTMODIR) & | ||
| 866 | ~(UARTMODIR_RXRTSE | UARTMODIR_TXCTSE); | ||
| 867 | |||
| 868 | if (mctrl & TIOCM_RTS) | ||
| 869 | temp |= UARTMODIR_RXRTSE; | ||
| 870 | |||
| 871 | if (mctrl & TIOCM_CTS) | ||
| 872 | temp |= UARTMODIR_TXCTSE; | ||
| 873 | |||
| 874 | lpuart32_write(temp, port->membase + UARTMODIR); | ||
| 875 | } | ||
| 876 | |||
| 579 | static void lpuart_break_ctl(struct uart_port *port, int break_state) | 877 | static void lpuart_break_ctl(struct uart_port *port, int break_state) |
| 580 | { | 878 | { |
| 581 | unsigned char temp; | 879 | unsigned char temp; |
| @@ -588,6 +886,18 @@ static void lpuart_break_ctl(struct uart_port *port, int break_state) | |||
| 588 | writeb(temp, port->membase + UARTCR2); | 886 | writeb(temp, port->membase + UARTCR2); |
| 589 | } | 887 | } |
| 590 | 888 | ||
| 889 | static void lpuart32_break_ctl(struct uart_port *port, int break_state) | ||
| 890 | { | ||
| 891 | unsigned long temp; | ||
| 892 | |||
| 893 | temp = lpuart32_read(port->membase + UARTCTRL) & ~UARTCTRL_SBK; | ||
| 894 | |||
| 895 | if (break_state != 0) | ||
| 896 | temp |= UARTCTRL_SBK; | ||
| 897 | |||
| 898 | lpuart32_write(temp, port->membase + UARTCTRL); | ||
| 899 | } | ||
| 900 | |||
| 591 | static void lpuart_setup_watermark(struct lpuart_port *sport) | 901 | static void lpuart_setup_watermark(struct lpuart_port *sport) |
| 592 | { | 902 | { |
| 593 | unsigned char val, cr2; | 903 | unsigned char val, cr2; |
| @@ -599,15 +909,7 @@ static void lpuart_setup_watermark(struct lpuart_port *sport) | |||
| 599 | UARTCR2_RIE | UARTCR2_RE); | 909 | UARTCR2_RIE | UARTCR2_RE); |
| 600 | writeb(cr2, sport->port.membase + UARTCR2); | 910 | writeb(cr2, sport->port.membase + UARTCR2); |
| 601 | 911 | ||
| 602 | /* determine FIFO size and enable FIFO mode */ | ||
| 603 | val = readb(sport->port.membase + UARTPFIFO); | 912 | val = readb(sport->port.membase + UARTPFIFO); |
| 604 | |||
| 605 | sport->txfifo_size = 0x1 << (((val >> UARTPFIFO_TXSIZE_OFF) & | ||
| 606 | UARTPFIFO_FIFOSIZE_MASK) + 1); | ||
| 607 | |||
| 608 | sport->rxfifo_size = 0x1 << (((val >> UARTPFIFO_RXSIZE_OFF) & | ||
| 609 | UARTPFIFO_FIFOSIZE_MASK) + 1); | ||
| 610 | |||
| 611 | writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE, | 913 | writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE, |
| 612 | sport->port.membase + UARTPFIFO); | 914 | sport->port.membase + UARTPFIFO); |
| 613 | 915 | ||
| @@ -622,6 +924,31 @@ static void lpuart_setup_watermark(struct lpuart_port *sport) | |||
| 622 | writeb(cr2_saved, sport->port.membase + UARTCR2); | 924 | writeb(cr2_saved, sport->port.membase + UARTCR2); |
| 623 | } | 925 | } |
| 624 | 926 | ||
| 927 | static void lpuart32_setup_watermark(struct lpuart_port *sport) | ||
| 928 | { | ||
| 929 | unsigned long val, ctrl; | ||
| 930 | unsigned long ctrl_saved; | ||
| 931 | |||
| 932 | ctrl = lpuart32_read(sport->port.membase + UARTCTRL); | ||
| 933 | ctrl_saved = ctrl; | ||
| 934 | ctrl &= ~(UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_TE | | ||
| 935 | UARTCTRL_RIE | UARTCTRL_RE); | ||
| 936 | lpuart32_write(ctrl, sport->port.membase + UARTCTRL); | ||
| 937 | |||
| 938 | /* enable FIFO mode */ | ||
| 939 | val = lpuart32_read(sport->port.membase + UARTFIFO); | ||
| 940 | val |= UARTFIFO_TXFE | UARTFIFO_RXFE; | ||
| 941 | val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH; | ||
| 942 | lpuart32_write(val, sport->port.membase + UARTFIFO); | ||
| 943 | |||
| 944 | /* set the watermark */ | ||
| 945 | val = (0x1 << UARTWATER_RXWATER_OFF) | (0x0 << UARTWATER_TXWATER_OFF); | ||
| 946 | lpuart32_write(val, sport->port.membase + UARTWATER); | ||
| 947 | |||
| 948 | /* Restore cr2 */ | ||
| 949 | lpuart32_write(ctrl_saved, sport->port.membase + UARTCTRL); | ||
| 950 | } | ||
| 951 | |||
| 625 | static int lpuart_dma_tx_request(struct uart_port *port) | 952 | static int lpuart_dma_tx_request(struct uart_port *port) |
| 626 | { | 953 | { |
| 627 | struct lpuart_port *sport = container_of(port, | 954 | struct lpuart_port *sport = container_of(port, |
| @@ -652,7 +979,7 @@ static int lpuart_dma_tx_request(struct uart_port *port) | |||
| 652 | dma_buf = sport->port.state->xmit.buf; | 979 | dma_buf = sport->port.state->xmit.buf; |
| 653 | dma_tx_sconfig.dst_addr = sport->port.mapbase + UARTDR; | 980 | dma_tx_sconfig.dst_addr = sport->port.mapbase + UARTDR; |
| 654 | dma_tx_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; | 981 | dma_tx_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; |
| 655 | dma_tx_sconfig.dst_maxburst = DMA_MAXBURST; | 982 | dma_tx_sconfig.dst_maxburst = sport->txfifo_size; |
| 656 | dma_tx_sconfig.direction = DMA_MEM_TO_DEV; | 983 | dma_tx_sconfig.direction = DMA_MEM_TO_DEV; |
| 657 | ret = dmaengine_slave_config(tx_chan, &dma_tx_sconfig); | 984 | ret = dmaengine_slave_config(tx_chan, &dma_tx_sconfig); |
| 658 | 985 | ||
| @@ -724,13 +1051,6 @@ static int lpuart_dma_rx_request(struct uart_port *port) | |||
| 724 | sport->dma_rx_buf_bus = dma_bus; | 1051 | sport->dma_rx_buf_bus = dma_bus; |
| 725 | sport->dma_rx_in_progress = 0; | 1052 | sport->dma_rx_in_progress = 0; |
| 726 | 1053 | ||
| 727 | sport->dma_rx_timeout = (sport->port.timeout - HZ / 50) * | ||
| 728 | FSL_UART_RX_DMA_BUFFER_SIZE * 3 / | ||
| 729 | sport->rxfifo_size / 2; | ||
| 730 | |||
| 731 | if (sport->dma_rx_timeout < msecs_to_jiffies(20)) | ||
| 732 | sport->dma_rx_timeout = msecs_to_jiffies(20); | ||
| 733 | |||
| 734 | return 0; | 1054 | return 0; |
| 735 | } | 1055 | } |
| 736 | 1056 | ||
| @@ -772,7 +1092,16 @@ static int lpuart_startup(struct uart_port *port) | |||
| 772 | unsigned long flags; | 1092 | unsigned long flags; |
| 773 | unsigned char temp; | 1093 | unsigned char temp; |
| 774 | 1094 | ||
| 775 | /*whether use dma support by dma request results*/ | 1095 | /* determine FIFO size and enable FIFO mode */ |
| 1096 | temp = readb(sport->port.membase + UARTPFIFO); | ||
| 1097 | |||
| 1098 | sport->txfifo_size = 0x1 << (((temp >> UARTPFIFO_TXSIZE_OFF) & | ||
| 1099 | UARTPFIFO_FIFOSIZE_MASK) + 1); | ||
| 1100 | |||
| 1101 | sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) & | ||
| 1102 | UARTPFIFO_FIFOSIZE_MASK) + 1); | ||
| 1103 | |||
| 1104 | /* Whether use dma support by dma request results */ | ||
| 776 | if (lpuart_dma_tx_request(port) || lpuart_dma_rx_request(port)) { | 1105 | if (lpuart_dma_tx_request(port) || lpuart_dma_rx_request(port)) { |
| 777 | sport->lpuart_dma_use = false; | 1106 | sport->lpuart_dma_use = false; |
| 778 | } else { | 1107 | } else { |
| @@ -798,6 +1127,40 @@ static int lpuart_startup(struct uart_port *port) | |||
| 798 | return 0; | 1127 | return 0; |
| 799 | } | 1128 | } |
| 800 | 1129 | ||
| 1130 | static int lpuart32_startup(struct uart_port *port) | ||
| 1131 | { | ||
| 1132 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | ||
| 1133 | int ret; | ||
| 1134 | unsigned long flags; | ||
| 1135 | unsigned long temp; | ||
| 1136 | |||
| 1137 | /* determine FIFO size */ | ||
| 1138 | temp = lpuart32_read(sport->port.membase + UARTFIFO); | ||
| 1139 | |||
| 1140 | sport->txfifo_size = 0x1 << (((temp >> UARTFIFO_TXSIZE_OFF) & | ||
| 1141 | UARTFIFO_FIFOSIZE_MASK) - 1); | ||
| 1142 | |||
| 1143 | sport->rxfifo_size = 0x1 << (((temp >> UARTFIFO_RXSIZE_OFF) & | ||
| 1144 | UARTFIFO_FIFOSIZE_MASK) - 1); | ||
| 1145 | |||
| 1146 | ret = devm_request_irq(port->dev, port->irq, lpuart32_int, 0, | ||
| 1147 | DRIVER_NAME, sport); | ||
| 1148 | if (ret) | ||
| 1149 | return ret; | ||
| 1150 | |||
| 1151 | spin_lock_irqsave(&sport->port.lock, flags); | ||
| 1152 | |||
| 1153 | lpuart32_setup_watermark(sport); | ||
| 1154 | |||
| 1155 | temp = lpuart32_read(sport->port.membase + UARTCTRL); | ||
| 1156 | temp |= (UARTCTRL_RIE | UARTCTRL_TIE | UARTCTRL_RE | UARTCTRL_TE); | ||
| 1157 | temp |= UARTCTRL_ILIE; | ||
| 1158 | lpuart32_write(temp, sport->port.membase + UARTCTRL); | ||
| 1159 | |||
| 1160 | spin_unlock_irqrestore(&sport->port.lock, flags); | ||
| 1161 | return 0; | ||
| 1162 | } | ||
| 1163 | |||
| 801 | static void lpuart_shutdown(struct uart_port *port) | 1164 | static void lpuart_shutdown(struct uart_port *port) |
| 802 | { | 1165 | { |
| 803 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | 1166 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); |
| @@ -822,6 +1185,25 @@ static void lpuart_shutdown(struct uart_port *port) | |||
| 822 | } | 1185 | } |
| 823 | } | 1186 | } |
| 824 | 1187 | ||
| 1188 | static void lpuart32_shutdown(struct uart_port *port) | ||
| 1189 | { | ||
| 1190 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | ||
| 1191 | unsigned long temp; | ||
| 1192 | unsigned long flags; | ||
| 1193 | |||
| 1194 | spin_lock_irqsave(&port->lock, flags); | ||
| 1195 | |||
| 1196 | /* disable Rx/Tx and interrupts */ | ||
| 1197 | temp = lpuart32_read(port->membase + UARTCTRL); | ||
| 1198 | temp &= ~(UARTCTRL_TE | UARTCTRL_RE | | ||
| 1199 | UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE); | ||
| 1200 | lpuart32_write(temp, port->membase + UARTCTRL); | ||
| 1201 | |||
| 1202 | spin_unlock_irqrestore(&port->lock, flags); | ||
| 1203 | |||
| 1204 | devm_free_irq(port->dev, port->irq, sport); | ||
| 1205 | } | ||
| 1206 | |||
| 825 | static void | 1207 | static void |
| 826 | lpuart_set_termios(struct uart_port *port, struct ktermios *termios, | 1208 | lpuart_set_termios(struct uart_port *port, struct ktermios *termios, |
| 827 | struct ktermios *old) | 1209 | struct ktermios *old) |
| @@ -922,6 +1304,17 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 922 | /* update the per-port timeout */ | 1304 | /* update the per-port timeout */ |
| 923 | uart_update_timeout(port, termios->c_cflag, baud); | 1305 | uart_update_timeout(port, termios->c_cflag, baud); |
| 924 | 1306 | ||
| 1307 | if (sport->lpuart_dma_use) { | ||
| 1308 | /* Calculate delay for 1.5 DMA buffers */ | ||
| 1309 | sport->dma_rx_timeout = (sport->port.timeout - HZ / 50) * | ||
| 1310 | FSL_UART_RX_DMA_BUFFER_SIZE * 3 / | ||
| 1311 | sport->rxfifo_size / 2; | ||
| 1312 | dev_dbg(port->dev, "DMA Rx t-out %ums, tty t-out %u jiffies\n", | ||
| 1313 | sport->dma_rx_timeout * 1000 / HZ, sport->port.timeout); | ||
| 1314 | if (sport->dma_rx_timeout < msecs_to_jiffies(20)) | ||
| 1315 | sport->dma_rx_timeout = msecs_to_jiffies(20); | ||
| 1316 | } | ||
| 1317 | |||
| 925 | /* wait transmit engin complete */ | 1318 | /* wait transmit engin complete */ |
| 926 | while (!(readb(sport->port.membase + UARTSR1) & UARTSR1_TC)) | 1319 | while (!(readb(sport->port.membase + UARTSR1) & UARTSR1_TC)) |
| 927 | barrier(); | 1320 | barrier(); |
| @@ -948,6 +1341,125 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 948 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1341 | spin_unlock_irqrestore(&sport->port.lock, flags); |
| 949 | } | 1342 | } |
| 950 | 1343 | ||
| 1344 | static void | ||
| 1345 | lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, | ||
| 1346 | struct ktermios *old) | ||
| 1347 | { | ||
| 1348 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | ||
| 1349 | unsigned long flags; | ||
| 1350 | unsigned long ctrl, old_ctrl, bd, modem; | ||
| 1351 | unsigned int baud; | ||
| 1352 | unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; | ||
| 1353 | unsigned int sbr; | ||
| 1354 | |||
| 1355 | ctrl = old_ctrl = lpuart32_read(sport->port.membase + UARTCTRL); | ||
| 1356 | bd = lpuart32_read(sport->port.membase + UARTBAUD); | ||
| 1357 | modem = lpuart32_read(sport->port.membase + UARTMODIR); | ||
| 1358 | /* | ||
| 1359 | * only support CS8 and CS7, and for CS7 must enable PE. | ||
| 1360 | * supported mode: | ||
| 1361 | * - (7,e/o,1) | ||
| 1362 | * - (8,n,1) | ||
| 1363 | * - (8,m/s,1) | ||
| 1364 | * - (8,e/o,1) | ||
| 1365 | */ | ||
| 1366 | while ((termios->c_cflag & CSIZE) != CS8 && | ||
| 1367 | (termios->c_cflag & CSIZE) != CS7) { | ||
| 1368 | termios->c_cflag &= ~CSIZE; | ||
| 1369 | termios->c_cflag |= old_csize; | ||
| 1370 | old_csize = CS8; | ||
| 1371 | } | ||
| 1372 | |||
| 1373 | if ((termios->c_cflag & CSIZE) == CS8 || | ||
| 1374 | (termios->c_cflag & CSIZE) == CS7) | ||
| 1375 | ctrl = old_ctrl & ~UARTCTRL_M; | ||
| 1376 | |||
| 1377 | if (termios->c_cflag & CMSPAR) { | ||
| 1378 | if ((termios->c_cflag & CSIZE) != CS8) { | ||
| 1379 | termios->c_cflag &= ~CSIZE; | ||
| 1380 | termios->c_cflag |= CS8; | ||
| 1381 | } | ||
| 1382 | ctrl |= UARTCTRL_M; | ||
| 1383 | } | ||
| 1384 | |||
| 1385 | if (termios->c_cflag & CRTSCTS) { | ||
| 1386 | modem |= (UARTMODEM_RXRTSE | UARTMODEM_TXCTSE); | ||
| 1387 | } else { | ||
| 1388 | termios->c_cflag &= ~CRTSCTS; | ||
| 1389 | modem &= ~(UARTMODEM_RXRTSE | UARTMODEM_TXCTSE); | ||
| 1390 | } | ||
| 1391 | |||
| 1392 | if (termios->c_cflag & CSTOPB) | ||
| 1393 | termios->c_cflag &= ~CSTOPB; | ||
| 1394 | |||
| 1395 | /* parity must be enabled when CS7 to match 8-bits format */ | ||
| 1396 | if ((termios->c_cflag & CSIZE) == CS7) | ||
| 1397 | termios->c_cflag |= PARENB; | ||
| 1398 | |||
| 1399 | if ((termios->c_cflag & PARENB)) { | ||
| 1400 | if (termios->c_cflag & CMSPAR) { | ||
| 1401 | ctrl &= ~UARTCTRL_PE; | ||
| 1402 | ctrl |= UARTCTRL_M; | ||
| 1403 | } else { | ||
| 1404 | ctrl |= UARTCR1_PE; | ||
| 1405 | if ((termios->c_cflag & CSIZE) == CS8) | ||
| 1406 | ctrl |= UARTCTRL_M; | ||
| 1407 | if (termios->c_cflag & PARODD) | ||
| 1408 | ctrl |= UARTCTRL_PT; | ||
| 1409 | else | ||
| 1410 | ctrl &= ~UARTCTRL_PT; | ||
| 1411 | } | ||
| 1412 | } | ||
| 1413 | |||
| 1414 | /* ask the core to calculate the divisor */ | ||
| 1415 | baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16); | ||
| 1416 | |||
| 1417 | spin_lock_irqsave(&sport->port.lock, flags); | ||
| 1418 | |||
| 1419 | sport->port.read_status_mask = 0; | ||
| 1420 | if (termios->c_iflag & INPCK) | ||
| 1421 | sport->port.read_status_mask |= (UARTSTAT_FE | UARTSTAT_PE); | ||
| 1422 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) | ||
| 1423 | sport->port.read_status_mask |= UARTSTAT_FE; | ||
| 1424 | |||
| 1425 | /* characters to ignore */ | ||
| 1426 | sport->port.ignore_status_mask = 0; | ||
| 1427 | if (termios->c_iflag & IGNPAR) | ||
| 1428 | sport->port.ignore_status_mask |= UARTSTAT_PE; | ||
| 1429 | if (termios->c_iflag & IGNBRK) { | ||
| 1430 | sport->port.ignore_status_mask |= UARTSTAT_FE; | ||
| 1431 | /* | ||
| 1432 | * if we're ignoring parity and break indicators, | ||
| 1433 | * ignore overruns too (for real raw support). | ||
| 1434 | */ | ||
| 1435 | if (termios->c_iflag & IGNPAR) | ||
| 1436 | sport->port.ignore_status_mask |= UARTSTAT_OR; | ||
| 1437 | } | ||
| 1438 | |||
| 1439 | /* update the per-port timeout */ | ||
| 1440 | uart_update_timeout(port, termios->c_cflag, baud); | ||
| 1441 | |||
| 1442 | /* wait transmit engin complete */ | ||
| 1443 | while (!(lpuart32_read(sport->port.membase + UARTSTAT) & UARTSTAT_TC)) | ||
| 1444 | barrier(); | ||
| 1445 | |||
| 1446 | /* disable transmit and receive */ | ||
| 1447 | lpuart32_write(old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE), | ||
| 1448 | sport->port.membase + UARTCTRL); | ||
| 1449 | |||
| 1450 | sbr = sport->port.uartclk / (16 * baud); | ||
| 1451 | bd &= ~UARTBAUD_SBR_MASK; | ||
| 1452 | bd |= sbr & UARTBAUD_SBR_MASK; | ||
| 1453 | bd |= UARTBAUD_BOTHEDGE; | ||
| 1454 | bd &= ~(UARTBAUD_TDMAE | UARTBAUD_RDMAE); | ||
| 1455 | lpuart32_write(bd, sport->port.membase + UARTBAUD); | ||
| 1456 | lpuart32_write(modem, sport->port.membase + UARTMODIR); | ||
| 1457 | lpuart32_write(ctrl, sport->port.membase + UARTCTRL); | ||
| 1458 | /* restore control register */ | ||
| 1459 | |||
| 1460 | spin_unlock_irqrestore(&sport->port.lock, flags); | ||
| 1461 | } | ||
| 1462 | |||
| 951 | static const char *lpuart_type(struct uart_port *port) | 1463 | static const char *lpuart_type(struct uart_port *port) |
| 952 | { | 1464 | { |
| 953 | return "FSL_LPUART"; | 1465 | return "FSL_LPUART"; |
| @@ -996,7 +1508,6 @@ static struct uart_ops lpuart_pops = { | |||
| 996 | .stop_tx = lpuart_stop_tx, | 1508 | .stop_tx = lpuart_stop_tx, |
| 997 | .start_tx = lpuart_start_tx, | 1509 | .start_tx = lpuart_start_tx, |
| 998 | .stop_rx = lpuart_stop_rx, | 1510 | .stop_rx = lpuart_stop_rx, |
| 999 | .enable_ms = lpuart_enable_ms, | ||
| 1000 | .break_ctl = lpuart_break_ctl, | 1511 | .break_ctl = lpuart_break_ctl, |
| 1001 | .startup = lpuart_startup, | 1512 | .startup = lpuart_startup, |
| 1002 | .shutdown = lpuart_shutdown, | 1513 | .shutdown = lpuart_shutdown, |
| @@ -1008,6 +1519,24 @@ static struct uart_ops lpuart_pops = { | |||
| 1008 | .verify_port = lpuart_verify_port, | 1519 | .verify_port = lpuart_verify_port, |
| 1009 | }; | 1520 | }; |
| 1010 | 1521 | ||
| 1522 | static struct uart_ops lpuart32_pops = { | ||
| 1523 | .tx_empty = lpuart32_tx_empty, | ||
| 1524 | .set_mctrl = lpuart32_set_mctrl, | ||
| 1525 | .get_mctrl = lpuart32_get_mctrl, | ||
| 1526 | .stop_tx = lpuart32_stop_tx, | ||
| 1527 | .start_tx = lpuart32_start_tx, | ||
| 1528 | .stop_rx = lpuart32_stop_rx, | ||
| 1529 | .break_ctl = lpuart32_break_ctl, | ||
| 1530 | .startup = lpuart32_startup, | ||
| 1531 | .shutdown = lpuart32_shutdown, | ||
| 1532 | .set_termios = lpuart32_set_termios, | ||
| 1533 | .type = lpuart_type, | ||
| 1534 | .request_port = lpuart_request_port, | ||
| 1535 | .release_port = lpuart_release_port, | ||
| 1536 | .config_port = lpuart_config_port, | ||
| 1537 | .verify_port = lpuart_verify_port, | ||
| 1538 | }; | ||
| 1539 | |||
| 1011 | static struct lpuart_port *lpuart_ports[UART_NR]; | 1540 | static struct lpuart_port *lpuart_ports[UART_NR]; |
| 1012 | 1541 | ||
| 1013 | #ifdef CONFIG_SERIAL_FSL_LPUART_CONSOLE | 1542 | #ifdef CONFIG_SERIAL_FSL_LPUART_CONSOLE |
| @@ -1019,6 +1548,14 @@ static void lpuart_console_putchar(struct uart_port *port, int ch) | |||
| 1019 | writeb(ch, port->membase + UARTDR); | 1548 | writeb(ch, port->membase + UARTDR); |
| 1020 | } | 1549 | } |
| 1021 | 1550 | ||
| 1551 | static void lpuart32_console_putchar(struct uart_port *port, int ch) | ||
| 1552 | { | ||
| 1553 | while (!(lpuart32_read(port->membase + UARTSTAT) & UARTSTAT_TDRE)) | ||
| 1554 | barrier(); | ||
| 1555 | |||
| 1556 | lpuart32_write(ch, port->membase + UARTDATA); | ||
| 1557 | } | ||
| 1558 | |||
| 1022 | static void | 1559 | static void |
| 1023 | lpuart_console_write(struct console *co, const char *s, unsigned int count) | 1560 | lpuart_console_write(struct console *co, const char *s, unsigned int count) |
| 1024 | { | 1561 | { |
| @@ -1040,6 +1577,27 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count) | |||
| 1040 | writeb(old_cr2, sport->port.membase + UARTCR2); | 1577 | writeb(old_cr2, sport->port.membase + UARTCR2); |
| 1041 | } | 1578 | } |
| 1042 | 1579 | ||
| 1580 | static void | ||
| 1581 | lpuart32_console_write(struct console *co, const char *s, unsigned int count) | ||
| 1582 | { | ||
| 1583 | struct lpuart_port *sport = lpuart_ports[co->index]; | ||
| 1584 | unsigned long old_cr, cr; | ||
| 1585 | |||
| 1586 | /* first save CR2 and then disable interrupts */ | ||
| 1587 | cr = old_cr = lpuart32_read(sport->port.membase + UARTCTRL); | ||
| 1588 | cr |= (UARTCTRL_TE | UARTCTRL_RE); | ||
| 1589 | cr &= ~(UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE); | ||
| 1590 | lpuart32_write(cr, sport->port.membase + UARTCTRL); | ||
| 1591 | |||
| 1592 | uart_console_write(&sport->port, s, count, lpuart32_console_putchar); | ||
| 1593 | |||
| 1594 | /* wait for transmitter finish complete and restore CR2 */ | ||
| 1595 | while (!(lpuart32_read(sport->port.membase + UARTSTAT) & UARTSTAT_TC)) | ||
| 1596 | barrier(); | ||
| 1597 | |||
| 1598 | lpuart32_write(old_cr, sport->port.membase + UARTCTRL); | ||
| 1599 | } | ||
| 1600 | |||
| 1043 | /* | 1601 | /* |
| 1044 | * if the port was already initialised (eg, by a boot loader), | 1602 | * if the port was already initialised (eg, by a boot loader), |
| 1045 | * try to determine the current setup. | 1603 | * try to determine the current setup. |
| @@ -1093,6 +1651,49 @@ lpuart_console_get_options(struct lpuart_port *sport, int *baud, | |||
| 1093 | "from %d to %d\n", baud_raw, *baud); | 1651 | "from %d to %d\n", baud_raw, *baud); |
| 1094 | } | 1652 | } |
| 1095 | 1653 | ||
| 1654 | static void __init | ||
| 1655 | lpuart32_console_get_options(struct lpuart_port *sport, int *baud, | ||
| 1656 | int *parity, int *bits) | ||
| 1657 | { | ||
| 1658 | unsigned long cr, bd; | ||
| 1659 | unsigned int sbr, uartclk, baud_raw; | ||
| 1660 | |||
| 1661 | cr = lpuart32_read(sport->port.membase + UARTCTRL); | ||
| 1662 | cr &= UARTCTRL_TE | UARTCTRL_RE; | ||
| 1663 | if (!cr) | ||
| 1664 | return; | ||
| 1665 | |||
| 1666 | /* ok, the port was enabled */ | ||
| 1667 | |||
| 1668 | cr = lpuart32_read(sport->port.membase + UARTCTRL); | ||
| 1669 | |||
| 1670 | *parity = 'n'; | ||
| 1671 | if (cr & UARTCTRL_PE) { | ||
| 1672 | if (cr & UARTCTRL_PT) | ||
| 1673 | *parity = 'o'; | ||
| 1674 | else | ||
| 1675 | *parity = 'e'; | ||
| 1676 | } | ||
| 1677 | |||
| 1678 | if (cr & UARTCTRL_M) | ||
| 1679 | *bits = 9; | ||
| 1680 | else | ||
| 1681 | *bits = 8; | ||
| 1682 | |||
| 1683 | bd = lpuart32_read(sport->port.membase + UARTBAUD); | ||
| 1684 | bd &= UARTBAUD_SBR_MASK; | ||
| 1685 | sbr = bd; | ||
| 1686 | uartclk = clk_get_rate(sport->clk); | ||
| 1687 | /* | ||
| 1688 | * baud = mod_clk/(16*(sbr[13]+(brfa)/32) | ||
| 1689 | */ | ||
| 1690 | baud_raw = uartclk / (16 * sbr); | ||
| 1691 | |||
| 1692 | if (*baud != baud_raw) | ||
| 1693 | printk(KERN_INFO "Serial: Console lpuart rounded baud rate" | ||
| 1694 | "from %d to %d\n", baud_raw, *baud); | ||
| 1695 | } | ||
| 1696 | |||
| 1096 | static int __init lpuart_console_setup(struct console *co, char *options) | 1697 | static int __init lpuart_console_setup(struct console *co, char *options) |
| 1097 | { | 1698 | { |
| 1098 | struct lpuart_port *sport; | 1699 | struct lpuart_port *sport; |
| @@ -1116,9 +1717,15 @@ static int __init lpuart_console_setup(struct console *co, char *options) | |||
| 1116 | if (options) | 1717 | if (options) |
| 1117 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 1718 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
| 1118 | else | 1719 | else |
| 1119 | lpuart_console_get_options(sport, &baud, &parity, &bits); | 1720 | if (sport->lpuart32) |
| 1721 | lpuart32_console_get_options(sport, &baud, &parity, &bits); | ||
| 1722 | else | ||
| 1723 | lpuart_console_get_options(sport, &baud, &parity, &bits); | ||
| 1120 | 1724 | ||
| 1121 | lpuart_setup_watermark(sport); | 1725 | if (sport->lpuart32) |
| 1726 | lpuart32_setup_watermark(sport); | ||
| 1727 | else | ||
| 1728 | lpuart_setup_watermark(sport); | ||
| 1122 | 1729 | ||
| 1123 | return uart_set_options(&sport->port, co, baud, parity, bits, flow); | 1730 | return uart_set_options(&sport->port, co, baud, parity, bits, flow); |
| 1124 | } | 1731 | } |
| @@ -1134,9 +1741,21 @@ static struct console lpuart_console = { | |||
| 1134 | .data = &lpuart_reg, | 1741 | .data = &lpuart_reg, |
| 1135 | }; | 1742 | }; |
| 1136 | 1743 | ||
| 1744 | static struct console lpuart32_console = { | ||
| 1745 | .name = DEV_NAME, | ||
| 1746 | .write = lpuart32_console_write, | ||
| 1747 | .device = uart_console_device, | ||
| 1748 | .setup = lpuart_console_setup, | ||
| 1749 | .flags = CON_PRINTBUFFER, | ||
| 1750 | .index = -1, | ||
| 1751 | .data = &lpuart_reg, | ||
| 1752 | }; | ||
| 1753 | |||
| 1137 | #define LPUART_CONSOLE (&lpuart_console) | 1754 | #define LPUART_CONSOLE (&lpuart_console) |
| 1755 | #define LPUART32_CONSOLE (&lpuart32_console) | ||
| 1138 | #else | 1756 | #else |
| 1139 | #define LPUART_CONSOLE NULL | 1757 | #define LPUART_CONSOLE NULL |
| 1758 | #define LPUART32_CONSOLE NULL | ||
| 1140 | #endif | 1759 | #endif |
| 1141 | 1760 | ||
| 1142 | static struct uart_driver lpuart_reg = { | 1761 | static struct uart_driver lpuart_reg = { |
| @@ -1166,7 +1785,7 @@ static int lpuart_probe(struct platform_device *pdev) | |||
| 1166 | return ret; | 1785 | return ret; |
| 1167 | } | 1786 | } |
| 1168 | sport->port.line = ret; | 1787 | sport->port.line = ret; |
| 1169 | 1788 | sport->lpuart32 = of_device_is_compatible(np, "fsl,ls1021a-lpuart"); | |
| 1170 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1789 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1171 | if (!res) | 1790 | if (!res) |
| 1172 | return -ENODEV; | 1791 | return -ENODEV; |
| @@ -1180,7 +1799,10 @@ static int lpuart_probe(struct platform_device *pdev) | |||
| 1180 | sport->port.type = PORT_LPUART; | 1799 | sport->port.type = PORT_LPUART; |
| 1181 | sport->port.iotype = UPIO_MEM; | 1800 | sport->port.iotype = UPIO_MEM; |
| 1182 | sport->port.irq = platform_get_irq(pdev, 0); | 1801 | sport->port.irq = platform_get_irq(pdev, 0); |
| 1183 | sport->port.ops = &lpuart_pops; | 1802 | if (sport->lpuart32) |
| 1803 | sport->port.ops = &lpuart32_pops; | ||
| 1804 | else | ||
| 1805 | sport->port.ops = &lpuart_pops; | ||
| 1184 | sport->port.flags = UPF_BOOT_AUTOCONF; | 1806 | sport->port.flags = UPF_BOOT_AUTOCONF; |
| 1185 | 1807 | ||
| 1186 | sport->clk = devm_clk_get(&pdev->dev, "ipg"); | 1808 | sport->clk = devm_clk_get(&pdev->dev, "ipg"); |
| @@ -1202,6 +1824,11 @@ static int lpuart_probe(struct platform_device *pdev) | |||
| 1202 | 1824 | ||
| 1203 | platform_set_drvdata(pdev, &sport->port); | 1825 | platform_set_drvdata(pdev, &sport->port); |
| 1204 | 1826 | ||
| 1827 | if (sport->lpuart32) | ||
| 1828 | lpuart_reg.cons = LPUART32_CONSOLE; | ||
| 1829 | else | ||
| 1830 | lpuart_reg.cons = LPUART_CONSOLE; | ||
| 1831 | |||
| 1205 | ret = uart_add_one_port(&lpuart_reg, &sport->port); | 1832 | ret = uart_add_one_port(&lpuart_reg, &sport->port); |
| 1206 | if (ret) { | 1833 | if (ret) { |
| 1207 | clk_disable_unprepare(sport->clk); | 1834 | clk_disable_unprepare(sport->clk); |
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c index 67423805e6d9..d4620fe5da2e 100644 --- a/drivers/tty/serial/icom.c +++ b/drivers/tty/serial/icom.c | |||
| @@ -1052,11 +1052,6 @@ static void icom_stop_rx(struct uart_port *port) | |||
| 1052 | writeb(cmdReg & ~CMD_RCV_ENABLE, &ICOM_PORT->dram->CmdReg); | 1052 | writeb(cmdReg & ~CMD_RCV_ENABLE, &ICOM_PORT->dram->CmdReg); |
| 1053 | } | 1053 | } |
| 1054 | 1054 | ||
| 1055 | static void icom_enable_ms(struct uart_port *port) | ||
| 1056 | { | ||
| 1057 | /* no-op */ | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | static void icom_break(struct uart_port *port, int break_state) | 1055 | static void icom_break(struct uart_port *port, int break_state) |
| 1061 | { | 1056 | { |
| 1062 | unsigned char cmdReg; | 1057 | unsigned char cmdReg; |
| @@ -1300,7 +1295,6 @@ static struct uart_ops icom_ops = { | |||
| 1300 | .start_tx = icom_start_tx, | 1295 | .start_tx = icom_start_tx, |
| 1301 | .send_xchar = icom_send_xchar, | 1296 | .send_xchar = icom_send_xchar, |
| 1302 | .stop_rx = icom_stop_rx, | 1297 | .stop_rx = icom_stop_rx, |
| 1303 | .enable_ms = icom_enable_ms, | ||
| 1304 | .break_ctl = icom_break, | 1298 | .break_ctl = icom_break, |
| 1305 | .startup = icom_open, | 1299 | .startup = icom_open, |
| 1306 | .shutdown = icom_close, | 1300 | .shutdown = icom_close, |
diff --git a/drivers/tty/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c index 6e4c715c5d26..abd7ea26ed9a 100644 --- a/drivers/tty/serial/ioc3_serial.c +++ b/drivers/tty/serial/ioc3_serial.c | |||
| @@ -1880,7 +1880,6 @@ static struct uart_ops ioc3_ops = { | |||
| 1880 | .stop_tx = ic3_stop_tx, | 1880 | .stop_tx = ic3_stop_tx, |
| 1881 | .start_tx = ic3_start_tx, | 1881 | .start_tx = ic3_start_tx, |
| 1882 | .stop_rx = ic3_stop_rx, | 1882 | .stop_rx = ic3_stop_rx, |
| 1883 | .enable_ms = null_void_function, | ||
| 1884 | .break_ctl = ic3_break_ctl, | 1883 | .break_ctl = ic3_break_ctl, |
| 1885 | .startup = ic3_startup, | 1884 | .startup = ic3_startup, |
| 1886 | .shutdown = ic3_shutdown, | 1885 | .shutdown = ic3_shutdown, |
diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c index 1274499850fc..aa28209f44c1 100644 --- a/drivers/tty/serial/ioc4_serial.c +++ b/drivers/tty/serial/ioc4_serial.c | |||
| @@ -2597,7 +2597,6 @@ static struct uart_ops ioc4_ops = { | |||
| 2597 | .stop_tx = ic4_stop_tx, | 2597 | .stop_tx = ic4_stop_tx, |
| 2598 | .start_tx = ic4_start_tx, | 2598 | .start_tx = ic4_start_tx, |
| 2599 | .stop_rx = null_void_function, | 2599 | .stop_rx = null_void_function, |
| 2600 | .enable_ms = null_void_function, | ||
| 2601 | .break_ctl = ic4_break_ctl, | 2600 | .break_ctl = ic4_break_ctl, |
| 2602 | .startup = ic4_startup, | 2601 | .startup = ic4_startup, |
| 2603 | .shutdown = ic4_shutdown, | 2602 | .shutdown = ic4_shutdown, |
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c index 27bb75070c96..3e5c1563afe2 100644 --- a/drivers/tty/serial/jsm/jsm_tty.c +++ b/drivers/tty/serial/jsm/jsm_tty.c | |||
| @@ -177,11 +177,6 @@ static void jsm_tty_stop_rx(struct uart_port *port) | |||
| 177 | channel->ch_bd->bd_ops->disable_receiver(channel); | 177 | channel->ch_bd->bd_ops->disable_receiver(channel); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | static void jsm_tty_enable_ms(struct uart_port *port) | ||
| 181 | { | ||
| 182 | /* Nothing needed */ | ||
| 183 | } | ||
| 184 | |||
| 185 | static void jsm_tty_break(struct uart_port *port, int break_state) | 180 | static void jsm_tty_break(struct uart_port *port, int break_state) |
| 186 | { | 181 | { |
| 187 | unsigned long lock_flags; | 182 | unsigned long lock_flags; |
| @@ -354,7 +349,6 @@ static struct uart_ops jsm_ops = { | |||
| 354 | .start_tx = jsm_tty_start_tx, | 349 | .start_tx = jsm_tty_start_tx, |
| 355 | .send_xchar = jsm_tty_send_xchar, | 350 | .send_xchar = jsm_tty_send_xchar, |
| 356 | .stop_rx = jsm_tty_stop_rx, | 351 | .stop_rx = jsm_tty_stop_rx, |
| 357 | .enable_ms = jsm_tty_enable_ms, | ||
| 358 | .break_ctl = jsm_tty_break, | 352 | .break_ctl = jsm_tty_break, |
| 359 | .startup = jsm_tty_open, | 353 | .startup = jsm_tty_open, |
| 360 | .shutdown = jsm_tty_close, | 354 | .shutdown = jsm_tty_close, |
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c index cfadf2971b12..6ec7501b464d 100644 --- a/drivers/tty/serial/kgdb_nmi.c +++ b/drivers/tty/serial/kgdb_nmi.c | |||
| @@ -42,7 +42,7 @@ static char *kgdb_nmi_magic = "$3#33"; | |||
| 42 | module_param_named(magic, kgdb_nmi_magic, charp, 0600); | 42 | module_param_named(magic, kgdb_nmi_magic, charp, 0600); |
| 43 | MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)"); | 43 | MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)"); |
| 44 | 44 | ||
| 45 | static bool kgdb_nmi_tty_enabled; | 45 | static atomic_t kgdb_nmi_num_readers = ATOMIC_INIT(0); |
| 46 | 46 | ||
| 47 | static int kgdb_nmi_console_setup(struct console *co, char *options) | 47 | static int kgdb_nmi_console_setup(struct console *co, char *options) |
| 48 | { | 48 | { |
| @@ -136,7 +136,7 @@ static int kgdb_nmi_poll_one_knock(void) | |||
| 136 | n = 0; | 136 | n = 0; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | if (kgdb_nmi_tty_enabled) { | 139 | if (atomic_read(&kgdb_nmi_num_readers)) { |
| 140 | kgdb_tty_recv(c); | 140 | kgdb_tty_recv(c); |
| 141 | return 0; | 141 | return 0; |
| 142 | } | 142 | } |
| @@ -197,7 +197,8 @@ static void kgdb_nmi_tty_receiver(unsigned long data) | |||
| 197 | priv->timer.expires = jiffies + (HZ/100); | 197 | priv->timer.expires = jiffies + (HZ/100); |
| 198 | add_timer(&priv->timer); | 198 | add_timer(&priv->timer); |
| 199 | 199 | ||
| 200 | if (likely(!kgdb_nmi_tty_enabled || !kfifo_len(&priv->fifo))) | 200 | if (likely(!atomic_read(&kgdb_nmi_num_readers) || |
| 201 | !kfifo_len(&priv->fifo))) | ||
| 201 | return; | 202 | return; |
| 202 | 203 | ||
| 203 | while (kfifo_out(&priv->fifo, &ch, 1)) | 204 | while (kfifo_out(&priv->fifo, &ch, 1)) |
| @@ -270,13 +271,23 @@ static void kgdb_nmi_tty_cleanup(struct tty_struct *tty) | |||
| 270 | static int kgdb_nmi_tty_open(struct tty_struct *tty, struct file *file) | 271 | static int kgdb_nmi_tty_open(struct tty_struct *tty, struct file *file) |
| 271 | { | 272 | { |
| 272 | struct kgdb_nmi_tty_priv *priv = tty->driver_data; | 273 | struct kgdb_nmi_tty_priv *priv = tty->driver_data; |
| 274 | unsigned int mode = file->f_flags & O_ACCMODE; | ||
| 275 | int ret; | ||
| 276 | |||
| 277 | ret = tty_port_open(&priv->port, tty, file); | ||
| 278 | if (!ret && (mode == O_RDONLY || mode == O_RDWR)) | ||
| 279 | atomic_inc(&kgdb_nmi_num_readers); | ||
| 273 | 280 | ||
| 274 | return tty_port_open(&priv->port, tty, file); | 281 | return ret; |
| 275 | } | 282 | } |
| 276 | 283 | ||
| 277 | static void kgdb_nmi_tty_close(struct tty_struct *tty, struct file *file) | 284 | static void kgdb_nmi_tty_close(struct tty_struct *tty, struct file *file) |
| 278 | { | 285 | { |
| 279 | struct kgdb_nmi_tty_priv *priv = tty->driver_data; | 286 | struct kgdb_nmi_tty_priv *priv = tty->driver_data; |
| 287 | unsigned int mode = file->f_flags & O_ACCMODE; | ||
| 288 | |||
| 289 | if (mode == O_RDONLY || mode == O_RDWR) | ||
| 290 | atomic_dec(&kgdb_nmi_num_readers); | ||
| 280 | 291 | ||
| 281 | tty_port_close(&priv->port, tty, file); | 292 | tty_port_close(&priv->port, tty, file); |
| 282 | } | 293 | } |
| @@ -313,12 +324,6 @@ static const struct tty_operations kgdb_nmi_tty_ops = { | |||
| 313 | .write = kgdb_nmi_tty_write, | 324 | .write = kgdb_nmi_tty_write, |
| 314 | }; | 325 | }; |
| 315 | 326 | ||
| 316 | static int kgdb_nmi_enable_console(int argc, const char *argv[]) | ||
| 317 | { | ||
| 318 | kgdb_nmi_tty_enabled = !(argc == 1 && !strcmp(argv[1], "off")); | ||
| 319 | return 0; | ||
| 320 | } | ||
| 321 | |||
| 322 | int kgdb_register_nmi_console(void) | 327 | int kgdb_register_nmi_console(void) |
| 323 | { | 328 | { |
| 324 | int ret; | 329 | int ret; |
| @@ -348,19 +353,10 @@ int kgdb_register_nmi_console(void) | |||
| 348 | goto err_drv_reg; | 353 | goto err_drv_reg; |
| 349 | } | 354 | } |
| 350 | 355 | ||
| 351 | ret = kdb_register("nmi_console", kgdb_nmi_enable_console, "[off]", | ||
| 352 | "switch to Linux NMI console", 0); | ||
| 353 | if (ret) { | ||
| 354 | pr_err("%s: can't register kdb command: %d\n", __func__, ret); | ||
| 355 | goto err_kdb_reg; | ||
| 356 | } | ||
| 357 | |||
| 358 | register_console(&kgdb_nmi_console); | 356 | register_console(&kgdb_nmi_console); |
| 359 | arch_kgdb_ops.enable_nmi(1); | 357 | arch_kgdb_ops.enable_nmi(1); |
| 360 | 358 | ||
| 361 | return 0; | 359 | return 0; |
| 362 | err_kdb_reg: | ||
| 363 | tty_unregister_driver(kgdb_nmi_tty_driver); | ||
| 364 | err_drv_reg: | 360 | err_drv_reg: |
| 365 | put_tty_driver(kgdb_nmi_tty_driver); | 361 | put_tty_driver(kgdb_nmi_tty_driver); |
| 366 | return ret; | 362 | return ret; |
| @@ -375,8 +371,6 @@ int kgdb_unregister_nmi_console(void) | |||
| 375 | return 0; | 371 | return 0; |
| 376 | arch_kgdb_ops.enable_nmi(0); | 372 | arch_kgdb_ops.enable_nmi(0); |
| 377 | 373 | ||
| 378 | kdb_unregister("nmi_console"); | ||
| 379 | |||
| 380 | ret = unregister_console(&kgdb_nmi_console); | 374 | ret = unregister_console(&kgdb_nmi_console); |
| 381 | if (ret) | 375 | if (ret) |
| 382 | return ret; | 376 | return ret; |
diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c index 88d01e0bb0c8..4675fe198d31 100644 --- a/drivers/tty/serial/lantiq.c +++ b/drivers/tty/serial/lantiq.c | |||
| @@ -154,11 +154,6 @@ lqasc_stop_rx(struct uart_port *port) | |||
| 154 | ltq_w32(ASCWHBSTATE_CLRREN, port->membase + LTQ_ASC_WHBSTATE); | 154 | ltq_w32(ASCWHBSTATE_CLRREN, port->membase + LTQ_ASC_WHBSTATE); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | static void | ||
| 158 | lqasc_enable_ms(struct uart_port *port) | ||
| 159 | { | ||
| 160 | } | ||
| 161 | |||
| 162 | static int | 157 | static int |
| 163 | lqasc_rx_chars(struct uart_port *port) | 158 | lqasc_rx_chars(struct uart_port *port) |
| 164 | { | 159 | { |
| @@ -568,7 +563,6 @@ static struct uart_ops lqasc_pops = { | |||
| 568 | .stop_tx = lqasc_stop_tx, | 563 | .stop_tx = lqasc_stop_tx, |
| 569 | .start_tx = lqasc_start_tx, | 564 | .start_tx = lqasc_start_tx, |
| 570 | .stop_rx = lqasc_stop_rx, | 565 | .stop_rx = lqasc_stop_rx, |
| 571 | .enable_ms = lqasc_enable_ms, | ||
| 572 | .break_ctl = lqasc_break_ctl, | 566 | .break_ctl = lqasc_break_ctl, |
| 573 | .startup = lqasc_startup, | 567 | .startup = lqasc_startup, |
| 574 | .shutdown = lqasc_shutdown, | 568 | .shutdown = lqasc_shutdown, |
| @@ -709,7 +703,7 @@ lqasc_probe(struct platform_device *pdev) | |||
| 709 | port = <q_port->port; | 703 | port = <q_port->port; |
| 710 | 704 | ||
| 711 | port->iotype = SERIAL_IO_MEM; | 705 | port->iotype = SERIAL_IO_MEM; |
| 712 | port->flags = ASYNC_BOOT_AUTOCONF | UPF_IOREMAP; | 706 | port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP; |
| 713 | port->ops = &lqasc_pops; | 707 | port->ops = &lqasc_pops; |
| 714 | port->fifosize = 16; | 708 | port->fifosize = 16; |
| 715 | port->type = PORT_LTQ_ASC, | 709 | port->type = PORT_LTQ_ASC, |
diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c index 701644f06820..6f0f89282847 100644 --- a/drivers/tty/serial/lpc32xx_hs.c +++ b/drivers/tty/serial/lpc32xx_hs.c | |||
| @@ -427,12 +427,6 @@ static void serial_lpc32xx_stop_rx(struct uart_port *port) | |||
| 427 | LPC32XX_HSU_FE_INT), LPC32XX_HSUART_IIR(port->membase)); | 427 | LPC32XX_HSU_FE_INT), LPC32XX_HSUART_IIR(port->membase)); |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | /* port->lock held by caller. */ | ||
| 431 | static void serial_lpc32xx_enable_ms(struct uart_port *port) | ||
| 432 | { | ||
| 433 | /* Modem status is not supported */ | ||
| 434 | } | ||
| 435 | |||
| 436 | /* port->lock is not held. */ | 430 | /* port->lock is not held. */ |
| 437 | static void serial_lpc32xx_break_ctl(struct uart_port *port, | 431 | static void serial_lpc32xx_break_ctl(struct uart_port *port, |
| 438 | int break_state) | 432 | int break_state) |
| @@ -658,7 +652,6 @@ static struct uart_ops serial_lpc32xx_pops = { | |||
| 658 | .stop_tx = serial_lpc32xx_stop_tx, | 652 | .stop_tx = serial_lpc32xx_stop_tx, |
| 659 | .start_tx = serial_lpc32xx_start_tx, | 653 | .start_tx = serial_lpc32xx_start_tx, |
| 660 | .stop_rx = serial_lpc32xx_stop_rx, | 654 | .stop_rx = serial_lpc32xx_stop_rx, |
| 661 | .enable_ms = serial_lpc32xx_enable_ms, | ||
| 662 | .break_ctl = serial_lpc32xx_break_ctl, | 655 | .break_ctl = serial_lpc32xx_break_ctl, |
| 663 | .startup = serial_lpc32xx_startup, | 656 | .startup = serial_lpc32xx_startup, |
| 664 | .shutdown = serial_lpc32xx_shutdown, | 657 | .shutdown = serial_lpc32xx_shutdown, |
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index ba285cd45b59..82573dc4d8cf 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c | |||
| @@ -1008,7 +1008,6 @@ static const struct uart_ops max310x_ops = { | |||
| 1008 | .stop_tx = max310x_null_void, | 1008 | .stop_tx = max310x_null_void, |
| 1009 | .start_tx = max310x_start_tx, | 1009 | .start_tx = max310x_start_tx, |
| 1010 | .stop_rx = max310x_null_void, | 1010 | .stop_rx = max310x_null_void, |
| 1011 | .enable_ms = max310x_null_void, | ||
| 1012 | .break_ctl = max310x_break_ctl, | 1011 | .break_ctl = max310x_break_ctl, |
| 1013 | .startup = max310x_startup, | 1012 | .startup = max310x_startup, |
| 1014 | .shutdown = max310x_shutdown, | 1013 | .shutdown = max310x_shutdown, |
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c index a6f085717f94..bc896dc7d2ed 100644 --- a/drivers/tty/serial/mcf.c +++ b/drivers/tty/serial/mcf.c | |||
| @@ -150,12 +150,6 @@ static void mcf_break_ctl(struct uart_port *port, int break_state) | |||
| 150 | 150 | ||
| 151 | /****************************************************************************/ | 151 | /****************************************************************************/ |
| 152 | 152 | ||
| 153 | static void mcf_enable_ms(struct uart_port *port) | ||
| 154 | { | ||
| 155 | } | ||
| 156 | |||
| 157 | /****************************************************************************/ | ||
| 158 | |||
| 159 | static int mcf_startup(struct uart_port *port) | 153 | static int mcf_startup(struct uart_port *port) |
| 160 | { | 154 | { |
| 161 | struct mcf_uart *pp = container_of(port, struct mcf_uart, port); | 155 | struct mcf_uart *pp = container_of(port, struct mcf_uart, port); |
| @@ -507,7 +501,6 @@ static const struct uart_ops mcf_uart_ops = { | |||
| 507 | .start_tx = mcf_start_tx, | 501 | .start_tx = mcf_start_tx, |
| 508 | .stop_tx = mcf_stop_tx, | 502 | .stop_tx = mcf_stop_tx, |
| 509 | .stop_rx = mcf_stop_rx, | 503 | .stop_rx = mcf_stop_rx, |
| 510 | .enable_ms = mcf_enable_ms, | ||
| 511 | .break_ctl = mcf_break_ctl, | 504 | .break_ctl = mcf_break_ctl, |
| 512 | .startup = mcf_startup, | 505 | .startup = mcf_startup, |
| 513 | .shutdown = mcf_shutdown, | 506 | .shutdown = mcf_shutdown, |
| @@ -544,7 +537,7 @@ int __init early_mcf_setup(struct mcf_platform_uart *platp) | |||
| 544 | port->iotype = SERIAL_IO_MEM; | 537 | port->iotype = SERIAL_IO_MEM; |
| 545 | port->irq = platp[i].irq; | 538 | port->irq = platp[i].irq; |
| 546 | port->uartclk = MCF_BUSCLK; | 539 | port->uartclk = MCF_BUSCLK; |
| 547 | port->flags = ASYNC_BOOT_AUTOCONF; | 540 | port->flags = UPF_BOOT_AUTOCONF; |
| 548 | port->ops = &mcf_uart_ops; | 541 | port->ops = &mcf_uart_ops; |
| 549 | } | 542 | } |
| 550 | 543 | ||
| @@ -669,7 +662,7 @@ static int mcf_probe(struct platform_device *pdev) | |||
| 669 | port->irq = platp[i].irq; | 662 | port->irq = platp[i].irq; |
| 670 | port->uartclk = MCF_BUSCLK; | 663 | port->uartclk = MCF_BUSCLK; |
| 671 | port->ops = &mcf_uart_ops; | 664 | port->ops = &mcf_uart_ops; |
| 672 | port->flags = ASYNC_BOOT_AUTOCONF; | 665 | port->flags = UPF_BOOT_AUTOCONF; |
| 673 | 666 | ||
| 674 | uart_add_one_port(&mcf_driver, port); | 667 | uart_add_one_port(&mcf_driver, port); |
| 675 | } | 668 | } |
diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c index c9d18548783a..30e9e60bc5cd 100644 --- a/drivers/tty/serial/men_z135_uart.c +++ b/drivers/tty/serial/men_z135_uart.c | |||
| @@ -308,9 +308,6 @@ static void men_z135_handle_tx(struct men_z135_port *uart) | |||
| 308 | if (port->x_char) | 308 | if (port->x_char) |
| 309 | goto out; | 309 | goto out; |
| 310 | 310 | ||
| 311 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
| 312 | uart_write_wakeup(port); | ||
| 313 | |||
| 314 | /* calculate bytes to copy */ | 311 | /* calculate bytes to copy */ |
| 315 | qlen = uart_circ_chars_pending(xmit); | 312 | qlen = uart_circ_chars_pending(xmit); |
| 316 | if (qlen <= 0) | 313 | if (qlen <= 0) |
| @@ -357,6 +354,9 @@ static void men_z135_handle_tx(struct men_z135_port *uart) | |||
| 357 | 354 | ||
| 358 | port->icount.tx += n; | 355 | port->icount.tx += n; |
| 359 | 356 | ||
| 357 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
| 358 | uart_write_wakeup(port); | ||
| 359 | |||
| 360 | irq_en: | 360 | irq_en: |
| 361 | if (!uart_circ_empty(xmit)) | 361 | if (!uart_circ_empty(xmit)) |
| 362 | men_z135_reg_set(uart, MEN_Z135_CONF_REG, MEN_Z135_IER_TXCIEN); | 362 | men_z135_reg_set(uart, MEN_Z135_CONF_REG, MEN_Z135_IER_TXCIEN); |
diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c index 759c6a6fa74a..ae49856ef6c7 100644 --- a/drivers/tty/serial/mpsc.c +++ b/drivers/tty/serial/mpsc.c | |||
| @@ -1336,10 +1336,6 @@ static void mpsc_stop_rx(struct uart_port *port) | |||
| 1336 | mpsc_sdma_cmd(pi, SDMA_SDCM_AR); | 1336 | mpsc_sdma_cmd(pi, SDMA_SDCM_AR); |
| 1337 | } | 1337 | } |
| 1338 | 1338 | ||
| 1339 | static void mpsc_enable_ms(struct uart_port *port) | ||
| 1340 | { | ||
| 1341 | } | ||
| 1342 | |||
| 1343 | static void mpsc_break_ctl(struct uart_port *port, int ctl) | 1339 | static void mpsc_break_ctl(struct uart_port *port, int ctl) |
| 1344 | { | 1340 | { |
| 1345 | struct mpsc_port_info *pi = (struct mpsc_port_info *)port; | 1341 | struct mpsc_port_info *pi = (struct mpsc_port_info *)port; |
| @@ -1674,7 +1670,6 @@ static struct uart_ops mpsc_pops = { | |||
| 1674 | .stop_tx = mpsc_stop_tx, | 1670 | .stop_tx = mpsc_stop_tx, |
| 1675 | .start_tx = mpsc_start_tx, | 1671 | .start_tx = mpsc_start_tx, |
| 1676 | .stop_rx = mpsc_stop_rx, | 1672 | .stop_rx = mpsc_stop_rx, |
| 1677 | .enable_ms = mpsc_enable_ms, | ||
| 1678 | .break_ctl = mpsc_break_ctl, | 1673 | .break_ctl = mpsc_break_ctl, |
| 1679 | .startup = mpsc_startup, | 1674 | .startup = mpsc_startup, |
| 1680 | .shutdown = mpsc_shutdown, | 1675 | .shutdown = mpsc_shutdown, |
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c index db0448ae59dc..1504a14ec1a6 100644 --- a/drivers/tty/serial/mrst_max3110.c +++ b/drivers/tty/serial/mrst_max3110.c | |||
| @@ -698,10 +698,6 @@ static void serial_m3110_pm(struct uart_port *port, unsigned int state, | |||
| 698 | { | 698 | { |
| 699 | } | 699 | } |
| 700 | 700 | ||
| 701 | static void serial_m3110_enable_ms(struct uart_port *port) | ||
| 702 | { | ||
| 703 | } | ||
| 704 | |||
| 705 | static struct uart_ops serial_m3110_ops = { | 701 | static struct uart_ops serial_m3110_ops = { |
| 706 | .tx_empty = serial_m3110_tx_empty, | 702 | .tx_empty = serial_m3110_tx_empty, |
| 707 | .set_mctrl = serial_m3110_set_mctrl, | 703 | .set_mctrl = serial_m3110_set_mctrl, |
| @@ -709,7 +705,6 @@ static struct uart_ops serial_m3110_ops = { | |||
| 709 | .stop_tx = serial_m3110_stop_tx, | 705 | .stop_tx = serial_m3110_stop_tx, |
| 710 | .start_tx = serial_m3110_start_tx, | 706 | .start_tx = serial_m3110_start_tx, |
| 711 | .stop_rx = serial_m3110_stop_rx, | 707 | .stop_rx = serial_m3110_stop_rx, |
| 712 | .enable_ms = serial_m3110_enable_ms, | ||
| 713 | .break_ctl = serial_m3110_break_ctl, | 708 | .break_ctl = serial_m3110_break_ctl, |
| 714 | .startup = serial_m3110_startup, | 709 | .startup = serial_m3110_startup, |
| 715 | .shutdown = serial_m3110_shutdown, | 710 | .shutdown = serial_m3110_shutdown, |
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 72000a6d5af0..0da0b5474e98 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c | |||
| @@ -125,14 +125,14 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr) | |||
| 125 | port->icount.rx += count; | 125 | port->icount.rx += count; |
| 126 | 126 | ||
| 127 | while (count > 0) { | 127 | while (count > 0) { |
| 128 | unsigned int c; | 128 | unsigned char buf[4]; |
| 129 | 129 | ||
| 130 | sr = msm_read(port, UART_SR); | 130 | sr = msm_read(port, UART_SR); |
| 131 | if ((sr & UART_SR_RX_READY) == 0) { | 131 | if ((sr & UART_SR_RX_READY) == 0) { |
| 132 | msm_port->old_snap_state -= count; | 132 | msm_port->old_snap_state -= count; |
| 133 | break; | 133 | break; |
| 134 | } | 134 | } |
| 135 | c = msm_read(port, UARTDM_RF); | 135 | ioread32_rep(port->membase + UARTDM_RF, buf, 1); |
| 136 | if (sr & UART_SR_RX_BREAK) { | 136 | if (sr & UART_SR_RX_BREAK) { |
| 137 | port->icount.brk++; | 137 | port->icount.brk++; |
| 138 | if (uart_handle_break(port)) | 138 | if (uart_handle_break(port)) |
| @@ -141,8 +141,7 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr) | |||
| 141 | port->icount.frame++; | 141 | port->icount.frame++; |
| 142 | 142 | ||
| 143 | /* TODO: handle sysrq */ | 143 | /* TODO: handle sysrq */ |
| 144 | tty_insert_flip_string(tport, (char *)&c, | 144 | tty_insert_flip_string(tport, buf, min(count, 4)); |
| 145 | (count > 4) ? 4 : count); | ||
| 146 | count -= 4; | 145 | count -= 4; |
| 147 | } | 146 | } |
| 148 | 147 | ||
| @@ -219,6 +218,12 @@ static void handle_tx(struct uart_port *port) | |||
| 219 | struct msm_port *msm_port = UART_TO_MSM(port); | 218 | struct msm_port *msm_port = UART_TO_MSM(port); |
| 220 | unsigned int tx_count, num_chars; | 219 | unsigned int tx_count, num_chars; |
| 221 | unsigned int tf_pointer = 0; | 220 | unsigned int tf_pointer = 0; |
| 221 | void __iomem *tf; | ||
| 222 | |||
| 223 | if (msm_port->is_uartdm) | ||
| 224 | tf = port->membase + UARTDM_TF; | ||
| 225 | else | ||
| 226 | tf = port->membase + UART_TF; | ||
| 222 | 227 | ||
| 223 | tx_count = uart_circ_chars_pending(xmit); | 228 | tx_count = uart_circ_chars_pending(xmit); |
| 224 | tx_count = min3(tx_count, (unsigned int)UART_XMIT_SIZE - xmit->tail, | 229 | tx_count = min3(tx_count, (unsigned int)UART_XMIT_SIZE - xmit->tail, |
| @@ -228,8 +233,7 @@ static void handle_tx(struct uart_port *port) | |||
| 228 | if (msm_port->is_uartdm) | 233 | if (msm_port->is_uartdm) |
| 229 | reset_dm_count(port, tx_count + 1); | 234 | reset_dm_count(port, tx_count + 1); |
| 230 | 235 | ||
| 231 | msm_write(port, port->x_char, | 236 | iowrite8_rep(tf, &port->x_char, 1); |
| 232 | msm_port->is_uartdm ? UARTDM_TF : UART_TF); | ||
| 233 | port->icount.tx++; | 237 | port->icount.tx++; |
| 234 | port->x_char = 0; | 238 | port->x_char = 0; |
| 235 | } else if (tx_count && msm_port->is_uartdm) { | 239 | } else if (tx_count && msm_port->is_uartdm) { |
| @@ -239,7 +243,6 @@ static void handle_tx(struct uart_port *port) | |||
| 239 | while (tf_pointer < tx_count) { | 243 | while (tf_pointer < tx_count) { |
| 240 | int i; | 244 | int i; |
| 241 | char buf[4] = { 0 }; | 245 | char buf[4] = { 0 }; |
| 242 | unsigned int *bf = (unsigned int *)&buf; | ||
| 243 | 246 | ||
| 244 | if (!(msm_read(port, UART_SR) & UART_SR_TX_READY)) | 247 | if (!(msm_read(port, UART_SR) & UART_SR_TX_READY)) |
| 245 | break; | 248 | break; |
| @@ -255,7 +258,7 @@ static void handle_tx(struct uart_port *port) | |||
| 255 | port->icount.tx++; | 258 | port->icount.tx++; |
| 256 | } | 259 | } |
| 257 | 260 | ||
| 258 | msm_write(port, *bf, msm_port->is_uartdm ? UARTDM_TF : UART_TF); | 261 | iowrite32_rep(tf, buf, 1); |
| 259 | xmit->tail = (xmit->tail + num_chars) & (UART_XMIT_SIZE - 1); | 262 | xmit->tail = (xmit->tail + num_chars) & (UART_XMIT_SIZE - 1); |
| 260 | tf_pointer += num_chars; | 263 | tf_pointer += num_chars; |
| 261 | } | 264 | } |
| @@ -861,12 +864,18 @@ static void msm_console_write(struct console *co, const char *s, | |||
| 861 | struct msm_port *msm_port; | 864 | struct msm_port *msm_port; |
| 862 | int num_newlines = 0; | 865 | int num_newlines = 0; |
| 863 | bool replaced = false; | 866 | bool replaced = false; |
| 867 | void __iomem *tf; | ||
| 864 | 868 | ||
| 865 | BUG_ON(co->index < 0 || co->index >= UART_NR); | 869 | BUG_ON(co->index < 0 || co->index >= UART_NR); |
| 866 | 870 | ||
| 867 | port = get_port_from_line(co->index); | 871 | port = get_port_from_line(co->index); |
| 868 | msm_port = UART_TO_MSM(port); | 872 | msm_port = UART_TO_MSM(port); |
| 869 | 873 | ||
| 874 | if (msm_port->is_uartdm) | ||
| 875 | tf = port->membase + UARTDM_TF; | ||
| 876 | else | ||
| 877 | tf = port->membase + UART_TF; | ||
| 878 | |||
| 870 | /* Account for newlines that will get a carriage return added */ | 879 | /* Account for newlines that will get a carriage return added */ |
| 871 | for (i = 0; i < count; i++) | 880 | for (i = 0; i < count; i++) |
| 872 | if (s[i] == '\n') | 881 | if (s[i] == '\n') |
| @@ -882,7 +891,6 @@ static void msm_console_write(struct console *co, const char *s, | |||
| 882 | int j; | 891 | int j; |
| 883 | unsigned int num_chars; | 892 | unsigned int num_chars; |
| 884 | char buf[4] = { 0 }; | 893 | char buf[4] = { 0 }; |
| 885 | unsigned int *bf = (unsigned int *)&buf; | ||
| 886 | 894 | ||
| 887 | if (msm_port->is_uartdm) | 895 | if (msm_port->is_uartdm) |
| 888 | num_chars = min(count - i, (unsigned int)sizeof(buf)); | 896 | num_chars = min(count - i, (unsigned int)sizeof(buf)); |
| @@ -907,7 +915,7 @@ static void msm_console_write(struct console *co, const char *s, | |||
| 907 | while (!(msm_read(port, UART_SR) & UART_SR_TX_READY)) | 915 | while (!(msm_read(port, UART_SR) & UART_SR_TX_READY)) |
| 908 | cpu_relax(); | 916 | cpu_relax(); |
| 909 | 917 | ||
| 910 | msm_write(port, *bf, msm_port->is_uartdm ? UARTDM_TF : UART_TF); | 918 | iowrite32_rep(tf, buf, 1); |
| 911 | i += num_chars; | 919 | i += num_chars; |
| 912 | } | 920 | } |
| 913 | spin_unlock(&port->lock); | 921 | spin_unlock(&port->lock); |
| @@ -917,7 +925,7 @@ static int __init msm_console_setup(struct console *co, char *options) | |||
| 917 | { | 925 | { |
| 918 | struct uart_port *port; | 926 | struct uart_port *port; |
| 919 | struct msm_port *msm_port; | 927 | struct msm_port *msm_port; |
| 920 | int baud, flow, bits, parity; | 928 | int baud = 0, flow, bits, parity; |
| 921 | 929 | ||
| 922 | if (unlikely(co->index >= UART_NR || co->index < 0)) | 930 | if (unlikely(co->index >= UART_NR || co->index < 0)) |
| 923 | return -ENXIO; | 931 | return -ENXIO; |
| @@ -1057,7 +1065,7 @@ static int msm_serial_remove(struct platform_device *pdev) | |||
| 1057 | return 0; | 1065 | return 0; |
| 1058 | } | 1066 | } |
| 1059 | 1067 | ||
| 1060 | static struct of_device_id msm_match_table[] = { | 1068 | static const struct of_device_id msm_match_table[] = { |
| 1061 | { .compatible = "qcom,msm-uart" }, | 1069 | { .compatible = "qcom,msm-uart" }, |
| 1062 | { .compatible = "qcom,msm-uartdm" }, | 1070 | { .compatible = "qcom,msm-uartdm" }, |
| 1063 | {} | 1071 | {} |
diff --git a/drivers/tty/serial/msm_serial.h b/drivers/tty/serial/msm_serial.h index d98d45efdf86..73d3abe71e79 100644 --- a/drivers/tty/serial/msm_serial.h +++ b/drivers/tty/serial/msm_serial.h | |||
| @@ -126,13 +126,13 @@ | |||
| 126 | static inline | 126 | static inline |
| 127 | void msm_write(struct uart_port *port, unsigned int val, unsigned int off) | 127 | void msm_write(struct uart_port *port, unsigned int val, unsigned int off) |
| 128 | { | 128 | { |
| 129 | __raw_writel(val, port->membase + off); | 129 | writel_relaxed(val, port->membase + off); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | static inline | 132 | static inline |
| 133 | unsigned int msm_read(struct uart_port *port, unsigned int off) | 133 | unsigned int msm_read(struct uart_port *port, unsigned int off) |
| 134 | { | 134 | { |
| 135 | return __raw_readl(port->membase + off); | 135 | return readl_relaxed(port->membase + off); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /* | 138 | /* |
diff --git a/drivers/tty/serial/mux.c b/drivers/tty/serial/mux.c index be127d0da32c..dd26511ad875 100644 --- a/drivers/tty/serial/mux.c +++ b/drivers/tty/serial/mux.c | |||
| @@ -169,16 +169,6 @@ static void mux_stop_rx(struct uart_port *port) | |||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | /** | 171 | /** |
| 172 | * mux_enable_ms - Enable modum status interrupts. | ||
| 173 | * @port: Ptr to the uart_port. | ||
| 174 | * | ||
| 175 | * The Serial Mux does not support this function. | ||
| 176 | */ | ||
| 177 | static void mux_enable_ms(struct uart_port *port) | ||
| 178 | { | ||
| 179 | } | ||
| 180 | |||
| 181 | /** | ||
| 182 | * mux_break_ctl - Control the transmitssion of a break signal. | 172 | * mux_break_ctl - Control the transmitssion of a break signal. |
| 183 | * @port: Ptr to the uart_port. | 173 | * @port: Ptr to the uart_port. |
| 184 | * @break_state: Raise/Lower the break signal. | 174 | * @break_state: Raise/Lower the break signal. |
| @@ -449,7 +439,6 @@ static struct uart_ops mux_pops = { | |||
| 449 | .stop_tx = mux_stop_tx, | 439 | .stop_tx = mux_stop_tx, |
| 450 | .start_tx = mux_start_tx, | 440 | .start_tx = mux_start_tx, |
| 451 | .stop_rx = mux_stop_rx, | 441 | .stop_rx = mux_stop_rx, |
| 452 | .enable_ms = mux_enable_ms, | ||
| 453 | .break_ctl = mux_break_ctl, | 442 | .break_ctl = mux_break_ctl, |
| 454 | .startup = mux_startup, | 443 | .startup = mux_startup, |
| 455 | .shutdown = mux_shutdown, | 444 | .shutdown = mux_shutdown, |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 86de4477d98a..b5c329248c81 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
| @@ -815,17 +815,11 @@ static void mxs_auart_break_ctl(struct uart_port *u, int ctl) | |||
| 815 | u->membase + AUART_LINECTRL_CLR); | 815 | u->membase + AUART_LINECTRL_CLR); |
| 816 | } | 816 | } |
| 817 | 817 | ||
| 818 | static void mxs_auart_enable_ms(struct uart_port *port) | ||
| 819 | { | ||
| 820 | /* just empty */ | ||
| 821 | } | ||
| 822 | |||
| 823 | static struct uart_ops mxs_auart_ops = { | 818 | static struct uart_ops mxs_auart_ops = { |
| 824 | .tx_empty = mxs_auart_tx_empty, | 819 | .tx_empty = mxs_auart_tx_empty, |
| 825 | .start_tx = mxs_auart_start_tx, | 820 | .start_tx = mxs_auart_start_tx, |
| 826 | .stop_tx = mxs_auart_stop_tx, | 821 | .stop_tx = mxs_auart_stop_tx, |
| 827 | .stop_rx = mxs_auart_stop_rx, | 822 | .stop_rx = mxs_auart_stop_rx, |
| 828 | .enable_ms = mxs_auart_enable_ms, | ||
| 829 | .break_ctl = mxs_auart_break_ctl, | 823 | .break_ctl = mxs_auart_break_ctl, |
| 830 | .set_mctrl = mxs_auart_set_mctrl, | 824 | .set_mctrl = mxs_auart_set_mctrl, |
| 831 | .get_mctrl = mxs_auart_get_mctrl, | 825 | .get_mctrl = mxs_auart_get_mctrl, |
diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c index 693bc6c2561e..c06366b6bc29 100644 --- a/drivers/tty/serial/nwpserial.c +++ b/drivers/tty/serial/nwpserial.c | |||
| @@ -240,11 +240,6 @@ static void nwpserial_break_ctl(struct uart_port *port, int ctl) | |||
| 240 | /* N/A */ | 240 | /* N/A */ |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static void nwpserial_enable_ms(struct uart_port *port) | ||
| 244 | { | ||
| 245 | /* N/A */ | ||
| 246 | } | ||
| 247 | |||
| 248 | static void nwpserial_stop_rx(struct uart_port *port) | 243 | static void nwpserial_stop_rx(struct uart_port *port) |
| 249 | { | 244 | { |
| 250 | struct nwpserial_port *up; | 245 | struct nwpserial_port *up; |
| @@ -315,7 +310,6 @@ static struct uart_ops nwpserial_pops = { | |||
| 315 | .stop_tx = nwpserial_stop_tx, | 310 | .stop_tx = nwpserial_stop_tx, |
| 316 | .start_tx = nwpserial_start_tx, | 311 | .start_tx = nwpserial_start_tx, |
| 317 | .stop_rx = nwpserial_stop_rx, | 312 | .stop_rx = nwpserial_stop_rx, |
| 318 | .enable_ms = nwpserial_enable_ms, | ||
| 319 | .break_ctl = nwpserial_break_ctl, | 313 | .break_ctl = nwpserial_break_ctl, |
| 320 | .startup = nwpserial_startup, | 314 | .startup = nwpserial_startup, |
| 321 | .shutdown = nwpserial_shutdown, | 315 | .shutdown = nwpserial_shutdown, |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 0cb6a8e52bd0..ea4ffc2ebb2f 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
| @@ -736,9 +736,10 @@ static void pch_request_dma(struct uart_port *port) | |||
| 736 | dma_cap_zero(mask); | 736 | dma_cap_zero(mask); |
| 737 | dma_cap_set(DMA_SLAVE, mask); | 737 | dma_cap_set(DMA_SLAVE, mask); |
| 738 | 738 | ||
| 739 | dma_dev = pci_get_bus_and_slot(priv->pdev->bus->number, | 739 | /* Get DMA's dev information */ |
| 740 | PCI_DEVFN(0xa, 0)); /* Get DMA's dev | 740 | dma_dev = pci_get_slot(priv->pdev->bus, |
| 741 | information */ | 741 | PCI_DEVFN(PCI_SLOT(priv->pdev->devfn), 0)); |
| 742 | |||
| 742 | /* Set Tx DMA */ | 743 | /* Set Tx DMA */ |
| 743 | param = &priv->param_tx; | 744 | param = &priv->param_tx; |
| 744 | param->dma_dev = &dma_dev->dev; | 745 | param->dma_dev = &dma_dev->dev; |
| @@ -1047,7 +1048,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) | |||
| 1047 | priv->sg_tx_p, nent, DMA_MEM_TO_DEV, | 1048 | priv->sg_tx_p, nent, DMA_MEM_TO_DEV, |
| 1048 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 1049 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 1049 | if (!desc) { | 1050 | if (!desc) { |
| 1050 | dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n", | 1051 | dev_err(priv->port.dev, "%s:dmaengine_prep_slave_sg Failed\n", |
| 1051 | __func__); | 1052 | __func__); |
| 1052 | return 0; | 1053 | return 0; |
| 1053 | } | 1054 | } |
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index c638c53cd2b6..21b7d8b86493 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c | |||
| @@ -778,7 +778,7 @@ static struct uart_ops serial_pxa_pops = { | |||
| 778 | .request_port = serial_pxa_request_port, | 778 | .request_port = serial_pxa_request_port, |
| 779 | .config_port = serial_pxa_config_port, | 779 | .config_port = serial_pxa_config_port, |
| 780 | .verify_port = serial_pxa_verify_port, | 780 | .verify_port = serial_pxa_verify_port, |
| 781 | #ifdef CONFIG_CONSOLE_POLL | 781 | #if defined(CONFIG_CONSOLE_POLL) && defined(CONFIG_SERIAL_PXA_CONSOLE) |
| 782 | .poll_get_char = serial_pxa_get_poll_char, | 782 | .poll_get_char = serial_pxa_get_poll_char, |
| 783 | .poll_put_char = serial_pxa_put_poll_char, | 783 | .poll_put_char = serial_pxa_put_poll_char, |
| 784 | #endif | 784 | #endif |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index c1d3ebdf3b97..4aff02d6712e 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
| @@ -203,10 +203,6 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port) | |||
| 203 | } | 203 | } |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | static void s3c24xx_serial_enable_ms(struct uart_port *port) | ||
| 207 | { | ||
| 208 | } | ||
| 209 | |||
| 210 | static inline struct s3c24xx_uart_info *s3c24xx_port_to_info(struct uart_port *port) | 206 | static inline struct s3c24xx_uart_info *s3c24xx_port_to_info(struct uart_port *port) |
| 211 | { | 207 | { |
| 212 | return to_ourport(port)->info; | 208 | return to_ourport(port)->info; |
| @@ -952,7 +948,6 @@ static struct uart_ops s3c24xx_serial_ops = { | |||
| 952 | .stop_tx = s3c24xx_serial_stop_tx, | 948 | .stop_tx = s3c24xx_serial_stop_tx, |
| 953 | .start_tx = s3c24xx_serial_start_tx, | 949 | .start_tx = s3c24xx_serial_start_tx, |
| 954 | .stop_rx = s3c24xx_serial_stop_rx, | 950 | .stop_rx = s3c24xx_serial_stop_rx, |
| 955 | .enable_ms = s3c24xx_serial_enable_ms, | ||
| 956 | .break_ctl = s3c24xx_serial_break_ctl, | 951 | .break_ctl = s3c24xx_serial_break_ctl, |
| 957 | .startup = s3c24xx_serial_startup, | 952 | .startup = s3c24xx_serial_startup, |
| 958 | .shutdown = s3c24xx_serial_shutdown, | 953 | .shutdown = s3c24xx_serial_shutdown, |
| @@ -1226,8 +1221,8 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
| 1226 | wr_regl(port, S3C64XX_UINTSP, 0xf); | 1221 | wr_regl(port, S3C64XX_UINTSP, 0xf); |
| 1227 | } | 1222 | } |
| 1228 | 1223 | ||
| 1229 | dbg("port: map=%08x, mem=%p, irq=%d (%d,%d), clock=%u\n", | 1224 | dbg("port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n", |
| 1230 | port->mapbase, port->membase, port->irq, | 1225 | &port->mapbase, port->membase, port->irq, |
| 1231 | ourport->rx_irq, ourport->tx_irq, port->uartclk); | 1226 | ourport->rx_irq, ourport->tx_irq, port->uartclk); |
| 1232 | 1227 | ||
| 1233 | /* reset the fifos (and setup the uart) */ | 1228 | /* reset the fifos (and setup the uart) */ |
| @@ -1274,12 +1269,20 @@ static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data( | |||
| 1274 | 1269 | ||
| 1275 | static int s3c24xx_serial_probe(struct platform_device *pdev) | 1270 | static int s3c24xx_serial_probe(struct platform_device *pdev) |
| 1276 | { | 1271 | { |
| 1272 | struct device_node *np = pdev->dev.of_node; | ||
| 1277 | struct s3c24xx_uart_port *ourport; | 1273 | struct s3c24xx_uart_port *ourport; |
| 1274 | int index = probe_index; | ||
| 1278 | int ret; | 1275 | int ret; |
| 1279 | 1276 | ||
| 1280 | dbg("s3c24xx_serial_probe(%p) %d\n", pdev, probe_index); | 1277 | if (np) { |
| 1278 | ret = of_alias_get_id(np, "serial"); | ||
| 1279 | if (ret >= 0) | ||
| 1280 | index = ret; | ||
| 1281 | } | ||
| 1282 | |||
| 1283 | dbg("s3c24xx_serial_probe(%p) %d\n", pdev, index); | ||
| 1281 | 1284 | ||
| 1282 | ourport = &s3c24xx_serial_ports[probe_index]; | 1285 | ourport = &s3c24xx_serial_ports[index]; |
| 1283 | 1286 | ||
| 1284 | ourport->drv_data = s3c24xx_get_driver_data(pdev); | 1287 | ourport->drv_data = s3c24xx_get_driver_data(pdev); |
| 1285 | if (!ourport->drv_data) { | 1288 | if (!ourport->drv_data) { |
| @@ -1293,9 +1296,15 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) | |||
| 1293 | dev_get_platdata(&pdev->dev) : | 1296 | dev_get_platdata(&pdev->dev) : |
| 1294 | ourport->drv_data->def_cfg; | 1297 | ourport->drv_data->def_cfg; |
| 1295 | 1298 | ||
| 1296 | ourport->port.fifosize = (ourport->info->fifosize) ? | 1299 | if (np) |
| 1297 | ourport->info->fifosize : | 1300 | of_property_read_u32(np, |
| 1298 | ourport->drv_data->fifosize[probe_index]; | 1301 | "samsung,uart-fifosize", &ourport->port.fifosize); |
| 1302 | |||
| 1303 | if (!ourport->port.fifosize) { | ||
| 1304 | ourport->port.fifosize = (ourport->info->fifosize) ? | ||
| 1305 | ourport->info->fifosize : | ||
| 1306 | ourport->drv_data->fifosize[index]; | ||
| 1307 | } | ||
| 1299 | 1308 | ||
| 1300 | probe_index++; | 1309 | probe_index++; |
| 1301 | 1310 | ||
| @@ -1303,7 +1312,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) | |||
| 1303 | 1312 | ||
| 1304 | ret = s3c24xx_serial_init_port(ourport, pdev); | 1313 | ret = s3c24xx_serial_init_port(ourport, pdev); |
| 1305 | if (ret < 0) | 1314 | if (ret < 0) |
| 1306 | goto probe_err; | 1315 | return ret; |
| 1307 | 1316 | ||
| 1308 | if (!s3c24xx_uart_drv.state) { | 1317 | if (!s3c24xx_uart_drv.state) { |
| 1309 | ret = uart_register_driver(&s3c24xx_uart_drv); | 1318 | ret = uart_register_driver(&s3c24xx_uart_drv); |
| @@ -1335,9 +1344,6 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) | |||
| 1335 | dev_err(&pdev->dev, "failed to add cpufreq notifier\n"); | 1344 | dev_err(&pdev->dev, "failed to add cpufreq notifier\n"); |
| 1336 | 1345 | ||
| 1337 | return 0; | 1346 | return 0; |
| 1338 | |||
| 1339 | probe_err: | ||
| 1340 | return ret; | ||
| 1341 | } | 1347 | } |
| 1342 | 1348 | ||
| 1343 | static int s3c24xx_serial_remove(struct platform_device *dev) | 1349 | static int s3c24xx_serial_remove(struct platform_device *dev) |
| @@ -1537,8 +1543,8 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud, | |||
| 1537 | case S3C2410_LCON_CS7: | 1543 | case S3C2410_LCON_CS7: |
| 1538 | *bits = 7; | 1544 | *bits = 7; |
| 1539 | break; | 1545 | break; |
| 1540 | default: | ||
| 1541 | case S3C2410_LCON_CS8: | 1546 | case S3C2410_LCON_CS8: |
| 1547 | default: | ||
| 1542 | *bits = 8; | 1548 | *bits = 8; |
| 1543 | break; | 1549 | break; |
| 1544 | } | 1550 | } |
| @@ -1712,9 +1718,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { | |||
| 1712 | #define S3C2440_SERIAL_DRV_DATA (kernel_ulong_t)NULL | 1718 | #define S3C2440_SERIAL_DRV_DATA (kernel_ulong_t)NULL |
| 1713 | #endif | 1719 | #endif |
| 1714 | 1720 | ||
| 1715 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) || \ | 1721 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) |
| 1716 | defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) || \ | ||
| 1717 | defined(CONFIG_CPU_S5PC100) | ||
| 1718 | static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { | 1722 | static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { |
| 1719 | .info = &(struct s3c24xx_uart_info) { | 1723 | .info = &(struct s3c24xx_uart_info) { |
| 1720 | .name = "Samsung S3C6400 UART", | 1724 | .name = "Samsung S3C6400 UART", |
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 1b6a77c4b2cb..3284c31085a7 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c | |||
| @@ -991,7 +991,6 @@ static const struct uart_ops sc16is7xx_ops = { | |||
| 991 | .stop_tx = sc16is7xx_stop_tx, | 991 | .stop_tx = sc16is7xx_stop_tx, |
| 992 | .start_tx = sc16is7xx_start_tx, | 992 | .start_tx = sc16is7xx_start_tx, |
| 993 | .stop_rx = sc16is7xx_stop_rx, | 993 | .stop_rx = sc16is7xx_stop_rx, |
| 994 | .enable_ms = sc16is7xx_null_void, | ||
| 995 | .break_ctl = sc16is7xx_break_ctl, | 994 | .break_ctl = sc16is7xx_break_ctl, |
| 996 | .startup = sc16is7xx_startup, | 995 | .startup = sc16is7xx_startup, |
| 997 | .shutdown = sc16is7xx_shutdown, | 996 | .shutdown = sc16is7xx_shutdown, |
| @@ -1061,7 +1060,6 @@ static int sc16is7xx_probe(struct device *dev, | |||
| 1061 | struct regmap *regmap, int irq, unsigned long flags) | 1060 | struct regmap *regmap, int irq, unsigned long flags) |
| 1062 | { | 1061 | { |
| 1063 | unsigned long freq, *pfreq = dev_get_platdata(dev); | 1062 | unsigned long freq, *pfreq = dev_get_platdata(dev); |
| 1064 | struct clk *clk; | ||
| 1065 | int i, ret; | 1063 | int i, ret; |
| 1066 | struct sc16is7xx_port *s; | 1064 | struct sc16is7xx_port *s; |
| 1067 | 1065 | ||
| @@ -1077,14 +1075,14 @@ static int sc16is7xx_probe(struct device *dev, | |||
| 1077 | return -ENOMEM; | 1075 | return -ENOMEM; |
| 1078 | } | 1076 | } |
| 1079 | 1077 | ||
| 1080 | clk = devm_clk_get(dev, NULL); | 1078 | s->clk = devm_clk_get(dev, NULL); |
| 1081 | if (IS_ERR(clk)) { | 1079 | if (IS_ERR(s->clk)) { |
| 1082 | if (pfreq) | 1080 | if (pfreq) |
| 1083 | freq = *pfreq; | 1081 | freq = *pfreq; |
| 1084 | else | 1082 | else |
| 1085 | return PTR_ERR(clk); | 1083 | return PTR_ERR(s->clk); |
| 1086 | } else { | 1084 | } else { |
| 1087 | freq = clk_get_rate(clk); | 1085 | freq = clk_get_rate(s->clk); |
| 1088 | } | 1086 | } |
| 1089 | 1087 | ||
| 1090 | s->regmap = regmap; | 1088 | s->regmap = regmap; |
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index e84b6a3bdd18..75850f70b479 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c | |||
| @@ -533,11 +533,6 @@ static unsigned int sccnxp_tx_empty(struct uart_port *port) | |||
| 533 | return (val & SR_TXEMT) ? TIOCSER_TEMT : 0; | 533 | return (val & SR_TXEMT) ? TIOCSER_TEMT : 0; |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | static void sccnxp_enable_ms(struct uart_port *port) | ||
| 537 | { | ||
| 538 | /* Do nothing */ | ||
| 539 | } | ||
| 540 | |||
| 541 | static void sccnxp_set_mctrl(struct uart_port *port, unsigned int mctrl) | 536 | static void sccnxp_set_mctrl(struct uart_port *port, unsigned int mctrl) |
| 542 | { | 537 | { |
| 543 | struct sccnxp_port *s = dev_get_drvdata(port->dev); | 538 | struct sccnxp_port *s = dev_get_drvdata(port->dev); |
| @@ -790,7 +785,6 @@ static const struct uart_ops sccnxp_ops = { | |||
| 790 | .stop_tx = sccnxp_stop_tx, | 785 | .stop_tx = sccnxp_stop_tx, |
| 791 | .start_tx = sccnxp_start_tx, | 786 | .start_tx = sccnxp_start_tx, |
| 792 | .stop_rx = sccnxp_stop_rx, | 787 | .stop_rx = sccnxp_stop_rx, |
| 793 | .enable_ms = sccnxp_enable_ms, | ||
| 794 | .break_ctl = sccnxp_break_ctl, | 788 | .break_ctl = sccnxp_break_ctl, |
| 795 | .startup = sccnxp_startup, | 789 | .startup = sccnxp_startup, |
| 796 | .shutdown = sccnxp_shutdown, | 790 | .shutdown = sccnxp_shutdown, |
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c index d5c2a287b7e7..53d7c31ce098 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c | |||
| @@ -482,6 +482,9 @@ static void tegra_uart_stop_tx(struct uart_port *u) | |||
| 482 | struct dma_tx_state state; | 482 | struct dma_tx_state state; |
| 483 | int count; | 483 | int count; |
| 484 | 484 | ||
| 485 | if (tup->tx_in_progress != TEGRA_UART_TX_DMA) | ||
| 486 | return; | ||
| 487 | |||
| 485 | dmaengine_terminate_all(tup->tx_dma_chan); | 488 | dmaengine_terminate_all(tup->tx_dma_chan); |
| 486 | dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); | 489 | dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); |
| 487 | count = tup->tx_bytes_requested - state.residue; | 490 | count = tup->tx_bytes_requested - state.residue; |
| @@ -599,6 +602,7 @@ static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup, | |||
| 599 | 602 | ||
| 600 | dmaengine_terminate_all(tup->rx_dma_chan); | 603 | dmaengine_terminate_all(tup->rx_dma_chan); |
| 601 | dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); | 604 | dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); |
| 605 | async_tx_ack(tup->rx_dma_desc); | ||
| 602 | count = tup->rx_bytes_requested - state.residue; | 606 | count = tup->rx_bytes_requested - state.residue; |
| 603 | 607 | ||
| 604 | /* If we are here, DMA is stopped */ | 608 | /* If we are here, DMA is stopped */ |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index fbf6c5ad222f..8bb19da01639 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
| @@ -243,6 +243,9 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) | |||
| 243 | /* | 243 | /* |
| 244 | * Turn off DTR and RTS early. | 244 | * Turn off DTR and RTS early. |
| 245 | */ | 245 | */ |
| 246 | if (uart_console(uport) && tty) | ||
| 247 | uport->cons->cflag = tty->termios.c_cflag; | ||
| 248 | |||
| 246 | if (!tty || (tty->termios.c_cflag & HUPCL)) | 249 | if (!tty || (tty->termios.c_cflag & HUPCL)) |
| 247 | uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); | 250 | uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); |
| 248 | 251 | ||
| @@ -447,6 +450,7 @@ static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, | |||
| 447 | return; | 450 | return; |
| 448 | 451 | ||
| 449 | termios = &tty->termios; | 452 | termios = &tty->termios; |
| 453 | uport->ops->set_termios(uport, termios, old_termios); | ||
| 450 | 454 | ||
| 451 | /* | 455 | /* |
| 452 | * Set flags based on termios cflag | 456 | * Set flags based on termios cflag |
| @@ -460,8 +464,6 @@ static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, | |||
| 460 | clear_bit(ASYNCB_CHECK_CD, &port->flags); | 464 | clear_bit(ASYNCB_CHECK_CD, &port->flags); |
| 461 | else | 465 | else |
| 462 | set_bit(ASYNCB_CHECK_CD, &port->flags); | 466 | set_bit(ASYNCB_CHECK_CD, &port->flags); |
| 463 | |||
| 464 | uport->ops->set_termios(uport, termios, old_termios); | ||
| 465 | } | 467 | } |
| 466 | 468 | ||
| 467 | static inline int __uart_put_char(struct uart_port *port, | 469 | static inline int __uart_put_char(struct uart_port *port, |
| @@ -1050,6 +1052,15 @@ static int uart_do_autoconfig(struct tty_struct *tty,struct uart_state *state) | |||
| 1050 | return ret; | 1052 | return ret; |
| 1051 | } | 1053 | } |
| 1052 | 1054 | ||
| 1055 | static void uart_enable_ms(struct uart_port *uport) | ||
| 1056 | { | ||
| 1057 | /* | ||
| 1058 | * Force modem status interrupts on | ||
| 1059 | */ | ||
| 1060 | if (uport->ops->enable_ms) | ||
| 1061 | uport->ops->enable_ms(uport); | ||
| 1062 | } | ||
| 1063 | |||
| 1053 | /* | 1064 | /* |
| 1054 | * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change | 1065 | * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change |
| 1055 | * - mask passed in arg for lines of interest | 1066 | * - mask passed in arg for lines of interest |
| @@ -1073,11 +1084,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg) | |||
| 1073 | */ | 1084 | */ |
| 1074 | spin_lock_irq(&uport->lock); | 1085 | spin_lock_irq(&uport->lock); |
| 1075 | memcpy(&cprev, &uport->icount, sizeof(struct uart_icount)); | 1086 | memcpy(&cprev, &uport->icount, sizeof(struct uart_icount)); |
| 1076 | 1087 | uart_enable_ms(uport); | |
| 1077 | /* | ||
| 1078 | * Force modem status interrupts on | ||
| 1079 | */ | ||
| 1080 | uport->ops->enable_ms(uport); | ||
| 1081 | spin_unlock_irq(&uport->lock); | 1088 | spin_unlock_irq(&uport->lock); |
| 1082 | 1089 | ||
| 1083 | add_wait_queue(&port->delta_msr_wait, &wait); | 1090 | add_wait_queue(&port->delta_msr_wait, &wait); |
| @@ -1274,6 +1281,8 @@ static void uart_set_termios(struct tty_struct *tty, | |||
| 1274 | } | 1281 | } |
| 1275 | 1282 | ||
| 1276 | uart_change_speed(tty, state, old_termios); | 1283 | uart_change_speed(tty, state, old_termios); |
| 1284 | /* reload cflag from termios; port driver may have overriden flags */ | ||
| 1285 | cflag = tty->termios.c_cflag; | ||
| 1277 | 1286 | ||
| 1278 | /* Handle transition to B0 status */ | 1287 | /* Handle transition to B0 status */ |
| 1279 | if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) | 1288 | if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) |
| @@ -1360,8 +1369,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
| 1360 | tty_ldisc_flush(tty); | 1369 | tty_ldisc_flush(tty); |
| 1361 | 1370 | ||
| 1362 | tty_port_tty_set(port, NULL); | 1371 | tty_port_tty_set(port, NULL); |
| 1363 | spin_lock_irqsave(&port->lock, flags); | ||
| 1364 | tty->closing = 0; | 1372 | tty->closing = 0; |
| 1373 | spin_lock_irqsave(&port->lock, flags); | ||
| 1365 | 1374 | ||
| 1366 | if (port->blocked_open) { | 1375 | if (port->blocked_open) { |
| 1367 | spin_unlock_irqrestore(&port->lock, flags); | 1376 | spin_unlock_irqrestore(&port->lock, flags); |
| @@ -1508,7 +1517,7 @@ static int uart_carrier_raised(struct tty_port *port) | |||
| 1508 | struct uart_port *uport = state->uart_port; | 1517 | struct uart_port *uport = state->uart_port; |
| 1509 | int mctrl; | 1518 | int mctrl; |
| 1510 | spin_lock_irq(&uport->lock); | 1519 | spin_lock_irq(&uport->lock); |
| 1511 | uport->ops->enable_ms(uport); | 1520 | uart_enable_ms(uport); |
| 1512 | mctrl = uport->ops->get_mctrl(uport); | 1521 | mctrl = uport->ops->get_mctrl(uport); |
| 1513 | spin_unlock_irq(&uport->lock); | 1522 | spin_unlock_irq(&uport->lock); |
| 1514 | if (mctrl & TIOCM_CAR) | 1523 | if (mctrl & TIOCM_CAR) |
| @@ -1576,14 +1585,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
| 1576 | tty_port_tty_set(port, tty); | 1585 | tty_port_tty_set(port, tty); |
| 1577 | 1586 | ||
| 1578 | /* | 1587 | /* |
| 1579 | * If the port is in the middle of closing, bail out now. | ||
| 1580 | */ | ||
| 1581 | if (tty_hung_up_p(filp)) { | ||
| 1582 | retval = -EAGAIN; | ||
| 1583 | goto err_dec_count; | ||
| 1584 | } | ||
| 1585 | |||
| 1586 | /* | ||
| 1587 | * Start up the serial port. | 1588 | * Start up the serial port. |
| 1588 | */ | 1589 | */ |
| 1589 | retval = uart_startup(tty, state, 0); | 1590 | retval = uart_startup(tty, state, 0); |
| @@ -2563,12 +2564,6 @@ static const struct attribute_group tty_dev_attr_group = { | |||
| 2563 | .attrs = tty_dev_attrs, | 2564 | .attrs = tty_dev_attrs, |
| 2564 | }; | 2565 | }; |
| 2565 | 2566 | ||
| 2566 | static const struct attribute_group *tty_dev_attr_groups[] = { | ||
| 2567 | &tty_dev_attr_group, | ||
| 2568 | NULL | ||
| 2569 | }; | ||
| 2570 | |||
| 2571 | |||
| 2572 | /** | 2567 | /** |
| 2573 | * uart_add_one_port - attach a driver-defined port structure | 2568 | * uart_add_one_port - attach a driver-defined port structure |
| 2574 | * @drv: pointer to the uart low level driver structure for this port | 2569 | * @drv: pointer to the uart low level driver structure for this port |
| @@ -2585,6 +2580,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2585 | struct tty_port *port; | 2580 | struct tty_port *port; |
| 2586 | int ret = 0; | 2581 | int ret = 0; |
| 2587 | struct device *tty_dev; | 2582 | struct device *tty_dev; |
| 2583 | int num_groups; | ||
| 2588 | 2584 | ||
| 2589 | BUG_ON(in_interrupt()); | 2585 | BUG_ON(in_interrupt()); |
| 2590 | 2586 | ||
| @@ -2618,12 +2614,26 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2618 | 2614 | ||
| 2619 | uart_configure_port(drv, state, uport); | 2615 | uart_configure_port(drv, state, uport); |
| 2620 | 2616 | ||
| 2617 | num_groups = 2; | ||
| 2618 | if (uport->attr_group) | ||
| 2619 | num_groups++; | ||
| 2620 | |||
| 2621 | uport->tty_groups = kcalloc(num_groups, sizeof(*uport->tty_groups), | ||
| 2622 | GFP_KERNEL); | ||
| 2623 | if (!uport->tty_groups) { | ||
| 2624 | ret = -ENOMEM; | ||
| 2625 | goto out; | ||
| 2626 | } | ||
| 2627 | uport->tty_groups[0] = &tty_dev_attr_group; | ||
| 2628 | if (uport->attr_group) | ||
| 2629 | uport->tty_groups[1] = uport->attr_group; | ||
| 2630 | |||
| 2621 | /* | 2631 | /* |
| 2622 | * Register the port whether it's detected or not. This allows | 2632 | * Register the port whether it's detected or not. This allows |
| 2623 | * setserial to be used to alter this port's parameters. | 2633 | * setserial to be used to alter this port's parameters. |
| 2624 | */ | 2634 | */ |
| 2625 | tty_dev = tty_port_register_device_attr(port, drv->tty_driver, | 2635 | tty_dev = tty_port_register_device_attr(port, drv->tty_driver, |
| 2626 | uport->line, uport->dev, port, tty_dev_attr_groups); | 2636 | uport->line, uport->dev, port, uport->tty_groups); |
| 2627 | if (likely(!IS_ERR(tty_dev))) { | 2637 | if (likely(!IS_ERR(tty_dev))) { |
| 2628 | device_set_wakeup_capable(tty_dev, 1); | 2638 | device_set_wakeup_capable(tty_dev, 1); |
| 2629 | } else { | 2639 | } else { |
| @@ -2702,6 +2712,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2702 | */ | 2712 | */ |
| 2703 | if (uport->type != PORT_UNKNOWN) | 2713 | if (uport->type != PORT_UNKNOWN) |
| 2704 | uport->ops->release_port(uport); | 2714 | uport->ops->release_port(uport); |
| 2715 | kfree(uport->tty_groups); | ||
| 2705 | 2716 | ||
| 2706 | /* | 2717 | /* |
| 2707 | * Indicate that there isn't a port here anymore. | 2718 | * Indicate that there isn't a port here anymore. |
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index ea8546092c7e..af115645c51f 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c | |||
| @@ -142,7 +142,6 @@ struct uart_txx9_port { | |||
| 142 | #define TXX9_SIFCR_RDIL_12 0x00000180 | 142 | #define TXX9_SIFCR_RDIL_12 0x00000180 |
| 143 | #define TXX9_SIFCR_RDIL_MAX 0x00000180 | 143 | #define TXX9_SIFCR_RDIL_MAX 0x00000180 |
| 144 | #define TXX9_SIFCR_TDIL_MASK 0x00000018 | 144 | #define TXX9_SIFCR_TDIL_MASK 0x00000018 |
| 145 | #define TXX9_SIFCR_TDIL_MASK 0x00000018 | ||
| 146 | #define TXX9_SIFCR_TDIL_1 0x00000000 | 145 | #define TXX9_SIFCR_TDIL_1 0x00000000 |
| 147 | #define TXX9_SIFCR_TDIL_4 0x00000001 | 146 | #define TXX9_SIFCR_TDIL_4 0x00000001 |
| 148 | #define TXX9_SIFCR_TDIL_8 0x00000010 | 147 | #define TXX9_SIFCR_TDIL_8 0x00000010 |
| @@ -244,11 +243,6 @@ static void serial_txx9_stop_rx(struct uart_port *port) | |||
| 244 | up->port.read_status_mask &= ~TXX9_SIDISR_RDIS; | 243 | up->port.read_status_mask &= ~TXX9_SIDISR_RDIS; |
| 245 | } | 244 | } |
| 246 | 245 | ||
| 247 | static void serial_txx9_enable_ms(struct uart_port *port) | ||
| 248 | { | ||
| 249 | /* TXX9-SIO can not control DTR... */ | ||
| 250 | } | ||
| 251 | |||
| 252 | static void serial_txx9_initialize(struct uart_port *port) | 246 | static void serial_txx9_initialize(struct uart_port *port) |
| 253 | { | 247 | { |
| 254 | struct uart_txx9_port *up = to_uart_txx9_port(port); | 248 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
| @@ -858,7 +852,6 @@ static struct uart_ops serial_txx9_pops = { | |||
| 858 | .stop_tx = serial_txx9_stop_tx, | 852 | .stop_tx = serial_txx9_stop_tx, |
| 859 | .start_tx = serial_txx9_start_tx, | 853 | .start_tx = serial_txx9_start_tx, |
| 860 | .stop_rx = serial_txx9_stop_rx, | 854 | .stop_rx = serial_txx9_stop_rx, |
| 861 | .enable_ms = serial_txx9_enable_ms, | ||
| 862 | .break_ctl = serial_txx9_break_ctl, | 855 | .break_ctl = serial_txx9_break_ctl, |
| 863 | .startup = serial_txx9_startup, | 856 | .startup = serial_txx9_startup, |
| 864 | .shutdown = serial_txx9_shutdown, | 857 | .shutdown = serial_txx9_shutdown, |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 88236da0ddf7..3081e46085ce 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -1560,13 +1560,6 @@ static void sci_stop_rx(struct uart_port *port) | |||
| 1560 | serial_port_out(port, SCSCR, ctrl); | 1560 | serial_port_out(port, SCSCR, ctrl); |
| 1561 | } | 1561 | } |
| 1562 | 1562 | ||
| 1563 | static void sci_enable_ms(struct uart_port *port) | ||
| 1564 | { | ||
| 1565 | /* | ||
| 1566 | * Not supported by hardware, always a nop. | ||
| 1567 | */ | ||
| 1568 | } | ||
| 1569 | |||
| 1570 | static void sci_break_ctl(struct uart_port *port, int break_state) | 1563 | static void sci_break_ctl(struct uart_port *port, int break_state) |
| 1571 | { | 1564 | { |
| 1572 | struct sci_port *s = to_sci_port(port); | 1565 | struct sci_port *s = to_sci_port(port); |
| @@ -1783,30 +1776,71 @@ static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps, | |||
| 1783 | return ((freq + 16 * bps) / (32 * bps) - 1); | 1776 | return ((freq + 16 * bps) / (32 * bps) - 1); |
| 1784 | } | 1777 | } |
| 1785 | 1778 | ||
| 1779 | /* calculate frame length from SMR */ | ||
| 1780 | static int sci_baud_calc_frame_len(unsigned int smr_val) | ||
| 1781 | { | ||
| 1782 | int len = 10; | ||
| 1783 | |||
| 1784 | if (smr_val & SCSMR_CHR) | ||
| 1785 | len--; | ||
| 1786 | if (smr_val & SCSMR_PE) | ||
| 1787 | len++; | ||
| 1788 | if (smr_val & SCSMR_STOP) | ||
| 1789 | len++; | ||
| 1790 | |||
| 1791 | return len; | ||
| 1792 | } | ||
| 1793 | |||
| 1794 | |||
| 1786 | /* calculate sample rate, BRR, and clock select for HSCIF */ | 1795 | /* calculate sample rate, BRR, and clock select for HSCIF */ |
| 1787 | static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq, | 1796 | static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq, |
| 1788 | int *brr, unsigned int *srr, | 1797 | int *brr, unsigned int *srr, |
| 1789 | unsigned int *cks) | 1798 | unsigned int *cks, int frame_len) |
| 1790 | { | 1799 | { |
| 1791 | int sr, c, br, err; | 1800 | int sr, c, br, err, recv_margin; |
| 1792 | int min_err = 1000; /* 100% */ | 1801 | int min_err = 1000; /* 100% */ |
| 1802 | int recv_max_margin = 0; | ||
| 1793 | 1803 | ||
| 1794 | /* Find the combination of sample rate and clock select with the | 1804 | /* Find the combination of sample rate and clock select with the |
| 1795 | smallest deviation from the desired baud rate. */ | 1805 | smallest deviation from the desired baud rate. */ |
| 1796 | for (sr = 8; sr <= 32; sr++) { | 1806 | for (sr = 8; sr <= 32; sr++) { |
| 1797 | for (c = 0; c <= 3; c++) { | 1807 | for (c = 0; c <= 3; c++) { |
| 1798 | /* integerized formulas from HSCIF documentation */ | 1808 | /* integerized formulas from HSCIF documentation */ |
| 1799 | br = freq / (sr * (1 << (2 * c + 1)) * bps) - 1; | 1809 | br = DIV_ROUND_CLOSEST(freq, (sr * |
| 1800 | if (br < 0 || br > 255) | 1810 | (1 << (2 * c + 1)) * bps)) - 1; |
| 1811 | br = clamp(br, 0, 255); | ||
| 1812 | err = DIV_ROUND_CLOSEST(freq, ((br + 1) * bps * sr * | ||
| 1813 | (1 << (2 * c + 1)) / 1000)) - | ||
| 1814 | 1000; | ||
| 1815 | if (err < 0) | ||
| 1801 | continue; | 1816 | continue; |
| 1802 | err = freq / ((br + 1) * bps * sr * | 1817 | |
| 1803 | (1 << (2 * c + 1)) / 1000) - 1000; | 1818 | /* Calc recv margin |
| 1819 | * M: Receive margin (%) | ||
| 1820 | * N: Ratio of bit rate to clock (N = sampling rate) | ||
| 1821 | * D: Clock duty (D = 0 to 1.0) | ||
| 1822 | * L: Frame length (L = 9 to 12) | ||
| 1823 | * F: Absolute value of clock frequency deviation | ||
| 1824 | * | ||
| 1825 | * M = |(0.5 - 1 / 2 * N) - ((L - 0.5) * F) - | ||
| 1826 | * (|D - 0.5| / N * (1 + F))| | ||
| 1827 | * NOTE: Usually, treat D for 0.5, F is 0 by this | ||
| 1828 | * calculation. | ||
| 1829 | */ | ||
| 1830 | recv_margin = abs((500 - | ||
| 1831 | DIV_ROUND_CLOSEST(1000, sr << 1)) / 10); | ||
| 1804 | if (min_err > err) { | 1832 | if (min_err > err) { |
| 1805 | min_err = err; | 1833 | min_err = err; |
| 1806 | *brr = br; | 1834 | recv_max_margin = recv_margin; |
| 1807 | *srr = sr - 1; | 1835 | } else if ((min_err == err) && |
| 1808 | *cks = c; | 1836 | (recv_margin > recv_max_margin)) |
| 1809 | } | 1837 | recv_max_margin = recv_margin; |
| 1838 | else | ||
| 1839 | continue; | ||
| 1840 | |||
| 1841 | *brr = br; | ||
| 1842 | *srr = sr - 1; | ||
| 1843 | *cks = c; | ||
| 1810 | } | 1844 | } |
| 1811 | } | 1845 | } |
| 1812 | 1846 | ||
| @@ -1840,10 +1874,19 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 1840 | { | 1874 | { |
| 1841 | struct sci_port *s = to_sci_port(port); | 1875 | struct sci_port *s = to_sci_port(port); |
| 1842 | struct plat_sci_reg *reg; | 1876 | struct plat_sci_reg *reg; |
| 1843 | unsigned int baud, smr_val, max_baud, cks = 0; | 1877 | unsigned int baud, smr_val = 0, max_baud, cks = 0; |
| 1844 | int t = -1; | 1878 | int t = -1; |
| 1845 | unsigned int srr = 15; | 1879 | unsigned int srr = 15; |
| 1846 | 1880 | ||
| 1881 | if ((termios->c_cflag & CSIZE) == CS7) | ||
| 1882 | smr_val |= SCSMR_CHR; | ||
| 1883 | if (termios->c_cflag & PARENB) | ||
| 1884 | smr_val |= SCSMR_PE; | ||
| 1885 | if (termios->c_cflag & PARODD) | ||
| 1886 | smr_val |= SCSMR_PE | SCSMR_ODD; | ||
| 1887 | if (termios->c_cflag & CSTOPB) | ||
| 1888 | smr_val |= SCSMR_STOP; | ||
| 1889 | |||
| 1847 | /* | 1890 | /* |
| 1848 | * earlyprintk comes here early on with port->uartclk set to zero. | 1891 | * earlyprintk comes here early on with port->uartclk set to zero. |
| 1849 | * the clock framework is not up and running at this point so here | 1892 | * the clock framework is not up and running at this point so here |
| @@ -1857,8 +1900,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 1857 | baud = uart_get_baud_rate(port, termios, old, 0, max_baud); | 1900 | baud = uart_get_baud_rate(port, termios, old, 0, max_baud); |
| 1858 | if (likely(baud && port->uartclk)) { | 1901 | if (likely(baud && port->uartclk)) { |
| 1859 | if (s->cfg->type == PORT_HSCIF) { | 1902 | if (s->cfg->type == PORT_HSCIF) { |
| 1903 | int frame_len = sci_baud_calc_frame_len(smr_val); | ||
| 1860 | sci_baud_calc_hscif(baud, port->uartclk, &t, &srr, | 1904 | sci_baud_calc_hscif(baud, port->uartclk, &t, &srr, |
| 1861 | &cks); | 1905 | &cks, frame_len); |
| 1862 | } else { | 1906 | } else { |
| 1863 | t = sci_scbrr_calc(s, baud, port->uartclk); | 1907 | t = sci_scbrr_calc(s, baud, port->uartclk); |
| 1864 | for (cks = 0; t >= 256 && cks <= 3; cks++) | 1908 | for (cks = 0; t >= 256 && cks <= 3; cks++) |
| @@ -1870,16 +1914,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 1870 | 1914 | ||
| 1871 | sci_reset(port); | 1915 | sci_reset(port); |
| 1872 | 1916 | ||
| 1873 | smr_val = serial_port_in(port, SCSMR) & 3; | 1917 | smr_val |= serial_port_in(port, SCSMR) & 3; |
| 1874 | |||
| 1875 | if ((termios->c_cflag & CSIZE) == CS7) | ||
| 1876 | smr_val |= SCSMR_CHR; | ||
| 1877 | if (termios->c_cflag & PARENB) | ||
| 1878 | smr_val |= SCSMR_PE; | ||
| 1879 | if (termios->c_cflag & PARODD) | ||
| 1880 | smr_val |= SCSMR_PE | SCSMR_ODD; | ||
| 1881 | if (termios->c_cflag & CSTOPB) | ||
| 1882 | smr_val |= SCSMR_STOP; | ||
| 1883 | 1918 | ||
| 1884 | uart_update_timeout(port, termios->c_cflag, baud); | 1919 | uart_update_timeout(port, termios->c_cflag, baud); |
| 1885 | 1920 | ||
| @@ -2080,7 +2115,6 @@ static struct uart_ops sci_uart_ops = { | |||
| 2080 | .start_tx = sci_start_tx, | 2115 | .start_tx = sci_start_tx, |
| 2081 | .stop_tx = sci_stop_tx, | 2116 | .stop_tx = sci_stop_tx, |
| 2082 | .stop_rx = sci_stop_rx, | 2117 | .stop_rx = sci_stop_rx, |
| 2083 | .enable_ms = sci_enable_ms, | ||
| 2084 | .break_ctl = sci_break_ctl, | 2118 | .break_ctl = sci_break_ctl, |
| 2085 | .startup = sci_startup, | 2119 | .startup = sci_startup, |
| 2086 | .shutdown = sci_shutdown, | 2120 | .shutdown = sci_shutdown, |
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index 9b4d71cff00d..4102192687ee 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c | |||
| @@ -290,7 +290,8 @@ static void sirfsoc_uart_start_tx(struct uart_port *port) | |||
| 290 | if (sirfport->tx_dma_chan) | 290 | if (sirfport->tx_dma_chan) |
| 291 | sirfsoc_uart_tx_with_dma(sirfport); | 291 | sirfsoc_uart_tx_with_dma(sirfport); |
| 292 | else { | 292 | else { |
| 293 | sirfsoc_uart_pio_tx_chars(sirfport, 1); | 293 | sirfsoc_uart_pio_tx_chars(sirfport, |
| 294 | SIRFSOC_UART_IO_TX_REASONABLE_CNT); | ||
| 294 | wr_regl(port, ureg->sirfsoc_tx_fifo_op, SIRFUART_FIFO_START); | 295 | wr_regl(port, ureg->sirfsoc_tx_fifo_op, SIRFUART_FIFO_START); |
| 295 | if (!sirfport->is_marco) | 296 | if (!sirfport->is_marco) |
| 296 | wr_regl(port, ureg->sirfsoc_int_en_reg, | 297 | wr_regl(port, ureg->sirfsoc_int_en_reg, |
diff --git a/drivers/tty/serial/sirfsoc_uart.h b/drivers/tty/serial/sirfsoc_uart.h index 69a62ebd3afc..6a7ebf7ef130 100644 --- a/drivers/tty/serial/sirfsoc_uart.h +++ b/drivers/tty/serial/sirfsoc_uart.h | |||
| @@ -449,4 +449,4 @@ struct sirfsoc_uart_port { | |||
| 449 | 449 | ||
| 450 | /* I/O Mode */ | 450 | /* I/O Mode */ |
| 451 | #define SIRFSOC_UART_IO_RX_MAX_CNT 256 | 451 | #define SIRFSOC_UART_IO_RX_MAX_CNT 256 |
| 452 | #define SIRFSOC_UART_IO_TX_REASONABLE_CNT 6 | 452 | #define SIRFSOC_UART_IO_TX_REASONABLE_CNT 256 |
diff --git a/drivers/tty/serial/sn_console.c b/drivers/tty/serial/sn_console.c index f51ffdc696fd..33e94e56dcdb 100644 --- a/drivers/tty/serial/sn_console.c +++ b/drivers/tty/serial/sn_console.c | |||
| @@ -275,15 +275,6 @@ static void snp_release_port(struct uart_port *port) | |||
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | /** | 277 | /** |
| 278 | * snp_enable_ms - Force modem status interrupts on - no-op for us | ||
| 279 | * @port: Port to operate on - we ignore - no-op function | ||
| 280 | * | ||
| 281 | */ | ||
| 282 | static void snp_enable_ms(struct uart_port *port) | ||
| 283 | { | ||
| 284 | } | ||
| 285 | |||
| 286 | /** | ||
| 287 | * snp_shutdown - shut down the port - free irq and disable - no-op for us | 278 | * snp_shutdown - shut down the port - free irq and disable - no-op for us |
| 288 | * @port: Port to shut down - we ignore | 279 | * @port: Port to shut down - we ignore |
| 289 | * | 280 | * |
| @@ -396,7 +387,6 @@ static struct uart_ops sn_console_ops = { | |||
| 396 | .stop_tx = snp_stop_tx, | 387 | .stop_tx = snp_stop_tx, |
| 397 | .start_tx = snp_start_tx, | 388 | .start_tx = snp_start_tx, |
| 398 | .stop_rx = snp_stop_rx, | 389 | .stop_rx = snp_stop_rx, |
| 399 | .enable_ms = snp_enable_ms, | ||
| 400 | .break_ctl = snp_break_ctl, | 390 | .break_ctl = snp_break_ctl, |
| 401 | .startup = snp_startup, | 391 | .startup = snp_startup, |
| 402 | .shutdown = snp_shutdown, | 392 | .shutdown = snp_shutdown, |
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index f48b1cc07eea..8b2d7356611d 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c | |||
| @@ -411,12 +411,6 @@ static void asc_stop_rx(struct uart_port *port) | |||
| 411 | asc_disable_rx_interrupts(port); | 411 | asc_disable_rx_interrupts(port); |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | /* Force modem status interrupts on */ | ||
| 415 | static void asc_enable_ms(struct uart_port *port) | ||
| 416 | { | ||
| 417 | /* Nothing here yet .. */ | ||
| 418 | } | ||
| 419 | |||
| 420 | /* Handle breaks - ignored by us */ | 414 | /* Handle breaks - ignored by us */ |
| 421 | static void asc_break_ctl(struct uart_port *port, int break_state) | 415 | static void asc_break_ctl(struct uart_port *port, int break_state) |
| 422 | { | 416 | { |
| @@ -533,12 +527,12 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 533 | * ASCBaudRate = ------------------------ | 527 | * ASCBaudRate = ------------------------ |
| 534 | * inputclock | 528 | * inputclock |
| 535 | * | 529 | * |
| 536 | * However to keep the maths inside 32bits we divide top and | 530 | * To keep maths inside 64bits, we divide inputclock by 16. |
| 537 | * bottom by 64. The +1 is to avoid a divide by zero if the | ||
| 538 | * input clock rate is something unexpected. | ||
| 539 | */ | 531 | */ |
| 540 | u32 counter = (baud * 16384) / ((port->uartclk / 64) + 1); | 532 | u64 dividend = (u64)baud * (1 << 16); |
| 541 | asc_out(port, ASC_BAUDRATE, counter); | 533 | |
| 534 | do_div(dividend, port->uartclk / 16); | ||
| 535 | asc_out(port, ASC_BAUDRATE, dividend); | ||
| 542 | ctrl_val |= ASC_CTL_BAUDMODE; | 536 | ctrl_val |= ASC_CTL_BAUDMODE; |
| 543 | } | 537 | } |
| 544 | 538 | ||
| @@ -644,7 +638,6 @@ static struct uart_ops asc_uart_ops = { | |||
| 644 | .start_tx = asc_start_tx, | 638 | .start_tx = asc_start_tx, |
| 645 | .stop_tx = asc_stop_tx, | 639 | .stop_tx = asc_stop_tx, |
| 646 | .stop_rx = asc_stop_rx, | 640 | .stop_rx = asc_stop_rx, |
| 647 | .enable_ms = asc_enable_ms, | ||
| 648 | .break_ctl = asc_break_ctl, | 641 | .break_ctl = asc_break_ctl, |
| 649 | .startup = asc_startup, | 642 | .startup = asc_startup, |
| 650 | .shutdown = asc_shutdown, | 643 | .shutdown = asc_shutdown, |
| @@ -849,7 +842,8 @@ static int asc_console_setup(struct console *co, char *options) | |||
| 849 | * this to be called during the uart port registration when the | 842 | * this to be called during the uart port registration when the |
| 850 | * driver gets probed and the port should be mapped at that point. | 843 | * driver gets probed and the port should be mapped at that point. |
| 851 | */ | 844 | */ |
| 852 | BUG_ON(ascport->port.mapbase == 0 || ascport->port.membase == NULL); | 845 | if (ascport->port.mapbase == 0 || ascport->port.membase == NULL) |
| 846 | return -ENXIO; | ||
| 853 | 847 | ||
| 854 | if (options) | 848 | if (options) |
| 855 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 849 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c index dc697cee248a..20521db2189f 100644 --- a/drivers/tty/serial/sunhv.c +++ b/drivers/tty/serial/sunhv.c | |||
| @@ -285,11 +285,6 @@ static void sunhv_stop_rx(struct uart_port *port) | |||
| 285 | { | 285 | { |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | /* port->lock held by caller. */ | ||
| 289 | static void sunhv_enable_ms(struct uart_port *port) | ||
| 290 | { | ||
| 291 | } | ||
| 292 | |||
| 293 | /* port->lock is not held. */ | 288 | /* port->lock is not held. */ |
| 294 | static void sunhv_break_ctl(struct uart_port *port, int break_state) | 289 | static void sunhv_break_ctl(struct uart_port *port, int break_state) |
| 295 | { | 290 | { |
| @@ -379,7 +374,6 @@ static struct uart_ops sunhv_pops = { | |||
| 379 | .start_tx = sunhv_start_tx, | 374 | .start_tx = sunhv_start_tx, |
| 380 | .send_xchar = sunhv_send_xchar, | 375 | .send_xchar = sunhv_send_xchar, |
| 381 | .stop_rx = sunhv_stop_rx, | 376 | .stop_rx = sunhv_stop_rx, |
| 382 | .enable_ms = sunhv_enable_ms, | ||
| 383 | .break_ctl = sunhv_break_ctl, | 377 | .break_ctl = sunhv_break_ctl, |
| 384 | .startup = sunhv_startup, | 378 | .startup = sunhv_startup, |
| 385 | .shutdown = sunhv_shutdown, | 379 | .shutdown = sunhv_shutdown, |
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index 2f57df9a71d9..bb09920ac9c7 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
| @@ -476,12 +476,6 @@ static void sunsab_stop_rx(struct uart_port *port) | |||
| 476 | writeb(up->interrupt_mask1, &up->regs->w.imr0); | 476 | writeb(up->interrupt_mask1, &up->regs->w.imr0); |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | /* port->lock held by caller. */ | ||
| 480 | static void sunsab_enable_ms(struct uart_port *port) | ||
| 481 | { | ||
| 482 | /* For now we always receive these interrupts. */ | ||
| 483 | } | ||
| 484 | |||
| 485 | /* port->lock is not held. */ | 479 | /* port->lock is not held. */ |
| 486 | static void sunsab_break_ctl(struct uart_port *port, int break_state) | 480 | static void sunsab_break_ctl(struct uart_port *port, int break_state) |
| 487 | { | 481 | { |
| @@ -810,7 +804,6 @@ static struct uart_ops sunsab_pops = { | |||
| 810 | .start_tx = sunsab_start_tx, | 804 | .start_tx = sunsab_start_tx, |
| 811 | .send_xchar = sunsab_send_xchar, | 805 | .send_xchar = sunsab_send_xchar, |
| 812 | .stop_rx = sunsab_stop_rx, | 806 | .stop_rx = sunsab_stop_rx, |
| 813 | .enable_ms = sunsab_enable_ms, | ||
| 814 | .break_ctl = sunsab_break_ctl, | 807 | .break_ctl = sunsab_break_ctl, |
| 815 | .startup = sunsab_startup, | 808 | .startup = sunsab_startup, |
| 816 | .shutdown = sunsab_shutdown, | 809 | .shutdown = sunsab_shutdown, |
diff --git a/drivers/tty/serial/tilegx.c b/drivers/tty/serial/tilegx.c index 613ccf09dc2a..453215f5420d 100644 --- a/drivers/tty/serial/tilegx.c +++ b/drivers/tty/serial/tilegx.c | |||
| @@ -314,15 +314,6 @@ static void tilegx_stop_rx(struct uart_port *port) | |||
| 314 | mutex_unlock(&tile_uart->mutex); | 314 | mutex_unlock(&tile_uart->mutex); |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | |||
| 318 | /* | ||
| 319 | * Enable modem status interrupts. | ||
| 320 | */ | ||
| 321 | static void tilegx_enable_ms(struct uart_port *port) | ||
| 322 | { | ||
| 323 | /* N/A */ | ||
| 324 | } | ||
| 325 | |||
| 326 | /* | 317 | /* |
| 327 | * Control the transmission of a break signal. | 318 | * Control the transmission of a break signal. |
| 328 | */ | 319 | */ |
| @@ -614,7 +605,6 @@ static const struct uart_ops tilegx_ops = { | |||
| 614 | .stop_tx = tilegx_stop_tx, | 605 | .stop_tx = tilegx_stop_tx, |
| 615 | .start_tx = tilegx_start_tx, | 606 | .start_tx = tilegx_start_tx, |
| 616 | .stop_rx = tilegx_stop_rx, | 607 | .stop_rx = tilegx_stop_rx, |
| 617 | .enable_ms = tilegx_enable_ms, | ||
| 618 | .break_ctl = tilegx_break_ctl, | 608 | .break_ctl = tilegx_break_ctl, |
| 619 | .startup = tilegx_startup, | 609 | .startup = tilegx_startup, |
| 620 | .shutdown = tilegx_shutdown, | 610 | .shutdown = tilegx_shutdown, |
diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c index f87097acd8ab..0d11d5032b93 100644 --- a/drivers/tty/serial/timbuart.c +++ b/drivers/tty/serial/timbuart.c | |||
| @@ -244,11 +244,6 @@ static void timbuart_mctrl_check(struct uart_port *port, u32 isr, u32 *ier) | |||
| 244 | *ier |= CTS_DELTA; | 244 | *ier |= CTS_DELTA; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | static void timbuart_enable_ms(struct uart_port *port) | ||
| 248 | { | ||
| 249 | /* N/A */ | ||
| 250 | } | ||
| 251 | |||
| 252 | static void timbuart_break_ctl(struct uart_port *port, int ctl) | 247 | static void timbuart_break_ctl(struct uart_port *port, int ctl) |
| 253 | { | 248 | { |
| 254 | /* N/A */ | 249 | /* N/A */ |
| @@ -405,7 +400,6 @@ static struct uart_ops timbuart_ops = { | |||
| 405 | .start_tx = timbuart_start_tx, | 400 | .start_tx = timbuart_start_tx, |
| 406 | .flush_buffer = timbuart_flush_buffer, | 401 | .flush_buffer = timbuart_flush_buffer, |
| 407 | .stop_rx = timbuart_stop_rx, | 402 | .stop_rx = timbuart_stop_rx, |
| 408 | .enable_ms = timbuart_enable_ms, | ||
| 409 | .break_ctl = timbuart_break_ctl, | 403 | .break_ctl = timbuart_break_ctl, |
| 410 | .startup = timbuart_startup, | 404 | .startup = timbuart_startup, |
| 411 | .shutdown = timbuart_shutdown, | 405 | .shutdown = timbuart_shutdown, |
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index dce27f34937e..9fc22f40796e 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c | |||
| @@ -250,11 +250,6 @@ static void ulite_stop_rx(struct uart_port *port) | |||
| 250 | | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN; | 250 | | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN; |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | static void ulite_enable_ms(struct uart_port *port) | ||
| 254 | { | ||
| 255 | /* N/A */ | ||
| 256 | } | ||
| 257 | |||
| 258 | static void ulite_break_ctl(struct uart_port *port, int ctl) | 253 | static void ulite_break_ctl(struct uart_port *port, int ctl) |
| 259 | { | 254 | { |
| 260 | /* N/A */ | 255 | /* N/A */ |
| @@ -395,7 +390,6 @@ static struct uart_ops ulite_ops = { | |||
| 395 | .stop_tx = ulite_stop_tx, | 390 | .stop_tx = ulite_stop_tx, |
| 396 | .start_tx = ulite_start_tx, | 391 | .start_tx = ulite_start_tx, |
| 397 | .stop_rx = ulite_stop_rx, | 392 | .stop_rx = ulite_stop_rx, |
| 398 | .enable_ms = ulite_enable_ms, | ||
| 399 | .break_ctl = ulite_break_ctl, | 393 | .break_ctl = ulite_break_ctl, |
| 400 | .startup = ulite_startup, | 394 | .startup = ulite_startup, |
| 401 | .shutdown = ulite_shutdown, | 395 | .shutdown = ulite_shutdown, |
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 1c52074c38df..c107a0f0e72f 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c | |||
| @@ -435,16 +435,6 @@ static void qe_uart_stop_rx(struct uart_port *port) | |||
| 435 | clrbits16(&qe_port->uccp->uccm, UCC_UART_UCCE_RX); | 435 | clrbits16(&qe_port->uccp->uccm, UCC_UART_UCCE_RX); |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | /* | ||
| 439 | * Enable status change interrupts | ||
| 440 | * | ||
| 441 | * We don't support status change interrupts, but we need to define this | ||
| 442 | * function otherwise the kernel will panic. | ||
| 443 | */ | ||
| 444 | static void qe_uart_enable_ms(struct uart_port *port) | ||
| 445 | { | ||
| 446 | } | ||
| 447 | |||
| 448 | /* Start or stop sending break signal | 438 | /* Start or stop sending break signal |
| 449 | * | 439 | * |
| 450 | * This function controls the sending of a break signal. If break_state=1, | 440 | * This function controls the sending of a break signal. If break_state=1, |
| @@ -1102,7 +1092,6 @@ static struct uart_ops qe_uart_pops = { | |||
| 1102 | .stop_tx = qe_uart_stop_tx, | 1092 | .stop_tx = qe_uart_stop_tx, |
| 1103 | .start_tx = qe_uart_start_tx, | 1093 | .start_tx = qe_uart_start_tx, |
| 1104 | .stop_rx = qe_uart_stop_rx, | 1094 | .stop_rx = qe_uart_stop_rx, |
| 1105 | .enable_ms = qe_uart_enable_ms, | ||
| 1106 | .break_ctl = qe_uart_break_ctl, | 1095 | .break_ctl = qe_uart_break_ctl, |
| 1107 | .startup = qe_uart_startup, | 1096 | .startup = qe_uart_startup, |
| 1108 | .shutdown = qe_uart_shutdown, | 1097 | .shutdown = qe_uart_shutdown, |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 8809775e2ba3..01951d27cc03 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
| @@ -918,11 +918,6 @@ static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
| 918 | /* N/A */ | 918 | /* N/A */ |
| 919 | } | 919 | } |
| 920 | 920 | ||
| 921 | static void cdns_uart_enable_ms(struct uart_port *port) | ||
| 922 | { | ||
| 923 | /* N/A */ | ||
| 924 | } | ||
| 925 | |||
| 926 | #ifdef CONFIG_CONSOLE_POLL | 921 | #ifdef CONFIG_CONSOLE_POLL |
| 927 | static int cdns_uart_poll_get_char(struct uart_port *port) | 922 | static int cdns_uart_poll_get_char(struct uart_port *port) |
| 928 | { | 923 | { |
| @@ -974,7 +969,6 @@ static void cdns_uart_poll_put_char(struct uart_port *port, unsigned char c) | |||
| 974 | static struct uart_ops cdns_uart_ops = { | 969 | static struct uart_ops cdns_uart_ops = { |
| 975 | .set_mctrl = cdns_uart_set_mctrl, | 970 | .set_mctrl = cdns_uart_set_mctrl, |
| 976 | .get_mctrl = cdns_uart_get_mctrl, | 971 | .get_mctrl = cdns_uart_get_mctrl, |
| 977 | .enable_ms = cdns_uart_enable_ms, | ||
| 978 | .start_tx = cdns_uart_start_tx, | 972 | .start_tx = cdns_uart_start_tx, |
| 979 | .stop_tx = cdns_uart_stop_tx, | 973 | .stop_tx = cdns_uart_stop_tx, |
| 980 | .stop_rx = cdns_uart_stop_rx, | 974 | .stop_rx = cdns_uart_stop_rx, |
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index d48e040cd8c5..b7991707ffc0 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c | |||
| @@ -3267,7 +3267,6 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
| 3267 | DECLARE_WAITQUEUE(wait, current); | 3267 | DECLARE_WAITQUEUE(wait, current); |
| 3268 | int retval; | 3268 | int retval; |
| 3269 | bool do_clocal = false; | 3269 | bool do_clocal = false; |
| 3270 | bool extra_count = false; | ||
| 3271 | unsigned long flags; | 3270 | unsigned long flags; |
| 3272 | int dcd; | 3271 | int dcd; |
| 3273 | struct tty_port *port = &info->port; | 3272 | struct tty_port *port = &info->port; |
| @@ -3300,10 +3299,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
| 3300 | __FILE__,__LINE__, tty->driver->name, port->count ); | 3299 | __FILE__,__LINE__, tty->driver->name, port->count ); |
| 3301 | 3300 | ||
| 3302 | spin_lock_irqsave(&info->irq_spinlock, flags); | 3301 | spin_lock_irqsave(&info->irq_spinlock, flags); |
| 3303 | if (!tty_hung_up_p(filp)) { | 3302 | port->count--; |
| 3304 | extra_count = true; | ||
| 3305 | port->count--; | ||
| 3306 | } | ||
| 3307 | spin_unlock_irqrestore(&info->irq_spinlock, flags); | 3303 | spin_unlock_irqrestore(&info->irq_spinlock, flags); |
| 3308 | port->blocked_open++; | 3304 | port->blocked_open++; |
| 3309 | 3305 | ||
| @@ -3342,7 +3338,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
| 3342 | remove_wait_queue(&port->open_wait, &wait); | 3338 | remove_wait_queue(&port->open_wait, &wait); |
| 3343 | 3339 | ||
| 3344 | /* FIXME: Racy on hangup during close wait */ | 3340 | /* FIXME: Racy on hangup during close wait */ |
| 3345 | if (extra_count) | 3341 | if (!tty_hung_up_p(filp)) |
| 3346 | port->count++; | 3342 | port->count++; |
| 3347 | port->blocked_open--; | 3343 | port->blocked_open--; |
| 3348 | 3344 | ||
| @@ -3403,7 +3399,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) | |||
| 3403 | __FILE__,__LINE__,tty->driver->name, info->port.count); | 3399 | __FILE__,__LINE__,tty->driver->name, info->port.count); |
| 3404 | 3400 | ||
| 3405 | /* If port is closing, signal caller to try again */ | 3401 | /* If port is closing, signal caller to try again */ |
| 3406 | if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){ | 3402 | if (info->port.flags & ASYNC_CLOSING){ |
| 3407 | wait_event_interruptible_tty(tty, info->port.close_wait, | 3403 | wait_event_interruptible_tty(tty, info->port.close_wait, |
| 3408 | !(info->port.flags & ASYNC_CLOSING)); | 3404 | !(info->port.flags & ASYNC_CLOSING)); |
| 3409 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? | 3405 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index c359a91f7346..ba1dbcdf4609 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c | |||
| @@ -673,7 +673,7 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
| 673 | DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->port.count)); | 673 | DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->port.count)); |
| 674 | 674 | ||
| 675 | /* If port is closing, signal caller to try again */ | 675 | /* If port is closing, signal caller to try again */ |
| 676 | if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){ | 676 | if (info->port.flags & ASYNC_CLOSING){ |
| 677 | wait_event_interruptible_tty(tty, info->port.close_wait, | 677 | wait_event_interruptible_tty(tty, info->port.close_wait, |
| 678 | !(info->port.flags & ASYNC_CLOSING)); | 678 | !(info->port.flags & ASYNC_CLOSING)); |
| 679 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? | 679 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
| @@ -3273,7 +3273,6 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
| 3273 | DECLARE_WAITQUEUE(wait, current); | 3273 | DECLARE_WAITQUEUE(wait, current); |
| 3274 | int retval; | 3274 | int retval; |
| 3275 | bool do_clocal = false; | 3275 | bool do_clocal = false; |
| 3276 | bool extra_count = false; | ||
| 3277 | unsigned long flags; | 3276 | unsigned long flags; |
| 3278 | int cd; | 3277 | int cd; |
| 3279 | struct tty_port *port = &info->port; | 3278 | struct tty_port *port = &info->port; |
| @@ -3300,10 +3299,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
| 3300 | add_wait_queue(&port->open_wait, &wait); | 3299 | add_wait_queue(&port->open_wait, &wait); |
| 3301 | 3300 | ||
| 3302 | spin_lock_irqsave(&info->lock, flags); | 3301 | spin_lock_irqsave(&info->lock, flags); |
| 3303 | if (!tty_hung_up_p(filp)) { | 3302 | port->count--; |
| 3304 | extra_count = true; | ||
| 3305 | port->count--; | ||
| 3306 | } | ||
| 3307 | spin_unlock_irqrestore(&info->lock, flags); | 3303 | spin_unlock_irqrestore(&info->lock, flags); |
| 3308 | port->blocked_open++; | 3304 | port->blocked_open++; |
| 3309 | 3305 | ||
| @@ -3338,7 +3334,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
| 3338 | set_current_state(TASK_RUNNING); | 3334 | set_current_state(TASK_RUNNING); |
| 3339 | remove_wait_queue(&port->open_wait, &wait); | 3335 | remove_wait_queue(&port->open_wait, &wait); |
| 3340 | 3336 | ||
| 3341 | if (extra_count) | 3337 | if (!tty_hung_up_p(filp)) |
| 3342 | port->count++; | 3338 | port->count++; |
| 3343 | port->blocked_open--; | 3339 | port->blocked_open--; |
| 3344 | 3340 | ||
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index 53ba8537de8d..c3f90910fed9 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c | |||
| @@ -753,7 +753,7 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
| 753 | __FILE__,__LINE__,tty->driver->name, info->port.count); | 753 | __FILE__,__LINE__,tty->driver->name, info->port.count); |
| 754 | 754 | ||
| 755 | /* If port is closing, signal caller to try again */ | 755 | /* If port is closing, signal caller to try again */ |
| 756 | if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){ | 756 | if (info->port.flags & ASYNC_CLOSING){ |
| 757 | wait_event_interruptible_tty(tty, info->port.close_wait, | 757 | wait_event_interruptible_tty(tty, info->port.close_wait, |
| 758 | !(info->port.flags & ASYNC_CLOSING)); | 758 | !(info->port.flags & ASYNC_CLOSING)); |
| 759 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? | 759 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
| @@ -3288,7 +3288,6 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
| 3288 | DECLARE_WAITQUEUE(wait, current); | 3288 | DECLARE_WAITQUEUE(wait, current); |
| 3289 | int retval; | 3289 | int retval; |
| 3290 | bool do_clocal = false; | 3290 | bool do_clocal = false; |
| 3291 | bool extra_count = false; | ||
| 3292 | unsigned long flags; | 3291 | unsigned long flags; |
| 3293 | int cd; | 3292 | int cd; |
| 3294 | struct tty_port *port = &info->port; | 3293 | struct tty_port *port = &info->port; |
| @@ -3322,10 +3321,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
| 3322 | __FILE__,__LINE__, tty->driver->name, port->count ); | 3321 | __FILE__,__LINE__, tty->driver->name, port->count ); |
| 3323 | 3322 | ||
| 3324 | spin_lock_irqsave(&info->lock, flags); | 3323 | spin_lock_irqsave(&info->lock, flags); |
| 3325 | if (!tty_hung_up_p(filp)) { | 3324 | port->count--; |
| 3326 | extra_count = true; | ||
| 3327 | port->count--; | ||
| 3328 | } | ||
| 3329 | spin_unlock_irqrestore(&info->lock, flags); | 3325 | spin_unlock_irqrestore(&info->lock, flags); |
| 3330 | port->blocked_open++; | 3326 | port->blocked_open++; |
| 3331 | 3327 | ||
| @@ -3362,8 +3358,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
| 3362 | 3358 | ||
| 3363 | set_current_state(TASK_RUNNING); | 3359 | set_current_state(TASK_RUNNING); |
| 3364 | remove_wait_queue(&port->open_wait, &wait); | 3360 | remove_wait_queue(&port->open_wait, &wait); |
| 3365 | 3361 | if (!tty_hung_up_p(filp)) | |
| 3366 | if (extra_count) | ||
| 3367 | port->count++; | 3362 | port->count++; |
| 3368 | port->blocked_open--; | 3363 | port->blocked_open--; |
| 3369 | 3364 | ||
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 34110719fe03..8fbad3410c75 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
| @@ -157,20 +157,6 @@ static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty); | |||
| 157 | static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty); | 157 | static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty); |
| 158 | 158 | ||
| 159 | /** | 159 | /** |
| 160 | * alloc_tty_struct - allocate a tty object | ||
| 161 | * | ||
| 162 | * Return a new empty tty structure. The data fields have not | ||
| 163 | * been initialized in any way but has been zeroed | ||
| 164 | * | ||
| 165 | * Locking: none | ||
| 166 | */ | ||
| 167 | |||
| 168 | struct tty_struct *alloc_tty_struct(void) | ||
| 169 | { | ||
| 170 | return kzalloc(sizeof(struct tty_struct), GFP_KERNEL); | ||
| 171 | } | ||
| 172 | |||
| 173 | /** | ||
| 174 | * free_tty_struct - free a disused tty | 160 | * free_tty_struct - free a disused tty |
| 175 | * @tty: tty struct to free | 161 | * @tty: tty struct to free |
| 176 | * | 162 | * |
| @@ -688,7 +674,7 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session) | |||
| 688 | for (n = 0; n < closecount; n++) | 674 | for (n = 0; n < closecount; n++) |
| 689 | tty->ops->close(tty, cons_filp); | 675 | tty->ops->close(tty, cons_filp); |
| 690 | } else if (tty->ops->hangup) | 676 | } else if (tty->ops->hangup) |
| 691 | (tty->ops->hangup)(tty); | 677 | tty->ops->hangup(tty); |
| 692 | /* | 678 | /* |
| 693 | * We don't want to have driver/ldisc interactions beyond | 679 | * We don't want to have driver/ldisc interactions beyond |
| 694 | * the ones we did here. The driver layer expects no | 680 | * the ones we did here. The driver layer expects no |
| @@ -1455,12 +1441,11 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx) | |||
| 1455 | if (!try_module_get(driver->owner)) | 1441 | if (!try_module_get(driver->owner)) |
| 1456 | return ERR_PTR(-ENODEV); | 1442 | return ERR_PTR(-ENODEV); |
| 1457 | 1443 | ||
| 1458 | tty = alloc_tty_struct(); | 1444 | tty = alloc_tty_struct(driver, idx); |
| 1459 | if (!tty) { | 1445 | if (!tty) { |
| 1460 | retval = -ENOMEM; | 1446 | retval = -ENOMEM; |
| 1461 | goto err_module_put; | 1447 | goto err_module_put; |
| 1462 | } | 1448 | } |
| 1463 | initialize_tty_struct(tty, driver, idx); | ||
| 1464 | 1449 | ||
| 1465 | tty_lock(tty); | 1450 | tty_lock(tty); |
| 1466 | retval = tty_driver_install_tty(driver, tty); | 1451 | retval = tty_driver_install_tty(driver, tty); |
| @@ -3003,19 +2988,21 @@ static struct device *tty_get_device(struct tty_struct *tty) | |||
| 3003 | 2988 | ||
| 3004 | 2989 | ||
| 3005 | /** | 2990 | /** |
| 3006 | * initialize_tty_struct | 2991 | * alloc_tty_struct |
| 3007 | * @tty: tty to initialize | ||
| 3008 | * | 2992 | * |
| 3009 | * This subroutine initializes a tty structure that has been newly | 2993 | * This subroutine allocates and initializes a tty structure. |
| 3010 | * allocated. | ||
| 3011 | * | 2994 | * |
| 3012 | * Locking: none - tty in question must not be exposed at this point | 2995 | * Locking: none - tty in question is not exposed at this point |
| 3013 | */ | 2996 | */ |
| 3014 | 2997 | ||
| 3015 | void initialize_tty_struct(struct tty_struct *tty, | 2998 | struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx) |
| 3016 | struct tty_driver *driver, int idx) | ||
| 3017 | { | 2999 | { |
| 3018 | memset(tty, 0, sizeof(struct tty_struct)); | 3000 | struct tty_struct *tty; |
| 3001 | |||
| 3002 | tty = kzalloc(sizeof(*tty), GFP_KERNEL); | ||
| 3003 | if (!tty) | ||
| 3004 | return NULL; | ||
| 3005 | |||
| 3019 | kref_init(&tty->kref); | 3006 | kref_init(&tty->kref); |
| 3020 | tty->magic = TTY_MAGIC; | 3007 | tty->magic = TTY_MAGIC; |
| 3021 | tty_ldisc_init(tty); | 3008 | tty_ldisc_init(tty); |
| @@ -3039,6 +3026,8 @@ void initialize_tty_struct(struct tty_struct *tty, | |||
| 3039 | tty->index = idx; | 3026 | tty->index = idx; |
| 3040 | tty_line_name(driver, idx, tty->name); | 3027 | tty_line_name(driver, idx, tty->name); |
| 3041 | tty->dev = tty_get_device(tty); | 3028 | tty->dev = tty_get_device(tty); |
| 3029 | |||
| 3030 | return tty; | ||
| 3042 | } | 3031 | } |
| 3043 | 3032 | ||
| 3044 | /** | 3033 | /** |
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 3f746c8eb0dd..1b9335796da4 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c | |||
| @@ -227,6 +227,8 @@ out: | |||
| 227 | * | 227 | * |
| 228 | * Perform port level tty hangup flag and count changes. Drop the tty | 228 | * Perform port level tty hangup flag and count changes. Drop the tty |
| 229 | * reference. | 229 | * reference. |
| 230 | * | ||
| 231 | * Caller holds tty lock. | ||
| 230 | */ | 232 | */ |
| 231 | 233 | ||
| 232 | void tty_port_hangup(struct tty_port *port) | 234 | void tty_port_hangup(struct tty_port *port) |
| @@ -348,6 +350,11 @@ EXPORT_SYMBOL(tty_port_lower_dtr_rts); | |||
| 348 | * do carrier detect and the dtr_rts method if it supports software | 350 | * do carrier detect and the dtr_rts method if it supports software |
| 349 | * management of these lines. Note that the dtr/rts raise is done each | 351 | * management of these lines. Note that the dtr/rts raise is done each |
| 350 | * iteration as a hangup may have previously dropped them while we wait. | 352 | * iteration as a hangup may have previously dropped them while we wait. |
| 353 | * | ||
| 354 | * Caller holds tty lock. | ||
| 355 | * | ||
| 356 | * NB: May drop and reacquire tty lock when blocking, so tty and tty_port | ||
| 357 | * may have changed state (eg., may have been hung up). | ||
| 351 | */ | 358 | */ |
| 352 | 359 | ||
| 353 | int tty_port_block_til_ready(struct tty_port *port, | 360 | int tty_port_block_til_ready(struct tty_port *port, |
| @@ -358,7 +365,7 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
| 358 | DEFINE_WAIT(wait); | 365 | DEFINE_WAIT(wait); |
| 359 | 366 | ||
| 360 | /* block if port is in the process of being closed */ | 367 | /* block if port is in the process of being closed */ |
| 361 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { | 368 | if (port->flags & ASYNC_CLOSING) { |
| 362 | wait_event_interruptible_tty(tty, port->close_wait, | 369 | wait_event_interruptible_tty(tty, port->close_wait, |
| 363 | !(port->flags & ASYNC_CLOSING)); | 370 | !(port->flags & ASYNC_CLOSING)); |
| 364 | if (port->flags & ASYNC_HUP_NOTIFY) | 371 | if (port->flags & ASYNC_HUP_NOTIFY) |
| @@ -392,8 +399,7 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
| 392 | 399 | ||
| 393 | /* The port lock protects the port counts */ | 400 | /* The port lock protects the port counts */ |
| 394 | spin_lock_irqsave(&port->lock, flags); | 401 | spin_lock_irqsave(&port->lock, flags); |
| 395 | if (!tty_hung_up_p(filp)) | 402 | port->count--; |
| 396 | port->count--; | ||
| 397 | port->blocked_open++; | 403 | port->blocked_open++; |
| 398 | spin_unlock_irqrestore(&port->lock, flags); | 404 | spin_unlock_irqrestore(&port->lock, flags); |
| 399 | 405 | ||
| @@ -458,6 +464,10 @@ static void tty_port_drain_delay(struct tty_port *port, struct tty_struct *tty) | |||
| 458 | schedule_timeout_interruptible(timeout); | 464 | schedule_timeout_interruptible(timeout); |
| 459 | } | 465 | } |
| 460 | 466 | ||
| 467 | /* Caller holds tty lock. | ||
| 468 | * NB: may drop and reacquire tty lock (in tty_wait_until_sent_from_close()) | ||
| 469 | * so tty and tty port may have changed state (but not hung up or reopened). | ||
| 470 | */ | ||
| 461 | int tty_port_close_start(struct tty_port *port, | 471 | int tty_port_close_start(struct tty_port *port, |
| 462 | struct tty_struct *tty, struct file *filp) | 472 | struct tty_struct *tty, struct file *filp) |
| 463 | { | 473 | { |
| @@ -486,9 +496,10 @@ int tty_port_close_start(struct tty_port *port, | |||
| 486 | return 0; | 496 | return 0; |
| 487 | } | 497 | } |
| 488 | set_bit(ASYNCB_CLOSING, &port->flags); | 498 | set_bit(ASYNCB_CLOSING, &port->flags); |
| 489 | tty->closing = 1; | ||
| 490 | spin_unlock_irqrestore(&port->lock, flags); | 499 | spin_unlock_irqrestore(&port->lock, flags); |
| 491 | 500 | ||
| 501 | tty->closing = 1; | ||
| 502 | |||
| 492 | if (test_bit(ASYNCB_INITIALIZED, &port->flags)) { | 503 | if (test_bit(ASYNCB_INITIALIZED, &port->flags)) { |
| 493 | /* Don't block on a stalled port, just pull the chain */ | 504 | /* Don't block on a stalled port, just pull the chain */ |
| 494 | if (tty->flow_stopped) | 505 | if (tty->flow_stopped) |
| @@ -506,13 +517,15 @@ int tty_port_close_start(struct tty_port *port, | |||
| 506 | } | 517 | } |
| 507 | EXPORT_SYMBOL(tty_port_close_start); | 518 | EXPORT_SYMBOL(tty_port_close_start); |
| 508 | 519 | ||
| 520 | /* Caller holds tty lock */ | ||
| 509 | void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) | 521 | void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) |
| 510 | { | 522 | { |
| 511 | unsigned long flags; | 523 | unsigned long flags; |
| 512 | 524 | ||
| 513 | spin_lock_irqsave(&port->lock, flags); | ||
| 514 | tty->closing = 0; | 525 | tty->closing = 0; |
| 515 | 526 | ||
| 527 | spin_lock_irqsave(&port->lock, flags); | ||
| 528 | |||
| 516 | if (port->blocked_open) { | 529 | if (port->blocked_open) { |
| 517 | spin_unlock_irqrestore(&port->lock, flags); | 530 | spin_unlock_irqrestore(&port->lock, flags); |
| 518 | if (port->close_delay) { | 531 | if (port->close_delay) { |
| @@ -528,6 +541,15 @@ void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) | |||
| 528 | } | 541 | } |
| 529 | EXPORT_SYMBOL(tty_port_close_end); | 542 | EXPORT_SYMBOL(tty_port_close_end); |
| 530 | 543 | ||
| 544 | /** | ||
| 545 | * tty_port_close | ||
| 546 | * | ||
| 547 | * Caller holds tty lock | ||
| 548 | * | ||
| 549 | * NB: may drop and reacquire tty lock (in tty_port_close_start()-> | ||
| 550 | * tty_wait_until_sent_from_close()) so tty and tty_port may have changed | ||
| 551 | * state (but not hung up or reopened). | ||
| 552 | */ | ||
| 531 | void tty_port_close(struct tty_port *port, struct tty_struct *tty, | 553 | void tty_port_close(struct tty_port *port, struct tty_struct *tty, |
| 532 | struct file *filp) | 554 | struct file *filp) |
| 533 | { | 555 | { |
| @@ -558,12 +580,19 @@ int tty_port_install(struct tty_port *port, struct tty_driver *driver, | |||
| 558 | } | 580 | } |
| 559 | EXPORT_SYMBOL_GPL(tty_port_install); | 581 | EXPORT_SYMBOL_GPL(tty_port_install); |
| 560 | 582 | ||
| 583 | /** | ||
| 584 | * tty_port_open | ||
| 585 | * | ||
| 586 | * Caller holds tty lock. | ||
| 587 | * | ||
| 588 | * NB: may drop and reacquire tty lock (in tty_port_block_til_ready()) so | ||
| 589 | * tty and tty_port may have changed state (eg., may be hung up now) | ||
| 590 | */ | ||
| 561 | int tty_port_open(struct tty_port *port, struct tty_struct *tty, | 591 | int tty_port_open(struct tty_port *port, struct tty_struct *tty, |
| 562 | struct file *filp) | 592 | struct file *filp) |
| 563 | { | 593 | { |
| 564 | spin_lock_irq(&port->lock); | 594 | spin_lock_irq(&port->lock); |
| 565 | if (!tty_hung_up_p(filp)) | 595 | ++port->count; |
| 566 | ++port->count; | ||
| 567 | spin_unlock_irq(&port->lock); | 596 | spin_unlock_irq(&port->lock); |
| 568 | tty_port_tty_set(port, tty); | 597 | tty_port_tty_set(port, tty); |
| 569 | 598 | ||
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index af47a8af6024..f93649e22c43 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
| @@ -74,8 +74,10 @@ struct uart_8250_port { | |||
| 74 | struct list_head list; /* ports on this IRQ */ | 74 | struct list_head list; /* ports on this IRQ */ |
| 75 | unsigned short capabilities; /* port capabilities */ | 75 | unsigned short capabilities; /* port capabilities */ |
| 76 | unsigned short bugs; /* port bugs */ | 76 | unsigned short bugs; /* port bugs */ |
| 77 | bool fifo_bug; /* min RX trigger if enabled */ | ||
| 77 | unsigned int tx_loadsz; /* transmit fifo load size */ | 78 | unsigned int tx_loadsz; /* transmit fifo load size */ |
| 78 | unsigned char acr; | 79 | unsigned char acr; |
| 80 | unsigned char fcr; | ||
| 79 | unsigned char ier; | 81 | unsigned char ier; |
| 80 | unsigned char lcr; | 82 | unsigned char lcr; |
| 81 | unsigned char mcr; | 83 | unsigned char mcr; |
| @@ -100,6 +102,11 @@ struct uart_8250_port { | |||
| 100 | void (*dl_write)(struct uart_8250_port *, int); | 102 | void (*dl_write)(struct uart_8250_port *, int); |
| 101 | }; | 103 | }; |
| 102 | 104 | ||
| 105 | static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) | ||
| 106 | { | ||
| 107 | return container_of(up, struct uart_8250_port, port); | ||
| 108 | } | ||
| 109 | |||
| 103 | int serial8250_register_8250_port(struct uart_8250_port *); | 110 | int serial8250_register_8250_port(struct uart_8250_port *); |
| 104 | void serial8250_unregister_port(int line); | 111 | void serial8250_unregister_port(int line); |
| 105 | void serial8250_suspend_port(int line); | 112 | void serial8250_suspend_port(int line); |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 5bbb809ee197..cf3a1e789bf5 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -199,6 +199,8 @@ struct uart_port { | |||
| 199 | unsigned char suspended; | 199 | unsigned char suspended; |
| 200 | unsigned char irq_wake; | 200 | unsigned char irq_wake; |
| 201 | unsigned char unused[2]; | 201 | unsigned char unused[2]; |
| 202 | struct attribute_group *attr_group; /* port specific attributes */ | ||
| 203 | const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ | ||
| 202 | void *private_data; /* generic platform data pointer */ | 204 | void *private_data; /* generic platform data pointer */ |
| 203 | }; | 205 | }; |
| 204 | 206 | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index 1c3316a47d7e..84132942902a 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -477,13 +477,11 @@ extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | |||
| 477 | unsigned int cmd, unsigned long arg); | 477 | unsigned int cmd, unsigned long arg); |
| 478 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); | 478 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); |
| 479 | extern void tty_default_fops(struct file_operations *fops); | 479 | extern void tty_default_fops(struct file_operations *fops); |
| 480 | extern struct tty_struct *alloc_tty_struct(void); | 480 | extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx); |
| 481 | extern int tty_alloc_file(struct file *file); | 481 | extern int tty_alloc_file(struct file *file); |
| 482 | extern void tty_add_file(struct tty_struct *tty, struct file *file); | 482 | extern void tty_add_file(struct tty_struct *tty, struct file *file); |
| 483 | extern void tty_free_file(struct file *file); | 483 | extern void tty_free_file(struct file *file); |
| 484 | extern void free_tty_struct(struct tty_struct *tty); | 484 | extern void free_tty_struct(struct tty_struct *tty); |
| 485 | extern void initialize_tty_struct(struct tty_struct *tty, | ||
| 486 | struct tty_driver *driver, int idx); | ||
| 487 | extern void deinitialize_tty_struct(struct tty_struct *tty); | 485 | extern void deinitialize_tty_struct(struct tty_struct *tty); |
| 488 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); | 486 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); |
| 489 | extern int tty_release(struct inode *inode, struct file *filp); | 487 | extern int tty_release(struct inode *inode, struct file *filp); |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 756a60989294..e48c608a8fa8 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
| @@ -35,14 +35,14 @@ | |||
| 35 | * This routine is mandatory; if this routine is not filled in, | 35 | * This routine is mandatory; if this routine is not filled in, |
| 36 | * the attempted open will fail with ENODEV. | 36 | * the attempted open will fail with ENODEV. |
| 37 | * | 37 | * |
| 38 | * Required method. | 38 | * Required method. Called with tty lock held. |
| 39 | * | 39 | * |
| 40 | * void (*close)(struct tty_struct * tty, struct file * filp); | 40 | * void (*close)(struct tty_struct * tty, struct file * filp); |
| 41 | * | 41 | * |
| 42 | * This routine is called when a particular tty device is closed. | 42 | * This routine is called when a particular tty device is closed. |
| 43 | * Note: called even if the corresponding open() failed. | 43 | * Note: called even if the corresponding open() failed. |
| 44 | * | 44 | * |
| 45 | * Required method. | 45 | * Required method. Called with tty lock held. |
| 46 | * | 46 | * |
| 47 | * void (*shutdown)(struct tty_struct * tty); | 47 | * void (*shutdown)(struct tty_struct * tty); |
| 48 | * | 48 | * |
| @@ -172,6 +172,8 @@ | |||
| 172 | * | 172 | * |
| 173 | * Optional: | 173 | * Optional: |
| 174 | * | 174 | * |
| 175 | * Called with tty lock held. | ||
| 176 | * | ||
| 175 | * int (*break_ctl)(struct tty_struct *tty, int state); | 177 | * int (*break_ctl)(struct tty_struct *tty, int state); |
| 176 | * | 178 | * |
| 177 | * This optional routine requests the tty driver to turn on or | 179 | * This optional routine requests the tty driver to turn on or |
diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h index 99b47058816a..df6c9ab6b0cd 100644 --- a/include/uapi/linux/serial_reg.h +++ b/include/uapi/linux/serial_reg.h | |||
| @@ -88,6 +88,11 @@ | |||
| 88 | #define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ | 88 | #define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ |
| 89 | #define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750) */ | 89 | #define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750) */ |
| 90 | 90 | ||
| 91 | #define UART_FCR_R_TRIG_SHIFT 6 | ||
| 92 | #define UART_FCR_R_TRIG_BITS(x) \ | ||
| 93 | (((x) & UART_FCR_TRIGGER_MASK) >> UART_FCR_R_TRIG_SHIFT) | ||
| 94 | #define UART_FCR_R_TRIG_MAX_STATE 4 | ||
| 95 | |||
| 91 | #define UART_LCR 3 /* Out: Line Control Register */ | 96 | #define UART_LCR 3 /* Out: Line Control Register */ |
| 92 | /* | 97 | /* |
| 93 | * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting | 98 | * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 2ba8b9705bb7..61ceb4cdb4a2 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
| @@ -320,8 +320,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
| 320 | __FILE__, __LINE__, tty->driver->name, port->count); | 320 | __FILE__, __LINE__, tty->driver->name, port->count); |
| 321 | 321 | ||
| 322 | spin_lock_irqsave(&port->lock, flags); | 322 | spin_lock_irqsave(&port->lock, flags); |
| 323 | if (!tty_hung_up_p(filp)) | 323 | port->count--; |
| 324 | port->count--; | ||
| 325 | port->blocked_open++; | 324 | port->blocked_open++; |
| 326 | spin_unlock_irqrestore(&port->lock, flags); | 325 | spin_unlock_irqrestore(&port->lock, flags); |
| 327 | 326 | ||
| @@ -458,8 +457,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
| 458 | /* | 457 | /* |
| 459 | * If the port is the middle of closing, bail out now | 458 | * If the port is the middle of closing, bail out now |
| 460 | */ | 459 | */ |
| 461 | if (tty_hung_up_p(filp) || | 460 | if (test_bit(ASYNCB_CLOSING, &self->port.flags)) { |
| 462 | test_bit(ASYNCB_CLOSING, &self->port.flags)) { | ||
| 463 | 461 | ||
| 464 | /* Hm, why are we blocking on ASYNC_CLOSING if we | 462 | /* Hm, why are we blocking on ASYNC_CLOSING if we |
| 465 | * do return -EAGAIN/-ERESTARTSYS below anyway? | 463 | * do return -EAGAIN/-ERESTARTSYS below anyway? |
