aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 18:11:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 18:11:04 -0400
commite6bee325e49f17c65c1fd66e9e8b348c85788341 (patch)
treebcc9e5d8e82efa9009edd481a837cc3626360091 /drivers
parenta5e6b135bdff649e4330f98e2e80dbb1984f7e77 (diff)
parent6ae705b23be8da52d3163be9d81e9b767876aaf9 (diff)
Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (76 commits) pch_uart: reference clock on CM-iTC pch_phub: add new device ML7213 n_gsm: fix UIH control byte : P bit should be 0 n_gsm: add a documentation serial: msm_serial_hs: Add MSM high speed UART driver tty_audit: fix tty_audit_add_data live lock on audit disabled tty: move cd1865.h to drivers/staging/tty/ Staging: tty: fix build with epca.c driver pcmcia: synclink_cs: fix prototype for mgslpc_ioctl() Staging: generic_serial: fix double locking bug nozomi: don't use flush_scheduled_work() tty/serial: Relax the device_type restriction from of_serial MAINTAINERS: Update HVC file patterns tty: phase out of ioctl file pointer for tty3270 as well tty: forgot to remove ipwireless from drivers/char/pcmcia/Makefile pch_uart: Fix DMA channel miss-setting issue. pch_uart: fix exclusive access issue pch_uart: fix auto flow control miss-setting issue pch_uart: fix uart clock setting issue pch_uart : Use dev_xxx not pr_xxx ... Fix up trivial conflicts in drivers/misc/pch_phub.c (same patch applied twice, then changes to the same area in one branch)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bluetooth/hci_ath.c26
-rw-r--r--drivers/char/Kconfig540
-rw-r--r--drivers/char/Makefile24
-rw-r--r--drivers/char/pcmcia/Makefile2
-rw-r--r--drivers/char/pcmcia/synclink_cs.c13
-rw-r--r--drivers/char/ttyprintk.c2
-rw-r--r--drivers/isdn/capi/capi.c10
-rw-r--r--drivers/isdn/gigaset/interface.c12
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c2
-rw-r--r--drivers/isdn/i4l/isdn_tty.c7
-rw-r--r--drivers/misc/pch_phub.c20
-rw-r--r--drivers/mmc/card/sdio_uart.c4
-rw-r--r--drivers/net/irda/irtty-sir.c2
-rw-r--r--drivers/net/usb/hso.c10
-rw-r--r--drivers/net/wan/pc300_tty.c9
-rw-r--r--drivers/s390/char/keyboard.c4
-rw-r--r--drivers/s390/char/keyboard.h2
-rw-r--r--drivers/s390/char/tty3270.c14
-rw-r--r--drivers/staging/Kconfig4
-rw-r--r--drivers/staging/Makefile2
-rw-r--r--drivers/staging/generic_serial/Kconfig45
-rw-r--r--drivers/staging/generic_serial/Makefile6
-rw-r--r--drivers/staging/generic_serial/TODO6
-rw-r--r--drivers/staging/generic_serial/generic_serial.c (renamed from drivers/char/generic_serial.c)4
-rw-r--r--drivers/staging/generic_serial/rio/Makefile (renamed from drivers/char/rio/Makefile)0
-rw-r--r--drivers/staging/generic_serial/rio/board.h (renamed from drivers/char/rio/board.h)0
-rw-r--r--drivers/staging/generic_serial/rio/cirrus.h (renamed from drivers/char/rio/cirrus.h)0
-rw-r--r--drivers/staging/generic_serial/rio/cmdblk.h (renamed from drivers/char/rio/cmdblk.h)0
-rw-r--r--drivers/staging/generic_serial/rio/cmdpkt.h (renamed from drivers/char/rio/cmdpkt.h)0
-rw-r--r--drivers/staging/generic_serial/rio/daemon.h (renamed from drivers/char/rio/daemon.h)0
-rw-r--r--drivers/staging/generic_serial/rio/errors.h (renamed from drivers/char/rio/errors.h)0
-rw-r--r--drivers/staging/generic_serial/rio/func.h (renamed from drivers/char/rio/func.h)0
-rw-r--r--drivers/staging/generic_serial/rio/host.h (renamed from drivers/char/rio/host.h)0
-rw-r--r--drivers/staging/generic_serial/rio/link.h (renamed from drivers/char/rio/link.h)0
-rw-r--r--drivers/staging/generic_serial/rio/linux_compat.h (renamed from drivers/char/rio/linux_compat.h)0
-rw-r--r--drivers/staging/generic_serial/rio/map.h (renamed from drivers/char/rio/map.h)0
-rw-r--r--drivers/staging/generic_serial/rio/param.h (renamed from drivers/char/rio/param.h)0
-rw-r--r--drivers/staging/generic_serial/rio/parmmap.h (renamed from drivers/char/rio/parmmap.h)0
-rw-r--r--drivers/staging/generic_serial/rio/pci.h (renamed from drivers/char/rio/pci.h)0
-rw-r--r--drivers/staging/generic_serial/rio/phb.h (renamed from drivers/char/rio/phb.h)0
-rw-r--r--drivers/staging/generic_serial/rio/pkt.h (renamed from drivers/char/rio/pkt.h)0
-rw-r--r--drivers/staging/generic_serial/rio/port.h (renamed from drivers/char/rio/port.h)0
-rw-r--r--drivers/staging/generic_serial/rio/protsts.h (renamed from drivers/char/rio/protsts.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rio.h (renamed from drivers/char/rio/rio.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rio_linux.c (renamed from drivers/char/rio/rio_linux.c)0
-rw-r--r--drivers/staging/generic_serial/rio/rio_linux.h (renamed from drivers/char/rio/rio_linux.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rioboard.h (renamed from drivers/char/rio/rioboard.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rioboot.c (renamed from drivers/char/rio/rioboot.c)0
-rw-r--r--drivers/staging/generic_serial/rio/riocmd.c (renamed from drivers/char/rio/riocmd.c)0
-rw-r--r--drivers/staging/generic_serial/rio/rioctrl.c (renamed from drivers/char/rio/rioctrl.c)0
-rw-r--r--drivers/staging/generic_serial/rio/riodrvr.h (renamed from drivers/char/rio/riodrvr.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rioinfo.h (renamed from drivers/char/rio/rioinfo.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rioinit.c (renamed from drivers/char/rio/rioinit.c)0
-rw-r--r--drivers/staging/generic_serial/rio/riointr.c (renamed from drivers/char/rio/riointr.c)0
-rw-r--r--drivers/staging/generic_serial/rio/rioioctl.h (renamed from drivers/char/rio/rioioctl.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rioparam.c (renamed from drivers/char/rio/rioparam.c)0
-rw-r--r--drivers/staging/generic_serial/rio/rioroute.c (renamed from drivers/char/rio/rioroute.c)0
-rw-r--r--drivers/staging/generic_serial/rio/riospace.h (renamed from drivers/char/rio/riospace.h)0
-rw-r--r--drivers/staging/generic_serial/rio/riotable.c (renamed from drivers/char/rio/riotable.c)0
-rw-r--r--drivers/staging/generic_serial/rio/riotty.c (renamed from drivers/char/rio/riotty.c)0
-rw-r--r--drivers/staging/generic_serial/rio/route.h (renamed from drivers/char/rio/route.h)0
-rw-r--r--drivers/staging/generic_serial/rio/rup.h (renamed from drivers/char/rio/rup.h)0
-rw-r--r--drivers/staging/generic_serial/rio/unixrup.h (renamed from drivers/char/rio/unixrup.h)0
-rw-r--r--drivers/staging/generic_serial/ser_a2232.c (renamed from drivers/char/ser_a2232.c)6
-rw-r--r--drivers/staging/generic_serial/ser_a2232.h (renamed from drivers/char/ser_a2232.h)0
-rw-r--r--drivers/staging/generic_serial/ser_a2232fw.ax (renamed from drivers/char/ser_a2232fw.ax)0
-rw-r--r--drivers/staging/generic_serial/ser_a2232fw.h (renamed from drivers/char/ser_a2232fw.h)0
-rw-r--r--drivers/staging/generic_serial/sx.c (renamed from drivers/char/sx.c)8
-rw-r--r--drivers/staging/generic_serial/sx.h (renamed from drivers/char/sx.h)0
-rw-r--r--drivers/staging/generic_serial/sxboards.h (renamed from drivers/char/sxboards.h)0
-rw-r--r--drivers/staging/generic_serial/sxwindow.h (renamed from drivers/char/sxwindow.h)0
-rw-r--r--drivers/staging/generic_serial/vme_scc.c (renamed from drivers/char/vme_scc.c)4
-rw-r--r--drivers/staging/quatech_usb2/quatech_usb2.c6
-rw-r--r--drivers/staging/serqt_usb2/serqt_usb2.c13
-rw-r--r--drivers/staging/tty/Kconfig87
-rw-r--r--drivers/staging/tty/Makefile7
-rw-r--r--drivers/staging/tty/TODO6
-rw-r--r--drivers/staging/tty/cd1865.h (renamed from drivers/char/cd1865.h)0
-rw-r--r--drivers/staging/tty/digi1.h (renamed from drivers/char/digi1.h)0
-rw-r--r--drivers/staging/tty/digiFep1.h (renamed from drivers/char/digiFep1.h)0
-rw-r--r--drivers/staging/tty/digiPCI.h (renamed from drivers/char/digiPCI.h)0
-rw-r--r--drivers/staging/tty/epca.c (renamed from drivers/char/epca.c)16
-rw-r--r--drivers/staging/tty/epca.h (renamed from drivers/char/epca.h)0
-rw-r--r--drivers/staging/tty/epcaconfig.h (renamed from drivers/char/epcaconfig.h)0
-rw-r--r--drivers/staging/tty/ip2/Makefile (renamed from drivers/char/ip2/Makefile)0
-rw-r--r--drivers/staging/tty/ip2/i2cmd.c (renamed from drivers/char/ip2/i2cmd.c)0
-rw-r--r--drivers/staging/tty/ip2/i2cmd.h (renamed from drivers/char/ip2/i2cmd.h)0
-rw-r--r--drivers/staging/tty/ip2/i2ellis.c (renamed from drivers/char/ip2/i2ellis.c)0
-rw-r--r--drivers/staging/tty/ip2/i2ellis.h (renamed from drivers/char/ip2/i2ellis.h)0
-rw-r--r--drivers/staging/tty/ip2/i2hw.h (renamed from drivers/char/ip2/i2hw.h)0
-rw-r--r--drivers/staging/tty/ip2/i2lib.c (renamed from drivers/char/ip2/i2lib.c)0
-rw-r--r--drivers/staging/tty/ip2/i2lib.h (renamed from drivers/char/ip2/i2lib.h)0
-rw-r--r--drivers/staging/tty/ip2/i2pack.h (renamed from drivers/char/ip2/i2pack.h)0
-rw-r--r--drivers/staging/tty/ip2/ip2.h (renamed from drivers/char/ip2/ip2.h)0
-rw-r--r--drivers/staging/tty/ip2/ip2ioctl.h (renamed from drivers/char/ip2/ip2ioctl.h)0
-rw-r--r--drivers/staging/tty/ip2/ip2main.c (renamed from drivers/char/ip2/ip2main.c)12
-rw-r--r--drivers/staging/tty/ip2/ip2trace.h (renamed from drivers/char/ip2/ip2trace.h)0
-rw-r--r--drivers/staging/tty/ip2/ip2types.h (renamed from drivers/char/ip2/ip2types.h)0
-rw-r--r--drivers/staging/tty/istallion.c (renamed from drivers/char/istallion.c)8
-rw-r--r--drivers/staging/tty/riscom8.c (renamed from drivers/char/riscom8.c)8
-rw-r--r--drivers/staging/tty/riscom8.h (renamed from drivers/char/riscom8.h)0
-rw-r--r--drivers/staging/tty/riscom8_reg.h (renamed from drivers/char/riscom8_reg.h)0
-rw-r--r--drivers/staging/tty/serial167.c (renamed from drivers/char/serial167.c)7
-rw-r--r--drivers/staging/tty/specialix.c (renamed from drivers/char/specialix.c)6
-rw-r--r--drivers/staging/tty/specialix_io8.h (renamed from drivers/char/specialix_io8.h)0
-rw-r--r--drivers/staging/tty/stallion.c (renamed from drivers/char/stallion.c)9
-rw-r--r--drivers/tty/Kconfig321
-rw-r--r--drivers/tty/Makefile15
-rw-r--r--drivers/tty/amiserial.c (renamed from drivers/char/amiserial.c)8
-rw-r--r--drivers/tty/bfin_jtag_comm.c (renamed from drivers/char/bfin_jtag_comm.c)0
-rw-r--r--drivers/tty/cyclades.c (renamed from drivers/char/cyclades.c)6
-rw-r--r--drivers/tty/hvc/Kconfig105
-rw-r--r--drivers/tty/hvc/Makefile1
-rw-r--r--drivers/tty/hvc/hvc_bfin_jtag.c105
-rw-r--r--drivers/tty/hvc/hvc_dcc.c43
-rw-r--r--drivers/tty/hvc/hvsi.c6
-rw-r--r--drivers/tty/ipwireless/Makefile (renamed from drivers/char/pcmcia/ipwireless/Makefile)0
-rw-r--r--drivers/tty/ipwireless/hardware.c (renamed from drivers/char/pcmcia/ipwireless/hardware.c)0
-rw-r--r--drivers/tty/ipwireless/hardware.h (renamed from drivers/char/pcmcia/ipwireless/hardware.h)0
-rw-r--r--drivers/tty/ipwireless/main.c (renamed from drivers/char/pcmcia/ipwireless/main.c)0
-rw-r--r--drivers/tty/ipwireless/main.h (renamed from drivers/char/pcmcia/ipwireless/main.h)0
-rw-r--r--drivers/tty/ipwireless/network.c (renamed from drivers/char/pcmcia/ipwireless/network.c)0
-rw-r--r--drivers/tty/ipwireless/network.h (renamed from drivers/char/pcmcia/ipwireless/network.h)0
-rw-r--r--drivers/tty/ipwireless/setup_protocol.h (renamed from drivers/char/pcmcia/ipwireless/setup_protocol.h)0
-rw-r--r--drivers/tty/ipwireless/tty.c (renamed from drivers/char/pcmcia/ipwireless/tty.c)8
-rw-r--r--drivers/tty/ipwireless/tty.h (renamed from drivers/char/pcmcia/ipwireless/tty.h)0
-rw-r--r--drivers/tty/isicom.c (renamed from drivers/char/isicom.c)8
-rw-r--r--drivers/tty/moxa.c (renamed from drivers/char/moxa.c)10
-rw-r--r--drivers/tty/moxa.h (renamed from drivers/char/moxa.h)0
-rw-r--r--drivers/tty/mxser.c (renamed from drivers/char/mxser.c)6
-rw-r--r--drivers/tty/mxser.h (renamed from drivers/char/mxser.h)0
-rw-r--r--drivers/tty/n_gsm.c9
-rw-r--r--drivers/tty/nozomi.c (renamed from drivers/char/nozomi.c)10
-rw-r--r--drivers/tty/pty.c4
-rw-r--r--drivers/tty/rocket.c (renamed from drivers/char/rocket.c)8
-rw-r--r--drivers/tty/rocket.h (renamed from drivers/char/rocket.h)0
-rw-r--r--drivers/tty/rocket_int.h (renamed from drivers/char/rocket_int.h)0
-rw-r--r--drivers/tty/serial/68328serial.c25
-rw-r--r--drivers/tty/serial/68328serial.h1
-rw-r--r--drivers/tty/serial/68360serial.c6
-rw-r--r--drivers/tty/serial/8250.c33
-rw-r--r--drivers/tty/serial/Kconfig31
-rw-r--r--drivers/tty/serial/Makefile2
-rw-r--r--drivers/tty/serial/altera_jtaguart.c85
-rw-r--r--drivers/tty/serial/altera_uart.c22
-rw-r--r--drivers/tty/serial/atmel_serial.c16
-rw-r--r--drivers/tty/serial/bfin_sport_uart.c2
-rw-r--r--drivers/tty/serial/crisv10.c7
-rw-r--r--drivers/tty/serial/ifx6x60.c68
-rw-r--r--drivers/tty/serial/ifx6x60.h6
-rw-r--r--drivers/tty/serial/mfd.c73
-rw-r--r--drivers/tty/serial/mrst_max3110.c2
-rw-r--r--drivers/tty/serial/msm_serial_hs.c1880
-rw-r--r--drivers/tty/serial/msm_smd_tty.c236
-rw-r--r--drivers/tty/serial/of_serial.c18
-rw-r--r--drivers/tty/serial/omap-serial.c11
-rw-r--r--drivers/tty/serial/pch_uart.c329
-rw-r--r--drivers/tty/serial/serial_core.c22
-rw-r--r--drivers/tty/synclink.c (renamed from drivers/char/synclink.c)13
-rw-r--r--drivers/tty/synclink_gt.c (renamed from drivers/char/synclink_gt.c)19
-rw-r--r--drivers/tty/synclinkmp.c (renamed from drivers/char/synclinkmp.c)17
-rw-r--r--drivers/tty/tty_audit.c4
-rw-r--r--drivers/tty/tty_io.c22
-rw-r--r--drivers/tty/tty_ioctl.c14
-rw-r--r--drivers/tty/tty_ldisc.c17
-rw-r--r--drivers/tty/vt/keyboard.c5
-rw-r--r--drivers/tty/vt/vc_screen.c110
-rw-r--r--drivers/tty/vt/vt.c27
-rw-r--r--drivers/tty/vt/vt_ioctl.c12
-rw-r--r--drivers/usb/class/cdc-acm.c6
-rw-r--r--drivers/usb/serial/ark3116.c6
-rw-r--r--drivers/usb/serial/belkin_sa.c8
-rw-r--r--drivers/usb/serial/ch341.c7
-rw-r--r--drivers/usb/serial/cp210x.c19
-rw-r--r--drivers/usb/serial/cypress_m8.c12
-rw-r--r--drivers/usb/serial/digi_acceleport.c14
-rw-r--r--drivers/usb/serial/ftdi_sio.c12
-rw-r--r--drivers/usb/serial/io_edgeport.c12
-rw-r--r--drivers/usb/serial/io_ti.c6
-rw-r--r--drivers/usb/serial/iuu_phoenix.c4
-rw-r--r--drivers/usb/serial/keyspan.c4
-rw-r--r--drivers/usb/serial/keyspan.h5
-rw-r--r--drivers/usb/serial/keyspan_pda.c4
-rw-r--r--drivers/usb/serial/kl5kusb105.c8
-rw-r--r--drivers/usb/serial/kobil_sct.c12
-rw-r--r--drivers/usb/serial/mct_u232.c8
-rw-r--r--drivers/usb/serial/mos7720.c8
-rw-r--r--drivers/usb/serial/mos7840.c6
-rw-r--r--drivers/usb/serial/opticon.c4
-rw-r--r--drivers/usb/serial/oti6858.c12
-rw-r--r--drivers/usb/serial/pl2303.c6
-rw-r--r--drivers/usb/serial/sierra.c4
-rw-r--r--drivers/usb/serial/spcp8x5.c6
-rw-r--r--drivers/usb/serial/ssu100.c6
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c14
-rw-r--r--drivers/usb/serial/usb-serial.c12
-rw-r--r--drivers/usb/serial/usb-wwan.h6
-rw-r--r--drivers/usb/serial/usb_wwan.c6
-rw-r--r--drivers/usb/serial/whiteheat.c12
199 files changed, 3726 insertions, 1304 deletions
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c
index 6a160c17ea94..bd34406faaae 100644
--- a/drivers/bluetooth/hci_ath.c
+++ b/drivers/bluetooth/hci_ath.c
@@ -51,32 +51,32 @@ struct ath_struct {
51 51
52static int ath_wakeup_ar3k(struct tty_struct *tty) 52static int ath_wakeup_ar3k(struct tty_struct *tty)
53{ 53{
54 struct termios settings; 54 struct ktermios ktermios;
55 int status = tty->driver->ops->tiocmget(tty, NULL); 55 int status = tty->driver->ops->tiocmget(tty);
56 56
57 if (status & TIOCM_CTS) 57 if (status & TIOCM_CTS)
58 return status; 58 return status;
59 59
60 /* Disable Automatic RTSCTS */ 60 /* Disable Automatic RTSCTS */
61 n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings); 61 memcpy(&ktermios, tty->termios, sizeof(ktermios));
62 settings.c_cflag &= ~CRTSCTS; 62 ktermios.c_cflag &= ~CRTSCTS;
63 n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings); 63 tty_set_termios(tty, &ktermios);
64 64
65 /* Clear RTS first */ 65 /* Clear RTS first */
66 status = tty->driver->ops->tiocmget(tty, NULL); 66 status = tty->driver->ops->tiocmget(tty);
67 tty->driver->ops->tiocmset(tty, NULL, 0x00, TIOCM_RTS); 67 tty->driver->ops->tiocmset(tty, 0x00, TIOCM_RTS);
68 mdelay(20); 68 mdelay(20);
69 69
70 /* Set RTS, wake up board */ 70 /* Set RTS, wake up board */
71 status = tty->driver->ops->tiocmget(tty, NULL); 71 status = tty->driver->ops->tiocmget(tty);
72 tty->driver->ops->tiocmset(tty, NULL, TIOCM_RTS, 0x00); 72 tty->driver->ops->tiocmset(tty, TIOCM_RTS, 0x00);
73 mdelay(20); 73 mdelay(20);
74 74
75 status = tty->driver->ops->tiocmget(tty, NULL); 75 status = tty->driver->ops->tiocmget(tty);
76 76
77 n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings); 77 /* Disable Automatic RTSCTS */
78 settings.c_cflag |= CRTSCTS; 78 ktermios.c_cflag |= CRTSCTS;
79 n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings); 79 status = tty_set_termios(tty, &ktermios);
80 80
81 return status; 81 return status;
82} 82}
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index b7980a83ce2d..04f8b2d083c6 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -4,89 +4,7 @@
4 4
5menu "Character devices" 5menu "Character devices"
6 6
7config VT 7source "drivers/tty/Kconfig"
8 bool "Virtual terminal" if EXPERT
9 depends on !S390
10 select INPUT
11 default y
12 ---help---
13 If you say Y here, you will get support for terminal devices with
14 display and keyboard devices. These are called "virtual" because you
15 can run several virtual terminals (also called virtual consoles) on
16 one physical terminal. This is rather useful, for example one
17 virtual terminal can collect system messages and warnings, another
18 one can be used for a text-mode user session, and a third could run
19 an X session, all in parallel. Switching between virtual terminals
20 is done with certain key combinations, usually Alt-<function key>.
21
22 The setterm command ("man setterm") can be used to change the
23 properties (such as colors or beeping) of a virtual terminal. The
24 man page console_codes(4) ("man console_codes") contains the special
25 character sequences that can be used to change those properties
26 directly. The fonts used on virtual terminals can be changed with
27 the setfont ("man setfont") command and the key bindings are defined
28 with the loadkeys ("man loadkeys") command.
29
30 You need at least one virtual terminal device in order to make use
31 of your keyboard and monitor. Therefore, only people configuring an
32 embedded system would want to say N here in order to save some
33 memory; the only way to log into such a system is then via a serial
34 or network connection.
35
36 If unsure, say Y, or else you won't be able to do much with your new
37 shiny Linux system :-)
38
39config CONSOLE_TRANSLATIONS
40 depends on VT
41 default y
42 bool "Enable character translations in console" if EXPERT
43 ---help---
44 This enables support for font mapping and Unicode translation
45 on virtual consoles.
46
47config VT_CONSOLE
48 bool "Support for console on virtual terminal" if EXPERT
49 depends on VT
50 default y
51 ---help---
52 The system console is the device which receives all kernel messages
53 and warnings and which allows logins in single user mode. If you
54 answer Y here, a virtual terminal (the device used to interact with
55 a physical terminal) can be used as system console. This is the most
56 common mode of operations, so you should say Y here unless you want
57 the kernel messages be output only to a serial port (in which case
58 you should say Y to "Console on serial port", below).
59
60 If you do say Y here, by default the currently visible virtual
61 terminal (/dev/tty0) will be used as system console. You can change
62 that with a kernel command line option such as "console=tty3" which
63 would use the third virtual terminal as system console. (Try "man
64 bootparam" or see the documentation of your boot loader (lilo or
65 loadlin) about how to pass options to the kernel at boot time.)
66
67 If unsure, say Y.
68
69config HW_CONSOLE
70 bool
71 depends on VT && !S390 && !UML
72 default y
73
74config VT_HW_CONSOLE_BINDING
75 bool "Support for binding and unbinding console drivers"
76 depends on HW_CONSOLE
77 default n
78 ---help---
79 The virtual terminal is the device that interacts with the physical
80 terminal through console drivers. On these systems, at least one
81 console driver is loaded. In other configurations, additional console
82 drivers may be enabled, such as the framebuffer console. If more than
83 1 console driver is enabled, setting this to 'y' will allow you to
84 select the console driver that will serve as the backend for the
85 virtual terminals.
86
87 See <file:Documentation/console/console.txt> for more
88 information. For framebuffer console users, please refer to
89 <file:Documentation/fb/fbcon.txt>.
90 8
91config DEVKMEM 9config DEVKMEM
92 bool "/dev/kmem virtual device support" 10 bool "/dev/kmem virtual device support"
@@ -97,253 +15,6 @@ config DEVKMEM
97 kind of kernel debugging operations. 15 kind of kernel debugging operations.
98 When in doubt, say "N". 16 When in doubt, say "N".
99 17
100config BFIN_JTAG_COMM
101 tristate "Blackfin JTAG Communication"
102 depends on BLACKFIN
103 help
104 Add support for emulating a TTY device over the Blackfin JTAG.
105
106 To compile this driver as a module, choose M here: the
107 module will be called bfin_jtag_comm.
108
109config BFIN_JTAG_COMM_CONSOLE
110 bool "Console on Blackfin JTAG"
111 depends on BFIN_JTAG_COMM=y
112
113config SERIAL_NONSTANDARD
114 bool "Non-standard serial port support"
115 depends on HAS_IOMEM
116 ---help---
117 Say Y here if you have any non-standard serial boards -- boards
118 which aren't supported using the standard "dumb" serial driver.
119 This includes intelligent serial boards such as Cyclades,
120 Digiboards, etc. These are usually used for systems that need many
121 serial ports because they serve many terminals or dial-in
122 connections.
123
124 Note that the answer to this question won't directly affect the
125 kernel: saying N will just cause the configurator to skip all
126 the questions about non-standard serial boards.
127
128 Most people can say N here.
129
130config COMPUTONE
131 tristate "Computone IntelliPort Plus serial support"
132 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
133 ---help---
134 This driver supports the entire family of Intelliport II/Plus
135 controllers with the exception of the MicroChannel controllers and
136 products previous to the Intelliport II. These are multiport cards,
137 which give you many serial ports. You would need something like this
138 to connect more than two modems to your Linux box, for instance in
139 order to become a dial-in server. If you have a card like that, say
140 Y here and read <file:Documentation/serial/computone.txt>.
141
142 To compile this driver as module, choose M here: the
143 module will be called ip2.
144
145config ROCKETPORT
146 tristate "Comtrol RocketPort support"
147 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
148 help
149 This driver supports Comtrol RocketPort and RocketModem PCI boards.
150 These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or
151 modems. For information about the RocketPort/RocketModem boards
152 and this driver read <file:Documentation/serial/rocket.txt>.
153
154 To compile this driver as a module, choose M here: the
155 module will be called rocket.
156
157 If you want to compile this driver into the kernel, say Y here. If
158 you don't have a Comtrol RocketPort/RocketModem card installed, say N.
159
160config CYCLADES
161 tristate "Cyclades async mux support"
162 depends on SERIAL_NONSTANDARD && (PCI || ISA)
163 select FW_LOADER
164 ---help---
165 This driver supports Cyclades Z and Y multiserial boards.
166 You would need something like this to connect more than two modems to
167 your Linux box, for instance in order to become a dial-in server.
168
169 For information about the Cyclades-Z card, read
170 <file:Documentation/serial/README.cycladesZ>.
171
172 To compile this driver as a module, choose M here: the
173 module will be called cyclades.
174
175 If you haven't heard about it, it's safe to say N.
176
177config CYZ_INTR
178 bool "Cyclades-Z interrupt mode operation (EXPERIMENTAL)"
179 depends on EXPERIMENTAL && CYCLADES
180 help
181 The Cyclades-Z family of multiport cards allows 2 (two) driver op
182 modes: polling and interrupt. In polling mode, the driver will check
183 the status of the Cyclades-Z ports every certain amount of time
184 (which is called polling cycle and is configurable). In interrupt
185 mode, it will use an interrupt line (IRQ) in order to check the
186 status of the Cyclades-Z ports. The default op mode is polling. If
187 unsure, say N.
188
189config DIGIEPCA
190 tristate "Digiboard Intelligent Async Support"
191 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
192 ---help---
193 This is a driver for Digi International's Xx, Xeve, and Xem series
194 of cards which provide multiple serial ports. You would need
195 something like this to connect more than two modems to your Linux
196 box, for instance in order to become a dial-in server. This driver
197 supports the original PC (ISA) boards as well as PCI, and EISA. If
198 you have a card like this, say Y here and read the file
199 <file:Documentation/serial/digiepca.txt>.
200
201 To compile this driver as a module, choose M here: the
202 module will be called epca.
203
204config MOXA_INTELLIO
205 tristate "Moxa Intellio support"
206 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
207 select FW_LOADER
208 help
209 Say Y here if you have a Moxa Intellio multiport serial card.
210
211 To compile this driver as a module, choose M here: the
212 module will be called moxa.
213
214config MOXA_SMARTIO
215 tristate "Moxa SmartIO support v. 2.0"
216 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
217 help
218 Say Y here if you have a Moxa SmartIO multiport serial card and/or
219 want to help develop a new version of this driver.
220
221 This is upgraded (1.9.1) driver from original Moxa drivers with
222 changes finally resulting in PCI probing.
223
224 This driver can also be built as a module. The module will be called
225 mxser. If you want to do that, say M here.
226
227config ISI
228 tristate "Multi-Tech multiport card support (EXPERIMENTAL)"
229 depends on SERIAL_NONSTANDARD && PCI
230 select FW_LOADER
231 help
232 This is a driver for the Multi-Tech cards which provide several
233 serial ports. The driver is experimental and can currently only be
234 built as a module. The module will be called isicom.
235 If you want to do that, choose M here.
236
237config SYNCLINK
238 tristate "Microgate SyncLink card support"
239 depends on SERIAL_NONSTANDARD && PCI && ISA_DMA_API
240 help
241 Provides support for the SyncLink ISA and PCI multiprotocol serial
242 adapters. These adapters support asynchronous and HDLC bit
243 synchronous communication up to 10Mbps (PCI adapter).
244
245 This driver can only be built as a module ( = code which can be
246 inserted in and removed from the running kernel whenever you want).
247 The module will be called synclink. If you want to do that, say M
248 here.
249
250config SYNCLINKMP
251 tristate "SyncLink Multiport support"
252 depends on SERIAL_NONSTANDARD && PCI
253 help
254 Enable support for the SyncLink Multiport (2 or 4 ports)
255 serial adapter, running asynchronous and HDLC communications up
256 to 2.048Mbps. Each ports is independently selectable for
257 RS-232, V.35, RS-449, RS-530, and X.21
258
259 This driver may be built as a module ( = code which can be
260 inserted in and removed from the running kernel whenever you want).
261 The module will be called synclinkmp. If you want to do that, say M
262 here.
263
264config SYNCLINK_GT
265 tristate "SyncLink GT/AC support"
266 depends on SERIAL_NONSTANDARD && PCI
267 help
268 Support for SyncLink GT and SyncLink AC families of
269 synchronous and asynchronous serial adapters
270 manufactured by Microgate Systems, Ltd. (www.microgate.com)
271
272config N_HDLC
273 tristate "HDLC line discipline support"
274 depends on SERIAL_NONSTANDARD
275 help
276 Allows synchronous HDLC communications with tty device drivers that
277 support synchronous HDLC such as the Microgate SyncLink adapter.
278
279 This driver can be built as a module ( = code which can be
280 inserted in and removed from the running kernel whenever you want).
281 The module will be called n_hdlc. If you want to do that, say M
282 here.
283
284config N_GSM
285 tristate "GSM MUX line discipline support (EXPERIMENTAL)"
286 depends on EXPERIMENTAL
287 depends on NET
288 help
289 This line discipline provides support for the GSM MUX protocol and
290 presents the mux as a set of 61 individual tty devices.
291
292config RISCOM8
293 tristate "SDL RISCom/8 card support"
294 depends on SERIAL_NONSTANDARD
295 help
296 This is a driver for the SDL Communications RISCom/8 multiport card,
297 which gives you many serial ports. You would need something like
298 this to connect more than two modems to your Linux box, for instance
299 in order to become a dial-in server. If you have a card like that,
300 say Y here and read the file <file:Documentation/serial/riscom8.txt>.
301
302 Also it's possible to say M here and compile this driver as kernel
303 loadable module; the module will be called riscom8.
304
305config SPECIALIX
306 tristate "Specialix IO8+ card support"
307 depends on SERIAL_NONSTANDARD
308 help
309 This is a driver for the Specialix IO8+ multiport card (both the
310 ISA and the PCI version) which gives you many serial ports. You
311 would need something like this to connect more than two modems to
312 your Linux box, for instance in order to become a dial-in server.
313
314 If you have a card like that, say Y here and read the file
315 <file:Documentation/serial/specialix.txt>. Also it's possible to say
316 M here and compile this driver as kernel loadable module which will be
317 called specialix.
318
319config SX
320 tristate "Specialix SX (and SI) card support"
321 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN
322 help
323 This is a driver for the SX and SI multiport serial cards.
324 Please read the file <file:Documentation/serial/sx.txt> for details.
325
326 This driver can only be built as a module ( = code which can be
327 inserted in and removed from the running kernel whenever you want).
328 The module will be called sx. If you want to do that, say M here.
329
330config RIO
331 tristate "Specialix RIO system support"
332 depends on SERIAL_NONSTANDARD && BROKEN
333 help
334 This is a driver for the Specialix RIO, a smart serial card which
335 drives an outboard box that can support up to 128 ports. Product
336 information is at <http://www.perle.com/support/documentation.html#multiport>.
337 There are both ISA and PCI versions.
338
339config RIO_OLDPCI
340 bool "Support really old RIO/PCI cards"
341 depends on RIO
342 help
343 Older RIO PCI cards need some initialization-time configuration to
344 determine the IRQ and some control addresses. If you have a RIO and
345 this doesn't seem to work, try setting this to Y.
346
347config STALDRV 18config STALDRV
348 bool "Stallion multiport serial support" 19 bool "Stallion multiport serial support"
349 depends on SERIAL_NONSTANDARD 20 depends on SERIAL_NONSTANDARD
@@ -356,54 +27,6 @@ config STALDRV
356 in this case. If you have never heard about all this, it's safe to 27 in this case. If you have never heard about all this, it's safe to
357 say N. 28 say N.
358 29
359config STALLION
360 tristate "Stallion EasyIO or EC8/32 support"
361 depends on STALDRV && (ISA || EISA || PCI)
362 help
363 If you have an EasyIO or EasyConnection 8/32 multiport Stallion
364 card, then this is for you; say Y. Make sure to read
365 <file:Documentation/serial/stallion.txt>.
366
367 To compile this driver as a module, choose M here: the
368 module will be called stallion.
369
370config ISTALLION
371 tristate "Stallion EC8/64, ONboard, Brumby support"
372 depends on STALDRV && (ISA || EISA || PCI)
373 help
374 If you have an EasyConnection 8/64, ONboard, Brumby or Stallion
375 serial multiport card, say Y here. Make sure to read
376 <file:Documentation/serial/stallion.txt>.
377
378 To compile this driver as a module, choose M here: the
379 module will be called istallion.
380
381config NOZOMI
382 tristate "HSDPA Broadband Wireless Data Card - Globe Trotter"
383 depends on PCI && EXPERIMENTAL
384 help
385 If you have a HSDPA driver Broadband Wireless Data Card -
386 Globe Trotter PCMCIA card, say Y here.
387
388 To compile this driver as a module, choose M here, the module
389 will be called nozomi.
390
391config A2232
392 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
393 depends on EXPERIMENTAL && ZORRO && BROKEN
394 ---help---
395 This option supports the 2232 7-port serial card shipped with the
396 Amiga 2000 and other Zorro-bus machines, dating from 1989. At
397 a max of 19,200 bps, the ports are served by a 6551 ACIA UART chip
398 each, plus a 8520 CIA, and a master 6502 CPU and buffer as well. The
399 ports were connected with 8 pin DIN connectors on the card bracket,
400 for which 8 pin to DB25 adapters were supplied. The card also had
401 jumpers internally to toggle various pinning configurations.
402
403 This driver can be built as a module; but then "generic_serial"
404 will also be built as a module. This has to be loaded before
405 "ser_a2232". If you want to do this, answer M here.
406
407config SGI_SNSC 30config SGI_SNSC
408 bool "SGI Altix system controller communication support" 31 bool "SGI Altix system controller communication support"
409 depends on (IA64_SGI_SN2 || IA64_GENERIC) 32 depends on (IA64_SGI_SN2 || IA64_GENERIC)
@@ -428,71 +51,6 @@ config SGI_MBCS
428 51
429source "drivers/tty/serial/Kconfig" 52source "drivers/tty/serial/Kconfig"
430 53
431config UNIX98_PTYS
432 bool "Unix98 PTY support" if EXPERT
433 default y
434 ---help---
435 A pseudo terminal (PTY) is a software device consisting of two
436 halves: a master and a slave. The slave device behaves identical to
437 a physical terminal; the master device is used by a process to
438 read data from and write data to the slave, thereby emulating a
439 terminal. Typical programs for the master side are telnet servers
440 and xterms.
441
442 Linux has traditionally used the BSD-like names /dev/ptyxx for
443 masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
444 has a number of problems. The GNU C library glibc 2.1 and later,
445 however, supports the Unix98 naming standard: in order to acquire a
446 pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
447 terminal is then made available to the process and the pseudo
448 terminal slave can be accessed as /dev/pts/<number>. What was
449 traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
450
451 All modern Linux systems use the Unix98 ptys. Say Y unless
452 you're on an embedded system and want to conserve memory.
453
454config DEVPTS_MULTIPLE_INSTANCES
455 bool "Support multiple instances of devpts"
456 depends on UNIX98_PTYS
457 default n
458 ---help---
459 Enable support for multiple instances of devpts filesystem.
460 If you want to have isolated PTY namespaces (eg: in containers),
461 say Y here. Otherwise, say N. If enabled, each mount of devpts
462 filesystem with the '-o newinstance' option will create an
463 independent PTY namespace.
464
465config LEGACY_PTYS
466 bool "Legacy (BSD) PTY support"
467 default y
468 ---help---
469 A pseudo terminal (PTY) is a software device consisting of two
470 halves: a master and a slave. The slave device behaves identical to
471 a physical terminal; the master device is used by a process to
472 read data from and write data to the slave, thereby emulating a
473 terminal. Typical programs for the master side are telnet servers
474 and xterms.
475
476 Linux has traditionally used the BSD-like names /dev/ptyxx
477 for masters and /dev/ttyxx for slaves of pseudo
478 terminals. This scheme has a number of problems, including
479 security. This option enables these legacy devices; on most
480 systems, it is safe to say N.
481
482
483config LEGACY_PTY_COUNT
484 int "Maximum number of legacy PTY in use"
485 depends on LEGACY_PTYS
486 range 0 256
487 default "256"
488 ---help---
489 The maximum number of legacy PTYs that can be used at any one time.
490 The default is 256, and should be more than enough. Embedded
491 systems may want to reduce this to save memory.
492
493 When not in use, each legacy PTY occupies 12 bytes on 32-bit
494 architectures and 24 bytes on 64-bit architectures.
495
496config TTY_PRINTK 54config TTY_PRINTK
497 bool "TTY driver to output user messages via printk" 55 bool "TTY driver to output user messages via printk"
498 depends on EXPERT 56 depends on EXPERT
@@ -612,84 +170,7 @@ config PPDEV
612 170
613 If unsure, say N. 171 If unsure, say N.
614 172
615config HVC_DRIVER 173source "drivers/tty/hvc/Kconfig"
616 bool
617 help
618 Generic "hypervisor virtual console" infrastructure for various
619 hypervisors (pSeries, iSeries, Xen, lguest).
620 It will automatically be selected if one of the back-end console drivers
621 is selected.
622
623config HVC_IRQ
624 bool
625
626config HVC_CONSOLE
627 bool "pSeries Hypervisor Virtual Console support"
628 depends on PPC_PSERIES
629 select HVC_DRIVER
630 select HVC_IRQ
631 help
632 pSeries machines when partitioned support a hypervisor virtual
633 console. This driver allows each pSeries partition to have a console
634 which is accessed via the HMC.
635
636config HVC_ISERIES
637 bool "iSeries Hypervisor Virtual Console support"
638 depends on PPC_ISERIES
639 default y
640 select HVC_DRIVER
641 select HVC_IRQ
642 select VIOPATH
643 help
644 iSeries machines support a hypervisor virtual console.
645
646config HVC_RTAS
647 bool "IBM RTAS Console support"
648 depends on PPC_RTAS
649 select HVC_DRIVER
650 help
651 IBM Console device driver which makes use of RTAS
652
653config HVC_BEAT
654 bool "Toshiba's Beat Hypervisor Console support"
655 depends on PPC_CELLEB
656 select HVC_DRIVER
657 help
658 Toshiba's Cell Reference Set Beat Console device driver
659
660config HVC_IUCV
661 bool "z/VM IUCV Hypervisor console support (VM only)"
662 depends on S390
663 select HVC_DRIVER
664 select IUCV
665 default y
666 help
667 This driver provides a Hypervisor console (HVC) back-end to access
668 a Linux (console) terminal via a z/VM IUCV communication path.
669
670config HVC_XEN
671 bool "Xen Hypervisor Console support"
672 depends on XEN
673 select HVC_DRIVER
674 select HVC_IRQ
675 default y
676 help
677 Xen virtual console device driver
678
679config HVC_UDBG
680 bool "udbg based fake hypervisor console"
681 depends on PPC && EXPERIMENTAL
682 select HVC_DRIVER
683 default n
684
685config HVC_DCC
686 bool "ARM JTAG DCC console"
687 depends on ARM
688 select HVC_DRIVER
689 help
690 This console uses the JTAG DCC on ARM to create a console under the HVC
691 driver. This console is used through a JTAG only on ARM. If you don't have
692 a JTAG then you probably don't want this option.
693 174
694config VIRTIO_CONSOLE 175config VIRTIO_CONSOLE
695 tristate "Virtio console" 176 tristate "Virtio console"
@@ -707,23 +188,6 @@ config VIRTIO_CONSOLE
707 the port which can be used by udev scripts to create a 188 the port which can be used by udev scripts to create a
708 symlink to the device. 189 symlink to the device.
709 190
710config HVCS
711 tristate "IBM Hypervisor Virtual Console Server support"
712 depends on PPC_PSERIES && HVC_CONSOLE
713 help
714 Partitionable IBM Power5 ppc64 machines allow hosting of
715 firmware virtual consoles from one Linux partition by
716 another Linux partition. This driver allows console data
717 from Linux partitions to be accessed through TTY device
718 interfaces in the device tree of a Linux partition running
719 this driver.
720
721 To compile this driver as a module, choose M here: the
722 module will be called hvcs. Additionally, this module
723 will depend on arch specific APIs exported from hvcserver.ko
724 which will also be compiled when this driver is built as a
725 module.
726
727config IBM_BSR 191config IBM_BSR
728 tristate "IBM POWER Barrier Synchronization Register support" 192 tristate "IBM POWER Barrier Synchronization Register support"
729 depends on PPC_PSERIES 193 depends on PPC_PSERIES
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 8238f89f73c9..057f65452e7b 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -5,31 +5,7 @@
5obj-y += mem.o random.o 5obj-y += mem.o random.o
6obj-$(CONFIG_TTY_PRINTK) += ttyprintk.o 6obj-$(CONFIG_TTY_PRINTK) += ttyprintk.o
7obj-y += misc.o 7obj-y += misc.o
8obj-$(CONFIG_BFIN_JTAG_COMM) += bfin_jtag_comm.o
9obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o
10obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o
11obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
12obj-$(CONFIG_ROCKETPORT) += rocket.o
13obj-$(CONFIG_SERIAL167) += serial167.o
14obj-$(CONFIG_CYCLADES) += cyclades.o
15obj-$(CONFIG_STALLION) += stallion.o
16obj-$(CONFIG_ISTALLION) += istallion.o
17obj-$(CONFIG_NOZOMI) += nozomi.o
18obj-$(CONFIG_DIGIEPCA) += epca.o
19obj-$(CONFIG_SPECIALIX) += specialix.o
20obj-$(CONFIG_MOXA_INTELLIO) += moxa.o
21obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o
22obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o 8obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
23obj-$(CONFIG_MOXA_SMARTIO) += mxser.o
24obj-$(CONFIG_COMPUTONE) += ip2/
25obj-$(CONFIG_RISCOM8) += riscom8.o
26obj-$(CONFIG_ISI) += isicom.o
27obj-$(CONFIG_SYNCLINK) += synclink.o
28obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o
29obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o
30obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
31obj-$(CONFIG_SX) += sx.o generic_serial.o
32obj-$(CONFIG_RIO) += rio/ generic_serial.o
33obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o 9obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o
34obj-$(CONFIG_RAW_DRIVER) += raw.o 10obj-$(CONFIG_RAW_DRIVER) += raw.o
35obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o 11obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o
diff --git a/drivers/char/pcmcia/Makefile b/drivers/char/pcmcia/Makefile
index be8f287aa398..0aae20985d57 100644
--- a/drivers/char/pcmcia/Makefile
+++ b/drivers/char/pcmcia/Makefile
@@ -4,8 +4,6 @@
4# Makefile for the Linux PCMCIA char device drivers. 4# Makefile for the Linux PCMCIA char device drivers.
5# 5#
6 6
7obj-y += ipwireless/
8
9obj-$(CONFIG_SYNCLINK_CS) += synclink_cs.o 7obj-$(CONFIG_SYNCLINK_CS) += synclink_cs.o
10obj-$(CONFIG_CARDMAN_4000) += cm4000_cs.o 8obj-$(CONFIG_CARDMAN_4000) += cm4000_cs.o
11obj-$(CONFIG_CARDMAN_4040) += cm4040_cs.o 9obj-$(CONFIG_CARDMAN_4040) += cm4040_cs.o
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index eaa41992fbe2..beca80bb9bdb 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -418,9 +418,9 @@ static void bh_status(MGSLPC_INFO *info);
418/* 418/*
419 * ioctl handlers 419 * ioctl handlers
420 */ 420 */
421static int tiocmget(struct tty_struct *tty, struct file *file); 421static int tiocmget(struct tty_struct *tty);
422static int tiocmset(struct tty_struct *tty, struct file *file, 422static int tiocmset(struct tty_struct *tty,
423 unsigned int set, unsigned int clear); 423 unsigned int set, unsigned int clear);
424static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount); 424static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount);
425static int get_params(MGSLPC_INFO *info, MGSL_PARAMS __user *user_params); 425static int get_params(MGSLPC_INFO *info, MGSL_PARAMS __user *user_params);
426static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params, struct tty_struct *tty); 426static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params, struct tty_struct *tty);
@@ -2114,7 +2114,7 @@ static int modem_input_wait(MGSLPC_INFO *info,int arg)
2114 2114
2115/* return the state of the serial control and status signals 2115/* return the state of the serial control and status signals
2116 */ 2116 */
2117static int tiocmget(struct tty_struct *tty, struct file *file) 2117static int tiocmget(struct tty_struct *tty)
2118{ 2118{
2119 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; 2119 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
2120 unsigned int result; 2120 unsigned int result;
@@ -2139,7 +2139,7 @@ static int tiocmget(struct tty_struct *tty, struct file *file)
2139 2139
2140/* set modem control signals (DTR/RTS) 2140/* set modem control signals (DTR/RTS)
2141 */ 2141 */
2142static int tiocmset(struct tty_struct *tty, struct file *file, 2142static int tiocmset(struct tty_struct *tty,
2143 unsigned int set, unsigned int clear) 2143 unsigned int set, unsigned int clear)
2144{ 2144{
2145 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; 2145 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
@@ -2222,13 +2222,12 @@ static int mgslpc_get_icount(struct tty_struct *tty,
2222 * Arguments: 2222 * Arguments:
2223 * 2223 *
2224 * tty pointer to tty instance data 2224 * tty pointer to tty instance data
2225 * file pointer to associated file object for device
2226 * cmd IOCTL command code 2225 * cmd IOCTL command code
2227 * arg command argument/context 2226 * arg command argument/context
2228 * 2227 *
2229 * Return Value: 0 if success, otherwise error code 2228 * Return Value: 0 if success, otherwise error code
2230 */ 2229 */
2231static int mgslpc_ioctl(struct tty_struct *tty, struct file * file, 2230static int mgslpc_ioctl(struct tty_struct *tty,
2232 unsigned int cmd, unsigned long arg) 2231 unsigned int cmd, unsigned long arg)
2233{ 2232{
2234 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; 2233 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
index c40c1612c8a7..a1f68af4ccf4 100644
--- a/drivers/char/ttyprintk.c
+++ b/drivers/char/ttyprintk.c
@@ -144,7 +144,7 @@ static int tpk_write_room(struct tty_struct *tty)
144/* 144/*
145 * TTY operations ioctl function. 145 * TTY operations ioctl function.
146 */ 146 */
147static int tpk_ioctl(struct tty_struct *tty, struct file *file, 147static int tpk_ioctl(struct tty_struct *tty,
148 unsigned int cmd, unsigned long arg) 148 unsigned int cmd, unsigned long arg)
149{ 149{
150 struct ttyprintk_port *tpkp = tty->driver_data; 150 struct ttyprintk_port *tpkp = tty->driver_data;
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index f80a7c48a35f..0d7088367038 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1219,16 +1219,10 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1219 return mp->outbytes; 1219 return mp->outbytes;
1220} 1220}
1221 1221
1222static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file, 1222static int capinc_tty_ioctl(struct tty_struct *tty,
1223 unsigned int cmd, unsigned long arg) 1223 unsigned int cmd, unsigned long arg)
1224{ 1224{
1225 int error = 0; 1225 return -ENOIOCTLCMD;
1226 switch (cmd) {
1227 default:
1228 error = n_tty_ioctl_helper(tty, file, cmd, arg);
1229 break;
1230 }
1231 return error;
1232} 1226}
1233 1227
1234static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old) 1228static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old)
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index bb710d16a526..59de638225fe 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -115,15 +115,15 @@ static int if_config(struct cardstate *cs, int *arg)
115 115
116static int if_open(struct tty_struct *tty, struct file *filp); 116static int if_open(struct tty_struct *tty, struct file *filp);
117static void if_close(struct tty_struct *tty, struct file *filp); 117static void if_close(struct tty_struct *tty, struct file *filp);
118static int if_ioctl(struct tty_struct *tty, struct file *file, 118static int if_ioctl(struct tty_struct *tty,
119 unsigned int cmd, unsigned long arg); 119 unsigned int cmd, unsigned long arg);
120static int if_write_room(struct tty_struct *tty); 120static int if_write_room(struct tty_struct *tty);
121static int if_chars_in_buffer(struct tty_struct *tty); 121static int if_chars_in_buffer(struct tty_struct *tty);
122static void if_throttle(struct tty_struct *tty); 122static void if_throttle(struct tty_struct *tty);
123static void if_unthrottle(struct tty_struct *tty); 123static void if_unthrottle(struct tty_struct *tty);
124static void if_set_termios(struct tty_struct *tty, struct ktermios *old); 124static void if_set_termios(struct tty_struct *tty, struct ktermios *old);
125static int if_tiocmget(struct tty_struct *tty, struct file *file); 125static int if_tiocmget(struct tty_struct *tty);
126static int if_tiocmset(struct tty_struct *tty, struct file *file, 126static int if_tiocmset(struct tty_struct *tty,
127 unsigned int set, unsigned int clear); 127 unsigned int set, unsigned int clear);
128static int if_write(struct tty_struct *tty, 128static int if_write(struct tty_struct *tty,
129 const unsigned char *buf, int count); 129 const unsigned char *buf, int count);
@@ -205,7 +205,7 @@ static void if_close(struct tty_struct *tty, struct file *filp)
205 module_put(cs->driver->owner); 205 module_put(cs->driver->owner);
206} 206}
207 207
208static int if_ioctl(struct tty_struct *tty, struct file *file, 208static int if_ioctl(struct tty_struct *tty,
209 unsigned int cmd, unsigned long arg) 209 unsigned int cmd, unsigned long arg)
210{ 210{
211 struct cardstate *cs; 211 struct cardstate *cs;
@@ -280,7 +280,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
280 return retval; 280 return retval;
281} 281}
282 282
283static int if_tiocmget(struct tty_struct *tty, struct file *file) 283static int if_tiocmget(struct tty_struct *tty)
284{ 284{
285 struct cardstate *cs; 285 struct cardstate *cs;
286 int retval; 286 int retval;
@@ -303,7 +303,7 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file)
303 return retval; 303 return retval;
304} 304}
305 305
306static int if_tiocmset(struct tty_struct *tty, struct file *file, 306static int if_tiocmset(struct tty_struct *tty,
307 unsigned int set, unsigned int clear) 307 unsigned int set, unsigned int clear)
308{ 308{
309 struct cardstate *cs; 309 struct cardstate *cs;
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index 0ef09d0eb96b..86a5c4f7775e 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -440,7 +440,7 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
440 if (!set && !clear) 440 if (!set && !clear)
441 return 0; 441 return 0;
442 gig_dbg(DEBUG_IF, "tiocmset set %x clear %x", set, clear); 442 gig_dbg(DEBUG_IF, "tiocmset set %x clear %x", set, clear);
443 return tty->ops->tiocmset(tty, NULL, set, clear); 443 return tty->ops->tiocmset(tty, set, clear);
444} 444}
445 445
446static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag) 446static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag)
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index c463162843ba..3d88f15aa218 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -1345,7 +1345,7 @@ isdn_tty_get_lsr_info(modem_info * info, uint __user * value)
1345 1345
1346 1346
1347static int 1347static int
1348isdn_tty_tiocmget(struct tty_struct *tty, struct file *file) 1348isdn_tty_tiocmget(struct tty_struct *tty)
1349{ 1349{
1350 modem_info *info = (modem_info *) tty->driver_data; 1350 modem_info *info = (modem_info *) tty->driver_data;
1351 u_char control, status; 1351 u_char control, status;
@@ -1372,7 +1372,7 @@ isdn_tty_tiocmget(struct tty_struct *tty, struct file *file)
1372} 1372}
1373 1373
1374static int 1374static int
1375isdn_tty_tiocmset(struct tty_struct *tty, struct file *file, 1375isdn_tty_tiocmset(struct tty_struct *tty,
1376 unsigned int set, unsigned int clear) 1376 unsigned int set, unsigned int clear)
1377{ 1377{
1378 modem_info *info = (modem_info *) tty->driver_data; 1378 modem_info *info = (modem_info *) tty->driver_data;
@@ -1413,8 +1413,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file,
1413} 1413}
1414 1414
1415static int 1415static int
1416isdn_tty_ioctl(struct tty_struct *tty, struct file *file, 1416isdn_tty_ioctl(struct tty_struct *tty, uint cmd, ulong arg)
1417 uint cmd, ulong arg)
1418{ 1417{
1419 modem_info *info = (modem_info *) tty->driver_data; 1418 modem_info *info = (modem_info *) tty->driver_data;
1420 int retval; 1419 int retval;
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 98bffc471b17..380ba806495d 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -27,6 +27,7 @@
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/if_ether.h> 28#include <linux/if_ether.h>
29#include <linux/ctype.h> 29#include <linux/ctype.h>
30#include <linux/dmi.h>
30 31
31#define PHUB_STATUS 0x00 /* Status Register offset */ 32#define PHUB_STATUS 0x00 /* Status Register offset */
32#define PHUB_CONTROL 0x04 /* Control Register offset */ 33#define PHUB_CONTROL 0x04 /* Control Register offset */
@@ -46,6 +47,17 @@
46#define PCH_MINOR_NOS 1 47#define PCH_MINOR_NOS 1
47#define CLKCFG_CAN_50MHZ 0x12000000 48#define CLKCFG_CAN_50MHZ 0x12000000
48#define CLKCFG_CANCLK_MASK 0xFF000000 49#define CLKCFG_CANCLK_MASK 0xFF000000
50#define CLKCFG_UART_MASK 0xFFFFFF
51
52/* CM-iTC */
53#define CLKCFG_UART_48MHZ (1 << 16)
54#define CLKCFG_BAUDDIV (2 << 20)
55#define CLKCFG_PLL2VCO (8 << 9)
56#define CLKCFG_UARTCLKSEL (1 << 18)
57
58/* Macros for ML7213 */
59#define PCI_VENDOR_ID_ROHM 0x10db
60#define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A
49 61
50/* Macros for ML7213 */ 62/* Macros for ML7213 */
51#define PCI_VENDOR_ID_ROHM 0x10db 63#define PCI_VENDOR_ID_ROHM 0x10db
@@ -618,6 +630,14 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
618 CLKCFG_CAN_50MHZ, 630 CLKCFG_CAN_50MHZ,
619 CLKCFG_CANCLK_MASK); 631 CLKCFG_CANCLK_MASK);
620 632
633 /* quirk for CM-iTC board */
634 if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
635 pch_phub_read_modify_write_reg(chip,
636 (unsigned int)CLKCFG_REG_OFFSET,
637 CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV |
638 CLKCFG_PLL2VCO | CLKCFG_UARTCLKSEL,
639 CLKCFG_UART_MASK);
640
621 /* set the prefech value */ 641 /* set the prefech value */
622 iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); 642 iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14);
623 /* set the interrupt delay value */ 643 /* set the interrupt delay value */
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index a0716967b7c8..c8c9edb3d7cb 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -956,7 +956,7 @@ static int sdio_uart_break_ctl(struct tty_struct *tty, int break_state)
956 return 0; 956 return 0;
957} 957}
958 958
959static int sdio_uart_tiocmget(struct tty_struct *tty, struct file *file) 959static int sdio_uart_tiocmget(struct tty_struct *tty)
960{ 960{
961 struct sdio_uart_port *port = tty->driver_data; 961 struct sdio_uart_port *port = tty->driver_data;
962 int result; 962 int result;
@@ -970,7 +970,7 @@ static int sdio_uart_tiocmget(struct tty_struct *tty, struct file *file)
970 return result; 970 return result;
971} 971}
972 972
973static int sdio_uart_tiocmset(struct tty_struct *tty, struct file *file, 973static int sdio_uart_tiocmset(struct tty_struct *tty,
974 unsigned int set, unsigned int clear) 974 unsigned int set, unsigned int clear)
975{ 975{
976 struct sdio_uart_port *port = tty->driver_data; 976 struct sdio_uart_port *port = tty->driver_data;
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index ee1dde52e8fc..3352b2443e58 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -167,7 +167,7 @@ static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)
167 * let's be careful... Jean II 167 * let's be careful... Jean II
168 */ 168 */
169 IRDA_ASSERT(priv->tty->ops->tiocmset != NULL, return -1;); 169 IRDA_ASSERT(priv->tty->ops->tiocmset != NULL, return -1;);
170 priv->tty->ops->tiocmset(priv->tty, NULL, set, clear); 170 priv->tty->ops->tiocmset(priv->tty, set, clear);
171 171
172 return 0; 172 return 0;
173} 173}
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 6d83812603b6..387ca43f26f4 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -324,7 +324,7 @@ struct hso_device {
324/* Prototypes */ 324/* Prototypes */
325/*****************************************************************************/ 325/*****************************************************************************/
326/* Serial driver functions */ 326/* Serial driver functions */
327static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file, 327static int hso_serial_tiocmset(struct tty_struct *tty,
328 unsigned int set, unsigned int clear); 328 unsigned int set, unsigned int clear);
329static void ctrl_callback(struct urb *urb); 329static void ctrl_callback(struct urb *urb);
330static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial); 330static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial);
@@ -1335,7 +1335,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
1335 1335
1336 /* done */ 1336 /* done */
1337 if (result) 1337 if (result)
1338 hso_serial_tiocmset(tty, NULL, TIOCM_RTS | TIOCM_DTR, 0); 1338 hso_serial_tiocmset(tty, TIOCM_RTS | TIOCM_DTR, 0);
1339err_out: 1339err_out:
1340 mutex_unlock(&serial->parent->mutex); 1340 mutex_unlock(&serial->parent->mutex);
1341 return result; 1341 return result;
@@ -1656,7 +1656,7 @@ static int hso_get_count(struct tty_struct *tty,
1656} 1656}
1657 1657
1658 1658
1659static int hso_serial_tiocmget(struct tty_struct *tty, struct file *file) 1659static int hso_serial_tiocmget(struct tty_struct *tty)
1660{ 1660{
1661 int retval; 1661 int retval;
1662 struct hso_serial *serial = get_serial_by_tty(tty); 1662 struct hso_serial *serial = get_serial_by_tty(tty);
@@ -1687,7 +1687,7 @@ static int hso_serial_tiocmget(struct tty_struct *tty, struct file *file)
1687 return retval; 1687 return retval;
1688} 1688}
1689 1689
1690static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file, 1690static int hso_serial_tiocmset(struct tty_struct *tty,
1691 unsigned int set, unsigned int clear) 1691 unsigned int set, unsigned int clear)
1692{ 1692{
1693 int val = 0; 1693 int val = 0;
@@ -1730,7 +1730,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file,
1730 USB_CTRL_SET_TIMEOUT); 1730 USB_CTRL_SET_TIMEOUT);
1731} 1731}
1732 1732
1733static int hso_serial_ioctl(struct tty_struct *tty, struct file *file, 1733static int hso_serial_ioctl(struct tty_struct *tty,
1734 unsigned int cmd, unsigned long arg) 1734 unsigned int cmd, unsigned long arg)
1735{ 1735{
1736 struct hso_serial *serial = get_serial_by_tty(tty); 1736 struct hso_serial *serial = get_serial_by_tty(tty);
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c
index 515d9b8af01e..1c65d1c33873 100644
--- a/drivers/net/wan/pc300_tty.c
+++ b/drivers/net/wan/pc300_tty.c
@@ -131,9 +131,8 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx);
131static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char); 131static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char);
132static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); 132static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char);
133 133
134static int pc300_tiocmset(struct tty_struct *, struct file *, 134static int pc300_tiocmset(struct tty_struct *, unsigned int, unsigned int);
135 unsigned int, unsigned int); 135static int pc300_tiocmget(struct tty_struct *);
136static int pc300_tiocmget(struct tty_struct *, struct file *);
137 136
138/* functions called by PC300 driver */ 137/* functions called by PC300 driver */
139void cpc_tty_init(pc300dev_t *dev); 138void cpc_tty_init(pc300dev_t *dev);
@@ -543,7 +542,7 @@ static int cpc_tty_chars_in_buffer(struct tty_struct *tty)
543 return 0; 542 return 0;
544} 543}
545 544
546static int pc300_tiocmset(struct tty_struct *tty, struct file *file, 545static int pc300_tiocmset(struct tty_struct *tty,
547 unsigned int set, unsigned int clear) 546 unsigned int set, unsigned int clear)
548{ 547{
549 st_cpc_tty_area *cpc_tty; 548 st_cpc_tty_area *cpc_tty;
@@ -570,7 +569,7 @@ static int pc300_tiocmset(struct tty_struct *tty, struct file *file,
570 return 0; 569 return 0;
571} 570}
572 571
573static int pc300_tiocmget(struct tty_struct *tty, struct file *file) 572static int pc300_tiocmget(struct tty_struct *tty)
574{ 573{
575 unsigned int result; 574 unsigned int result;
576 unsigned char status; 575 unsigned char status;
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
index 5ad44daef73b..806588192483 100644
--- a/drivers/s390/char/keyboard.c
+++ b/drivers/s390/char/keyboard.c
@@ -455,9 +455,7 @@ do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs,
455 return 0; 455 return 0;
456} 456}
457 457
458int 458int kbd_ioctl(struct kbd_data *kbd, unsigned int cmd, unsigned long arg)
459kbd_ioctl(struct kbd_data *kbd, struct file *file,
460 unsigned int cmd, unsigned long arg)
461{ 459{
462 void __user *argp; 460 void __user *argp;
463 unsigned int ct; 461 unsigned int ct;
diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h
index 5ccfe9cf126d..7e736aaeae6e 100644
--- a/drivers/s390/char/keyboard.h
+++ b/drivers/s390/char/keyboard.h
@@ -36,7 +36,7 @@ void kbd_free(struct kbd_data *);
36void kbd_ascebc(struct kbd_data *, unsigned char *); 36void kbd_ascebc(struct kbd_data *, unsigned char *);
37 37
38void kbd_keycode(struct kbd_data *, unsigned int); 38void kbd_keycode(struct kbd_data *, unsigned int);
39int kbd_ioctl(struct kbd_data *, struct file *, unsigned int, unsigned long); 39int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long);
40 40
41/* 41/*
42 * Helper Functions. 42 * Helper Functions.
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index 911822db614d..d33554df2b06 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -1718,9 +1718,8 @@ tty3270_wait_until_sent(struct tty_struct *tty, int timeout)
1718{ 1718{
1719} 1719}
1720 1720
1721static int 1721static int tty3270_ioctl(struct tty_struct *tty, unsigned int cmd,
1722tty3270_ioctl(struct tty_struct *tty, struct file *file, 1722 unsigned long arg)
1723 unsigned int cmd, unsigned long arg)
1724{ 1723{
1725 struct tty3270 *tp; 1724 struct tty3270 *tp;
1726 1725
@@ -1729,13 +1728,12 @@ tty3270_ioctl(struct tty_struct *tty, struct file *file,
1729 return -ENODEV; 1728 return -ENODEV;
1730 if (tty->flags & (1 << TTY_IO_ERROR)) 1729 if (tty->flags & (1 << TTY_IO_ERROR))
1731 return -EIO; 1730 return -EIO;
1732 return kbd_ioctl(tp->kbd, file, cmd, arg); 1731 return kbd_ioctl(tp->kbd, cmd, arg);
1733} 1732}
1734 1733
1735#ifdef CONFIG_COMPAT 1734#ifdef CONFIG_COMPAT
1736static long 1735static long tty3270_compat_ioctl(struct tty_struct *tty,
1737tty3270_compat_ioctl(struct tty_struct *tty, struct file *file, 1736 unsigned int cmd, unsigned long arg)
1738 unsigned int cmd, unsigned long arg)
1739{ 1737{
1740 struct tty3270 *tp; 1738 struct tty3270 *tp;
1741 1739
@@ -1744,7 +1742,7 @@ tty3270_compat_ioctl(struct tty_struct *tty, struct file *file,
1744 return -ENODEV; 1742 return -ENODEV;
1745 if (tty->flags & (1 << TTY_IO_ERROR)) 1743 if (tty->flags & (1 << TTY_IO_ERROR))
1746 return -EIO; 1744 return -EIO;
1747 return kbd_ioctl(tp->kbd, file, cmd, (unsigned long)compat_ptr(arg)); 1745 return kbd_ioctl(tp->kbd, cmd, (unsigned long)compat_ptr(arg));
1748} 1746}
1749#endif 1747#endif
1750 1748
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 5c8fcfc42c3e..58e4a8e15a0e 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -41,6 +41,10 @@ config STAGING_EXCLUDE_BUILD
41 41
42if !STAGING_EXCLUDE_BUILD 42if !STAGING_EXCLUDE_BUILD
43 43
44source "drivers/staging/tty/Kconfig"
45
46source "drivers/staging/generic_serial/Kconfig"
47
44source "drivers/staging/et131x/Kconfig" 48source "drivers/staging/et131x/Kconfig"
45 49
46source "drivers/staging/slicoss/Kconfig" 50source "drivers/staging/slicoss/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index d53886317826..ff7372d25c91 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -3,6 +3,8 @@
3# fix for build system bug... 3# fix for build system bug...
4obj-$(CONFIG_STAGING) += staging.o 4obj-$(CONFIG_STAGING) += staging.o
5 5
6obj-y += tty/
7obj-y += generic_serial/
6obj-$(CONFIG_ET131X) += et131x/ 8obj-$(CONFIG_ET131X) += et131x/
7obj-$(CONFIG_SLICOSS) += slicoss/ 9obj-$(CONFIG_SLICOSS) += slicoss/
8obj-$(CONFIG_VIDEO_GO7007) += go7007/ 10obj-$(CONFIG_VIDEO_GO7007) += go7007/
diff --git a/drivers/staging/generic_serial/Kconfig b/drivers/staging/generic_serial/Kconfig
new file mode 100644
index 000000000000..795daea37750
--- /dev/null
+++ b/drivers/staging/generic_serial/Kconfig
@@ -0,0 +1,45 @@
1config A2232
2 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
3 depends on EXPERIMENTAL && ZORRO && BROKEN
4 ---help---
5 This option supports the 2232 7-port serial card shipped with the
6 Amiga 2000 and other Zorro-bus machines, dating from 1989. At
7 a max of 19,200 bps, the ports are served by a 6551 ACIA UART chip
8 each, plus a 8520 CIA, and a master 6502 CPU and buffer as well. The
9 ports were connected with 8 pin DIN connectors on the card bracket,
10 for which 8 pin to DB25 adapters were supplied. The card also had
11 jumpers internally to toggle various pinning configurations.
12
13 This driver can be built as a module; but then "generic_serial"
14 will also be built as a module. This has to be loaded before
15 "ser_a2232". If you want to do this, answer M here.
16
17config SX
18 tristate "Specialix SX (and SI) card support"
19 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN
20 help
21 This is a driver for the SX and SI multiport serial cards.
22 Please read the file <file:Documentation/serial/sx.txt> for details.
23
24 This driver can only be built as a module ( = code which can be
25 inserted in and removed from the running kernel whenever you want).
26 The module will be called sx. If you want to do that, say M here.
27
28config RIO
29 tristate "Specialix RIO system support"
30 depends on SERIAL_NONSTANDARD && BROKEN
31 help
32 This is a driver for the Specialix RIO, a smart serial card which
33 drives an outboard box that can support up to 128 ports. Product
34 information is at <http://www.perle.com/support/documentation.html#multiport>.
35 There are both ISA and PCI versions.
36
37config RIO_OLDPCI
38 bool "Support really old RIO/PCI cards"
39 depends on RIO
40 help
41 Older RIO PCI cards need some initialization-time configuration to
42 determine the IRQ and some control addresses. If you have a RIO and
43 this doesn't seem to work, try setting this to Y.
44
45
diff --git a/drivers/staging/generic_serial/Makefile b/drivers/staging/generic_serial/Makefile
new file mode 100644
index 000000000000..ffc90c8b013c
--- /dev/null
+++ b/drivers/staging/generic_serial/Makefile
@@ -0,0 +1,6 @@
1obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o
2obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o
3obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
4obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o
5obj-$(CONFIG_SX) += sx.o generic_serial.o
6obj-$(CONFIG_RIO) += rio/ generic_serial.o
diff --git a/drivers/staging/generic_serial/TODO b/drivers/staging/generic_serial/TODO
new file mode 100644
index 000000000000..88756453ac6c
--- /dev/null
+++ b/drivers/staging/generic_serial/TODO
@@ -0,0 +1,6 @@
1These are a few tty/serial drivers that either do not build,
2or work if they do build, or if they seem to work, are for obsolete
3hardware, or are full of unfixable races and no one uses them anymore.
4
5If no one steps up to adopt any of these drivers, they will be removed
6in the 2.6.41 release.
diff --git a/drivers/char/generic_serial.c b/drivers/staging/generic_serial/generic_serial.c
index 5954ee1dc953..466988dbc37d 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/staging/generic_serial/generic_serial.c
@@ -566,9 +566,9 @@ void gs_close(struct tty_struct * tty, struct file * filp)
566 * line status register. 566 * line status register.
567 */ 567 */
568 568
569 spin_lock_irqsave(&port->driver_lock, flags); 569 spin_lock(&port->driver_lock);
570 port->rd->disable_rx_interrupts (port); 570 port->rd->disable_rx_interrupts (port);
571 spin_unlock_irqrestore(&port->driver_lock, flags); 571 spin_unlock(&port->driver_lock);
572 spin_unlock_irqrestore(&port->port.lock, flags); 572 spin_unlock_irqrestore(&port->port.lock, flags);
573 573
574 /* close has no way of returning "EINTR", so discard return value */ 574 /* close has no way of returning "EINTR", so discard return value */
diff --git a/drivers/char/rio/Makefile b/drivers/staging/generic_serial/rio/Makefile
index 1661875883fb..1661875883fb 100644
--- a/drivers/char/rio/Makefile
+++ b/drivers/staging/generic_serial/rio/Makefile
diff --git a/drivers/char/rio/board.h b/drivers/staging/generic_serial/rio/board.h
index bdea633a9076..bdea633a9076 100644
--- a/drivers/char/rio/board.h
+++ b/drivers/staging/generic_serial/rio/board.h
diff --git a/drivers/char/rio/cirrus.h b/drivers/staging/generic_serial/rio/cirrus.h
index 5ab51679caa2..5ab51679caa2 100644
--- a/drivers/char/rio/cirrus.h
+++ b/drivers/staging/generic_serial/rio/cirrus.h
diff --git a/drivers/char/rio/cmdblk.h b/drivers/staging/generic_serial/rio/cmdblk.h
index 9ed4f861675a..9ed4f861675a 100644
--- a/drivers/char/rio/cmdblk.h
+++ b/drivers/staging/generic_serial/rio/cmdblk.h
diff --git a/drivers/char/rio/cmdpkt.h b/drivers/staging/generic_serial/rio/cmdpkt.h
index c1e7a2798070..c1e7a2798070 100644
--- a/drivers/char/rio/cmdpkt.h
+++ b/drivers/staging/generic_serial/rio/cmdpkt.h
diff --git a/drivers/char/rio/daemon.h b/drivers/staging/generic_serial/rio/daemon.h
index 4af90323fd00..4af90323fd00 100644
--- a/drivers/char/rio/daemon.h
+++ b/drivers/staging/generic_serial/rio/daemon.h
diff --git a/drivers/char/rio/errors.h b/drivers/staging/generic_serial/rio/errors.h
index bdb05234090a..bdb05234090a 100644
--- a/drivers/char/rio/errors.h
+++ b/drivers/staging/generic_serial/rio/errors.h
diff --git a/drivers/char/rio/func.h b/drivers/staging/generic_serial/rio/func.h
index 078d44f85e45..078d44f85e45 100644
--- a/drivers/char/rio/func.h
+++ b/drivers/staging/generic_serial/rio/func.h
diff --git a/drivers/char/rio/host.h b/drivers/staging/generic_serial/rio/host.h
index 78f24540c224..78f24540c224 100644
--- a/drivers/char/rio/host.h
+++ b/drivers/staging/generic_serial/rio/host.h
diff --git a/drivers/char/rio/link.h b/drivers/staging/generic_serial/rio/link.h
index f3bf11a04d41..f3bf11a04d41 100644
--- a/drivers/char/rio/link.h
+++ b/drivers/staging/generic_serial/rio/link.h
diff --git a/drivers/char/rio/linux_compat.h b/drivers/staging/generic_serial/rio/linux_compat.h
index 34c0d2899ef1..34c0d2899ef1 100644
--- a/drivers/char/rio/linux_compat.h
+++ b/drivers/staging/generic_serial/rio/linux_compat.h
diff --git a/drivers/char/rio/map.h b/drivers/staging/generic_serial/rio/map.h
index 8366978578c1..8366978578c1 100644
--- a/drivers/char/rio/map.h
+++ b/drivers/staging/generic_serial/rio/map.h
diff --git a/drivers/char/rio/param.h b/drivers/staging/generic_serial/rio/param.h
index 7e9b6283e8aa..7e9b6283e8aa 100644
--- a/drivers/char/rio/param.h
+++ b/drivers/staging/generic_serial/rio/param.h
diff --git a/drivers/char/rio/parmmap.h b/drivers/staging/generic_serial/rio/parmmap.h
index acc8fa439df5..acc8fa439df5 100644
--- a/drivers/char/rio/parmmap.h
+++ b/drivers/staging/generic_serial/rio/parmmap.h
diff --git a/drivers/char/rio/pci.h b/drivers/staging/generic_serial/rio/pci.h
index 6032f9135956..6032f9135956 100644
--- a/drivers/char/rio/pci.h
+++ b/drivers/staging/generic_serial/rio/pci.h
diff --git a/drivers/char/rio/phb.h b/drivers/staging/generic_serial/rio/phb.h
index a4c48ae4e365..a4c48ae4e365 100644
--- a/drivers/char/rio/phb.h
+++ b/drivers/staging/generic_serial/rio/phb.h
diff --git a/drivers/char/rio/pkt.h b/drivers/staging/generic_serial/rio/pkt.h
index a9458164f02f..a9458164f02f 100644
--- a/drivers/char/rio/pkt.h
+++ b/drivers/staging/generic_serial/rio/pkt.h
diff --git a/drivers/char/rio/port.h b/drivers/staging/generic_serial/rio/port.h
index 49cf6d15ee54..49cf6d15ee54 100644
--- a/drivers/char/rio/port.h
+++ b/drivers/staging/generic_serial/rio/port.h
diff --git a/drivers/char/rio/protsts.h b/drivers/staging/generic_serial/rio/protsts.h
index 8ab79401d3ee..8ab79401d3ee 100644
--- a/drivers/char/rio/protsts.h
+++ b/drivers/staging/generic_serial/rio/protsts.h
diff --git a/drivers/char/rio/rio.h b/drivers/staging/generic_serial/rio/rio.h
index 1bf36223a4e8..1bf36223a4e8 100644
--- a/drivers/char/rio/rio.h
+++ b/drivers/staging/generic_serial/rio/rio.h
diff --git a/drivers/char/rio/rio_linux.c b/drivers/staging/generic_serial/rio/rio_linux.c
index 5e33293d24e3..5e33293d24e3 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/staging/generic_serial/rio/rio_linux.c
diff --git a/drivers/char/rio/rio_linux.h b/drivers/staging/generic_serial/rio/rio_linux.h
index 7f26cd7c815e..7f26cd7c815e 100644
--- a/drivers/char/rio/rio_linux.h
+++ b/drivers/staging/generic_serial/rio/rio_linux.h
diff --git a/drivers/char/rio/rioboard.h b/drivers/staging/generic_serial/rio/rioboard.h
index 252230043c82..252230043c82 100644
--- a/drivers/char/rio/rioboard.h
+++ b/drivers/staging/generic_serial/rio/rioboard.h
diff --git a/drivers/char/rio/rioboot.c b/drivers/staging/generic_serial/rio/rioboot.c
index d956dd316005..d956dd316005 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/staging/generic_serial/rio/rioboot.c
diff --git a/drivers/char/rio/riocmd.c b/drivers/staging/generic_serial/rio/riocmd.c
index f121357e5af0..f121357e5af0 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/staging/generic_serial/rio/riocmd.c
diff --git a/drivers/char/rio/rioctrl.c b/drivers/staging/generic_serial/rio/rioctrl.c
index 780506326a73..780506326a73 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/staging/generic_serial/rio/rioctrl.c
diff --git a/drivers/char/rio/riodrvr.h b/drivers/staging/generic_serial/rio/riodrvr.h
index 0907e711b355..0907e711b355 100644
--- a/drivers/char/rio/riodrvr.h
+++ b/drivers/staging/generic_serial/rio/riodrvr.h
diff --git a/drivers/char/rio/rioinfo.h b/drivers/staging/generic_serial/rio/rioinfo.h
index 42ff1e79d96f..42ff1e79d96f 100644
--- a/drivers/char/rio/rioinfo.h
+++ b/drivers/staging/generic_serial/rio/rioinfo.h
diff --git a/drivers/char/rio/rioinit.c b/drivers/staging/generic_serial/rio/rioinit.c
index 24a282bb89d4..24a282bb89d4 100644
--- a/drivers/char/rio/rioinit.c
+++ b/drivers/staging/generic_serial/rio/rioinit.c
diff --git a/drivers/char/rio/riointr.c b/drivers/staging/generic_serial/rio/riointr.c
index 2e71aecae206..2e71aecae206 100644
--- a/drivers/char/rio/riointr.c
+++ b/drivers/staging/generic_serial/rio/riointr.c
diff --git a/drivers/char/rio/rioioctl.h b/drivers/staging/generic_serial/rio/rioioctl.h
index e8af5b30519e..e8af5b30519e 100644
--- a/drivers/char/rio/rioioctl.h
+++ b/drivers/staging/generic_serial/rio/rioioctl.h
diff --git a/drivers/char/rio/rioparam.c b/drivers/staging/generic_serial/rio/rioparam.c
index 6415f3f32a72..6415f3f32a72 100644
--- a/drivers/char/rio/rioparam.c
+++ b/drivers/staging/generic_serial/rio/rioparam.c
diff --git a/drivers/char/rio/rioroute.c b/drivers/staging/generic_serial/rio/rioroute.c
index f9b936ac3394..f9b936ac3394 100644
--- a/drivers/char/rio/rioroute.c
+++ b/drivers/staging/generic_serial/rio/rioroute.c
diff --git a/drivers/char/rio/riospace.h b/drivers/staging/generic_serial/rio/riospace.h
index ffb31d4332b9..ffb31d4332b9 100644
--- a/drivers/char/rio/riospace.h
+++ b/drivers/staging/generic_serial/rio/riospace.h
diff --git a/drivers/char/rio/riotable.c b/drivers/staging/generic_serial/rio/riotable.c
index 3d15802dc0f3..3d15802dc0f3 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/staging/generic_serial/rio/riotable.c
diff --git a/drivers/char/rio/riotty.c b/drivers/staging/generic_serial/rio/riotty.c
index 8a90393faf3c..8a90393faf3c 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/staging/generic_serial/rio/riotty.c
diff --git a/drivers/char/rio/route.h b/drivers/staging/generic_serial/rio/route.h
index 46e963771c30..46e963771c30 100644
--- a/drivers/char/rio/route.h
+++ b/drivers/staging/generic_serial/rio/route.h
diff --git a/drivers/char/rio/rup.h b/drivers/staging/generic_serial/rio/rup.h
index 4ae90cb207a9..4ae90cb207a9 100644
--- a/drivers/char/rio/rup.h
+++ b/drivers/staging/generic_serial/rio/rup.h
diff --git a/drivers/char/rio/unixrup.h b/drivers/staging/generic_serial/rio/unixrup.h
index 7abf0cba0f2c..7abf0cba0f2c 100644
--- a/drivers/char/rio/unixrup.h
+++ b/drivers/staging/generic_serial/rio/unixrup.h
diff --git a/drivers/char/ser_a2232.c b/drivers/staging/generic_serial/ser_a2232.c
index 9610861d1f5f..3f47c2ead8e5 100644
--- a/drivers/char/ser_a2232.c
+++ b/drivers/staging/generic_serial/ser_a2232.c
@@ -133,8 +133,8 @@ static void a2232_hungup(void *ptr);
133/* END GENERIC_SERIAL PROTOTYPES */ 133/* END GENERIC_SERIAL PROTOTYPES */
134 134
135/* Functions that the TTY driver struct expects */ 135/* Functions that the TTY driver struct expects */
136static int a2232_ioctl(struct tty_struct *tty, struct file *file, 136static int a2232_ioctl(struct tty_struct *tty,
137 unsigned int cmd, unsigned long arg); 137 unsigned int cmd, unsigned long arg);
138static void a2232_throttle(struct tty_struct *tty); 138static void a2232_throttle(struct tty_struct *tty);
139static void a2232_unthrottle(struct tty_struct *tty); 139static void a2232_unthrottle(struct tty_struct *tty);
140static int a2232_open(struct tty_struct * tty, struct file * filp); 140static int a2232_open(struct tty_struct * tty, struct file * filp);
@@ -447,7 +447,7 @@ static void a2232_hungup(void *ptr)
447/*** END OF REAL_DRIVER FUNCTIONS ***/ 447/*** END OF REAL_DRIVER FUNCTIONS ***/
448 448
449/*** BEGIN FUNCTIONS EXPECTED BY TTY DRIVER STRUCTS ***/ 449/*** BEGIN FUNCTIONS EXPECTED BY TTY DRIVER STRUCTS ***/
450static int a2232_ioctl( struct tty_struct *tty, struct file *file, 450static int a2232_ioctl( struct tty_struct *tty,
451 unsigned int cmd, unsigned long arg) 451 unsigned int cmd, unsigned long arg)
452{ 452{
453 return -ENOIOCTLCMD; 453 return -ENOIOCTLCMD;
diff --git a/drivers/char/ser_a2232.h b/drivers/staging/generic_serial/ser_a2232.h
index bc09eb9e118b..bc09eb9e118b 100644
--- a/drivers/char/ser_a2232.h
+++ b/drivers/staging/generic_serial/ser_a2232.h
diff --git a/drivers/char/ser_a2232fw.ax b/drivers/staging/generic_serial/ser_a2232fw.ax
index 736438032768..736438032768 100644
--- a/drivers/char/ser_a2232fw.ax
+++ b/drivers/staging/generic_serial/ser_a2232fw.ax
diff --git a/drivers/char/ser_a2232fw.h b/drivers/staging/generic_serial/ser_a2232fw.h
index e09a30acfe5c..e09a30acfe5c 100644
--- a/drivers/char/ser_a2232fw.h
+++ b/drivers/staging/generic_serial/ser_a2232fw.h
diff --git a/drivers/char/sx.c b/drivers/staging/generic_serial/sx.c
index a786326cea2f..1291462bcddb 100644
--- a/drivers/char/sx.c
+++ b/drivers/staging/generic_serial/sx.c
@@ -1873,14 +1873,14 @@ static int sx_break(struct tty_struct *tty, int flag)
1873 return 0; 1873 return 0;
1874} 1874}
1875 1875
1876static int sx_tiocmget(struct tty_struct *tty, struct file *file) 1876static int sx_tiocmget(struct tty_struct *tty)
1877{ 1877{
1878 struct sx_port *port = tty->driver_data; 1878 struct sx_port *port = tty->driver_data;
1879 return sx_getsignals(port); 1879 return sx_getsignals(port);
1880} 1880}
1881 1881
1882static int sx_tiocmset(struct tty_struct *tty, struct file *file, 1882static int sx_tiocmset(struct tty_struct *tty,
1883 unsigned int set, unsigned int clear) 1883 unsigned int set, unsigned int clear)
1884{ 1884{
1885 struct sx_port *port = tty->driver_data; 1885 struct sx_port *port = tty->driver_data;
1886 int rts = -1, dtr = -1; 1886 int rts = -1, dtr = -1;
@@ -1899,7 +1899,7 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file,
1899 return 0; 1899 return 0;
1900} 1900}
1901 1901
1902static int sx_ioctl(struct tty_struct *tty, struct file *filp, 1902static int sx_ioctl(struct tty_struct *tty,
1903 unsigned int cmd, unsigned long arg) 1903 unsigned int cmd, unsigned long arg)
1904{ 1904{
1905 int rc; 1905 int rc;
diff --git a/drivers/char/sx.h b/drivers/staging/generic_serial/sx.h
index 87c2defdead7..87c2defdead7 100644
--- a/drivers/char/sx.h
+++ b/drivers/staging/generic_serial/sx.h
diff --git a/drivers/char/sxboards.h b/drivers/staging/generic_serial/sxboards.h
index 427927dc7dbf..427927dc7dbf 100644
--- a/drivers/char/sxboards.h
+++ b/drivers/staging/generic_serial/sxboards.h
diff --git a/drivers/char/sxwindow.h b/drivers/staging/generic_serial/sxwindow.h
index cf01b662aefc..cf01b662aefc 100644
--- a/drivers/char/sxwindow.h
+++ b/drivers/staging/generic_serial/sxwindow.h
diff --git a/drivers/char/vme_scc.c b/drivers/staging/generic_serial/vme_scc.c
index 12de1202d22c..96838640f575 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/staging/generic_serial/vme_scc.c
@@ -75,7 +75,7 @@ static void scc_hungup(void *ptr);
75static void scc_close(void *ptr); 75static void scc_close(void *ptr);
76static int scc_chars_in_buffer(void * ptr); 76static int scc_chars_in_buffer(void * ptr);
77static int scc_open(struct tty_struct * tty, struct file * filp); 77static int scc_open(struct tty_struct * tty, struct file * filp);
78static int scc_ioctl(struct tty_struct * tty, struct file * filp, 78static int scc_ioctl(struct tty_struct * tty,
79 unsigned int cmd, unsigned long arg); 79 unsigned int cmd, unsigned long arg);
80static void scc_throttle(struct tty_struct *tty); 80static void scc_throttle(struct tty_struct *tty);
81static void scc_unthrottle(struct tty_struct *tty); 81static void scc_unthrottle(struct tty_struct *tty);
@@ -1046,7 +1046,7 @@ static void scc_unthrottle (struct tty_struct * tty)
1046} 1046}
1047 1047
1048 1048
1049static int scc_ioctl(struct tty_struct *tty, struct file *file, 1049static int scc_ioctl(struct tty_struct *tty,
1050 unsigned int cmd, unsigned long arg) 1050 unsigned int cmd, unsigned long arg)
1051{ 1051{
1052 return -ENOIOCTLCMD; 1052 return -ENOIOCTLCMD;
diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c
index ed58f482c963..36b18e302718 100644
--- a/drivers/staging/quatech_usb2/quatech_usb2.c
+++ b/drivers/staging/quatech_usb2/quatech_usb2.c
@@ -852,7 +852,7 @@ static int qt2_chars_in_buffer(struct tty_struct *tty)
852 * TIOCMGET and TIOCMSET are filtered off to their own methods before they get 852 * TIOCMGET and TIOCMSET are filtered off to their own methods before they get
853 * here, so we don't have to handle them. 853 * here, so we don't have to handle them.
854 */ 854 */
855static int qt2_ioctl(struct tty_struct *tty, struct file *file, 855static int qt2_ioctl(struct tty_struct *tty,
856 unsigned int cmd, unsigned long arg) 856 unsigned int cmd, unsigned long arg)
857{ 857{
858 struct usb_serial_port *port = tty->driver_data; 858 struct usb_serial_port *port = tty->driver_data;
@@ -1078,7 +1078,7 @@ static void qt2_set_termios(struct tty_struct *tty,
1078 } 1078 }
1079} 1079}
1080 1080
1081static int qt2_tiocmget(struct tty_struct *tty, struct file *file) 1081static int qt2_tiocmget(struct tty_struct *tty)
1082{ 1082{
1083 struct usb_serial_port *port = tty->driver_data; 1083 struct usb_serial_port *port = tty->driver_data;
1084 struct usb_serial *serial = port->serial; 1084 struct usb_serial *serial = port->serial;
@@ -1121,7 +1121,7 @@ static int qt2_tiocmget(struct tty_struct *tty, struct file *file)
1121 } 1121 }
1122} 1122}
1123 1123
1124static int qt2_tiocmset(struct tty_struct *tty, struct file *file, 1124static int qt2_tiocmset(struct tty_struct *tty,
1125 unsigned int set, unsigned int clear) 1125 unsigned int set, unsigned int clear)
1126{ 1126{
1127 struct usb_serial_port *port = tty->driver_data; 1127 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c
index 27841ef6a568..e0aae86a8809 100644
--- a/drivers/staging/serqt_usb2/serqt_usb2.c
+++ b/drivers/staging/serqt_usb2/serqt_usb2.c
@@ -1191,7 +1191,7 @@ static int qt_write_room(struct tty_struct *tty)
1191 1191
1192} 1192}
1193 1193
1194static int qt_ioctl(struct tty_struct *tty, struct file *file, 1194static int qt_ioctl(struct tty_struct *tty,
1195 unsigned int cmd, unsigned long arg) 1195 unsigned int cmd, unsigned long arg)
1196{ 1196{
1197 struct usb_serial_port *port = tty->driver_data; 1197 struct usb_serial_port *port = tty->driver_data;
@@ -1383,7 +1383,7 @@ static void qt_break(struct tty_struct *tty, int break_state)
1383 1383
1384static inline int qt_real_tiocmget(struct tty_struct *tty, 1384static inline int qt_real_tiocmget(struct tty_struct *tty,
1385 struct usb_serial_port *port, 1385 struct usb_serial_port *port,
1386 struct file *file, struct usb_serial *serial) 1386 struct usb_serial *serial)
1387{ 1387{
1388 1388
1389 u8 mcr; 1389 u8 mcr;
@@ -1425,7 +1425,6 @@ static inline int qt_real_tiocmget(struct tty_struct *tty,
1425 1425
1426static inline int qt_real_tiocmset(struct tty_struct *tty, 1426static inline int qt_real_tiocmset(struct tty_struct *tty,
1427 struct usb_serial_port *port, 1427 struct usb_serial_port *port,
1428 struct file *file,
1429 struct usb_serial *serial, 1428 struct usb_serial *serial,
1430 unsigned int value) 1429 unsigned int value)
1431{ 1430{
@@ -1462,7 +1461,7 @@ static inline int qt_real_tiocmset(struct tty_struct *tty,
1462 return 0; 1461 return 0;
1463} 1462}
1464 1463
1465static int qt_tiocmget(struct tty_struct *tty, struct file *file) 1464static int qt_tiocmget(struct tty_struct *tty)
1466{ 1465{
1467 struct usb_serial_port *port = tty->driver_data; 1466 struct usb_serial_port *port = tty->driver_data;
1468 struct usb_serial *serial = get_usb_serial(port, __func__); 1467 struct usb_serial *serial = get_usb_serial(port, __func__);
@@ -1480,13 +1479,13 @@ static int qt_tiocmget(struct tty_struct *tty, struct file *file)
1480 dbg("%s - port %d\n", __func__, port->number); 1479 dbg("%s - port %d\n", __func__, port->number);
1481 dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding); 1480 dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);
1482 1481
1483 retval = qt_real_tiocmget(tty, port, file, serial); 1482 retval = qt_real_tiocmget(tty, port, serial);
1484 1483
1485 spin_unlock_irqrestore(&qt_port->lock, flags); 1484 spin_unlock_irqrestore(&qt_port->lock, flags);
1486 return retval; 1485 return retval;
1487} 1486}
1488 1487
1489static int qt_tiocmset(struct tty_struct *tty, struct file *file, 1488static int qt_tiocmset(struct tty_struct *tty,
1490 unsigned int set, unsigned int clear) 1489 unsigned int set, unsigned int clear)
1491{ 1490{
1492 1491
@@ -1506,7 +1505,7 @@ static int qt_tiocmset(struct tty_struct *tty, struct file *file,
1506 dbg("%s - port %d\n", __func__, port->number); 1505 dbg("%s - port %d\n", __func__, port->number);
1507 dbg("%s - qt_port->RxHolding = %d\n", __func__, qt_port->RxHolding); 1506 dbg("%s - qt_port->RxHolding = %d\n", __func__, qt_port->RxHolding);
1508 1507
1509 retval = qt_real_tiocmset(tty, port, file, serial, set); 1508 retval = qt_real_tiocmset(tty, port, serial, set);
1510 1509
1511 spin_unlock_irqrestore(&qt_port->lock, flags); 1510 spin_unlock_irqrestore(&qt_port->lock, flags);
1512 return retval; 1511 return retval;
diff --git a/drivers/staging/tty/Kconfig b/drivers/staging/tty/Kconfig
new file mode 100644
index 000000000000..77103a07abbd
--- /dev/null
+++ b/drivers/staging/tty/Kconfig
@@ -0,0 +1,87 @@
1config STALLION
2 tristate "Stallion EasyIO or EC8/32 support"
3 depends on STALDRV && (ISA || EISA || PCI)
4 help
5 If you have an EasyIO or EasyConnection 8/32 multiport Stallion
6 card, then this is for you; say Y. Make sure to read
7 <file:Documentation/serial/stallion.txt>.
8
9 To compile this driver as a module, choose M here: the
10 module will be called stallion.
11
12config ISTALLION
13 tristate "Stallion EC8/64, ONboard, Brumby support"
14 depends on STALDRV && (ISA || EISA || PCI)
15 help
16 If you have an EasyConnection 8/64, ONboard, Brumby or Stallion
17 serial multiport card, say Y here. Make sure to read
18 <file:Documentation/serial/stallion.txt>.
19
20 To compile this driver as a module, choose M here: the
21 module will be called istallion.
22
23config DIGIEPCA
24 tristate "Digiboard Intelligent Async Support"
25 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
26 ---help---
27 This is a driver for Digi International's Xx, Xeve, and Xem series
28 of cards which provide multiple serial ports. You would need
29 something like this to connect more than two modems to your Linux
30 box, for instance in order to become a dial-in server. This driver
31 supports the original PC (ISA) boards as well as PCI, and EISA. If
32 you have a card like this, say Y here and read the file
33 <file:Documentation/serial/digiepca.txt>.
34
35 To compile this driver as a module, choose M here: the
36 module will be called epca.
37
38config RISCOM8
39 tristate "SDL RISCom/8 card support"
40 depends on SERIAL_NONSTANDARD
41 help
42 This is a driver for the SDL Communications RISCom/8 multiport card,
43 which gives you many serial ports. You would need something like
44 this to connect more than two modems to your Linux box, for instance
45 in order to become a dial-in server. If you have a card like that,
46 say Y here and read the file <file:Documentation/serial/riscom8.txt>.
47
48 Also it's possible to say M here and compile this driver as kernel
49 loadable module; the module will be called riscom8.
50
51config SPECIALIX
52 tristate "Specialix IO8+ card support"
53 depends on SERIAL_NONSTANDARD
54 help
55 This is a driver for the Specialix IO8+ multiport card (both the
56 ISA and the PCI version) which gives you many serial ports. You
57 would need something like this to connect more than two modems to
58 your Linux box, for instance in order to become a dial-in server.
59
60 If you have a card like that, say Y here and read the file
61 <file:Documentation/serial/specialix.txt>. Also it's possible to say
62 M here and compile this driver as kernel loadable module which will be
63 called specialix.
64
65config COMPUTONE
66 tristate "Computone IntelliPort Plus serial support"
67 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
68 ---help---
69 This driver supports the entire family of Intelliport II/Plus
70 controllers with the exception of the MicroChannel controllers and
71 products previous to the Intelliport II. These are multiport cards,
72 which give you many serial ports. You would need something like this
73 to connect more than two modems to your Linux box, for instance in
74 order to become a dial-in server. If you have a card like that, say
75 Y here and read <file:Documentation/serial/computone.txt>.
76
77 To compile this driver as module, choose M here: the
78 module will be called ip2.
79
80config SERIAL167
81 bool "CD2401 support for MVME166/7 serial ports"
82 depends on MVME16x
83 help
84 This is the driver for the serial ports on the Motorola MVME166,
85 167, and 172 boards. Everyone using one of these boards should say
86 Y here.
87
diff --git a/drivers/staging/tty/Makefile b/drivers/staging/tty/Makefile
new file mode 100644
index 000000000000..ac57c105611b
--- /dev/null
+++ b/drivers/staging/tty/Makefile
@@ -0,0 +1,7 @@
1obj-$(CONFIG_STALLION) += stallion.o
2obj-$(CONFIG_ISTALLION) += istallion.o
3obj-$(CONFIG_DIGIEPCA) += epca.o
4obj-$(CONFIG_SERIAL167) += serial167.o
5obj-$(CONFIG_SPECIALIX) += specialix.o
6obj-$(CONFIG_RISCOM8) += riscom8.o
7obj-$(CONFIG_COMPUTONE) += ip2/
diff --git a/drivers/staging/tty/TODO b/drivers/staging/tty/TODO
new file mode 100644
index 000000000000..88756453ac6c
--- /dev/null
+++ b/drivers/staging/tty/TODO
@@ -0,0 +1,6 @@
1These are a few tty/serial drivers that either do not build,
2or work if they do build, or if they seem to work, are for obsolete
3hardware, or are full of unfixable races and no one uses them anymore.
4
5If no one steps up to adopt any of these drivers, they will be removed
6in the 2.6.41 release.
diff --git a/drivers/char/cd1865.h b/drivers/staging/tty/cd1865.h
index 9940966e7a1d..9940966e7a1d 100644
--- a/drivers/char/cd1865.h
+++ b/drivers/staging/tty/cd1865.h
diff --git a/drivers/char/digi1.h b/drivers/staging/tty/digi1.h
index 94d4eab5d3ca..94d4eab5d3ca 100644
--- a/drivers/char/digi1.h
+++ b/drivers/staging/tty/digi1.h
diff --git a/drivers/char/digiFep1.h b/drivers/staging/tty/digiFep1.h
index 3c1f1922c798..3c1f1922c798 100644
--- a/drivers/char/digiFep1.h
+++ b/drivers/staging/tty/digiFep1.h
diff --git a/drivers/char/digiPCI.h b/drivers/staging/tty/digiPCI.h
index 6ca7819e5069..6ca7819e5069 100644
--- a/drivers/char/digiPCI.h
+++ b/drivers/staging/tty/digiPCI.h
diff --git a/drivers/char/epca.c b/drivers/staging/tty/epca.c
index d9df46aa0fba..7ad3638967ae 100644
--- a/drivers/char/epca.c
+++ b/drivers/staging/tty/epca.c
@@ -175,9 +175,9 @@ static unsigned termios2digi_i(struct channel *ch, unsigned);
175static unsigned termios2digi_c(struct channel *ch, unsigned); 175static unsigned termios2digi_c(struct channel *ch, unsigned);
176static void epcaparam(struct tty_struct *, struct channel *); 176static void epcaparam(struct tty_struct *, struct channel *);
177static void receive_data(struct channel *, struct tty_struct *tty); 177static void receive_data(struct channel *, struct tty_struct *tty);
178static int pc_ioctl(struct tty_struct *, struct file *, 178static int pc_ioctl(struct tty_struct *,
179 unsigned int, unsigned long); 179 unsigned int, unsigned long);
180static int info_ioctl(struct tty_struct *, struct file *, 180static int info_ioctl(struct tty_struct *,
181 unsigned int, unsigned long); 181 unsigned int, unsigned long);
182static void pc_set_termios(struct tty_struct *, struct ktermios *); 182static void pc_set_termios(struct tty_struct *, struct ktermios *);
183static void do_softint(struct work_struct *work); 183static void do_softint(struct work_struct *work);
@@ -1919,7 +1919,7 @@ static void receive_data(struct channel *ch, struct tty_struct *tty)
1919 tty_schedule_flip(tty); 1919 tty_schedule_flip(tty);
1920} 1920}
1921 1921
1922static int info_ioctl(struct tty_struct *tty, struct file *file, 1922static int info_ioctl(struct tty_struct *tty,
1923 unsigned int cmd, unsigned long arg) 1923 unsigned int cmd, unsigned long arg)
1924{ 1924{
1925 switch (cmd) { 1925 switch (cmd) {
@@ -1982,7 +1982,7 @@ static int info_ioctl(struct tty_struct *tty, struct file *file,
1982 return 0; 1982 return 0;
1983} 1983}
1984 1984
1985static int pc_tiocmget(struct tty_struct *tty, struct file *file) 1985static int pc_tiocmget(struct tty_struct *tty)
1986{ 1986{
1987 struct channel *ch = tty->driver_data; 1987 struct channel *ch = tty->driver_data;
1988 struct board_chan __iomem *bc; 1988 struct board_chan __iomem *bc;
@@ -2015,7 +2015,7 @@ static int pc_tiocmget(struct tty_struct *tty, struct file *file)
2015 return mflag; 2015 return mflag;
2016} 2016}
2017 2017
2018static int pc_tiocmset(struct tty_struct *tty, struct file *file, 2018static int pc_tiocmset(struct tty_struct *tty,
2019 unsigned int set, unsigned int clear) 2019 unsigned int set, unsigned int clear)
2020{ 2020{
2021 struct channel *ch = tty->driver_data; 2021 struct channel *ch = tty->driver_data;
@@ -2057,7 +2057,7 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file,
2057 return 0; 2057 return 0;
2058} 2058}
2059 2059
2060static int pc_ioctl(struct tty_struct *tty, struct file *file, 2060static int pc_ioctl(struct tty_struct *tty,
2061 unsigned int cmd, unsigned long arg) 2061 unsigned int cmd, unsigned long arg)
2062{ 2062{
2063 digiflow_t dflow; 2063 digiflow_t dflow;
@@ -2074,14 +2074,14 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file,
2074 return -EINVAL; 2074 return -EINVAL;
2075 switch (cmd) { 2075 switch (cmd) {
2076 case TIOCMODG: 2076 case TIOCMODG:
2077 mflag = pc_tiocmget(tty, file); 2077 mflag = pc_tiocmget(tty);
2078 if (put_user(mflag, (unsigned long __user *)argp)) 2078 if (put_user(mflag, (unsigned long __user *)argp))
2079 return -EFAULT; 2079 return -EFAULT;
2080 break; 2080 break;
2081 case TIOCMODS: 2081 case TIOCMODS:
2082 if (get_user(mstat, (unsigned __user *)argp)) 2082 if (get_user(mstat, (unsigned __user *)argp))
2083 return -EFAULT; 2083 return -EFAULT;
2084 return pc_tiocmset(tty, file, mstat, ~mstat); 2084 return pc_tiocmset(tty, mstat, ~mstat);
2085 case TIOCSDTR: 2085 case TIOCSDTR:
2086 spin_lock_irqsave(&epca_lock, flags); 2086 spin_lock_irqsave(&epca_lock, flags);
2087 ch->omodem |= ch->m_dtr; 2087 ch->omodem |= ch->m_dtr;
diff --git a/drivers/char/epca.h b/drivers/staging/tty/epca.h
index d414bf2dbf7c..d414bf2dbf7c 100644
--- a/drivers/char/epca.h
+++ b/drivers/staging/tty/epca.h
diff --git a/drivers/char/epcaconfig.h b/drivers/staging/tty/epcaconfig.h
index 55dec067078e..55dec067078e 100644
--- a/drivers/char/epcaconfig.h
+++ b/drivers/staging/tty/epcaconfig.h
diff --git a/drivers/char/ip2/Makefile b/drivers/staging/tty/ip2/Makefile
index 7b78e0dfc5b0..7b78e0dfc5b0 100644
--- a/drivers/char/ip2/Makefile
+++ b/drivers/staging/tty/ip2/Makefile
diff --git a/drivers/char/ip2/i2cmd.c b/drivers/staging/tty/ip2/i2cmd.c
index e7af647800b6..e7af647800b6 100644
--- a/drivers/char/ip2/i2cmd.c
+++ b/drivers/staging/tty/ip2/i2cmd.c
diff --git a/drivers/char/ip2/i2cmd.h b/drivers/staging/tty/ip2/i2cmd.h
index 29277ec6b8ed..29277ec6b8ed 100644
--- a/drivers/char/ip2/i2cmd.h
+++ b/drivers/staging/tty/ip2/i2cmd.h
diff --git a/drivers/char/ip2/i2ellis.c b/drivers/staging/tty/ip2/i2ellis.c
index 29db44de399f..29db44de399f 100644
--- a/drivers/char/ip2/i2ellis.c
+++ b/drivers/staging/tty/ip2/i2ellis.c
diff --git a/drivers/char/ip2/i2ellis.h b/drivers/staging/tty/ip2/i2ellis.h
index fb6df2456018..fb6df2456018 100644
--- a/drivers/char/ip2/i2ellis.h
+++ b/drivers/staging/tty/ip2/i2ellis.h
diff --git a/drivers/char/ip2/i2hw.h b/drivers/staging/tty/ip2/i2hw.h
index c0ba6c05f0cd..c0ba6c05f0cd 100644
--- a/drivers/char/ip2/i2hw.h
+++ b/drivers/staging/tty/ip2/i2hw.h
diff --git a/drivers/char/ip2/i2lib.c b/drivers/staging/tty/ip2/i2lib.c
index 0d10b89218ed..0d10b89218ed 100644
--- a/drivers/char/ip2/i2lib.c
+++ b/drivers/staging/tty/ip2/i2lib.c
diff --git a/drivers/char/ip2/i2lib.h b/drivers/staging/tty/ip2/i2lib.h
index e559e9bac06d..e559e9bac06d 100644
--- a/drivers/char/ip2/i2lib.h
+++ b/drivers/staging/tty/ip2/i2lib.h
diff --git a/drivers/char/ip2/i2pack.h b/drivers/staging/tty/ip2/i2pack.h
index 00342a677c90..00342a677c90 100644
--- a/drivers/char/ip2/i2pack.h
+++ b/drivers/staging/tty/ip2/i2pack.h
diff --git a/drivers/char/ip2/ip2.h b/drivers/staging/tty/ip2/ip2.h
index 936ccc533949..936ccc533949 100644
--- a/drivers/char/ip2/ip2.h
+++ b/drivers/staging/tty/ip2/ip2.h
diff --git a/drivers/char/ip2/ip2ioctl.h b/drivers/staging/tty/ip2/ip2ioctl.h
index aa0a9da85e05..aa0a9da85e05 100644
--- a/drivers/char/ip2/ip2ioctl.h
+++ b/drivers/staging/tty/ip2/ip2ioctl.h
diff --git a/drivers/char/ip2/ip2main.c b/drivers/staging/tty/ip2/ip2main.c
index c3a025356b8b..ea7a8fb08283 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/staging/tty/ip2/ip2main.c
@@ -173,7 +173,7 @@ static void ip2_flush_chars(PTTY);
173static int ip2_write_room(PTTY); 173static int ip2_write_room(PTTY);
174static int ip2_chars_in_buf(PTTY); 174static int ip2_chars_in_buf(PTTY);
175static void ip2_flush_buffer(PTTY); 175static void ip2_flush_buffer(PTTY);
176static int ip2_ioctl(PTTY, struct file *, UINT, ULONG); 176static int ip2_ioctl(PTTY, UINT, ULONG);
177static void ip2_set_termios(PTTY, struct ktermios *); 177static void ip2_set_termios(PTTY, struct ktermios *);
178static void ip2_set_line_discipline(PTTY); 178static void ip2_set_line_discipline(PTTY);
179static void ip2_throttle(PTTY); 179static void ip2_throttle(PTTY);
@@ -181,8 +181,8 @@ static void ip2_unthrottle(PTTY);
181static void ip2_stop(PTTY); 181static void ip2_stop(PTTY);
182static void ip2_start(PTTY); 182static void ip2_start(PTTY);
183static void ip2_hangup(PTTY); 183static void ip2_hangup(PTTY);
184static int ip2_tiocmget(struct tty_struct *tty, struct file *file); 184static int ip2_tiocmget(struct tty_struct *tty);
185static int ip2_tiocmset(struct tty_struct *tty, struct file *file, 185static int ip2_tiocmset(struct tty_struct *tty,
186 unsigned int set, unsigned int clear); 186 unsigned int set, unsigned int clear);
187static int ip2_get_icount(struct tty_struct *tty, 187static int ip2_get_icount(struct tty_struct *tty,
188 struct serial_icounter_struct *icount); 188 struct serial_icounter_struct *icount);
@@ -2038,7 +2038,7 @@ ip2_stop ( PTTY tty )
2038/* Device Ioctl Section */ 2038/* Device Ioctl Section */
2039/******************************************************************************/ 2039/******************************************************************************/
2040 2040
2041static int ip2_tiocmget(struct tty_struct *tty, struct file *file) 2041static int ip2_tiocmget(struct tty_struct *tty)
2042{ 2042{
2043 i2ChanStrPtr pCh = DevTable[tty->index]; 2043 i2ChanStrPtr pCh = DevTable[tty->index];
2044#ifdef ENABLE_DSSNOW 2044#ifdef ENABLE_DSSNOW
@@ -2085,7 +2085,7 @@ static int ip2_tiocmget(struct tty_struct *tty, struct file *file)
2085 | ((pCh->dataSetIn & I2_CTS) ? TIOCM_CTS : 0); 2085 | ((pCh->dataSetIn & I2_CTS) ? TIOCM_CTS : 0);
2086} 2086}
2087 2087
2088static int ip2_tiocmset(struct tty_struct *tty, struct file *file, 2088static int ip2_tiocmset(struct tty_struct *tty,
2089 unsigned int set, unsigned int clear) 2089 unsigned int set, unsigned int clear)
2090{ 2090{
2091 i2ChanStrPtr pCh = DevTable[tty->index]; 2091 i2ChanStrPtr pCh = DevTable[tty->index];
@@ -2127,7 +2127,7 @@ static int ip2_tiocmset(struct tty_struct *tty, struct file *file,
2127/* */ 2127/* */
2128/******************************************************************************/ 2128/******************************************************************************/
2129static int 2129static int
2130ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) 2130ip2_ioctl ( PTTY tty, UINT cmd, ULONG arg )
2131{ 2131{
2132 wait_queue_t wait; 2132 wait_queue_t wait;
2133 i2ChanStrPtr pCh = DevTable[tty->index]; 2133 i2ChanStrPtr pCh = DevTable[tty->index];
diff --git a/drivers/char/ip2/ip2trace.h b/drivers/staging/tty/ip2/ip2trace.h
index da20435dc8a6..da20435dc8a6 100644
--- a/drivers/char/ip2/ip2trace.h
+++ b/drivers/staging/tty/ip2/ip2trace.h
diff --git a/drivers/char/ip2/ip2types.h b/drivers/staging/tty/ip2/ip2types.h
index 9d67b260b2f6..9d67b260b2f6 100644
--- a/drivers/char/ip2/ip2types.h
+++ b/drivers/staging/tty/ip2/ip2types.h
diff --git a/drivers/char/istallion.c b/drivers/staging/tty/istallion.c
index 7c6de4c92458..0b266272cccd 100644
--- a/drivers/char/istallion.c
+++ b/drivers/staging/tty/istallion.c
@@ -603,7 +603,7 @@ static int stli_putchar(struct tty_struct *tty, unsigned char ch);
603static void stli_flushchars(struct tty_struct *tty); 603static void stli_flushchars(struct tty_struct *tty);
604static int stli_writeroom(struct tty_struct *tty); 604static int stli_writeroom(struct tty_struct *tty);
605static int stli_charsinbuffer(struct tty_struct *tty); 605static int stli_charsinbuffer(struct tty_struct *tty);
606static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); 606static int stli_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
607static void stli_settermios(struct tty_struct *tty, struct ktermios *old); 607static void stli_settermios(struct tty_struct *tty, struct ktermios *old);
608static void stli_throttle(struct tty_struct *tty); 608static void stli_throttle(struct tty_struct *tty);
609static void stli_unthrottle(struct tty_struct *tty); 609static void stli_unthrottle(struct tty_struct *tty);
@@ -1501,7 +1501,7 @@ static int stli_setserial(struct tty_struct *tty, struct serial_struct __user *s
1501 1501
1502/*****************************************************************************/ 1502/*****************************************************************************/
1503 1503
1504static int stli_tiocmget(struct tty_struct *tty, struct file *file) 1504static int stli_tiocmget(struct tty_struct *tty)
1505{ 1505{
1506 struct stliport *portp = tty->driver_data; 1506 struct stliport *portp = tty->driver_data;
1507 struct stlibrd *brdp; 1507 struct stlibrd *brdp;
@@ -1524,7 +1524,7 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file)
1524 return stli_mktiocm(portp->asig.sigvalue); 1524 return stli_mktiocm(portp->asig.sigvalue);
1525} 1525}
1526 1526
1527static int stli_tiocmset(struct tty_struct *tty, struct file *file, 1527static int stli_tiocmset(struct tty_struct *tty,
1528 unsigned int set, unsigned int clear) 1528 unsigned int set, unsigned int clear)
1529{ 1529{
1530 struct stliport *portp = tty->driver_data; 1530 struct stliport *portp = tty->driver_data;
@@ -1556,7 +1556,7 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file,
1556 sizeof(asysigs_t), 0); 1556 sizeof(asysigs_t), 0);
1557} 1557}
1558 1558
1559static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) 1559static int stli_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
1560{ 1560{
1561 struct stliport *portp; 1561 struct stliport *portp;
1562 struct stlibrd *brdp; 1562 struct stlibrd *brdp;
diff --git a/drivers/char/riscom8.c b/drivers/staging/tty/riscom8.c
index af4de1fe8445..602643a40b4b 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/staging/tty/riscom8.c
@@ -1086,7 +1086,7 @@ static int rc_chars_in_buffer(struct tty_struct *tty)
1086 return port->xmit_cnt; 1086 return port->xmit_cnt;
1087} 1087}
1088 1088
1089static int rc_tiocmget(struct tty_struct *tty, struct file *file) 1089static int rc_tiocmget(struct tty_struct *tty)
1090{ 1090{
1091 struct riscom_port *port = tty->driver_data; 1091 struct riscom_port *port = tty->driver_data;
1092 struct riscom_board *bp; 1092 struct riscom_board *bp;
@@ -1115,8 +1115,8 @@ static int rc_tiocmget(struct tty_struct *tty, struct file *file)
1115 return result; 1115 return result;
1116} 1116}
1117 1117
1118static int rc_tiocmset(struct tty_struct *tty, struct file *file, 1118static int rc_tiocmset(struct tty_struct *tty,
1119 unsigned int set, unsigned int clear) 1119 unsigned int set, unsigned int clear)
1120{ 1120{
1121 struct riscom_port *port = tty->driver_data; 1121 struct riscom_port *port = tty->driver_data;
1122 unsigned long flags; 1122 unsigned long flags;
@@ -1236,7 +1236,7 @@ static int rc_get_serial_info(struct riscom_port *port,
1236 return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0; 1236 return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0;
1237} 1237}
1238 1238
1239static int rc_ioctl(struct tty_struct *tty, struct file *filp, 1239static int rc_ioctl(struct tty_struct *tty,
1240 unsigned int cmd, unsigned long arg) 1240 unsigned int cmd, unsigned long arg)
1241{ 1241{
1242 struct riscom_port *port = tty->driver_data; 1242 struct riscom_port *port = tty->driver_data;
diff --git a/drivers/char/riscom8.h b/drivers/staging/tty/riscom8.h
index c9876b3f9714..c9876b3f9714 100644
--- a/drivers/char/riscom8.h
+++ b/drivers/staging/tty/riscom8.h
diff --git a/drivers/char/riscom8_reg.h b/drivers/staging/tty/riscom8_reg.h
index a32475ed0d18..a32475ed0d18 100644
--- a/drivers/char/riscom8_reg.h
+++ b/drivers/staging/tty/riscom8_reg.h
diff --git a/drivers/char/serial167.c b/drivers/staging/tty/serial167.c
index 748c3b0ecd89..674af6933978 100644
--- a/drivers/char/serial167.c
+++ b/drivers/staging/tty/serial167.c
@@ -1308,7 +1308,7 @@ check_and_exit:
1308 return startup(info); 1308 return startup(info);
1309} /* set_serial_info */ 1309} /* set_serial_info */
1310 1310
1311static int cy_tiocmget(struct tty_struct *tty, struct file *file) 1311static int cy_tiocmget(struct tty_struct *tty)
1312{ 1312{
1313 struct cyclades_port *info = tty->driver_data; 1313 struct cyclades_port *info = tty->driver_data;
1314 int channel; 1314 int channel;
@@ -1331,8 +1331,7 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
1331} /* cy_tiocmget */ 1331} /* cy_tiocmget */
1332 1332
1333static int 1333static int
1334cy_tiocmset(struct tty_struct *tty, struct file *file, 1334cy_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
1335 unsigned int set, unsigned int clear)
1336{ 1335{
1337 struct cyclades_port *info = tty->driver_data; 1336 struct cyclades_port *info = tty->driver_data;
1338 int channel; 1337 int channel;
@@ -1493,7 +1492,7 @@ get_default_timeout(struct cyclades_port *info, unsigned long __user * value)
1493} 1492}
1494 1493
1495static int 1494static int
1496cy_ioctl(struct tty_struct *tty, struct file *file, 1495cy_ioctl(struct tty_struct *tty,
1497 unsigned int cmd, unsigned long arg) 1496 unsigned int cmd, unsigned long arg)
1498{ 1497{
1499 struct cyclades_port *info = tty->driver_data; 1498 struct cyclades_port *info = tty->driver_data;
diff --git a/drivers/char/specialix.c b/drivers/staging/tty/specialix.c
index c2bca3f25ef3..47e5753f732a 100644
--- a/drivers/char/specialix.c
+++ b/drivers/staging/tty/specialix.c
@@ -1737,7 +1737,7 @@ static int sx_chars_in_buffer(struct tty_struct *tty)
1737 return port->xmit_cnt; 1737 return port->xmit_cnt;
1738} 1738}
1739 1739
1740static int sx_tiocmget(struct tty_struct *tty, struct file *file) 1740static int sx_tiocmget(struct tty_struct *tty)
1741{ 1741{
1742 struct specialix_port *port = tty->driver_data; 1742 struct specialix_port *port = tty->driver_data;
1743 struct specialix_board *bp; 1743 struct specialix_board *bp;
@@ -1778,7 +1778,7 @@ static int sx_tiocmget(struct tty_struct *tty, struct file *file)
1778} 1778}
1779 1779
1780 1780
1781static int sx_tiocmset(struct tty_struct *tty, struct file *file, 1781static int sx_tiocmset(struct tty_struct *tty,
1782 unsigned int set, unsigned int clear) 1782 unsigned int set, unsigned int clear)
1783{ 1783{
1784 struct specialix_port *port = tty->driver_data; 1784 struct specialix_port *port = tty->driver_data;
@@ -1928,7 +1928,7 @@ static int sx_get_serial_info(struct specialix_port *port,
1928} 1928}
1929 1929
1930 1930
1931static int sx_ioctl(struct tty_struct *tty, struct file *filp, 1931static int sx_ioctl(struct tty_struct *tty,
1932 unsigned int cmd, unsigned long arg) 1932 unsigned int cmd, unsigned long arg)
1933{ 1933{
1934 struct specialix_port *port = tty->driver_data; 1934 struct specialix_port *port = tty->driver_data;
diff --git a/drivers/char/specialix_io8.h b/drivers/staging/tty/specialix_io8.h
index c63005274d9b..c63005274d9b 100644
--- a/drivers/char/specialix_io8.h
+++ b/drivers/staging/tty/specialix_io8.h
diff --git a/drivers/char/stallion.c b/drivers/staging/tty/stallion.c
index 461a5a045517..4fff5cd3b163 100644
--- a/drivers/char/stallion.c
+++ b/drivers/staging/tty/stallion.c
@@ -1094,7 +1094,7 @@ static int stl_setserial(struct tty_struct *tty, struct serial_struct __user *sp
1094 1094
1095/*****************************************************************************/ 1095/*****************************************************************************/
1096 1096
1097static int stl_tiocmget(struct tty_struct *tty, struct file *file) 1097static int stl_tiocmget(struct tty_struct *tty)
1098{ 1098{
1099 struct stlport *portp; 1099 struct stlport *portp;
1100 1100
@@ -1107,7 +1107,7 @@ static int stl_tiocmget(struct tty_struct *tty, struct file *file)
1107 return stl_getsignals(portp); 1107 return stl_getsignals(portp);
1108} 1108}
1109 1109
1110static int stl_tiocmset(struct tty_struct *tty, struct file *file, 1110static int stl_tiocmset(struct tty_struct *tty,
1111 unsigned int set, unsigned int clear) 1111 unsigned int set, unsigned int clear)
1112{ 1112{
1113 struct stlport *portp; 1113 struct stlport *portp;
@@ -1132,14 +1132,13 @@ static int stl_tiocmset(struct tty_struct *tty, struct file *file,
1132 return 0; 1132 return 0;
1133} 1133}
1134 1134
1135static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) 1135static int stl_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
1136{ 1136{
1137 struct stlport *portp; 1137 struct stlport *portp;
1138 int rc; 1138 int rc;
1139 void __user *argp = (void __user *)arg; 1139 void __user *argp = (void __user *)arg;
1140 1140
1141 pr_debug("stl_ioctl(tty=%p,file=%p,cmd=%x,arg=%lx)\n", tty, file, cmd, 1141 pr_debug("stl_ioctl(tty=%p,cmd=%x,arg=%lx)\n", tty, cmd, arg);
1142 arg);
1143 1142
1144 portp = tty->driver_data; 1143 portp = tty->driver_data;
1145 if (portp == NULL) 1144 if (portp == NULL)
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
new file mode 100644
index 000000000000..3fd7199301b6
--- /dev/null
+++ b/drivers/tty/Kconfig
@@ -0,0 +1,321 @@
1config VT
2 bool "Virtual terminal" if EXPERT
3 depends on !S390
4 select INPUT
5 default y
6 ---help---
7 If you say Y here, you will get support for terminal devices with
8 display and keyboard devices. These are called "virtual" because you
9 can run several virtual terminals (also called virtual consoles) on
10 one physical terminal. This is rather useful, for example one
11 virtual terminal can collect system messages and warnings, another
12 one can be used for a text-mode user session, and a third could run
13 an X session, all in parallel. Switching between virtual terminals
14 is done with certain key combinations, usually Alt-<function key>.
15
16 The setterm command ("man setterm") can be used to change the
17 properties (such as colors or beeping) of a virtual terminal. The
18 man page console_codes(4) ("man console_codes") contains the special
19 character sequences that can be used to change those properties
20 directly. The fonts used on virtual terminals can be changed with
21 the setfont ("man setfont") command and the key bindings are defined
22 with the loadkeys ("man loadkeys") command.
23
24 You need at least one virtual terminal device in order to make use
25 of your keyboard and monitor. Therefore, only people configuring an
26 embedded system would want to say N here in order to save some
27 memory; the only way to log into such a system is then via a serial
28 or network connection.
29
30 If unsure, say Y, or else you won't be able to do much with your new
31 shiny Linux system :-)
32
33config CONSOLE_TRANSLATIONS
34 depends on VT
35 default y
36 bool "Enable character translations in console" if EXPERT
37 ---help---
38 This enables support for font mapping and Unicode translation
39 on virtual consoles.
40
41config VT_CONSOLE
42 bool "Support for console on virtual terminal" if EXPERT
43 depends on VT
44 default y
45 ---help---
46 The system console is the device which receives all kernel messages
47 and warnings and which allows logins in single user mode. If you
48 answer Y here, a virtual terminal (the device used to interact with
49 a physical terminal) can be used as system console. This is the most
50 common mode of operations, so you should say Y here unless you want
51 the kernel messages be output only to a serial port (in which case
52 you should say Y to "Console on serial port", below).
53
54 If you do say Y here, by default the currently visible virtual
55 terminal (/dev/tty0) will be used as system console. You can change
56 that with a kernel command line option such as "console=tty3" which
57 would use the third virtual terminal as system console. (Try "man
58 bootparam" or see the documentation of your boot loader (lilo or
59 loadlin) about how to pass options to the kernel at boot time.)
60
61 If unsure, say Y.
62
63config HW_CONSOLE
64 bool
65 depends on VT && !S390 && !UML
66 default y
67
68config VT_HW_CONSOLE_BINDING
69 bool "Support for binding and unbinding console drivers"
70 depends on HW_CONSOLE
71 default n
72 ---help---
73 The virtual terminal is the device that interacts with the physical
74 terminal through console drivers. On these systems, at least one
75 console driver is loaded. In other configurations, additional console
76 drivers may be enabled, such as the framebuffer console. If more than
77 1 console driver is enabled, setting this to 'y' will allow you to
78 select the console driver that will serve as the backend for the
79 virtual terminals.
80
81 See <file:Documentation/console/console.txt> for more
82 information. For framebuffer console users, please refer to
83 <file:Documentation/fb/fbcon.txt>.
84
85config UNIX98_PTYS
86 bool "Unix98 PTY support" if EXPERT
87 default y
88 ---help---
89 A pseudo terminal (PTY) is a software device consisting of two
90 halves: a master and a slave. The slave device behaves identical to
91 a physical terminal; the master device is used by a process to
92 read data from and write data to the slave, thereby emulating a
93 terminal. Typical programs for the master side are telnet servers
94 and xterms.
95
96 Linux has traditionally used the BSD-like names /dev/ptyxx for
97 masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
98 has a number of problems. The GNU C library glibc 2.1 and later,
99 however, supports the Unix98 naming standard: in order to acquire a
100 pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
101 terminal is then made available to the process and the pseudo
102 terminal slave can be accessed as /dev/pts/<number>. What was
103 traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
104
105 All modern Linux systems use the Unix98 ptys. Say Y unless
106 you're on an embedded system and want to conserve memory.
107
108config DEVPTS_MULTIPLE_INSTANCES
109 bool "Support multiple instances of devpts"
110 depends on UNIX98_PTYS
111 default n
112 ---help---
113 Enable support for multiple instances of devpts filesystem.
114 If you want to have isolated PTY namespaces (eg: in containers),
115 say Y here. Otherwise, say N. If enabled, each mount of devpts
116 filesystem with the '-o newinstance' option will create an
117 independent PTY namespace.
118
119config LEGACY_PTYS
120 bool "Legacy (BSD) PTY support"
121 default y
122 ---help---
123 A pseudo terminal (PTY) is a software device consisting of two
124 halves: a master and a slave. The slave device behaves identical to
125 a physical terminal; the master device is used by a process to
126 read data from and write data to the slave, thereby emulating a
127 terminal. Typical programs for the master side are telnet servers
128 and xterms.
129
130 Linux has traditionally used the BSD-like names /dev/ptyxx
131 for masters and /dev/ttyxx for slaves of pseudo
132 terminals. This scheme has a number of problems, including
133 security. This option enables these legacy devices; on most
134 systems, it is safe to say N.
135
136
137config LEGACY_PTY_COUNT
138 int "Maximum number of legacy PTY in use"
139 depends on LEGACY_PTYS
140 range 0 256
141 default "256"
142 ---help---
143 The maximum number of legacy PTYs that can be used at any one time.
144 The default is 256, and should be more than enough. Embedded
145 systems may want to reduce this to save memory.
146
147 When not in use, each legacy PTY occupies 12 bytes on 32-bit
148 architectures and 24 bytes on 64-bit architectures.
149
150config BFIN_JTAG_COMM
151 tristate "Blackfin JTAG Communication"
152 depends on BLACKFIN
153 help
154 Add support for emulating a TTY device over the Blackfin JTAG.
155
156 To compile this driver as a module, choose M here: the
157 module will be called bfin_jtag_comm.
158
159config BFIN_JTAG_COMM_CONSOLE
160 bool "Console on Blackfin JTAG"
161 depends on BFIN_JTAG_COMM=y
162
163config SERIAL_NONSTANDARD
164 bool "Non-standard serial port support"
165 depends on HAS_IOMEM
166 ---help---
167 Say Y here if you have any non-standard serial boards -- boards
168 which aren't supported using the standard "dumb" serial driver.
169 This includes intelligent serial boards such as Cyclades,
170 Digiboards, etc. These are usually used for systems that need many
171 serial ports because they serve many terminals or dial-in
172 connections.
173
174 Note that the answer to this question won't directly affect the
175 kernel: saying N will just cause the configurator to skip all
176 the questions about non-standard serial boards.
177
178 Most people can say N here.
179
180config ROCKETPORT
181 tristate "Comtrol RocketPort support"
182 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
183 help
184 This driver supports Comtrol RocketPort and RocketModem PCI boards.
185 These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or
186 modems. For information about the RocketPort/RocketModem boards
187 and this driver read <file:Documentation/serial/rocket.txt>.
188
189 To compile this driver as a module, choose M here: the
190 module will be called rocket.
191
192 If you want to compile this driver into the kernel, say Y here. If
193 you don't have a Comtrol RocketPort/RocketModem card installed, say N.
194
195config CYCLADES
196 tristate "Cyclades async mux support"
197 depends on SERIAL_NONSTANDARD && (PCI || ISA)
198 select FW_LOADER
199 ---help---
200 This driver supports Cyclades Z and Y multiserial boards.
201 You would need something like this to connect more than two modems to
202 your Linux box, for instance in order to become a dial-in server.
203
204 For information about the Cyclades-Z card, read
205 <file:Documentation/serial/README.cycladesZ>.
206
207 To compile this driver as a module, choose M here: the
208 module will be called cyclades.
209
210 If you haven't heard about it, it's safe to say N.
211
212config CYZ_INTR
213 bool "Cyclades-Z interrupt mode operation (EXPERIMENTAL)"
214 depends on EXPERIMENTAL && CYCLADES
215 help
216 The Cyclades-Z family of multiport cards allows 2 (two) driver op
217 modes: polling and interrupt. In polling mode, the driver will check
218 the status of the Cyclades-Z ports every certain amount of time
219 (which is called polling cycle and is configurable). In interrupt
220 mode, it will use an interrupt line (IRQ) in order to check the
221 status of the Cyclades-Z ports. The default op mode is polling. If
222 unsure, say N.
223
224config MOXA_INTELLIO
225 tristate "Moxa Intellio support"
226 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
227 select FW_LOADER
228 help
229 Say Y here if you have a Moxa Intellio multiport serial card.
230
231 To compile this driver as a module, choose M here: the
232 module will be called moxa.
233
234config MOXA_SMARTIO
235 tristate "Moxa SmartIO support v. 2.0"
236 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
237 help
238 Say Y here if you have a Moxa SmartIO multiport serial card and/or
239 want to help develop a new version of this driver.
240
241 This is upgraded (1.9.1) driver from original Moxa drivers with
242 changes finally resulting in PCI probing.
243
244 This driver can also be built as a module. The module will be called
245 mxser. If you want to do that, say M here.
246
247config SYNCLINK
248 tristate "Microgate SyncLink card support"
249 depends on SERIAL_NONSTANDARD && PCI && ISA_DMA_API
250 help
251 Provides support for the SyncLink ISA and PCI multiprotocol serial
252 adapters. These adapters support asynchronous and HDLC bit
253 synchronous communication up to 10Mbps (PCI adapter).
254
255 This driver can only be built as a module ( = code which can be
256 inserted in and removed from the running kernel whenever you want).
257 The module will be called synclink. If you want to do that, say M
258 here.
259
260config SYNCLINKMP
261 tristate "SyncLink Multiport support"
262 depends on SERIAL_NONSTANDARD && PCI
263 help
264 Enable support for the SyncLink Multiport (2 or 4 ports)
265 serial adapter, running asynchronous and HDLC communications up
266 to 2.048Mbps. Each ports is independently selectable for
267 RS-232, V.35, RS-449, RS-530, and X.21
268
269 This driver may be built as a module ( = code which can be
270 inserted in and removed from the running kernel whenever you want).
271 The module will be called synclinkmp. If you want to do that, say M
272 here.
273
274config SYNCLINK_GT
275 tristate "SyncLink GT/AC support"
276 depends on SERIAL_NONSTANDARD && PCI
277 help
278 Support for SyncLink GT and SyncLink AC families of
279 synchronous and asynchronous serial adapters
280 manufactured by Microgate Systems, Ltd. (www.microgate.com)
281
282config NOZOMI
283 tristate "HSDPA Broadband Wireless Data Card - Globe Trotter"
284 depends on PCI && EXPERIMENTAL
285 help
286 If you have a HSDPA driver Broadband Wireless Data Card -
287 Globe Trotter PCMCIA card, say Y here.
288
289 To compile this driver as a module, choose M here, the module
290 will be called nozomi.
291
292config ISI
293 tristate "Multi-Tech multiport card support (EXPERIMENTAL)"
294 depends on SERIAL_NONSTANDARD && PCI
295 select FW_LOADER
296 help
297 This is a driver for the Multi-Tech cards which provide several
298 serial ports. The driver is experimental and can currently only be
299 built as a module. The module will be called isicom.
300 If you want to do that, choose M here.
301
302config N_HDLC
303 tristate "HDLC line discipline support"
304 depends on SERIAL_NONSTANDARD
305 help
306 Allows synchronous HDLC communications with tty device drivers that
307 support synchronous HDLC such as the Microgate SyncLink adapter.
308
309 This driver can be built as a module ( = code which can be
310 inserted in and removed from the running kernel whenever you want).
311 The module will be called n_hdlc. If you want to do that, say M
312 here.
313
314config N_GSM
315 tristate "GSM MUX line discipline support (EXPERIMENTAL)"
316 depends on EXPERIMENTAL
317 depends on NET
318 help
319 This line discipline provides support for the GSM MUX protocol and
320 presents the mux as a set of 61 individual tty devices.
321
diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile
index 396277216e4f..690522fcb338 100644
--- a/drivers/tty/Makefile
+++ b/drivers/tty/Makefile
@@ -11,3 +11,18 @@ obj-$(CONFIG_R3964) += n_r3964.o
11obj-y += vt/ 11obj-y += vt/
12obj-$(CONFIG_HVC_DRIVER) += hvc/ 12obj-$(CONFIG_HVC_DRIVER) += hvc/
13obj-y += serial/ 13obj-y += serial/
14
15# tty drivers
16obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
17obj-$(CONFIG_BFIN_JTAG_COMM) += bfin_jtag_comm.o
18obj-$(CONFIG_CYCLADES) += cyclades.o
19obj-$(CONFIG_ISI) += isicom.o
20obj-$(CONFIG_MOXA_INTELLIO) += moxa.o
21obj-$(CONFIG_MOXA_SMARTIO) += mxser.o
22obj-$(CONFIG_NOZOMI) += nozomi.o
23obj-$(CONFIG_ROCKETPORT) += rocket.o
24obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o
25obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o
26obj-$(CONFIG_SYNCLINK) += synclink.o
27
28obj-y += ipwireless/
diff --git a/drivers/char/amiserial.c b/drivers/tty/amiserial.c
index 6ee3348bc3e4..f214e5022472 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1194,7 +1194,7 @@ static int get_lsr_info(struct async_struct * info, unsigned int __user *value)
1194} 1194}
1195 1195
1196 1196
1197static int rs_tiocmget(struct tty_struct *tty, struct file *file) 1197static int rs_tiocmget(struct tty_struct *tty)
1198{ 1198{
1199 struct async_struct * info = tty->driver_data; 1199 struct async_struct * info = tty->driver_data;
1200 unsigned char control, status; 1200 unsigned char control, status;
@@ -1216,8 +1216,8 @@ static int rs_tiocmget(struct tty_struct *tty, struct file *file)
1216 | (!(status & SER_CTS) ? TIOCM_CTS : 0); 1216 | (!(status & SER_CTS) ? TIOCM_CTS : 0);
1217} 1217}
1218 1218
1219static int rs_tiocmset(struct tty_struct *tty, struct file *file, 1219static int rs_tiocmset(struct tty_struct *tty, unsigned int set,
1220 unsigned int set, unsigned int clear) 1220 unsigned int clear)
1221{ 1221{
1222 struct async_struct * info = tty->driver_data; 1222 struct async_struct * info = tty->driver_data;
1223 unsigned long flags; 1223 unsigned long flags;
@@ -1293,7 +1293,7 @@ static int rs_get_icount(struct tty_struct *tty,
1293 return 0; 1293 return 0;
1294} 1294}
1295 1295
1296static int rs_ioctl(struct tty_struct *tty, struct file * file, 1296static int rs_ioctl(struct tty_struct *tty,
1297 unsigned int cmd, unsigned long arg) 1297 unsigned int cmd, unsigned long arg)
1298{ 1298{
1299 struct async_struct * info = tty->driver_data; 1299 struct async_struct * info = tty->driver_data;
diff --git a/drivers/char/bfin_jtag_comm.c b/drivers/tty/bfin_jtag_comm.c
index 16402445f2b2..16402445f2b2 100644
--- a/drivers/char/bfin_jtag_comm.c
+++ b/drivers/tty/bfin_jtag_comm.c
diff --git a/drivers/char/cyclades.c b/drivers/tty/cyclades.c
index 4f152c28f40e..c99728f0cd9f 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -2429,7 +2429,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
2429 return put_user(result, (unsigned long __user *)value); 2429 return put_user(result, (unsigned long __user *)value);
2430} 2430}
2431 2431
2432static int cy_tiocmget(struct tty_struct *tty, struct file *file) 2432static int cy_tiocmget(struct tty_struct *tty)
2433{ 2433{
2434 struct cyclades_port *info = tty->driver_data; 2434 struct cyclades_port *info = tty->driver_data;
2435 struct cyclades_card *card; 2435 struct cyclades_card *card;
@@ -2483,7 +2483,7 @@ end:
2483} /* cy_tiomget */ 2483} /* cy_tiomget */
2484 2484
2485static int 2485static int
2486cy_tiocmset(struct tty_struct *tty, struct file *file, 2486cy_tiocmset(struct tty_struct *tty,
2487 unsigned int set, unsigned int clear) 2487 unsigned int set, unsigned int clear)
2488{ 2488{
2489 struct cyclades_port *info = tty->driver_data; 2489 struct cyclades_port *info = tty->driver_data;
@@ -2680,7 +2680,7 @@ static int cy_cflags_changed(struct cyclades_port *info, unsigned long arg,
2680 * not recognized by the driver, it should return ENOIOCTLCMD. 2680 * not recognized by the driver, it should return ENOIOCTLCMD.
2681 */ 2681 */
2682static int 2682static int
2683cy_ioctl(struct tty_struct *tty, struct file *file, 2683cy_ioctl(struct tty_struct *tty,
2684 unsigned int cmd, unsigned long arg) 2684 unsigned int cmd, unsigned long arg)
2685{ 2685{
2686 struct cyclades_port *info = tty->driver_data; 2686 struct cyclades_port *info = tty->driver_data;
diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
new file mode 100644
index 000000000000..6f2c9809f1fb
--- /dev/null
+++ b/drivers/tty/hvc/Kconfig
@@ -0,0 +1,105 @@
1config HVC_DRIVER
2 bool
3 help
4 Generic "hypervisor virtual console" infrastructure for various
5 hypervisors (pSeries, iSeries, Xen, lguest).
6 It will automatically be selected if one of the back-end console drivers
7 is selected.
8
9config HVC_IRQ
10 bool
11
12config HVC_CONSOLE
13 bool "pSeries Hypervisor Virtual Console support"
14 depends on PPC_PSERIES
15 select HVC_DRIVER
16 select HVC_IRQ
17 help
18 pSeries machines when partitioned support a hypervisor virtual
19 console. This driver allows each pSeries partition to have a console
20 which is accessed via the HMC.
21
22config HVC_ISERIES
23 bool "iSeries Hypervisor Virtual Console support"
24 depends on PPC_ISERIES
25 default y
26 select HVC_DRIVER
27 select HVC_IRQ
28 select VIOPATH
29 help
30 iSeries machines support a hypervisor virtual console.
31
32config HVC_RTAS
33 bool "IBM RTAS Console support"
34 depends on PPC_RTAS
35 select HVC_DRIVER
36 help
37 IBM Console device driver which makes use of RTAS
38
39config HVC_BEAT
40 bool "Toshiba's Beat Hypervisor Console support"
41 depends on PPC_CELLEB
42 select HVC_DRIVER
43 help
44 Toshiba's Cell Reference Set Beat Console device driver
45
46config HVC_IUCV
47 bool "z/VM IUCV Hypervisor console support (VM only)"
48 depends on S390
49 select HVC_DRIVER
50 select IUCV
51 default y
52 help
53 This driver provides a Hypervisor console (HVC) back-end to access
54 a Linux (console) terminal via a z/VM IUCV communication path.
55
56config HVC_XEN
57 bool "Xen Hypervisor Console support"
58 depends on XEN
59 select HVC_DRIVER
60 select HVC_IRQ
61 default y
62 help
63 Xen virtual console device driver
64
65config HVC_UDBG
66 bool "udbg based fake hypervisor console"
67 depends on PPC && EXPERIMENTAL
68 select HVC_DRIVER
69 default n
70
71config HVC_DCC
72 bool "ARM JTAG DCC console"
73 depends on ARM
74 select HVC_DRIVER
75 help
76 This console uses the JTAG DCC on ARM to create a console under the HVC
77 driver. This console is used through a JTAG only on ARM. If you don't have
78 a JTAG then you probably don't want this option.
79
80config HVC_BFIN_JTAG
81 bool "Blackfin JTAG console"
82 depends on BLACKFIN
83 select HVC_DRIVER
84 help
85 This console uses the Blackfin JTAG to create a console under the
86 the HVC driver. If you don't have JTAG, then you probably don't
87 want this option.
88
89config HVCS
90 tristate "IBM Hypervisor Virtual Console Server support"
91 depends on PPC_PSERIES && HVC_CONSOLE
92 help
93 Partitionable IBM Power5 ppc64 machines allow hosting of
94 firmware virtual consoles from one Linux partition by
95 another Linux partition. This driver allows console data
96 from Linux partitions to be accessed through TTY device
97 interfaces in the device tree of a Linux partition running
98 this driver.
99
100 To compile this driver as a module, choose M here: the
101 module will be called hvcs. Additionally, this module
102 will depend on arch specific APIs exported from hvcserver.ko
103 which will also be compiled when this driver is built as a
104 module.
105
diff --git a/drivers/tty/hvc/Makefile b/drivers/tty/hvc/Makefile
index d79e7e9bf9d2..40a25d93fe52 100644
--- a/drivers/tty/hvc/Makefile
+++ b/drivers/tty/hvc/Makefile
@@ -9,4 +9,5 @@ obj-$(CONFIG_HVC_IRQ) += hvc_irq.o
9obj-$(CONFIG_HVC_XEN) += hvc_xen.o 9obj-$(CONFIG_HVC_XEN) += hvc_xen.o
10obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o 10obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o
11obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o 11obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o
12obj-$(CONFIG_HVC_BFIN_JTAG) += hvc_bfin_jtag.o
12obj-$(CONFIG_HVCS) += hvcs.o 13obj-$(CONFIG_HVCS) += hvcs.o
diff --git a/drivers/tty/hvc/hvc_bfin_jtag.c b/drivers/tty/hvc/hvc_bfin_jtag.c
new file mode 100644
index 000000000000..31d6cc6a77af
--- /dev/null
+++ b/drivers/tty/hvc/hvc_bfin_jtag.c
@@ -0,0 +1,105 @@
1/*
2 * Console via Blackfin JTAG Communication
3 *
4 * Copyright 2008-2011 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 */
10
11#include <linux/console.h>
12#include <linux/delay.h>
13#include <linux/err.h>
14#include <linux/init.h>
15#include <linux/moduleparam.h>
16#include <linux/types.h>
17
18#include "hvc_console.h"
19
20/* See the Debug/Emulation chapter in the HRM */
21#define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */
22#define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */
23#define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */
24#define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */
25
26/* Helper functions to glue the register API to simple C operations */
27static inline uint32_t bfin_write_emudat(uint32_t emudat)
28{
29 __asm__ __volatile__("emudat = %0;" : : "d"(emudat));
30 return emudat;
31}
32
33static inline uint32_t bfin_read_emudat(void)
34{
35 uint32_t emudat;
36 __asm__ __volatile__("%0 = emudat;" : "=d"(emudat));
37 return emudat;
38}
39
40/* Send data to the host */
41static int hvc_bfin_put_chars(uint32_t vt, const char *buf, int count)
42{
43 static uint32_t outbound_len;
44 uint32_t emudat;
45 int ret;
46
47 if (bfin_read_DBGSTAT() & EMUDOF)
48 return 0;
49
50 if (!outbound_len) {
51 outbound_len = count;
52 bfin_write_emudat(outbound_len);
53 return 0;
54 }
55
56 ret = min(outbound_len, (uint32_t)4);
57 memcpy(&emudat, buf, ret);
58 bfin_write_emudat(emudat);
59 outbound_len -= ret;
60
61 return ret;
62}
63
64/* Receive data from the host */
65static int hvc_bfin_get_chars(uint32_t vt, char *buf, int count)
66{
67 static uint32_t inbound_len;
68 uint32_t emudat;
69 int ret;
70
71 if (!(bfin_read_DBGSTAT() & EMUDIF))
72 return 0;
73 emudat = bfin_read_emudat();
74
75 if (!inbound_len) {
76 inbound_len = emudat;
77 return 0;
78 }
79
80 ret = min(inbound_len, (uint32_t)4);
81 memcpy(buf, &emudat, ret);
82 inbound_len -= ret;
83
84 return ret;
85}
86
87/* Glue the HVC layers to the Blackfin layers */
88static const struct hv_ops hvc_bfin_get_put_ops = {
89 .get_chars = hvc_bfin_get_chars,
90 .put_chars = hvc_bfin_put_chars,
91};
92
93static int __init hvc_bfin_console_init(void)
94{
95 hvc_instantiate(0, 0, &hvc_bfin_get_put_ops);
96 return 0;
97}
98console_initcall(hvc_bfin_console_init);
99
100static int __init hvc_bfin_init(void)
101{
102 hvc_alloc(0, 0, &hvc_bfin_get_put_ops, 128);
103 return 0;
104}
105device_initcall(hvc_bfin_init);
diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c
index 6470f63deb4b..435f6facbc23 100644
--- a/drivers/tty/hvc/hvc_dcc.c
+++ b/drivers/tty/hvc/hvc_dcc.c
@@ -33,54 +33,29 @@
33static inline u32 __dcc_getstatus(void) 33static inline u32 __dcc_getstatus(void)
34{ 34{
35 u32 __ret; 35 u32 __ret;
36 36 asm volatile("mrc p14, 0, %0, c0, c1, 0 @ read comms ctrl reg"
37 asm("mrc p14, 0, %0, c0, c1, 0 @ read comms ctrl reg"
38 : "=r" (__ret) : : "cc"); 37 : "=r" (__ret) : : "cc");
39 38
40 return __ret; 39 return __ret;
41} 40}
42 41
43 42
44#if defined(CONFIG_CPU_V7)
45static inline char __dcc_getchar(void) 43static inline char __dcc_getchar(void)
46{ 44{
47 char __c; 45 char __c;
48 46
49 asm("get_wait: mrc p14, 0, pc, c0, c1, 0 \n\ 47 asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
50 bne get_wait \n\
51 mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
52 : "=r" (__c) : : "cc");
53
54 return __c;
55}
56#else
57static inline char __dcc_getchar(void)
58{
59 char __c;
60
61 asm("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
62 : "=r" (__c)); 48 : "=r" (__c));
63 49
64 return __c; 50 return __c;
65} 51}
66#endif
67 52
68#if defined(CONFIG_CPU_V7)
69static inline void __dcc_putchar(char c)
70{
71 asm("put_wait: mrc p14, 0, pc, c0, c1, 0 \n\
72 bcs put_wait \n\
73 mcr p14, 0, %0, c0, c5, 0 "
74 : : "r" (c) : "cc");
75}
76#else
77static inline void __dcc_putchar(char c) 53static inline void __dcc_putchar(char c)
78{ 54{
79 asm("mcr p14, 0, %0, c0, c5, 0 @ write a char" 55 asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char"
80 : /* no output register */ 56 : /* no output register */
81 : "r" (c)); 57 : "r" (c));
82} 58}
83#endif
84 59
85static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count) 60static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
86{ 61{
@@ -90,7 +65,7 @@ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
90 while (__dcc_getstatus() & DCC_STATUS_TX) 65 while (__dcc_getstatus() & DCC_STATUS_TX)
91 cpu_relax(); 66 cpu_relax();
92 67
93 __dcc_putchar((char)(buf[i] & 0xFF)); 68 __dcc_putchar(buf[i]);
94 } 69 }
95 70
96 return count; 71 return count;
@@ -100,15 +75,11 @@ static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
100{ 75{
101 int i; 76 int i;
102 77
103 for (i = 0; i < count; ++i) { 78 for (i = 0; i < count; ++i)
104 int c = -1;
105
106 if (__dcc_getstatus() & DCC_STATUS_RX) 79 if (__dcc_getstatus() & DCC_STATUS_RX)
107 c = __dcc_getchar(); 80 buf[i] = __dcc_getchar();
108 if (c < 0) 81 else
109 break; 82 break;
110 buf[i] = c;
111 }
112 83
113 return i; 84 return i;
114} 85}
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
index 67a75a502c01..8a8d6373f164 100644
--- a/drivers/tty/hvc/hvsi.c
+++ b/drivers/tty/hvc/hvsi.c
@@ -1095,7 +1095,7 @@ static void hvsi_unthrottle(struct tty_struct *tty)
1095 h_vio_signal(hp->vtermno, VIO_IRQ_ENABLE); 1095 h_vio_signal(hp->vtermno, VIO_IRQ_ENABLE);
1096} 1096}
1097 1097
1098static int hvsi_tiocmget(struct tty_struct *tty, struct file *file) 1098static int hvsi_tiocmget(struct tty_struct *tty)
1099{ 1099{
1100 struct hvsi_struct *hp = tty->driver_data; 1100 struct hvsi_struct *hp = tty->driver_data;
1101 1101
@@ -1103,8 +1103,8 @@ static int hvsi_tiocmget(struct tty_struct *tty, struct file *file)
1103 return hp->mctrl; 1103 return hp->mctrl;
1104} 1104}
1105 1105
1106static int hvsi_tiocmset(struct tty_struct *tty, struct file *file, 1106static int hvsi_tiocmset(struct tty_struct *tty,
1107 unsigned int set, unsigned int clear) 1107 unsigned int set, unsigned int clear)
1108{ 1108{
1109 struct hvsi_struct *hp = tty->driver_data; 1109 struct hvsi_struct *hp = tty->driver_data;
1110 unsigned long flags; 1110 unsigned long flags;
diff --git a/drivers/char/pcmcia/ipwireless/Makefile b/drivers/tty/ipwireless/Makefile
index db80873d7f20..db80873d7f20 100644
--- a/drivers/char/pcmcia/ipwireless/Makefile
+++ b/drivers/tty/ipwireless/Makefile
diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index 0aeb5a38d296..0aeb5a38d296 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
diff --git a/drivers/char/pcmcia/ipwireless/hardware.h b/drivers/tty/ipwireless/hardware.h
index 90a8590e43b0..90a8590e43b0 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.h
+++ b/drivers/tty/ipwireless/hardware.h
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/tty/ipwireless/main.c
index 444155a305ae..444155a305ae 100644
--- a/drivers/char/pcmcia/ipwireless/main.c
+++ b/drivers/tty/ipwireless/main.c
diff --git a/drivers/char/pcmcia/ipwireless/main.h b/drivers/tty/ipwireless/main.h
index f2cbb116bccb..f2cbb116bccb 100644
--- a/drivers/char/pcmcia/ipwireless/main.h
+++ b/drivers/tty/ipwireless/main.h
diff --git a/drivers/char/pcmcia/ipwireless/network.c b/drivers/tty/ipwireless/network.c
index f7daeea598e4..f7daeea598e4 100644
--- a/drivers/char/pcmcia/ipwireless/network.c
+++ b/drivers/tty/ipwireless/network.c
diff --git a/drivers/char/pcmcia/ipwireless/network.h b/drivers/tty/ipwireless/network.h
index 561f765b3334..561f765b3334 100644
--- a/drivers/char/pcmcia/ipwireless/network.h
+++ b/drivers/tty/ipwireless/network.h
diff --git a/drivers/char/pcmcia/ipwireless/setup_protocol.h b/drivers/tty/ipwireless/setup_protocol.h
index 9d6bcc77c73c..9d6bcc77c73c 100644
--- a/drivers/char/pcmcia/ipwireless/setup_protocol.h
+++ b/drivers/tty/ipwireless/setup_protocol.h
diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index f5eb28b6cb0f..ef92869502a7 100644
--- a/drivers/char/pcmcia/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -395,7 +395,7 @@ static int set_control_lines(struct ipw_tty *tty, unsigned int set,
395 return 0; 395 return 0;
396} 396}
397 397
398static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file) 398static int ipw_tiocmget(struct tty_struct *linux_tty)
399{ 399{
400 struct ipw_tty *tty = linux_tty->driver_data; 400 struct ipw_tty *tty = linux_tty->driver_data;
401 /* FIXME: Exactly how is the tty object locked here .. */ 401 /* FIXME: Exactly how is the tty object locked here .. */
@@ -410,7 +410,7 @@ static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file)
410} 410}
411 411
412static int 412static int
413ipw_tiocmset(struct tty_struct *linux_tty, struct file *file, 413ipw_tiocmset(struct tty_struct *linux_tty,
414 unsigned int set, unsigned int clear) 414 unsigned int set, unsigned int clear)
415{ 415{
416 struct ipw_tty *tty = linux_tty->driver_data; 416 struct ipw_tty *tty = linux_tty->driver_data;
@@ -425,7 +425,7 @@ ipw_tiocmset(struct tty_struct *linux_tty, struct file *file,
425 return set_control_lines(tty, set, clear); 425 return set_control_lines(tty, set, clear);
426} 426}
427 427
428static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, 428static int ipw_ioctl(struct tty_struct *linux_tty,
429 unsigned int cmd, unsigned long arg) 429 unsigned int cmd, unsigned long arg)
430{ 430{
431 struct ipw_tty *tty = linux_tty->driver_data; 431 struct ipw_tty *tty = linux_tty->driver_data;
@@ -484,7 +484,7 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
484 return tty_perform_flush(linux_tty, arg); 484 return tty_perform_flush(linux_tty, arg);
485 } 485 }
486 } 486 }
487 return tty_mode_ioctl(linux_tty, file, cmd , arg); 487 return -ENOIOCTLCMD;
488} 488}
489 489
490static int add_tty(int j, 490static int add_tty(int j,
diff --git a/drivers/char/pcmcia/ipwireless/tty.h b/drivers/tty/ipwireless/tty.h
index 747b2d637860..747b2d637860 100644
--- a/drivers/char/pcmcia/ipwireless/tty.h
+++ b/drivers/tty/ipwireless/tty.h
diff --git a/drivers/char/isicom.c b/drivers/tty/isicom.c
index c27e9d21fea9..db1cf9c328d8 100644
--- a/drivers/char/isicom.c
+++ b/drivers/tty/isicom.c
@@ -1065,7 +1065,7 @@ static int isicom_send_break(struct tty_struct *tty, int length)
1065 return 0; 1065 return 0;
1066} 1066}
1067 1067
1068static int isicom_tiocmget(struct tty_struct *tty, struct file *file) 1068static int isicom_tiocmget(struct tty_struct *tty)
1069{ 1069{
1070 struct isi_port *port = tty->driver_data; 1070 struct isi_port *port = tty->driver_data;
1071 /* just send the port status */ 1071 /* just send the port status */
@@ -1082,8 +1082,8 @@ static int isicom_tiocmget(struct tty_struct *tty, struct file *file)
1082 ((status & ISI_RI ) ? TIOCM_RI : 0); 1082 ((status & ISI_RI ) ? TIOCM_RI : 0);
1083} 1083}
1084 1084
1085static int isicom_tiocmset(struct tty_struct *tty, struct file *file, 1085static int isicom_tiocmset(struct tty_struct *tty,
1086 unsigned int set, unsigned int clear) 1086 unsigned int set, unsigned int clear)
1087{ 1087{
1088 struct isi_port *port = tty->driver_data; 1088 struct isi_port *port = tty->driver_data;
1089 unsigned long flags; 1089 unsigned long flags;
@@ -1167,7 +1167,7 @@ static int isicom_get_serial_info(struct isi_port *port,
1167 return 0; 1167 return 0;
1168} 1168}
1169 1169
1170static int isicom_ioctl(struct tty_struct *tty, struct file *filp, 1170static int isicom_ioctl(struct tty_struct *tty,
1171 unsigned int cmd, unsigned long arg) 1171 unsigned int cmd, unsigned long arg)
1172{ 1172{
1173 struct isi_port *port = tty->driver_data; 1173 struct isi_port *port = tty->driver_data;
diff --git a/drivers/char/moxa.c b/drivers/tty/moxa.c
index 107b0bd58d19..35b0c38590e6 100644
--- a/drivers/char/moxa.c
+++ b/drivers/tty/moxa.c
@@ -199,8 +199,8 @@ static void moxa_set_termios(struct tty_struct *, struct ktermios *);
199static void moxa_stop(struct tty_struct *); 199static void moxa_stop(struct tty_struct *);
200static void moxa_start(struct tty_struct *); 200static void moxa_start(struct tty_struct *);
201static void moxa_hangup(struct tty_struct *); 201static void moxa_hangup(struct tty_struct *);
202static int moxa_tiocmget(struct tty_struct *tty, struct file *file); 202static int moxa_tiocmget(struct tty_struct *tty);
203static int moxa_tiocmset(struct tty_struct *tty, struct file *file, 203static int moxa_tiocmset(struct tty_struct *tty,
204 unsigned int set, unsigned int clear); 204 unsigned int set, unsigned int clear);
205static void moxa_poll(unsigned long); 205static void moxa_poll(unsigned long);
206static void moxa_set_tty_param(struct tty_struct *, struct ktermios *); 206static void moxa_set_tty_param(struct tty_struct *, struct ktermios *);
@@ -287,7 +287,7 @@ static void moxa_low_water_check(void __iomem *ofsAddr)
287 * TTY operations 287 * TTY operations
288 */ 288 */
289 289
290static int moxa_ioctl(struct tty_struct *tty, struct file *file, 290static int moxa_ioctl(struct tty_struct *tty,
291 unsigned int cmd, unsigned long arg) 291 unsigned int cmd, unsigned long arg)
292{ 292{
293 struct moxa_port *ch = tty->driver_data; 293 struct moxa_port *ch = tty->driver_data;
@@ -1257,7 +1257,7 @@ static int moxa_chars_in_buffer(struct tty_struct *tty)
1257 return chars; 1257 return chars;
1258} 1258}
1259 1259
1260static int moxa_tiocmget(struct tty_struct *tty, struct file *file) 1260static int moxa_tiocmget(struct tty_struct *tty)
1261{ 1261{
1262 struct moxa_port *ch = tty->driver_data; 1262 struct moxa_port *ch = tty->driver_data;
1263 int flag = 0, dtr, rts; 1263 int flag = 0, dtr, rts;
@@ -1277,7 +1277,7 @@ static int moxa_tiocmget(struct tty_struct *tty, struct file *file)
1277 return flag; 1277 return flag;
1278} 1278}
1279 1279
1280static int moxa_tiocmset(struct tty_struct *tty, struct file *file, 1280static int moxa_tiocmset(struct tty_struct *tty,
1281 unsigned int set, unsigned int clear) 1281 unsigned int set, unsigned int clear)
1282{ 1282{
1283 struct moxa_port *ch; 1283 struct moxa_port *ch;
diff --git a/drivers/char/moxa.h b/drivers/tty/moxa.h
index 87d16ce57be7..87d16ce57be7 100644
--- a/drivers/char/moxa.h
+++ b/drivers/tty/moxa.h
diff --git a/drivers/char/mxser.c b/drivers/tty/mxser.c
index dd9d75351cd6..d188f378684d 100644
--- a/drivers/char/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1320,7 +1320,7 @@ static int mxser_get_lsr_info(struct mxser_port *info,
1320 return put_user(result, value); 1320 return put_user(result, value);
1321} 1321}
1322 1322
1323static int mxser_tiocmget(struct tty_struct *tty, struct file *file) 1323static int mxser_tiocmget(struct tty_struct *tty)
1324{ 1324{
1325 struct mxser_port *info = tty->driver_data; 1325 struct mxser_port *info = tty->driver_data;
1326 unsigned char control, status; 1326 unsigned char control, status;
@@ -1347,7 +1347,7 @@ static int mxser_tiocmget(struct tty_struct *tty, struct file *file)
1347 ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); 1347 ((status & UART_MSR_CTS) ? TIOCM_CTS : 0);
1348} 1348}
1349 1349
1350static int mxser_tiocmset(struct tty_struct *tty, struct file *file, 1350static int mxser_tiocmset(struct tty_struct *tty,
1351 unsigned int set, unsigned int clear) 1351 unsigned int set, unsigned int clear)
1352{ 1352{
1353 struct mxser_port *info = tty->driver_data; 1353 struct mxser_port *info = tty->driver_data;
@@ -1655,7 +1655,7 @@ static int mxser_cflags_changed(struct mxser_port *info, unsigned long arg,
1655 return ret; 1655 return ret;
1656} 1656}
1657 1657
1658static int mxser_ioctl(struct tty_struct *tty, struct file *file, 1658static int mxser_ioctl(struct tty_struct *tty,
1659 unsigned int cmd, unsigned long arg) 1659 unsigned int cmd, unsigned long arg)
1660{ 1660{
1661 struct mxser_port *info = tty->driver_data; 1661 struct mxser_port *info = tty->driver_data;
diff --git a/drivers/char/mxser.h b/drivers/tty/mxser.h
index 41878a69203d..41878a69203d 100644
--- a/drivers/char/mxser.h
+++ b/drivers/tty/mxser.h
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index aa2e5d3eb01a..176f63256b37 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1250,8 +1250,7 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
1250 1250
1251static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl) 1251static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl)
1252{ 1252{
1253 struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, 1253 struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype);
1254 gsm->ftype|PF);
1255 if (msg == NULL) 1254 if (msg == NULL)
1256 return; 1255 return;
1257 msg->data[0] = (ctrl->cmd << 1) | 2 | EA; /* command */ 1256 msg->data[0] = (ctrl->cmd << 1) | 2 | EA; /* command */
@@ -2649,13 +2648,13 @@ static void gsmtty_wait_until_sent(struct tty_struct *tty, int timeout)
2649 to do here */ 2648 to do here */
2650} 2649}
2651 2650
2652static int gsmtty_tiocmget(struct tty_struct *tty, struct file *filp) 2651static int gsmtty_tiocmget(struct tty_struct *tty)
2653{ 2652{
2654 struct gsm_dlci *dlci = tty->driver_data; 2653 struct gsm_dlci *dlci = tty->driver_data;
2655 return dlci->modem_rx; 2654 return dlci->modem_rx;
2656} 2655}
2657 2656
2658static int gsmtty_tiocmset(struct tty_struct *tty, struct file *filp, 2657static int gsmtty_tiocmset(struct tty_struct *tty,
2659 unsigned int set, unsigned int clear) 2658 unsigned int set, unsigned int clear)
2660{ 2659{
2661 struct gsm_dlci *dlci = tty->driver_data; 2660 struct gsm_dlci *dlci = tty->driver_data;
@@ -2672,7 +2671,7 @@ static int gsmtty_tiocmset(struct tty_struct *tty, struct file *filp,
2672} 2671}
2673 2672
2674 2673
2675static int gsmtty_ioctl(struct tty_struct *tty, struct file *filp, 2674static int gsmtty_ioctl(struct tty_struct *tty,
2676 unsigned int cmd, unsigned long arg) 2675 unsigned int cmd, unsigned long arg)
2677{ 2676{
2678 return -ENOIOCTLCMD; 2677 return -ENOIOCTLCMD;
diff --git a/drivers/char/nozomi.c b/drivers/tty/nozomi.c
index 294d03e8c61a..f4f11164efe5 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1514,8 +1514,6 @@ static void __devexit tty_exit(struct nozomi *dc)
1514 1514
1515 DBG1(" "); 1515 DBG1(" ");
1516 1516
1517 flush_scheduled_work();
1518
1519 for (i = 0; i < MAX_PORT; ++i) { 1517 for (i = 0; i < MAX_PORT; ++i) {
1520 struct tty_struct *tty = tty_port_tty_get(&dc->port[i].port); 1518 struct tty_struct *tty = tty_port_tty_get(&dc->port[i].port);
1521 if (tty && list_empty(&tty->hangup_work.entry)) 1519 if (tty && list_empty(&tty->hangup_work.entry))
@@ -1750,7 +1748,7 @@ static int ntty_write_room(struct tty_struct *tty)
1750} 1748}
1751 1749
1752/* Gets io control parameters */ 1750/* Gets io control parameters */
1753static int ntty_tiocmget(struct tty_struct *tty, struct file *file) 1751static int ntty_tiocmget(struct tty_struct *tty)
1754{ 1752{
1755 const struct port *port = tty->driver_data; 1753 const struct port *port = tty->driver_data;
1756 const struct ctrl_dl *ctrl_dl = &port->ctrl_dl; 1754 const struct ctrl_dl *ctrl_dl = &port->ctrl_dl;
@@ -1767,8 +1765,8 @@ static int ntty_tiocmget(struct tty_struct *tty, struct file *file)
1767} 1765}
1768 1766
1769/* Sets io controls parameters */ 1767/* Sets io controls parameters */
1770static int ntty_tiocmset(struct tty_struct *tty, struct file *file, 1768static int ntty_tiocmset(struct tty_struct *tty,
1771 unsigned int set, unsigned int clear) 1769 unsigned int set, unsigned int clear)
1772{ 1770{
1773 struct nozomi *dc = get_dc_by_tty(tty); 1771 struct nozomi *dc = get_dc_by_tty(tty);
1774 unsigned long flags; 1772 unsigned long flags;
@@ -1824,7 +1822,7 @@ static int ntty_tiocgicount(struct tty_struct *tty,
1824 return 0; 1822 return 0;
1825} 1823}
1826 1824
1827static int ntty_ioctl(struct tty_struct *tty, struct file *file, 1825static int ntty_ioctl(struct tty_struct *tty,
1828 unsigned int cmd, unsigned long arg) 1826 unsigned int cmd, unsigned long arg)
1829{ 1827{
1830 struct port *port = tty->driver_data; 1828 struct port *port = tty->driver_data;
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 923a48585501..c88029af84dd 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -334,7 +334,7 @@ free_mem_out:
334 return -ENOMEM; 334 return -ENOMEM;
335} 335}
336 336
337static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file, 337static int pty_bsd_ioctl(struct tty_struct *tty,
338 unsigned int cmd, unsigned long arg) 338 unsigned int cmd, unsigned long arg)
339{ 339{
340 switch (cmd) { 340 switch (cmd) {
@@ -489,7 +489,7 @@ static struct ctl_table pty_root_table[] = {
489}; 489};
490 490
491 491
492static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, 492static int pty_unix98_ioctl(struct tty_struct *tty,
493 unsigned int cmd, unsigned long arg) 493 unsigned int cmd, unsigned long arg)
494{ 494{
495 switch (cmd) { 495 switch (cmd) {
diff --git a/drivers/char/rocket.c b/drivers/tty/rocket.c
index 3e4e73a0d7c1..3780da8ad12d 100644
--- a/drivers/char/rocket.c
+++ b/drivers/tty/rocket.c
@@ -1169,7 +1169,7 @@ static int sGetChanRI(CHANNEL_T * ChP)
1169 * Returns the state of the serial modem control lines. These next 2 functions 1169 * Returns the state of the serial modem control lines. These next 2 functions
1170 * are the way kernel versions > 2.5 handle modem control lines rather than IOCTLs. 1170 * are the way kernel versions > 2.5 handle modem control lines rather than IOCTLs.
1171 */ 1171 */
1172static int rp_tiocmget(struct tty_struct *tty, struct file *file) 1172static int rp_tiocmget(struct tty_struct *tty)
1173{ 1173{
1174 struct r_port *info = tty->driver_data; 1174 struct r_port *info = tty->driver_data;
1175 unsigned int control, result, ChanStatus; 1175 unsigned int control, result, ChanStatus;
@@ -1189,8 +1189,8 @@ static int rp_tiocmget(struct tty_struct *tty, struct file *file)
1189/* 1189/*
1190 * Sets the modem control lines 1190 * Sets the modem control lines
1191 */ 1191 */
1192static int rp_tiocmset(struct tty_struct *tty, struct file *file, 1192static int rp_tiocmset(struct tty_struct *tty,
1193 unsigned int set, unsigned int clear) 1193 unsigned int set, unsigned int clear)
1194{ 1194{
1195 struct r_port *info = tty->driver_data; 1195 struct r_port *info = tty->driver_data;
1196 1196
@@ -1326,7 +1326,7 @@ static int get_version(struct r_port *info, struct rocket_version __user *retver
1326} 1326}
1327 1327
1328/* IOCTL call handler into the driver */ 1328/* IOCTL call handler into the driver */
1329static int rp_ioctl(struct tty_struct *tty, struct file *file, 1329static int rp_ioctl(struct tty_struct *tty,
1330 unsigned int cmd, unsigned long arg) 1330 unsigned int cmd, unsigned long arg)
1331{ 1331{
1332 struct r_port *info = tty->driver_data; 1332 struct r_port *info = tty->driver_data;
diff --git a/drivers/char/rocket.h b/drivers/tty/rocket.h
index ec863f35f1a9..ec863f35f1a9 100644
--- a/drivers/char/rocket.h
+++ b/drivers/tty/rocket.h
diff --git a/drivers/char/rocket_int.h b/drivers/tty/rocket_int.h
index 67e0f1e778a2..67e0f1e778a2 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/tty/rocket_int.h
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c
index de0160e3f8c4..d5bfd41707e7 100644
--- a/drivers/tty/serial/68328serial.c
+++ b/drivers/tty/serial/68328serial.c
@@ -393,28 +393,6 @@ static void do_softint(struct work_struct *work)
393#endif 393#endif
394} 394}
395 395
396/*
397 * This routine is called from the scheduler tqueue when the interrupt
398 * routine has signalled that a hangup has occurred. The path of
399 * hangup processing is:
400 *
401 * serial interrupt routine -> (scheduler tqueue) ->
402 * do_serial_hangup() -> tty->hangup() -> rs_hangup()
403 *
404 */
405static void do_serial_hangup(struct work_struct *work)
406{
407 struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup);
408 struct tty_struct *tty;
409
410 tty = info->tty;
411 if (!tty)
412 return;
413
414 tty_hangup(tty);
415}
416
417
418static int startup(struct m68k_serial * info) 396static int startup(struct m68k_serial * info)
419{ 397{
420 m68328_uart *uart = &uart_addr[info->line]; 398 m68328_uart *uart = &uart_addr[info->line];
@@ -967,7 +945,7 @@ static void send_break(struct m68k_serial * info, unsigned int duration)
967 local_irq_restore(flags); 945 local_irq_restore(flags);
968} 946}
969 947
970static int rs_ioctl(struct tty_struct *tty, struct file * file, 948static int rs_ioctl(struct tty_struct *tty,
971 unsigned int cmd, unsigned long arg) 949 unsigned int cmd, unsigned long arg)
972{ 950{
973 struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; 951 struct m68k_serial * info = (struct m68k_serial *)tty->driver_data;
@@ -1347,7 +1325,6 @@ rs68328_init(void)
1347 info->count = 0; 1325 info->count = 0;
1348 info->blocked_open = 0; 1326 info->blocked_open = 0;
1349 INIT_WORK(&info->tqueue, do_softint); 1327 INIT_WORK(&info->tqueue, do_softint);
1350 INIT_WORK(&info->tqueue_hangup, do_serial_hangup);
1351 init_waitqueue_head(&info->open_wait); 1328 init_waitqueue_head(&info->open_wait);
1352 init_waitqueue_head(&info->close_wait); 1329 init_waitqueue_head(&info->close_wait);
1353 info->line = i; 1330 info->line = i;
diff --git a/drivers/tty/serial/68328serial.h b/drivers/tty/serial/68328serial.h
index 664ceb0a158c..8c9c3c0745db 100644
--- a/drivers/tty/serial/68328serial.h
+++ b/drivers/tty/serial/68328serial.h
@@ -159,7 +159,6 @@ struct m68k_serial {
159 int xmit_tail; 159 int xmit_tail;
160 int xmit_cnt; 160 int xmit_cnt;
161 struct work_struct tqueue; 161 struct work_struct tqueue;
162 struct work_struct tqueue_hangup;
163 wait_queue_head_t open_wait; 162 wait_queue_head_t open_wait;
164 wait_queue_head_t close_wait; 163 wait_queue_head_t close_wait;
165}; 164};
diff --git a/drivers/tty/serial/68360serial.c b/drivers/tty/serial/68360serial.c
index bc21eeae8fde..0a3e8787ed50 100644
--- a/drivers/tty/serial/68360serial.c
+++ b/drivers/tty/serial/68360serial.c
@@ -1240,7 +1240,7 @@ static int get_lsr_info(struct async_struct * info, unsigned int *value)
1240} 1240}
1241#endif 1241#endif
1242 1242
1243static int rs_360_tiocmget(struct tty_struct *tty, struct file *file) 1243static int rs_360_tiocmget(struct tty_struct *tty)
1244{ 1244{
1245 ser_info_t *info = (ser_info_t *)tty->driver_data; 1245 ser_info_t *info = (ser_info_t *)tty->driver_data;
1246 unsigned int result = 0; 1246 unsigned int result = 0;
@@ -1271,7 +1271,7 @@ static int rs_360_tiocmget(struct tty_struct *tty, struct file *file)
1271 return result; 1271 return result;
1272} 1272}
1273 1273
1274static int rs_360_tiocmset(struct tty_struct *tty, struct file *file, 1274static int rs_360_tiocmset(struct tty_struct *tty,
1275 unsigned int set, unsigned int clear) 1275 unsigned int set, unsigned int clear)
1276{ 1276{
1277#ifdef modem_control 1277#ifdef modem_control
@@ -1405,7 +1405,7 @@ static int rs_360_get_icount(struct tty_struct *tty,
1405 return 0; 1405 return 0;
1406} 1406}
1407 1407
1408static int rs_360_ioctl(struct tty_struct *tty, struct file * file, 1408static int rs_360_ioctl(struct tty_struct *tty,
1409 unsigned int cmd, unsigned long arg) 1409 unsigned int cmd, unsigned long arg)
1410{ 1410{
1411 int error; 1411 int error;
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index 3975df6f7fdb..b3b881bc4712 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -954,6 +954,23 @@ static int broken_efr(struct uart_8250_port *up)
954 return 0; 954 return 0;
955} 955}
956 956
957static inline int ns16550a_goto_highspeed(struct uart_8250_port *up)
958{
959 unsigned char status;
960
961 status = serial_in(up, 0x04); /* EXCR2 */
962#define PRESL(x) ((x) & 0x30)
963 if (PRESL(status) == 0x10) {
964 /* already in high speed mode */
965 return 0;
966 } else {
967 status &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */
968 status |= 0x10; /* 1.625 divisor for baud_base --> 921600 */
969 serial_outp(up, 0x04, status);
970 }
971 return 1;
972}
973
957/* 974/*
958 * We know that the chip has FIFOs. Does it have an EFR? The 975 * We know that the chip has FIFOs. Does it have an EFR? The
959 * EFR is located in the same register position as the IIR and 976 * EFR is located in the same register position as the IIR and
@@ -1025,12 +1042,8 @@ static void autoconfig_16550a(struct uart_8250_port *up)
1025 quot = serial_dl_read(up); 1042 quot = serial_dl_read(up);
1026 quot <<= 3; 1043 quot <<= 3;
1027 1044
1028 status1 = serial_in(up, 0x04); /* EXCR2 */ 1045 if (ns16550a_goto_highspeed(up))
1029 status1 &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */ 1046 serial_dl_write(up, quot);
1030 status1 |= 0x10; /* 1.625 divisor for baud_base --> 921600 */
1031 serial_outp(up, 0x04, status1);
1032
1033 serial_dl_write(up, quot);
1034 1047
1035 serial_outp(up, UART_LCR, 0); 1048 serial_outp(up, UART_LCR, 0);
1036 1049
@@ -3025,17 +3038,13 @@ void serial8250_resume_port(int line)
3025 struct uart_8250_port *up = &serial8250_ports[line]; 3038 struct uart_8250_port *up = &serial8250_ports[line];
3026 3039
3027 if (up->capabilities & UART_NATSEMI) { 3040 if (up->capabilities & UART_NATSEMI) {
3028 unsigned char tmp;
3029
3030 /* Ensure it's still in high speed mode */ 3041 /* Ensure it's still in high speed mode */
3031 serial_outp(up, UART_LCR, 0xE0); 3042 serial_outp(up, UART_LCR, 0xE0);
3032 3043
3033 tmp = serial_in(up, 0x04); /* EXCR2 */ 3044 ns16550a_goto_highspeed(up);
3034 tmp &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */
3035 tmp |= 0x10; /* 1.625 divisor for baud_base --> 921600 */
3036 serial_outp(up, 0x04, tmp);
3037 3045
3038 serial_outp(up, UART_LCR, 0); 3046 serial_outp(up, UART_LCR, 0);
3047 up->port.uartclk = 921600*16;
3039 } 3048 }
3040 uart_resume_port(&serial8250_reg, &up->port); 3049 uart_resume_port(&serial8250_reg, &up->port);
3041} 3050}
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 2b8334601c8b..d9ccbf825095 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1319,6 +1319,18 @@ config SERIAL_MSM_CONSOLE
1319 depends on SERIAL_MSM=y 1319 depends on SERIAL_MSM=y
1320 select SERIAL_CORE_CONSOLE 1320 select SERIAL_CORE_CONSOLE
1321 1321
1322config SERIAL_MSM_HS
1323 tristate "MSM UART High Speed: Serial Driver"
1324 depends on ARCH_MSM
1325 select SERIAL_CORE
1326 help
1327 If you have a machine based on MSM family of SoCs, you
1328 can enable its onboard high speed serial port by enabling
1329 this option.
1330
1331 Choose M here to compile it as a module. The module will be
1332 called msm_serial_hs.
1333
1322config SERIAL_VT8500 1334config SERIAL_VT8500
1323 bool "VIA VT8500 on-chip serial port support" 1335 bool "VIA VT8500 on-chip serial port support"
1324 depends on ARM && ARCH_VT8500 1336 depends on ARM && ARCH_VT8500
@@ -1588,12 +1600,25 @@ config SERIAL_IFX6X60
1588 Support for the IFX6x60 modem devices on Intel MID platforms. 1600 Support for the IFX6x60 modem devices on Intel MID platforms.
1589 1601
1590config SERIAL_PCH_UART 1602config SERIAL_PCH_UART
1591 tristate "Intel EG20T PCH UART" 1603 tristate "Intel EG20T PCH UART/OKI SEMICONDUCTOR ML7213 IOH"
1592 depends on PCI && DMADEVICES 1604 depends on PCI
1593 select SERIAL_CORE 1605 select SERIAL_CORE
1594 select PCH_DMA
1595 help 1606 help
1596 This driver is for PCH(Platform controller Hub) UART of Intel EG20T 1607 This driver is for PCH(Platform controller Hub) UART of Intel EG20T
1597 which is an IOH(Input/Output Hub) for x86 embedded processor. 1608 which is an IOH(Input/Output Hub) for x86 embedded processor.
1598 Enabling PCH_DMA, this PCH UART works as DMA mode. 1609 Enabling PCH_DMA, this PCH UART works as DMA mode.
1610
1611 This driver also can be used for OKI SEMICONDUCTOR ML7213 IOH(Input/
1612 Output Hub) which is for IVI(In-Vehicle Infotainment) use.
1613 ML7213 is companion chip for Intel Atom E6xx series.
1614 ML7213 is completely compatible for Intel EG20T PCH.
1615
1616config SERIAL_MSM_SMD
1617 bool "Enable tty device interface for some SMD ports"
1618 default n
1619 depends on MSM_SMD
1620 help
1621 Enables userspace clients to read and write to some streaming SMD
1622 ports via tty device interface for MSM chipset.
1623
1599endmenu 1624endmenu
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 8ea92e9c73b0..d94dc005c8a6 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o
76obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o 76obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
77obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o 77obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
78obj-$(CONFIG_SERIAL_MSM) += msm_serial.o 78obj-$(CONFIG_SERIAL_MSM) += msm_serial.o
79obj-$(CONFIG_SERIAL_MSM_HS) += msm_serial_hs.o
79obj-$(CONFIG_SERIAL_NETX) += netx-serial.o 80obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
80obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o 81obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
81obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o 82obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
@@ -92,3 +93,4 @@ obj-$(CONFIG_SERIAL_MRST_MAX3110) += mrst_max3110.o
92obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o 93obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o
93obj-$(CONFIG_SERIAL_IFX6X60) += ifx6x60.o 94obj-$(CONFIG_SERIAL_IFX6X60) += ifx6x60.o
94obj-$(CONFIG_SERIAL_PCH_UART) += pch_uart.o 95obj-$(CONFIG_SERIAL_PCH_UART) += pch_uart.o
96obj-$(CONFIG_SERIAL_MSM_SMD) += msm_smd_tty.o
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index f9b49b5ff5e1..8f014bb916b7 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -305,28 +305,6 @@ static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS];
305 305
306#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) 306#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE)
307 307
308int __init early_altera_jtaguart_setup(struct altera_jtaguart_platform_uart
309 *platp)
310{
311 struct uart_port *port;
312 int i;
313
314 for (i = 0; i < ALTERA_JTAGUART_MAXPORTS && platp[i].mapbase; i++) {
315 port = &altera_jtaguart_ports[i].port;
316
317 port->line = i;
318 port->type = PORT_ALTERA_JTAGUART;
319 port->mapbase = platp[i].mapbase;
320 port->membase = ioremap(port->mapbase, ALTERA_JTAGUART_SIZE);
321 port->iotype = SERIAL_IO_MEM;
322 port->irq = platp[i].irq;
323 port->flags = ASYNC_BOOT_AUTOCONF;
324 port->ops = &altera_jtaguart_ops;
325 }
326
327 return 0;
328}
329
330#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) 308#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS)
331static void altera_jtaguart_console_putc(struct console *co, const char c) 309static void altera_jtaguart_console_putc(struct console *co, const char c)
332{ 310{
@@ -384,7 +362,7 @@ static int __init altera_jtaguart_console_setup(struct console *co,
384 if (co->index < 0 || co->index >= ALTERA_JTAGUART_MAXPORTS) 362 if (co->index < 0 || co->index >= ALTERA_JTAGUART_MAXPORTS)
385 return -EINVAL; 363 return -EINVAL;
386 port = &altera_jtaguart_ports[co->index].port; 364 port = &altera_jtaguart_ports[co->index].port;
387 if (port->membase == 0) 365 if (port->membase == NULL)
388 return -ENODEV; 366 return -ENODEV;
389 return 0; 367 return 0;
390} 368}
@@ -431,22 +409,45 @@ static int __devinit altera_jtaguart_probe(struct platform_device *pdev)
431{ 409{
432 struct altera_jtaguart_platform_uart *platp = pdev->dev.platform_data; 410 struct altera_jtaguart_platform_uart *platp = pdev->dev.platform_data;
433 struct uart_port *port; 411 struct uart_port *port;
434 int i; 412 struct resource *res_irq, *res_mem;
413 int i = pdev->id;
435 414
436 for (i = 0; i < ALTERA_JTAGUART_MAXPORTS && platp[i].mapbase; i++) { 415 /* -1 emphasizes that the platform must have one port, no .N suffix */
437 port = &altera_jtaguart_ports[i].port; 416 if (i == -1)
417 i = 0;
438 418
439 port->line = i; 419 if (i >= ALTERA_JTAGUART_MAXPORTS)
440 port->type = PORT_ALTERA_JTAGUART; 420 return -EINVAL;
441 port->mapbase = platp[i].mapbase;
442 port->membase = ioremap(port->mapbase, ALTERA_JTAGUART_SIZE);
443 port->iotype = SERIAL_IO_MEM;
444 port->irq = platp[i].irq;
445 port->ops = &altera_jtaguart_ops;
446 port->flags = ASYNC_BOOT_AUTOCONF;
447 421
448 uart_add_one_port(&altera_jtaguart_driver, port); 422 port = &altera_jtaguart_ports[i].port;
449 } 423
424 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
425 if (res_mem)
426 port->mapbase = res_mem->start;
427 else if (platp)
428 port->mapbase = platp->mapbase;
429 else
430 return -ENODEV;
431
432 res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
433 if (res_irq)
434 port->irq = res_irq->start;
435 else if (platp)
436 port->irq = platp->irq;
437 else
438 return -ENODEV;
439
440 port->membase = ioremap(port->mapbase, ALTERA_JTAGUART_SIZE);
441 if (!port->membase)
442 return -ENOMEM;
443
444 port->line = i;
445 port->type = PORT_ALTERA_JTAGUART;
446 port->iotype = SERIAL_IO_MEM;
447 port->ops = &altera_jtaguart_ops;
448 port->flags = UPF_BOOT_AUTOCONF;
449
450 uart_add_one_port(&altera_jtaguart_driver, port);
450 451
451 return 0; 452 return 0;
452} 453}
@@ -454,13 +455,13 @@ static int __devinit altera_jtaguart_probe(struct platform_device *pdev)
454static int __devexit altera_jtaguart_remove(struct platform_device *pdev) 455static int __devexit altera_jtaguart_remove(struct platform_device *pdev)
455{ 456{
456 struct uart_port *port; 457 struct uart_port *port;
457 int i; 458 int i = pdev->id;
458 459
459 for (i = 0; i < ALTERA_JTAGUART_MAXPORTS; i++) { 460 if (i == -1)
460 port = &altera_jtaguart_ports[i].port; 461 i = 0;
461 if (port) 462
462 uart_remove_one_port(&altera_jtaguart_driver, port); 463 port = &altera_jtaguart_ports[i].port;
463 } 464 uart_remove_one_port(&altera_jtaguart_driver, port);
464 465
465 return 0; 466 return 0;
466} 467}
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 721216292a50..3a573528555e 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -86,16 +86,12 @@ struct altera_uart {
86 86
87static u32 altera_uart_readl(struct uart_port *port, int reg) 87static u32 altera_uart_readl(struct uart_port *port, int reg)
88{ 88{
89 struct altera_uart_platform_uart *platp = port->private_data; 89 return readl(port->membase + (reg << port->regshift));
90
91 return readl(port->membase + (reg << platp->bus_shift));
92} 90}
93 91
94static void altera_uart_writel(struct uart_port *port, u32 dat, int reg) 92static void altera_uart_writel(struct uart_port *port, u32 dat, int reg)
95{ 93{
96 struct altera_uart_platform_uart *platp = port->private_data; 94 writel(dat, port->membase + (reg << port->regshift));
97
98 writel(dat, port->membase + (reg << platp->bus_shift));
99} 95}
100 96
101static unsigned int altera_uart_tx_empty(struct uart_port *port) 97static unsigned int altera_uart_tx_empty(struct uart_port *port)
@@ -546,13 +542,17 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
546 if (!port->membase) 542 if (!port->membase)
547 return -ENOMEM; 543 return -ENOMEM;
548 544
545 if (platp)
546 port->regshift = platp->bus_shift;
547 else
548 port->regshift = 0;
549
549 port->line = i; 550 port->line = i;
550 port->type = PORT_ALTERA_UART; 551 port->type = PORT_ALTERA_UART;
551 port->iotype = SERIAL_IO_MEM; 552 port->iotype = SERIAL_IO_MEM;
552 port->uartclk = platp->uartclk; 553 port->uartclk = platp->uartclk;
553 port->ops = &altera_uart_ops; 554 port->ops = &altera_uart_ops;
554 port->flags = UPF_BOOT_AUTOCONF; 555 port->flags = UPF_BOOT_AUTOCONF;
555 port->private_data = platp;
556 556
557 uart_add_one_port(&altera_uart_driver, port); 557 uart_add_one_port(&altera_uart_driver, port);
558 558
@@ -561,9 +561,15 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
561 561
562static int __devexit altera_uart_remove(struct platform_device *pdev) 562static int __devexit altera_uart_remove(struct platform_device *pdev)
563{ 563{
564 struct uart_port *port = &altera_uart_ports[pdev->id].port; 564 struct uart_port *port;
565 int i = pdev->id;
565 566
567 if (i == -1)
568 i = 0;
569
570 port = &altera_uart_ports[i].port;
566 uart_remove_one_port(&altera_uart_driver, port); 571 uart_remove_one_port(&altera_uart_driver, port);
572
567 return 0; 573 return 0;
568} 574}
569 575
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2a1d52fb4936..f119d1761106 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1240,6 +1240,21 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
1240 spin_unlock_irqrestore(&port->lock, flags); 1240 spin_unlock_irqrestore(&port->lock, flags);
1241} 1241}
1242 1242
1243static void atmel_set_ldisc(struct uart_port *port, int new)
1244{
1245 int line = port->line;
1246
1247 if (line >= port->state->port.tty->driver->num)
1248 return;
1249
1250 if (port->state->port.tty->ldisc->ops->num == N_PPS) {
1251 port->flags |= UPF_HARDPPS_CD;
1252 atmel_enable_ms(port);
1253 } else {
1254 port->flags &= ~UPF_HARDPPS_CD;
1255 }
1256}
1257
1243/* 1258/*
1244 * Return string describing the specified port 1259 * Return string describing the specified port
1245 */ 1260 */
@@ -1380,6 +1395,7 @@ static struct uart_ops atmel_pops = {
1380 .shutdown = atmel_shutdown, 1395 .shutdown = atmel_shutdown,
1381 .flush_buffer = atmel_flush_buffer, 1396 .flush_buffer = atmel_flush_buffer,
1382 .set_termios = atmel_set_termios, 1397 .set_termios = atmel_set_termios,
1398 .set_ldisc = atmel_set_ldisc,
1383 .type = atmel_type, 1399 .type = atmel_type,
1384 .release_port = atmel_release_port, 1400 .release_port = atmel_release_port,
1385 .request_port = atmel_request_port, 1401 .request_port = atmel_request_port,
diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c
index e95c524d9d18..c3ec0a61d859 100644
--- a/drivers/tty/serial/bfin_sport_uart.c
+++ b/drivers/tty/serial/bfin_sport_uart.c
@@ -788,7 +788,7 @@ static int __devinit sport_uart_probe(struct platform_device *pdev)
788 sport->port.mapbase = res->start; 788 sport->port.mapbase = res->start;
789 789
790 sport->port.irq = platform_get_irq(pdev, 0); 790 sport->port.irq = platform_get_irq(pdev, 0);
791 if (sport->port.irq < 0) { 791 if ((int)sport->port.irq < 0) {
792 dev_err(&pdev->dev, "No sport RX/TX IRQ specified\n"); 792 dev_err(&pdev->dev, "No sport RX/TX IRQ specified\n");
793 ret = -ENOENT; 793 ret = -ENOENT;
794 goto out_error_unmap; 794 goto out_error_unmap;
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index bcc31f2140ac..225123b37f19 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -3581,8 +3581,7 @@ rs_break(struct tty_struct *tty, int break_state)
3581} 3581}
3582 3582
3583static int 3583static int
3584rs_tiocmset(struct tty_struct *tty, struct file *file, 3584rs_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
3585 unsigned int set, unsigned int clear)
3586{ 3585{
3587 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3586 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3588 unsigned long flags; 3587 unsigned long flags;
@@ -3614,7 +3613,7 @@ rs_tiocmset(struct tty_struct *tty, struct file *file,
3614} 3613}
3615 3614
3616static int 3615static int
3617rs_tiocmget(struct tty_struct *tty, struct file *file) 3616rs_tiocmget(struct tty_struct *tty)
3618{ 3617{
3619 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3618 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3620 unsigned int result; 3619 unsigned int result;
@@ -3648,7 +3647,7 @@ rs_tiocmget(struct tty_struct *tty, struct file *file)
3648 3647
3649 3648
3650static int 3649static int
3651rs_ioctl(struct tty_struct *tty, struct file * file, 3650rs_ioctl(struct tty_struct *tty,
3652 unsigned int cmd, unsigned long arg) 3651 unsigned int cmd, unsigned long arg)
3653{ 3652{
3654 struct e100_serial * info = (struct e100_serial *)tty->driver_data; 3653 struct e100_serial * info = (struct e100_serial *)tty->driver_data;
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index ab93763862d5..8ee5a41d340d 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -8,7 +8,7 @@
8 * Jan Dumon <j.dumon@option.com> 8 * Jan Dumon <j.dumon@option.com>
9 * 9 *
10 * Copyright (C) 2009, 2010 Intel Corp 10 * Copyright (C) 2009, 2010 Intel Corp
11 * Russ Gorby <richardx.r.gorby@intel.com> 11 * Russ Gorby <russ.gorby@intel.com>
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as 14 * it under the terms of the GNU General Public License version 2 as
@@ -67,6 +67,7 @@
67#define IFX_SPI_MORE_MASK 0x10 67#define IFX_SPI_MORE_MASK 0x10
68#define IFX_SPI_MORE_BIT 12 /* bit position in u16 */ 68#define IFX_SPI_MORE_BIT 12 /* bit position in u16 */
69#define IFX_SPI_CTS_BIT 13 /* bit position in u16 */ 69#define IFX_SPI_CTS_BIT 13 /* bit position in u16 */
70#define IFX_SPI_MODE SPI_MODE_1
70#define IFX_SPI_TTY_ID 0 71#define IFX_SPI_TTY_ID 0
71#define IFX_SPI_TIMEOUT_SEC 2 72#define IFX_SPI_TIMEOUT_SEC 2
72#define IFX_SPI_HEADER_0 (-1) 73#define IFX_SPI_HEADER_0 (-1)
@@ -76,7 +77,7 @@
76static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev); 77static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev);
77 78
78/* local variables */ 79/* local variables */
79static int spi_b16 = 1; /* 8 or 16 bit word length */ 80static int spi_bpw = 16; /* 8, 16 or 32 bit word length */
80static struct tty_driver *tty_drv; 81static struct tty_driver *tty_drv;
81static struct ifx_spi_device *saved_ifx_dev; 82static struct ifx_spi_device *saved_ifx_dev;
82static struct lock_class_key ifx_spi_key; 83static struct lock_class_key ifx_spi_key;
@@ -244,7 +245,7 @@ static void ifx_spi_timeout(unsigned long arg)
244 * Map the signal state into Linux modem flags and report the value 245 * Map the signal state into Linux modem flags and report the value
245 * in Linux terms 246 * in Linux terms
246 */ 247 */
247static int ifx_spi_tiocmget(struct tty_struct *tty, struct file *filp) 248static int ifx_spi_tiocmget(struct tty_struct *tty)
248{ 249{
249 unsigned int value; 250 unsigned int value;
250 struct ifx_spi_device *ifx_dev = tty->driver_data; 251 struct ifx_spi_device *ifx_dev = tty->driver_data;
@@ -262,7 +263,6 @@ static int ifx_spi_tiocmget(struct tty_struct *tty, struct file *filp)
262/** 263/**
263 * ifx_spi_tiocmset - set modem bits 264 * ifx_spi_tiocmset - set modem bits
264 * @tty: the tty structure 265 * @tty: the tty structure
265 * @filp: file handle issuing the request
266 * @set: bits to set 266 * @set: bits to set
267 * @clear: bits to clear 267 * @clear: bits to clear
268 * 268 *
@@ -271,7 +271,7 @@ static int ifx_spi_tiocmget(struct tty_struct *tty, struct file *filp)
271 * 271 *
272 * FIXME: do we need to kick the tranfers when we do this ? 272 * FIXME: do we need to kick the tranfers when we do this ?
273 */ 273 */
274static int ifx_spi_tiocmset(struct tty_struct *tty, struct file *filp, 274static int ifx_spi_tiocmset(struct tty_struct *tty,
275 unsigned int set, unsigned int clear) 275 unsigned int set, unsigned int clear)
276{ 276{
277 struct ifx_spi_device *ifx_dev = tty->driver_data; 277 struct ifx_spi_device *ifx_dev = tty->driver_data;
@@ -722,9 +722,9 @@ static void ifx_spi_io(unsigned long data)
722 /* note len is BYTES, not transfers */ 722 /* note len is BYTES, not transfers */
723 ifx_dev->spi_xfer.len = IFX_SPI_TRANSFER_SIZE; 723 ifx_dev->spi_xfer.len = IFX_SPI_TRANSFER_SIZE;
724 ifx_dev->spi_xfer.cs_change = 0; 724 ifx_dev->spi_xfer.cs_change = 0;
725 ifx_dev->spi_xfer.speed_hz = 12500000; 725 ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz;
726 /* ifx_dev->spi_xfer.speed_hz = 390625; */ 726 /* ifx_dev->spi_xfer.speed_hz = 390625; */
727 ifx_dev->spi_xfer.bits_per_word = spi_b16 ? 16 : 8; 727 ifx_dev->spi_xfer.bits_per_word = spi_bpw;
728 728
729 ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer; 729 ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer;
730 ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer; 730 ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer;
@@ -732,7 +732,7 @@ static void ifx_spi_io(unsigned long data)
732 /* 732 /*
733 * setup dma pointers 733 * setup dma pointers
734 */ 734 */
735 if (ifx_dev->is_6160) { 735 if (ifx_dev->use_dma) {
736 ifx_dev->spi_msg.is_dma_mapped = 1; 736 ifx_dev->spi_msg.is_dma_mapped = 1;
737 ifx_dev->tx_dma = ifx_dev->tx_bus; 737 ifx_dev->tx_dma = ifx_dev->tx_bus;
738 ifx_dev->rx_dma = ifx_dev->rx_bus; 738 ifx_dev->rx_dma = ifx_dev->rx_bus;
@@ -798,8 +798,8 @@ static int ifx_spi_create_port(struct ifx_spi_device *ifx_dev)
798 goto error_ret; 798 goto error_ret;
799 } 799 }
800 800
801 pport->ops = &ifx_tty_port_ops;
802 tty_port_init(pport); 801 tty_port_init(pport);
802 pport->ops = &ifx_tty_port_ops;
803 ifx_dev->minor = IFX_SPI_TTY_ID; 803 ifx_dev->minor = IFX_SPI_TTY_ID;
804 ifx_dev->tty_dev = tty_register_device(tty_drv, ifx_dev->minor, 804 ifx_dev->tty_dev = tty_register_device(tty_drv, ifx_dev->minor,
805 &ifx_dev->spi_dev->dev); 805 &ifx_dev->spi_dev->dev);
@@ -960,7 +960,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
960{ 960{
961 int ret; 961 int ret;
962 int srdy; 962 int srdy;
963 struct ifx_modem_platform_data *pl_data = NULL; 963 struct ifx_modem_platform_data *pl_data;
964 struct ifx_spi_device *ifx_dev; 964 struct ifx_spi_device *ifx_dev;
965 965
966 if (saved_ifx_dev) { 966 if (saved_ifx_dev) {
@@ -968,6 +968,12 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
968 return -ENODEV; 968 return -ENODEV;
969 } 969 }
970 970
971 pl_data = (struct ifx_modem_platform_data *)spi->dev.platform_data;
972 if (!pl_data) {
973 dev_err(&spi->dev, "missing platform data!");
974 return -ENODEV;
975 }
976
971 /* initialize structure to hold our device variables */ 977 /* initialize structure to hold our device variables */
972 ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL); 978 ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL);
973 if (!ifx_dev) { 979 if (!ifx_dev) {
@@ -983,14 +989,25 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
983 init_timer(&ifx_dev->spi_timer); 989 init_timer(&ifx_dev->spi_timer);
984 ifx_dev->spi_timer.function = ifx_spi_timeout; 990 ifx_dev->spi_timer.function = ifx_spi_timeout;
985 ifx_dev->spi_timer.data = (unsigned long)ifx_dev; 991 ifx_dev->spi_timer.data = (unsigned long)ifx_dev;
986 ifx_dev->is_6160 = pl_data->is_6160; 992 ifx_dev->modem = pl_data->modem_type;
993 ifx_dev->use_dma = pl_data->use_dma;
994 ifx_dev->max_hz = pl_data->max_hz;
995 /* initialize spi mode, etc */
996 spi->max_speed_hz = ifx_dev->max_hz;
997 spi->mode = IFX_SPI_MODE | (SPI_LOOP & spi->mode);
998 spi->bits_per_word = spi_bpw;
999 ret = spi_setup(spi);
1000 if (ret) {
1001 dev_err(&spi->dev, "SPI setup wasn't successful %d", ret);
1002 return -ENODEV;
1003 }
987 1004
988 /* ensure SPI protocol flags are initialized to enable transfer */ 1005 /* ensure SPI protocol flags are initialized to enable transfer */
989 ifx_dev->spi_more = 0; 1006 ifx_dev->spi_more = 0;
990 ifx_dev->spi_slave_cts = 0; 1007 ifx_dev->spi_slave_cts = 0;
991 1008
992 /*initialize transfer and dma buffers */ 1009 /*initialize transfer and dma buffers */
993 ifx_dev->tx_buffer = dma_alloc_coherent(&ifx_dev->spi_dev->dev, 1010 ifx_dev->tx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent,
994 IFX_SPI_TRANSFER_SIZE, 1011 IFX_SPI_TRANSFER_SIZE,
995 &ifx_dev->tx_bus, 1012 &ifx_dev->tx_bus,
996 GFP_KERNEL); 1013 GFP_KERNEL);
@@ -999,7 +1016,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
999 ret = -ENOMEM; 1016 ret = -ENOMEM;
1000 goto error_ret; 1017 goto error_ret;
1001 } 1018 }
1002 ifx_dev->rx_buffer = dma_alloc_coherent(&ifx_dev->spi_dev->dev, 1019 ifx_dev->rx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent,
1003 IFX_SPI_TRANSFER_SIZE, 1020 IFX_SPI_TRANSFER_SIZE,
1004 &ifx_dev->rx_bus, 1021 &ifx_dev->rx_bus,
1005 GFP_KERNEL); 1022 GFP_KERNEL);
@@ -1025,18 +1042,11 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
1025 goto error_ret; 1042 goto error_ret;
1026 } 1043 }
1027 1044
1028 pl_data = (struct ifx_modem_platform_data *)spi->dev.platform_data; 1045 ifx_dev->gpio.reset = pl_data->rst_pmu;
1029 if (pl_data) { 1046 ifx_dev->gpio.po = pl_data->pwr_on;
1030 ifx_dev->gpio.reset = pl_data->rst_pmu; 1047 ifx_dev->gpio.mrdy = pl_data->mrdy;
1031 ifx_dev->gpio.po = pl_data->pwr_on; 1048 ifx_dev->gpio.srdy = pl_data->srdy;
1032 ifx_dev->gpio.mrdy = pl_data->mrdy; 1049 ifx_dev->gpio.reset_out = pl_data->rst_out;
1033 ifx_dev->gpio.srdy = pl_data->srdy;
1034 ifx_dev->gpio.reset_out = pl_data->rst_out;
1035 } else {
1036 dev_err(&spi->dev, "missing platform data!");
1037 ret = -ENODEV;
1038 goto error_ret;
1039 }
1040 1050
1041 dev_info(&spi->dev, "gpios %d, %d, %d, %d, %d", 1051 dev_info(&spi->dev, "gpios %d, %d, %d, %d, %d",
1042 ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy, 1052 ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy,
@@ -1322,9 +1332,9 @@ static const struct spi_device_id ifx_id_table[] = {
1322MODULE_DEVICE_TABLE(spi, ifx_id_table); 1332MODULE_DEVICE_TABLE(spi, ifx_id_table);
1323 1333
1324/* spi operations */ 1334/* spi operations */
1325static const struct spi_driver ifx_spi_driver_6160 = { 1335static const struct spi_driver ifx_spi_driver = {
1326 .driver = { 1336 .driver = {
1327 .name = "ifx6160", 1337 .name = DRVNAME,
1328 .bus = &spi_bus_type, 1338 .bus = &spi_bus_type,
1329 .pm = &ifx_spi_pm, 1339 .pm = &ifx_spi_pm,
1330 .owner = THIS_MODULE}, 1340 .owner = THIS_MODULE},
@@ -1346,7 +1356,7 @@ static void __exit ifx_spi_exit(void)
1346{ 1356{
1347 /* unregister */ 1357 /* unregister */
1348 tty_unregister_driver(tty_drv); 1358 tty_unregister_driver(tty_drv);
1349 spi_unregister_driver((void *)&ifx_spi_driver_6160); 1359 spi_unregister_driver((void *)&ifx_spi_driver);
1350} 1360}
1351 1361
1352/** 1362/**
@@ -1388,7 +1398,7 @@ static int __init ifx_spi_init(void)
1388 return result; 1398 return result;
1389 } 1399 }
1390 1400
1391 result = spi_register_driver((void *)&ifx_spi_driver_6160); 1401 result = spi_register_driver((void *)&ifx_spi_driver);
1392 if (result) { 1402 if (result) {
1393 pr_err("%s: spi_register_driver failed(%d)", 1403 pr_err("%s: spi_register_driver failed(%d)",
1394 DRVNAME, result); 1404 DRVNAME, result);
diff --git a/drivers/tty/serial/ifx6x60.h b/drivers/tty/serial/ifx6x60.h
index deb7b8d977dc..e8464baf9e75 100644
--- a/drivers/tty/serial/ifx6x60.h
+++ b/drivers/tty/serial/ifx6x60.h
@@ -29,8 +29,6 @@
29#define DRVNAME "ifx6x60" 29#define DRVNAME "ifx6x60"
30#define TTYNAME "ttyIFX" 30#define TTYNAME "ttyIFX"
31 31
32/* #define IFX_THROTTLE_CODE */
33
34#define IFX_SPI_MAX_MINORS 1 32#define IFX_SPI_MAX_MINORS 1
35#define IFX_SPI_TRANSFER_SIZE 2048 33#define IFX_SPI_TRANSFER_SIZE 2048
36#define IFX_SPI_FIFO_SIZE 4096 34#define IFX_SPI_FIFO_SIZE 4096
@@ -88,7 +86,9 @@ struct ifx_spi_device {
88 dma_addr_t rx_dma; 86 dma_addr_t rx_dma;
89 dma_addr_t tx_dma; 87 dma_addr_t tx_dma;
90 88
91 int is_6160; /* Modem type */ 89 int modem; /* Modem type */
90 int use_dma; /* provide dma-able addrs in SPI msg */
91 long max_hz; /* max SPI frequency */
92 92
93 spinlock_t write_lock; 93 spinlock_t write_lock;
94 int write_pending; 94 int write_pending;
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index d40010a22ecd..c111f36f5d21 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -16,9 +16,7 @@
16 * 2/3 chan to port 1, 4/5 chan to port 3. Even number chans 16 * 2/3 chan to port 1, 4/5 chan to port 3. Even number chans
17 * are used for RX, odd chans for TX 17 * are used for RX, odd chans for TX
18 * 18 *
19 * 2. In A0 stepping, UART will not support TX half empty flag 19 * 2. The RI/DSR/DCD/DTR are not pinned out, DCD & DSR are always
20 *
21 * 3. The RI/DSR/DCD/DTR are not pinned out, DCD & DSR are always
22 * asserted, only when the HW is reset the DDCD and DDSR will 20 * asserted, only when the HW is reset the DDCD and DDSR will
23 * be triggered 21 * be triggered
24 */ 22 */
@@ -41,8 +39,6 @@
41#include <linux/io.h> 39#include <linux/io.h>
42#include <linux/debugfs.h> 40#include <linux/debugfs.h>
43 41
44#define MFD_HSU_A0_STEPPING 1
45
46#define HSU_DMA_BUF_SIZE 2048 42#define HSU_DMA_BUF_SIZE 2048
47 43
48#define chan_readl(chan, offset) readl(chan->reg + offset) 44#define chan_readl(chan, offset) readl(chan->reg + offset)
@@ -51,7 +47,10 @@
51#define mfd_readl(obj, offset) readl(obj->reg + offset) 47#define mfd_readl(obj, offset) readl(obj->reg + offset)
52#define mfd_writel(obj, offset, val) writel(val, obj->reg + offset) 48#define mfd_writel(obj, offset, val) writel(val, obj->reg + offset)
53 49
54#define HSU_DMA_TIMEOUT_CHECK_FREQ (HZ/10) 50static int hsu_dma_enable;
51module_param(hsu_dma_enable, int, 0);
52MODULE_PARM_DESC(hsu_dma_enable, "It is a bitmap to set working mode, if \
53bit[x] is 1, then port[x] will work in DMA mode, otherwise in PIO mode.");
55 54
56struct hsu_dma_buffer { 55struct hsu_dma_buffer {
57 u8 *buf; 56 u8 *buf;
@@ -65,7 +64,6 @@ struct hsu_dma_chan {
65 enum dma_data_direction dirt; 64 enum dma_data_direction dirt;
66 struct uart_hsu_port *uport; 65 struct uart_hsu_port *uport;
67 void __iomem *reg; 66 void __iomem *reg;
68 struct timer_list rx_timer; /* only needed by RX channel */
69}; 67};
70 68
71struct uart_hsu_port { 69struct uart_hsu_port {
@@ -355,8 +353,6 @@ void hsu_dma_start_rx_chan(struct hsu_dma_chan *rxc, struct hsu_dma_buffer *dbuf
355 | (0x1 << 24) /* timeout bit, see HSU Errata 1 */ 353 | (0x1 << 24) /* timeout bit, see HSU Errata 1 */
356 ); 354 );
357 chan_writel(rxc, HSU_CH_CR, 0x3); 355 chan_writel(rxc, HSU_CH_CR, 0x3);
358
359 mod_timer(&rxc->rx_timer, jiffies + HSU_DMA_TIMEOUT_CHECK_FREQ);
360} 356}
361 357
362/* Protected by spin_lock_irqsave(port->lock) */ 358/* Protected by spin_lock_irqsave(port->lock) */
@@ -420,7 +416,6 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
420 chan_writel(chan, HSU_CH_CR, 0x3); 416 chan_writel(chan, HSU_CH_CR, 0x3);
421 return; 417 return;
422 } 418 }
423 del_timer(&chan->rx_timer);
424 419
425 dma_sync_single_for_cpu(port->dev, dbuf->dma_addr, 420 dma_sync_single_for_cpu(port->dev, dbuf->dma_addr,
426 dbuf->dma_size, DMA_FROM_DEVICE); 421 dbuf->dma_size, DMA_FROM_DEVICE);
@@ -448,8 +443,6 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
448 tty_flip_buffer_push(tty); 443 tty_flip_buffer_push(tty);
449 444
450 chan_writel(chan, HSU_CH_CR, 0x3); 445 chan_writel(chan, HSU_CH_CR, 0x3);
451 chan->rx_timer.expires = jiffies + HSU_DMA_TIMEOUT_CHECK_FREQ;
452 add_timer(&chan->rx_timer);
453 446
454} 447}
455 448
@@ -551,16 +544,9 @@ static void transmit_chars(struct uart_hsu_port *up)
551 return; 544 return;
552 } 545 }
553 546
554#ifndef MFD_HSU_A0_STEPPING 547 /* The IRQ is for TX FIFO half-empty */
555 count = up->port.fifosize / 2; 548 count = up->port.fifosize / 2;
556#else 549
557 /*
558 * A0 only supports fully empty IRQ, and the first char written
559 * into it won't clear the EMPT bit, so we may need be cautious
560 * by useing a shorter buffer
561 */
562 count = up->port.fifosize - 4;
563#endif
564 do { 550 do {
565 serial_out(up, UART_TX, xmit->buf[xmit->tail]); 551 serial_out(up, UART_TX, xmit->buf[xmit->tail]);
566 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 552 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
@@ -769,9 +755,8 @@ static void serial_hsu_break_ctl(struct uart_port *port, int break_state)
769/* 755/*
770 * What special to do: 756 * What special to do:
771 * 1. chose the 64B fifo mode 757 * 1. chose the 64B fifo mode
772 * 2. make sure not to select half empty mode for A0 stepping 758 * 2. start dma or pio depends on configuration
773 * 3. start dma or pio depends on configuration 759 * 3. we only allocate dma memory when needed
774 * 4. we only allocate dma memory when needed
775 */ 760 */
776static int serial_hsu_startup(struct uart_port *port) 761static int serial_hsu_startup(struct uart_port *port)
777{ 762{
@@ -870,8 +855,6 @@ static void serial_hsu_shutdown(struct uart_port *port)
870 container_of(port, struct uart_hsu_port, port); 855 container_of(port, struct uart_hsu_port, port);
871 unsigned long flags; 856 unsigned long flags;
872 857
873 del_timer_sync(&up->rxc->rx_timer);
874
875 /* Disable interrupts from this port */ 858 /* Disable interrupts from this port */
876 up->ier = 0; 859 up->ier = 0;
877 serial_out(up, UART_IER, 0); 860 serial_out(up, UART_IER, 0);
@@ -977,10 +960,6 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios,
977 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_HSU_64_32B; 960 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_HSU_64_32B;
978 961
979 fcr |= UART_FCR_HSU_64B_FIFO; 962 fcr |= UART_FCR_HSU_64B_FIFO;
980#ifdef MFD_HSU_A0_STEPPING
981 /* A0 doesn't support half empty IRQ */
982 fcr |= UART_FCR_FULL_EMPT_TXI;
983#endif
984 963
985 /* 964 /*
986 * Ok, we're now changing the port state. Do it with 965 * Ok, we're now changing the port state. Do it with
@@ -1343,28 +1322,6 @@ err_disable:
1343 return ret; 1322 return ret;
1344} 1323}
1345 1324
1346static void hsu_dma_rx_timeout(unsigned long data)
1347{
1348 struct hsu_dma_chan *chan = (void *)data;
1349 struct uart_hsu_port *up = chan->uport;
1350 struct hsu_dma_buffer *dbuf = &up->rxbuf;
1351 int count = 0;
1352 unsigned long flags;
1353
1354 spin_lock_irqsave(&up->port.lock, flags);
1355
1356 count = chan_readl(chan, HSU_CH_D0SAR) - dbuf->dma_addr;
1357
1358 if (!count) {
1359 mod_timer(&chan->rx_timer, jiffies + HSU_DMA_TIMEOUT_CHECK_FREQ);
1360 goto exit;
1361 }
1362
1363 hsu_dma_rx(up, 0);
1364exit:
1365 spin_unlock_irqrestore(&up->port.lock, flags);
1366}
1367
1368static void hsu_global_init(void) 1325static void hsu_global_init(void)
1369{ 1326{
1370 struct hsu_port *hsu; 1327 struct hsu_port *hsu;
@@ -1415,6 +1372,12 @@ static void hsu_global_init(void)
1415 1372
1416 serial_hsu_ports[i] = uport; 1373 serial_hsu_ports[i] = uport;
1417 uport->index = i; 1374 uport->index = i;
1375
1376 if (hsu_dma_enable & (1<<i))
1377 uport->use_dma = 1;
1378 else
1379 uport->use_dma = 0;
1380
1418 uport++; 1381 uport++;
1419 } 1382 }
1420 1383
@@ -1427,12 +1390,6 @@ static void hsu_global_init(void)
1427 dchan->reg = hsu->reg + HSU_DMA_CHANS_REG_OFFSET + 1390 dchan->reg = hsu->reg + HSU_DMA_CHANS_REG_OFFSET +
1428 i * HSU_DMA_CHANS_REG_LENGTH; 1391 i * HSU_DMA_CHANS_REG_LENGTH;
1429 1392
1430 /* Work around for RX */
1431 if (dchan->dirt == DMA_FROM_DEVICE) {
1432 init_timer(&dchan->rx_timer);
1433 dchan->rx_timer.function = hsu_dma_rx_timeout;
1434 dchan->rx_timer.data = (unsigned long)dchan;
1435 }
1436 dchan++; 1393 dchan++;
1437 } 1394 }
1438 1395
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index b62857bf2fdb..37e13c3d91d9 100644
--- a/drivers/tty/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
@@ -51,7 +51,7 @@
51struct uart_max3110 { 51struct uart_max3110 {
52 struct uart_port port; 52 struct uart_port port;
53 struct spi_device *spi; 53 struct spi_device *spi;
54 char name[24]; 54 char name[SPI_NAME_SIZE];
55 55
56 wait_queue_head_t wq; 56 wait_queue_head_t wq;
57 struct task_struct *main_thread; 57 struct task_struct *main_thread;
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
new file mode 100644
index 000000000000..2e7fc9cee9cc
--- /dev/null
+++ b/drivers/tty/serial/msm_serial_hs.c
@@ -0,0 +1,1880 @@
1/*
2 * MSM 7k/8k High speed uart driver
3 *
4 * Copyright (c) 2007-2011, Code Aurora Forum. All rights reserved.
5 * Copyright (c) 2008 Google Inc.
6 * Modified: Nick Pelly <npelly@google.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * Has optional support for uart power management independent of linux
18 * suspend/resume:
19 *
20 * RX wakeup.
21 * UART wakeup can be triggered by RX activity (using a wakeup GPIO on the
22 * UART RX pin). This should only be used if there is not a wakeup
23 * GPIO on the UART CTS, and the first RX byte is known (for example, with the
24 * Bluetooth Texas Instruments HCILL protocol), since the first RX byte will
25 * always be lost. RTS will be asserted even while the UART is off in this mode
26 * of operation. See msm_serial_hs_platform_data.rx_wakeup_irq.
27 */
28
29#include <linux/module.h>
30
31#include <linux/serial.h>
32#include <linux/serial_core.h>
33#include <linux/slab.h>
34#include <linux/init.h>
35#include <linux/interrupt.h>
36#include <linux/irq.h>
37#include <linux/io.h>
38#include <linux/ioport.h>
39#include <linux/kernel.h>
40#include <linux/timer.h>
41#include <linux/clk.h>
42#include <linux/platform_device.h>
43#include <linux/pm_runtime.h>
44#include <linux/dma-mapping.h>
45#include <linux/dmapool.h>
46#include <linux/wait.h>
47#include <linux/workqueue.h>
48
49#include <linux/atomic.h>
50#include <asm/irq.h>
51#include <asm/system.h>
52
53#include <mach/hardware.h>
54#include <mach/dma.h>
55#include <linux/platform_data/msm_serial_hs.h>
56
57/* HSUART Registers */
58#define UARTDM_MR1_ADDR 0x0
59#define UARTDM_MR2_ADDR 0x4
60
61/* Data Mover result codes */
62#define RSLT_FIFO_CNTR_BMSK (0xE << 28)
63#define RSLT_VLD BIT(1)
64
65/* write only register */
66#define UARTDM_CSR_ADDR 0x8
67#define UARTDM_CSR_115200 0xFF
68#define UARTDM_CSR_57600 0xEE
69#define UARTDM_CSR_38400 0xDD
70#define UARTDM_CSR_28800 0xCC
71#define UARTDM_CSR_19200 0xBB
72#define UARTDM_CSR_14400 0xAA
73#define UARTDM_CSR_9600 0x99
74#define UARTDM_CSR_7200 0x88
75#define UARTDM_CSR_4800 0x77
76#define UARTDM_CSR_3600 0x66
77#define UARTDM_CSR_2400 0x55
78#define UARTDM_CSR_1200 0x44
79#define UARTDM_CSR_600 0x33
80#define UARTDM_CSR_300 0x22
81#define UARTDM_CSR_150 0x11
82#define UARTDM_CSR_75 0x00
83
84/* write only register */
85#define UARTDM_TF_ADDR 0x70
86#define UARTDM_TF2_ADDR 0x74
87#define UARTDM_TF3_ADDR 0x78
88#define UARTDM_TF4_ADDR 0x7C
89
90/* write only register */
91#define UARTDM_CR_ADDR 0x10
92#define UARTDM_IMR_ADDR 0x14
93
94#define UARTDM_IPR_ADDR 0x18
95#define UARTDM_TFWR_ADDR 0x1c
96#define UARTDM_RFWR_ADDR 0x20
97#define UARTDM_HCR_ADDR 0x24
98#define UARTDM_DMRX_ADDR 0x34
99#define UARTDM_IRDA_ADDR 0x38
100#define UARTDM_DMEN_ADDR 0x3c
101
102/* UART_DM_NO_CHARS_FOR_TX */
103#define UARTDM_NCF_TX_ADDR 0x40
104
105#define UARTDM_BADR_ADDR 0x44
106
107#define UARTDM_SIM_CFG_ADDR 0x80
108/* Read Only register */
109#define UARTDM_SR_ADDR 0x8
110
111/* Read Only register */
112#define UARTDM_RF_ADDR 0x70
113#define UARTDM_RF2_ADDR 0x74
114#define UARTDM_RF3_ADDR 0x78
115#define UARTDM_RF4_ADDR 0x7C
116
117/* Read Only register */
118#define UARTDM_MISR_ADDR 0x10
119
120/* Read Only register */
121#define UARTDM_ISR_ADDR 0x14
122#define UARTDM_RX_TOTAL_SNAP_ADDR 0x38
123
124#define UARTDM_RXFS_ADDR 0x50
125
126/* Register field Mask Mapping */
127#define UARTDM_SR_PAR_FRAME_BMSK BIT(5)
128#define UARTDM_SR_OVERRUN_BMSK BIT(4)
129#define UARTDM_SR_TXEMT_BMSK BIT(3)
130#define UARTDM_SR_TXRDY_BMSK BIT(2)
131#define UARTDM_SR_RXRDY_BMSK BIT(0)
132
133#define UARTDM_CR_TX_DISABLE_BMSK BIT(3)
134#define UARTDM_CR_RX_DISABLE_BMSK BIT(1)
135#define UARTDM_CR_TX_EN_BMSK BIT(2)
136#define UARTDM_CR_RX_EN_BMSK BIT(0)
137
138/* UARTDM_CR channel_comman bit value (register field is bits 8:4) */
139#define RESET_RX 0x10
140#define RESET_TX 0x20
141#define RESET_ERROR_STATUS 0x30
142#define RESET_BREAK_INT 0x40
143#define START_BREAK 0x50
144#define STOP_BREAK 0x60
145#define RESET_CTS 0x70
146#define RESET_STALE_INT 0x80
147#define RFR_LOW 0xD0
148#define RFR_HIGH 0xE0
149#define CR_PROTECTION_EN 0x100
150#define STALE_EVENT_ENABLE 0x500
151#define STALE_EVENT_DISABLE 0x600
152#define FORCE_STALE_EVENT 0x400
153#define CLEAR_TX_READY 0x300
154#define RESET_TX_ERROR 0x800
155#define RESET_TX_DONE 0x810
156
157#define UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00
158#define UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f
159#define UARTDM_MR1_CTS_CTL_BMSK 0x40
160#define UARTDM_MR1_RX_RDY_CTL_BMSK 0x80
161
162#define UARTDM_MR2_ERROR_MODE_BMSK 0x40
163#define UARTDM_MR2_BITS_PER_CHAR_BMSK 0x30
164
165/* bits per character configuration */
166#define FIVE_BPC (0 << 4)
167#define SIX_BPC (1 << 4)
168#define SEVEN_BPC (2 << 4)
169#define EIGHT_BPC (3 << 4)
170
171#define UARTDM_MR2_STOP_BIT_LEN_BMSK 0xc
172#define STOP_BIT_ONE (1 << 2)
173#define STOP_BIT_TWO (3 << 2)
174
175#define UARTDM_MR2_PARITY_MODE_BMSK 0x3
176
177/* Parity configuration */
178#define NO_PARITY 0x0
179#define EVEN_PARITY 0x1
180#define ODD_PARITY 0x2
181#define SPACE_PARITY 0x3
182
183#define UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80
184#define UARTDM_IPR_STALE_LSB_BMSK 0x1f
185
186/* These can be used for both ISR and IMR register */
187#define UARTDM_ISR_TX_READY_BMSK BIT(7)
188#define UARTDM_ISR_CURRENT_CTS_BMSK BIT(6)
189#define UARTDM_ISR_DELTA_CTS_BMSK BIT(5)
190#define UARTDM_ISR_RXLEV_BMSK BIT(4)
191#define UARTDM_ISR_RXSTALE_BMSK BIT(3)
192#define UARTDM_ISR_RXBREAK_BMSK BIT(2)
193#define UARTDM_ISR_RXHUNT_BMSK BIT(1)
194#define UARTDM_ISR_TXLEV_BMSK BIT(0)
195
196/* Field definitions for UART_DM_DMEN*/
197#define UARTDM_TX_DM_EN_BMSK 0x1
198#define UARTDM_RX_DM_EN_BMSK 0x2
199
200#define UART_FIFOSIZE 64
201#define UARTCLK 7372800
202
203/* Rx DMA request states */
204enum flush_reason {
205 FLUSH_NONE,
206 FLUSH_DATA_READY,
207 FLUSH_DATA_INVALID, /* values after this indicate invalid data */
208 FLUSH_IGNORE = FLUSH_DATA_INVALID,
209 FLUSH_STOP,
210 FLUSH_SHUTDOWN,
211};
212
213/* UART clock states */
214enum msm_hs_clk_states_e {
215 MSM_HS_CLK_PORT_OFF, /* port not in use */
216 MSM_HS_CLK_OFF, /* clock disabled */
217 MSM_HS_CLK_REQUEST_OFF, /* disable after TX and RX flushed */
218 MSM_HS_CLK_ON, /* clock enabled */
219};
220
221/* Track the forced RXSTALE flush during clock off sequence.
222 * These states are only valid during MSM_HS_CLK_REQUEST_OFF */
223enum msm_hs_clk_req_off_state_e {
224 CLK_REQ_OFF_START,
225 CLK_REQ_OFF_RXSTALE_ISSUED,
226 CLK_REQ_OFF_FLUSH_ISSUED,
227 CLK_REQ_OFF_RXSTALE_FLUSHED,
228};
229
230/**
231 * struct msm_hs_tx
232 * @tx_ready_int_en: ok to dma more tx?
233 * @dma_in_flight: tx dma in progress
234 * @xfer: top level DMA command pointer structure
235 * @command_ptr: third level command struct pointer
236 * @command_ptr_ptr: second level command list struct pointer
237 * @mapped_cmd_ptr: DMA view of third level command struct
238 * @mapped_cmd_ptr_ptr: DMA view of second level command list struct
239 * @tx_count: number of bytes to transfer in DMA transfer
240 * @dma_base: DMA view of UART xmit buffer
241 *
242 * This structure describes a single Tx DMA transaction. MSM DMA
243 * commands have two levels of indirection. The top level command
244 * ptr points to a list of command ptr which in turn points to a
245 * single DMA 'command'. In our case each Tx transaction consists
246 * of a single second level pointer pointing to a 'box type' command.
247 */
248struct msm_hs_tx {
249 unsigned int tx_ready_int_en;
250 unsigned int dma_in_flight;
251 struct msm_dmov_cmd xfer;
252 dmov_box *command_ptr;
253 u32 *command_ptr_ptr;
254 dma_addr_t mapped_cmd_ptr;
255 dma_addr_t mapped_cmd_ptr_ptr;
256 int tx_count;
257 dma_addr_t dma_base;
258};
259
260/**
261 * struct msm_hs_rx
262 * @flush: Rx DMA request state
263 * @xfer: top level DMA command pointer structure
264 * @cmdptr_dmaaddr: DMA view of second level command structure
265 * @command_ptr: third level DMA command pointer structure
266 * @command_ptr_ptr: second level DMA command list pointer
267 * @mapped_cmd_ptr: DMA view of the third level command structure
268 * @wait: wait for DMA completion before shutdown
269 * @buffer: destination buffer for RX DMA
270 * @rbuffer: DMA view of buffer
271 * @pool: dma pool out of which coherent rx buffer is allocated
272 * @tty_work: private work-queue for tty flip buffer push task
273 *
274 * This structure describes a single Rx DMA transaction. Rx DMA
275 * transactions use box mode DMA commands.
276 */
277struct msm_hs_rx {
278 enum flush_reason flush;
279 struct msm_dmov_cmd xfer;
280 dma_addr_t cmdptr_dmaaddr;
281 dmov_box *command_ptr;
282 u32 *command_ptr_ptr;
283 dma_addr_t mapped_cmd_ptr;
284 wait_queue_head_t wait;
285 dma_addr_t rbuffer;
286 unsigned char *buffer;
287 struct dma_pool *pool;
288 struct work_struct tty_work;
289};
290
291/**
292 * struct msm_hs_rx_wakeup
293 * @irq: IRQ line to be configured as interrupt source on Rx activity
294 * @ignore: boolean value. 1 = ignore the wakeup interrupt
295 * @rx_to_inject: extra character to be inserted to Rx tty on wakeup
296 * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character
297 *
298 * This is an optional structure required for UART Rx GPIO IRQ based
299 * wakeup from low power state. UART wakeup can be triggered by RX activity
300 * (using a wakeup GPIO on the UART RX pin). This should only be used if
301 * there is not a wakeup GPIO on the UART CTS, and the first RX byte is
302 * known (eg., with the Bluetooth Texas Instruments HCILL protocol),
303 * since the first RX byte will always be lost. RTS will be asserted even
304 * while the UART is clocked off in this mode of operation.
305 */
306struct msm_hs_rx_wakeup {
307 int irq; /* < 0 indicates low power wakeup disabled */
308 unsigned char ignore;
309 unsigned char inject_rx;
310 char rx_to_inject;
311};
312
313/**
314 * struct msm_hs_port
315 * @uport: embedded uart port structure
316 * @imr_reg: shadow value of UARTDM_IMR
317 * @clk: uart input clock handle
318 * @tx: Tx transaction related data structure
319 * @rx: Rx transaction related data structure
320 * @dma_tx_channel: Tx DMA command channel
321 * @dma_rx_channel Rx DMA command channel
322 * @dma_tx_crci: Tx channel rate control interface number
323 * @dma_rx_crci: Rx channel rate control interface number
324 * @clk_off_timer: Timer to poll DMA event completion before clock off
325 * @clk_off_delay: clk_off_timer poll interval
326 * @clk_state: overall clock state
327 * @clk_req_off_state: post flush clock states
328 * @rx_wakeup: optional rx_wakeup feature related data
329 * @exit_lpm_cb: optional callback to exit low power mode
330 *
331 * Low level serial port structure.
332 */
333struct msm_hs_port {
334 struct uart_port uport;
335 unsigned long imr_reg;
336 struct clk *clk;
337 struct msm_hs_tx tx;
338 struct msm_hs_rx rx;
339
340 int dma_tx_channel;
341 int dma_rx_channel;
342 int dma_tx_crci;
343 int dma_rx_crci;
344
345 struct hrtimer clk_off_timer;
346 ktime_t clk_off_delay;
347 enum msm_hs_clk_states_e clk_state;
348 enum msm_hs_clk_req_off_state_e clk_req_off_state;
349
350 struct msm_hs_rx_wakeup rx_wakeup;
351 void (*exit_lpm_cb)(struct uart_port *);
352};
353
354#define MSM_UARTDM_BURST_SIZE 16 /* DM burst size (in bytes) */
355#define UARTDM_TX_BUF_SIZE UART_XMIT_SIZE
356#define UARTDM_RX_BUF_SIZE 512
357
358#define UARTDM_NR 2
359
360static struct msm_hs_port q_uart_port[UARTDM_NR];
361static struct platform_driver msm_serial_hs_platform_driver;
362static struct uart_driver msm_hs_driver;
363static struct uart_ops msm_hs_ops;
364static struct workqueue_struct *msm_hs_workqueue;
365
366#define UARTDM_TO_MSM(uart_port) \
367 container_of((uart_port), struct msm_hs_port, uport)
368
369static unsigned int use_low_power_rx_wakeup(struct msm_hs_port
370 *msm_uport)
371{
372 return (msm_uport->rx_wakeup.irq >= 0);
373}
374
375static unsigned int msm_hs_read(struct uart_port *uport,
376 unsigned int offset)
377{
378 return ioread32(uport->membase + offset);
379}
380
381static void msm_hs_write(struct uart_port *uport, unsigned int offset,
382 unsigned int value)
383{
384 iowrite32(value, uport->membase + offset);
385}
386
387static void msm_hs_release_port(struct uart_port *port)
388{
389 iounmap(port->membase);
390}
391
392static int msm_hs_request_port(struct uart_port *port)
393{
394 port->membase = ioremap(port->mapbase, PAGE_SIZE);
395 if (unlikely(!port->membase))
396 return -ENOMEM;
397
398 /* configure the CR Protection to Enable */
399 msm_hs_write(port, UARTDM_CR_ADDR, CR_PROTECTION_EN);
400 return 0;
401}
402
403static int __devexit msm_hs_remove(struct platform_device *pdev)
404{
405
406 struct msm_hs_port *msm_uport;
407 struct device *dev;
408
409 if (pdev->id < 0 || pdev->id >= UARTDM_NR) {
410 printk(KERN_ERR "Invalid plaform device ID = %d\n", pdev->id);
411 return -EINVAL;
412 }
413
414 msm_uport = &q_uart_port[pdev->id];
415 dev = msm_uport->uport.dev;
416
417 dma_unmap_single(dev, msm_uport->rx.mapped_cmd_ptr, sizeof(dmov_box),
418 DMA_TO_DEVICE);
419 dma_pool_free(msm_uport->rx.pool, msm_uport->rx.buffer,
420 msm_uport->rx.rbuffer);
421 dma_pool_destroy(msm_uport->rx.pool);
422
423 dma_unmap_single(dev, msm_uport->rx.cmdptr_dmaaddr, sizeof(u32 *),
424 DMA_TO_DEVICE);
425 dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr_ptr, sizeof(u32 *),
426 DMA_TO_DEVICE);
427 dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr, sizeof(dmov_box),
428 DMA_TO_DEVICE);
429
430 uart_remove_one_port(&msm_hs_driver, &msm_uport->uport);
431 clk_put(msm_uport->clk);
432
433 /* Free the tx resources */
434 kfree(msm_uport->tx.command_ptr);
435 kfree(msm_uport->tx.command_ptr_ptr);
436
437 /* Free the rx resources */
438 kfree(msm_uport->rx.command_ptr);
439 kfree(msm_uport->rx.command_ptr_ptr);
440
441 iounmap(msm_uport->uport.membase);
442
443 return 0;
444}
445
446static int msm_hs_init_clk_locked(struct uart_port *uport)
447{
448 int ret;
449 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
450
451 ret = clk_enable(msm_uport->clk);
452 if (ret) {
453 printk(KERN_ERR "Error could not turn on UART clk\n");
454 return ret;
455 }
456
457 /* Set up the MREG/NREG/DREG/MNDREG */
458 ret = clk_set_rate(msm_uport->clk, uport->uartclk);
459 if (ret) {
460 printk(KERN_WARNING "Error setting clock rate on UART\n");
461 clk_disable(msm_uport->clk);
462 return ret;
463 }
464
465 msm_uport->clk_state = MSM_HS_CLK_ON;
466 return 0;
467}
468
469/* Enable and Disable clocks (Used for power management) */
470static void msm_hs_pm(struct uart_port *uport, unsigned int state,
471 unsigned int oldstate)
472{
473 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
474
475 if (use_low_power_rx_wakeup(msm_uport) ||
476 msm_uport->exit_lpm_cb)
477 return; /* ignore linux PM states,
478 use msm_hs_request_clock API */
479
480 switch (state) {
481 case 0:
482 clk_enable(msm_uport->clk);
483 break;
484 case 3:
485 clk_disable(msm_uport->clk);
486 break;
487 default:
488 dev_err(uport->dev, "msm_serial: Unknown PM state %d\n",
489 state);
490 }
491}
492
493/*
494 * programs the UARTDM_CSR register with correct bit rates
495 *
496 * Interrupts should be disabled before we are called, as
497 * we modify Set Baud rate
498 * Set receive stale interrupt level, dependant on Bit Rate
499 * Goal is to have around 8 ms before indicate stale.
500 * roundup (((Bit Rate * .008) / 10) + 1
501 */
502static void msm_hs_set_bps_locked(struct uart_port *uport,
503 unsigned int bps)
504{
505 unsigned long rxstale;
506 unsigned long data;
507 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
508
509 switch (bps) {
510 case 300:
511 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_75);
512 rxstale = 1;
513 break;
514 case 600:
515 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_150);
516 rxstale = 1;
517 break;
518 case 1200:
519 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_300);
520 rxstale = 1;
521 break;
522 case 2400:
523 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_600);
524 rxstale = 1;
525 break;
526 case 4800:
527 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_1200);
528 rxstale = 1;
529 break;
530 case 9600:
531 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_2400);
532 rxstale = 2;
533 break;
534 case 14400:
535 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_3600);
536 rxstale = 3;
537 break;
538 case 19200:
539 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_4800);
540 rxstale = 4;
541 break;
542 case 28800:
543 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_7200);
544 rxstale = 6;
545 break;
546 case 38400:
547 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_9600);
548 rxstale = 8;
549 break;
550 case 57600:
551 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_14400);
552 rxstale = 16;
553 break;
554 case 76800:
555 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_19200);
556 rxstale = 16;
557 break;
558 case 115200:
559 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_28800);
560 rxstale = 31;
561 break;
562 case 230400:
563 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_57600);
564 rxstale = 31;
565 break;
566 case 460800:
567 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_115200);
568 rxstale = 31;
569 break;
570 case 4000000:
571 case 3686400:
572 case 3200000:
573 case 3500000:
574 case 3000000:
575 case 2500000:
576 case 1500000:
577 case 1152000:
578 case 1000000:
579 case 921600:
580 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_115200);
581 rxstale = 31;
582 break;
583 default:
584 msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_2400);
585 /* default to 9600 */
586 bps = 9600;
587 rxstale = 2;
588 break;
589 }
590 if (bps > 460800)
591 uport->uartclk = bps * 16;
592 else
593 uport->uartclk = UARTCLK;
594
595 if (clk_set_rate(msm_uport->clk, uport->uartclk)) {
596 printk(KERN_WARNING "Error setting clock rate on UART\n");
597 return;
598 }
599
600 data = rxstale & UARTDM_IPR_STALE_LSB_BMSK;
601 data |= UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK & (rxstale << 2);
602
603 msm_hs_write(uport, UARTDM_IPR_ADDR, data);
604}
605
606/*
607 * termios : new ktermios
608 * oldtermios: old ktermios previous setting
609 *
610 * Configure the serial port
611 */
612static void msm_hs_set_termios(struct uart_port *uport,
613 struct ktermios *termios,
614 struct ktermios *oldtermios)
615{
616 unsigned int bps;
617 unsigned long data;
618 unsigned long flags;
619 unsigned int c_cflag = termios->c_cflag;
620 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
621
622 spin_lock_irqsave(&uport->lock, flags);
623 clk_enable(msm_uport->clk);
624
625 /* 300 is the minimum baud support by the driver */
626 bps = uart_get_baud_rate(uport, termios, oldtermios, 200, 4000000);
627
628 /* Temporary remapping 200 BAUD to 3.2 mbps */
629 if (bps == 200)
630 bps = 3200000;
631
632 msm_hs_set_bps_locked(uport, bps);
633
634 data = msm_hs_read(uport, UARTDM_MR2_ADDR);
635 data &= ~UARTDM_MR2_PARITY_MODE_BMSK;
636 /* set parity */
637 if (PARENB == (c_cflag & PARENB)) {
638 if (PARODD == (c_cflag & PARODD))
639 data |= ODD_PARITY;
640 else if (CMSPAR == (c_cflag & CMSPAR))
641 data |= SPACE_PARITY;
642 else
643 data |= EVEN_PARITY;
644 }
645
646 /* Set bits per char */
647 data &= ~UARTDM_MR2_BITS_PER_CHAR_BMSK;
648
649 switch (c_cflag & CSIZE) {
650 case CS5:
651 data |= FIVE_BPC;
652 break;
653 case CS6:
654 data |= SIX_BPC;
655 break;
656 case CS7:
657 data |= SEVEN_BPC;
658 break;
659 default:
660 data |= EIGHT_BPC;
661 break;
662 }
663 /* stop bits */
664 if (c_cflag & CSTOPB) {
665 data |= STOP_BIT_TWO;
666 } else {
667 /* otherwise 1 stop bit */
668 data |= STOP_BIT_ONE;
669 }
670 data |= UARTDM_MR2_ERROR_MODE_BMSK;
671 /* write parity/bits per char/stop bit configuration */
672 msm_hs_write(uport, UARTDM_MR2_ADDR, data);
673
674 /* Configure HW flow control */
675 data = msm_hs_read(uport, UARTDM_MR1_ADDR);
676
677 data &= ~(UARTDM_MR1_CTS_CTL_BMSK | UARTDM_MR1_RX_RDY_CTL_BMSK);
678
679 if (c_cflag & CRTSCTS) {
680 data |= UARTDM_MR1_CTS_CTL_BMSK;
681 data |= UARTDM_MR1_RX_RDY_CTL_BMSK;
682 }
683
684 msm_hs_write(uport, UARTDM_MR1_ADDR, data);
685
686 uport->ignore_status_mask = termios->c_iflag & INPCK;
687 uport->ignore_status_mask |= termios->c_iflag & IGNPAR;
688 uport->read_status_mask = (termios->c_cflag & CREAD);
689
690 msm_hs_write(uport, UARTDM_IMR_ADDR, 0);
691
692 /* Set Transmit software time out */
693 uart_update_timeout(uport, c_cflag, bps);
694
695 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX);
696 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_TX);
697
698 if (msm_uport->rx.flush == FLUSH_NONE) {
699 msm_uport->rx.flush = FLUSH_IGNORE;
700 msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1);
701 }
702
703 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
704
705 clk_disable(msm_uport->clk);
706 spin_unlock_irqrestore(&uport->lock, flags);
707}
708
709/*
710 * Standard API, Transmitter
711 * Any character in the transmit shift register is sent
712 */
713static unsigned int msm_hs_tx_empty(struct uart_port *uport)
714{
715 unsigned int data;
716 unsigned int ret = 0;
717 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
718
719 clk_enable(msm_uport->clk);
720
721 data = msm_hs_read(uport, UARTDM_SR_ADDR);
722 if (data & UARTDM_SR_TXEMT_BMSK)
723 ret = TIOCSER_TEMT;
724
725 clk_disable(msm_uport->clk);
726
727 return ret;
728}
729
730/*
731 * Standard API, Stop transmitter.
732 * Any character in the transmit shift register is sent as
733 * well as the current data mover transfer .
734 */
735static void msm_hs_stop_tx_locked(struct uart_port *uport)
736{
737 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
738
739 msm_uport->tx.tx_ready_int_en = 0;
740}
741
742/*
743 * Standard API, Stop receiver as soon as possible.
744 *
745 * Function immediately terminates the operation of the
746 * channel receiver and any incoming characters are lost. None
747 * of the receiver status bits are affected by this command and
748 * characters that are already in the receive FIFO there.
749 */
750static void msm_hs_stop_rx_locked(struct uart_port *uport)
751{
752 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
753 unsigned int data;
754
755 clk_enable(msm_uport->clk);
756
757 /* disable dlink */
758 data = msm_hs_read(uport, UARTDM_DMEN_ADDR);
759 data &= ~UARTDM_RX_DM_EN_BMSK;
760 msm_hs_write(uport, UARTDM_DMEN_ADDR, data);
761
762 /* Disable the receiver */
763 if (msm_uport->rx.flush == FLUSH_NONE)
764 msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1);
765
766 if (msm_uport->rx.flush != FLUSH_SHUTDOWN)
767 msm_uport->rx.flush = FLUSH_STOP;
768
769 clk_disable(msm_uport->clk);
770}
771
772/* Transmit the next chunk of data */
773static void msm_hs_submit_tx_locked(struct uart_port *uport)
774{
775 int left;
776 int tx_count;
777 dma_addr_t src_addr;
778 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
779 struct msm_hs_tx *tx = &msm_uport->tx;
780 struct circ_buf *tx_buf = &msm_uport->uport.state->xmit;
781
782 if (uart_circ_empty(tx_buf) || uport->state->port.tty->stopped) {
783 msm_hs_stop_tx_locked(uport);
784 return;
785 }
786
787 tx->dma_in_flight = 1;
788
789 tx_count = uart_circ_chars_pending(tx_buf);
790
791 if (UARTDM_TX_BUF_SIZE < tx_count)
792 tx_count = UARTDM_TX_BUF_SIZE;
793
794 left = UART_XMIT_SIZE - tx_buf->tail;
795
796 if (tx_count > left)
797 tx_count = left;
798
799 src_addr = tx->dma_base + tx_buf->tail;
800 dma_sync_single_for_device(uport->dev, src_addr, tx_count,
801 DMA_TO_DEVICE);
802
803 tx->command_ptr->num_rows = (((tx_count + 15) >> 4) << 16) |
804 ((tx_count + 15) >> 4);
805 tx->command_ptr->src_row_addr = src_addr;
806
807 dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr,
808 sizeof(dmov_box), DMA_TO_DEVICE);
809
810 *tx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(tx->mapped_cmd_ptr);
811
812 dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr_ptr,
813 sizeof(u32 *), DMA_TO_DEVICE);
814
815 /* Save tx_count to use in Callback */
816 tx->tx_count = tx_count;
817 msm_hs_write(uport, UARTDM_NCF_TX_ADDR, tx_count);
818
819 /* Disable the tx_ready interrupt */
820 msm_uport->imr_reg &= ~UARTDM_ISR_TX_READY_BMSK;
821 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
822 msm_dmov_enqueue_cmd(msm_uport->dma_tx_channel, &tx->xfer);
823}
824
825/* Start to receive the next chunk of data */
826static void msm_hs_start_rx_locked(struct uart_port *uport)
827{
828 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
829
830 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT);
831 msm_hs_write(uport, UARTDM_DMRX_ADDR, UARTDM_RX_BUF_SIZE);
832 msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_ENABLE);
833 msm_uport->imr_reg |= UARTDM_ISR_RXLEV_BMSK;
834 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
835
836 msm_uport->rx.flush = FLUSH_NONE;
837 msm_dmov_enqueue_cmd(msm_uport->dma_rx_channel, &msm_uport->rx.xfer);
838
839 /* might have finished RX and be ready to clock off */
840 hrtimer_start(&msm_uport->clk_off_timer, msm_uport->clk_off_delay,
841 HRTIMER_MODE_REL);
842}
843
844/* Enable the transmitter Interrupt */
845static void msm_hs_start_tx_locked(struct uart_port *uport)
846{
847 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
848
849 clk_enable(msm_uport->clk);
850
851 if (msm_uport->exit_lpm_cb)
852 msm_uport->exit_lpm_cb(uport);
853
854 if (msm_uport->tx.tx_ready_int_en == 0) {
855 msm_uport->tx.tx_ready_int_en = 1;
856 msm_hs_submit_tx_locked(uport);
857 }
858
859 clk_disable(msm_uport->clk);
860}
861
862/*
863 * This routine is called when we are done with a DMA transfer
864 *
865 * This routine is registered with Data mover when we set
866 * up a Data Mover transfer. It is called from Data mover ISR
867 * when the DMA transfer is done.
868 */
869static void msm_hs_dmov_tx_callback(struct msm_dmov_cmd *cmd_ptr,
870 unsigned int result,
871 struct msm_dmov_errdata *err)
872{
873 unsigned long flags;
874 struct msm_hs_port *msm_uport;
875
876 /* DMA did not finish properly */
877 WARN_ON((((result & RSLT_FIFO_CNTR_BMSK) >> 28) == 1) &&
878 !(result & RSLT_VLD));
879
880 msm_uport = container_of(cmd_ptr, struct msm_hs_port, tx.xfer);
881
882 spin_lock_irqsave(&msm_uport->uport.lock, flags);
883 clk_enable(msm_uport->clk);
884
885 msm_uport->imr_reg |= UARTDM_ISR_TX_READY_BMSK;
886 msm_hs_write(&msm_uport->uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
887
888 clk_disable(msm_uport->clk);
889 spin_unlock_irqrestore(&msm_uport->uport.lock, flags);
890}
891
892/*
893 * This routine is called when we are done with a DMA transfer or the
894 * a flush has been sent to the data mover driver.
895 *
896 * This routine is registered with Data mover when we set up a Data Mover
897 * transfer. It is called from Data mover ISR when the DMA transfer is done.
898 */
899static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr,
900 unsigned int result,
901 struct msm_dmov_errdata *err)
902{
903 int retval;
904 int rx_count;
905 unsigned long status;
906 unsigned int error_f = 0;
907 unsigned long flags;
908 unsigned int flush;
909 struct tty_struct *tty;
910 struct uart_port *uport;
911 struct msm_hs_port *msm_uport;
912
913 msm_uport = container_of(cmd_ptr, struct msm_hs_port, rx.xfer);
914 uport = &msm_uport->uport;
915
916 spin_lock_irqsave(&uport->lock, flags);
917 clk_enable(msm_uport->clk);
918
919 tty = uport->state->port.tty;
920
921 msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE);
922
923 status = msm_hs_read(uport, UARTDM_SR_ADDR);
924
925 /* overflow is not connect to data in a FIFO */
926 if (unlikely((status & UARTDM_SR_OVERRUN_BMSK) &&
927 (uport->read_status_mask & CREAD))) {
928 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
929 uport->icount.buf_overrun++;
930 error_f = 1;
931 }
932
933 if (!(uport->ignore_status_mask & INPCK))
934 status = status & ~(UARTDM_SR_PAR_FRAME_BMSK);
935
936 if (unlikely(status & UARTDM_SR_PAR_FRAME_BMSK)) {
937 /* Can not tell difference between parity & frame error */
938 uport->icount.parity++;
939 error_f = 1;
940 if (uport->ignore_status_mask & IGNPAR)
941 tty_insert_flip_char(tty, 0, TTY_PARITY);
942 }
943
944 if (error_f)
945 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_ERROR_STATUS);
946
947 if (msm_uport->clk_req_off_state == CLK_REQ_OFF_FLUSH_ISSUED)
948 msm_uport->clk_req_off_state = CLK_REQ_OFF_RXSTALE_FLUSHED;
949
950 flush = msm_uport->rx.flush;
951 if (flush == FLUSH_IGNORE)
952 msm_hs_start_rx_locked(uport);
953 if (flush == FLUSH_STOP)
954 msm_uport->rx.flush = FLUSH_SHUTDOWN;
955 if (flush >= FLUSH_DATA_INVALID)
956 goto out;
957
958 rx_count = msm_hs_read(uport, UARTDM_RX_TOTAL_SNAP_ADDR);
959
960 if (0 != (uport->read_status_mask & CREAD)) {
961 retval = tty_insert_flip_string(tty, msm_uport->rx.buffer,
962 rx_count);
963 BUG_ON(retval != rx_count);
964 }
965
966 msm_hs_start_rx_locked(uport);
967
968out:
969 clk_disable(msm_uport->clk);
970
971 spin_unlock_irqrestore(&uport->lock, flags);
972
973 if (flush < FLUSH_DATA_INVALID)
974 queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work);
975}
976
977static void msm_hs_tty_flip_buffer_work(struct work_struct *work)
978{
979 struct msm_hs_port *msm_uport =
980 container_of(work, struct msm_hs_port, rx.tty_work);
981 struct tty_struct *tty = msm_uport->uport.state->port.tty;
982
983 tty_flip_buffer_push(tty);
984}
985
986/*
987 * Standard API, Current states of modem control inputs
988 *
989 * Since CTS can be handled entirely by HARDWARE we always
990 * indicate clear to send and count on the TX FIFO to block when
991 * it fills up.
992 *
993 * - TIOCM_DCD
994 * - TIOCM_CTS
995 * - TIOCM_DSR
996 * - TIOCM_RI
997 * (Unsupported) DCD and DSR will return them high. RI will return low.
998 */
999static unsigned int msm_hs_get_mctrl_locked(struct uart_port *uport)
1000{
1001 return TIOCM_DSR | TIOCM_CAR | TIOCM_CTS;
1002}
1003
1004/*
1005 * True enables UART auto RFR, which indicates we are ready for data if the RX
1006 * buffer is not full. False disables auto RFR, and deasserts RFR to indicate
1007 * we are not ready for data. Must be called with UART clock on.
1008 */
1009static void set_rfr_locked(struct uart_port *uport, int auto_rfr)
1010{
1011 unsigned int data;
1012
1013 data = msm_hs_read(uport, UARTDM_MR1_ADDR);
1014
1015 if (auto_rfr) {
1016 /* enable auto ready-for-receiving */
1017 data |= UARTDM_MR1_RX_RDY_CTL_BMSK;
1018 msm_hs_write(uport, UARTDM_MR1_ADDR, data);
1019 } else {
1020 /* disable auto ready-for-receiving */
1021 data &= ~UARTDM_MR1_RX_RDY_CTL_BMSK;
1022 msm_hs_write(uport, UARTDM_MR1_ADDR, data);
1023 /* RFR is active low, set high */
1024 msm_hs_write(uport, UARTDM_CR_ADDR, RFR_HIGH);
1025 }
1026}
1027
1028/*
1029 * Standard API, used to set or clear RFR
1030 */
1031static void msm_hs_set_mctrl_locked(struct uart_port *uport,
1032 unsigned int mctrl)
1033{
1034 unsigned int auto_rfr;
1035 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1036
1037 clk_enable(msm_uport->clk);
1038
1039 auto_rfr = TIOCM_RTS & mctrl ? 1 : 0;
1040 set_rfr_locked(uport, auto_rfr);
1041
1042 clk_disable(msm_uport->clk);
1043}
1044
1045/* Standard API, Enable modem status (CTS) interrupt */
1046static void msm_hs_enable_ms_locked(struct uart_port *uport)
1047{
1048 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1049
1050 clk_enable(msm_uport->clk);
1051
1052 /* Enable DELTA_CTS Interrupt */
1053 msm_uport->imr_reg |= UARTDM_ISR_DELTA_CTS_BMSK;
1054 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
1055
1056 clk_disable(msm_uport->clk);
1057
1058}
1059
1060/*
1061 * Standard API, Break Signal
1062 *
1063 * Control the transmission of a break signal. ctl eq 0 => break
1064 * signal terminate ctl ne 0 => start break signal
1065 */
1066static void msm_hs_break_ctl(struct uart_port *uport, int ctl)
1067{
1068 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1069
1070 clk_enable(msm_uport->clk);
1071 msm_hs_write(uport, UARTDM_CR_ADDR, ctl ? START_BREAK : STOP_BREAK);
1072 clk_disable(msm_uport->clk);
1073}
1074
1075static void msm_hs_config_port(struct uart_port *uport, int cfg_flags)
1076{
1077 unsigned long flags;
1078
1079 spin_lock_irqsave(&uport->lock, flags);
1080 if (cfg_flags & UART_CONFIG_TYPE) {
1081 uport->type = PORT_MSM;
1082 msm_hs_request_port(uport);
1083 }
1084 spin_unlock_irqrestore(&uport->lock, flags);
1085}
1086
1087/* Handle CTS changes (Called from interrupt handler) */
1088static void msm_hs_handle_delta_cts(struct uart_port *uport)
1089{
1090 unsigned long flags;
1091 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1092
1093 spin_lock_irqsave(&uport->lock, flags);
1094 clk_enable(msm_uport->clk);
1095
1096 /* clear interrupt */
1097 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_CTS);
1098 uport->icount.cts++;
1099
1100 clk_disable(msm_uport->clk);
1101 spin_unlock_irqrestore(&uport->lock, flags);
1102
1103 /* clear the IOCTL TIOCMIWAIT if called */
1104 wake_up_interruptible(&uport->state->port.delta_msr_wait);
1105}
1106
1107/* check if the TX path is flushed, and if so clock off
1108 * returns 0 did not clock off, need to retry (still sending final byte)
1109 * -1 did not clock off, do not retry
1110 * 1 if we clocked off
1111 */
1112static int msm_hs_check_clock_off_locked(struct uart_port *uport)
1113{
1114 unsigned long sr_status;
1115 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1116 struct circ_buf *tx_buf = &uport->state->xmit;
1117
1118 /* Cancel if tx tty buffer is not empty, dma is in flight,
1119 * or tx fifo is not empty, or rx fifo is not empty */
1120 if (msm_uport->clk_state != MSM_HS_CLK_REQUEST_OFF ||
1121 !uart_circ_empty(tx_buf) || msm_uport->tx.dma_in_flight ||
1122 (msm_uport->imr_reg & UARTDM_ISR_TXLEV_BMSK) ||
1123 !(msm_uport->imr_reg & UARTDM_ISR_RXLEV_BMSK)) {
1124 return -1;
1125 }
1126
1127 /* Make sure the uart is finished with the last byte */
1128 sr_status = msm_hs_read(uport, UARTDM_SR_ADDR);
1129 if (!(sr_status & UARTDM_SR_TXEMT_BMSK))
1130 return 0; /* retry */
1131
1132 /* Make sure forced RXSTALE flush complete */
1133 switch (msm_uport->clk_req_off_state) {
1134 case CLK_REQ_OFF_START:
1135 msm_uport->clk_req_off_state = CLK_REQ_OFF_RXSTALE_ISSUED;
1136 msm_hs_write(uport, UARTDM_CR_ADDR, FORCE_STALE_EVENT);
1137 return 0; /* RXSTALE flush not complete - retry */
1138 case CLK_REQ_OFF_RXSTALE_ISSUED:
1139 case CLK_REQ_OFF_FLUSH_ISSUED:
1140 return 0; /* RXSTALE flush not complete - retry */
1141 case CLK_REQ_OFF_RXSTALE_FLUSHED:
1142 break; /* continue */
1143 }
1144
1145 if (msm_uport->rx.flush != FLUSH_SHUTDOWN) {
1146 if (msm_uport->rx.flush == FLUSH_NONE)
1147 msm_hs_stop_rx_locked(uport);
1148 return 0; /* come back later to really clock off */
1149 }
1150
1151 /* we really want to clock off */
1152 clk_disable(msm_uport->clk);
1153 msm_uport->clk_state = MSM_HS_CLK_OFF;
1154
1155 if (use_low_power_rx_wakeup(msm_uport)) {
1156 msm_uport->rx_wakeup.ignore = 1;
1157 enable_irq(msm_uport->rx_wakeup.irq);
1158 }
1159 return 1;
1160}
1161
1162static enum hrtimer_restart msm_hs_clk_off_retry(struct hrtimer *timer)
1163{
1164 unsigned long flags;
1165 int ret = HRTIMER_NORESTART;
1166 struct msm_hs_port *msm_uport = container_of(timer, struct msm_hs_port,
1167 clk_off_timer);
1168 struct uart_port *uport = &msm_uport->uport;
1169
1170 spin_lock_irqsave(&uport->lock, flags);
1171
1172 if (!msm_hs_check_clock_off_locked(uport)) {
1173 hrtimer_forward_now(timer, msm_uport->clk_off_delay);
1174 ret = HRTIMER_RESTART;
1175 }
1176
1177 spin_unlock_irqrestore(&uport->lock, flags);
1178
1179 return ret;
1180}
1181
1182static irqreturn_t msm_hs_isr(int irq, void *dev)
1183{
1184 unsigned long flags;
1185 unsigned long isr_status;
1186 struct msm_hs_port *msm_uport = dev;
1187 struct uart_port *uport = &msm_uport->uport;
1188 struct circ_buf *tx_buf = &uport->state->xmit;
1189 struct msm_hs_tx *tx = &msm_uport->tx;
1190 struct msm_hs_rx *rx = &msm_uport->rx;
1191
1192 spin_lock_irqsave(&uport->lock, flags);
1193
1194 isr_status = msm_hs_read(uport, UARTDM_MISR_ADDR);
1195
1196 /* Uart RX starting */
1197 if (isr_status & UARTDM_ISR_RXLEV_BMSK) {
1198 msm_uport->imr_reg &= ~UARTDM_ISR_RXLEV_BMSK;
1199 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
1200 }
1201 /* Stale rx interrupt */
1202 if (isr_status & UARTDM_ISR_RXSTALE_BMSK) {
1203 msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE);
1204 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT);
1205
1206 if (msm_uport->clk_req_off_state == CLK_REQ_OFF_RXSTALE_ISSUED)
1207 msm_uport->clk_req_off_state =
1208 CLK_REQ_OFF_FLUSH_ISSUED;
1209 if (rx->flush == FLUSH_NONE) {
1210 rx->flush = FLUSH_DATA_READY;
1211 msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1);
1212 }
1213 }
1214 /* tx ready interrupt */
1215 if (isr_status & UARTDM_ISR_TX_READY_BMSK) {
1216 /* Clear TX Ready */
1217 msm_hs_write(uport, UARTDM_CR_ADDR, CLEAR_TX_READY);
1218
1219 if (msm_uport->clk_state == MSM_HS_CLK_REQUEST_OFF) {
1220 msm_uport->imr_reg |= UARTDM_ISR_TXLEV_BMSK;
1221 msm_hs_write(uport, UARTDM_IMR_ADDR,
1222 msm_uport->imr_reg);
1223 }
1224
1225 /* Complete DMA TX transactions and submit new transactions */
1226 tx_buf->tail = (tx_buf->tail + tx->tx_count) & ~UART_XMIT_SIZE;
1227
1228 tx->dma_in_flight = 0;
1229
1230 uport->icount.tx += tx->tx_count;
1231 if (tx->tx_ready_int_en)
1232 msm_hs_submit_tx_locked(uport);
1233
1234 if (uart_circ_chars_pending(tx_buf) < WAKEUP_CHARS)
1235 uart_write_wakeup(uport);
1236 }
1237 if (isr_status & UARTDM_ISR_TXLEV_BMSK) {
1238 /* TX FIFO is empty */
1239 msm_uport->imr_reg &= ~UARTDM_ISR_TXLEV_BMSK;
1240 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
1241 if (!msm_hs_check_clock_off_locked(uport))
1242 hrtimer_start(&msm_uport->clk_off_timer,
1243 msm_uport->clk_off_delay,
1244 HRTIMER_MODE_REL);
1245 }
1246
1247 /* Change in CTS interrupt */
1248 if (isr_status & UARTDM_ISR_DELTA_CTS_BMSK)
1249 msm_hs_handle_delta_cts(uport);
1250
1251 spin_unlock_irqrestore(&uport->lock, flags);
1252
1253 return IRQ_HANDLED;
1254}
1255
1256void msm_hs_request_clock_off_locked(struct uart_port *uport)
1257{
1258 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1259
1260 if (msm_uport->clk_state == MSM_HS_CLK_ON) {
1261 msm_uport->clk_state = MSM_HS_CLK_REQUEST_OFF;
1262 msm_uport->clk_req_off_state = CLK_REQ_OFF_START;
1263 if (!use_low_power_rx_wakeup(msm_uport))
1264 set_rfr_locked(uport, 0);
1265 msm_uport->imr_reg |= UARTDM_ISR_TXLEV_BMSK;
1266 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
1267 }
1268}
1269
1270/**
1271 * msm_hs_request_clock_off - request to (i.e. asynchronously) turn off uart
1272 * clock once pending TX is flushed and Rx DMA command is terminated.
1273 * @uport: uart_port structure for the device instance.
1274 *
1275 * This functions puts the device into a partially active low power mode. It
1276 * waits to complete all pending tx transactions, flushes ongoing Rx DMA
1277 * command and terminates UART side Rx transaction, puts UART HW in non DMA
1278 * mode and then clocks off the device. A client calls this when no UART
1279 * data is expected. msm_request_clock_on() must be called before any further
1280 * UART can be sent or received.
1281 */
1282void msm_hs_request_clock_off(struct uart_port *uport)
1283{
1284 unsigned long flags;
1285
1286 spin_lock_irqsave(&uport->lock, flags);
1287 msm_hs_request_clock_off_locked(uport);
1288 spin_unlock_irqrestore(&uport->lock, flags);
1289}
1290
1291void msm_hs_request_clock_on_locked(struct uart_port *uport)
1292{
1293 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1294 unsigned int data;
1295
1296 switch (msm_uport->clk_state) {
1297 case MSM_HS_CLK_OFF:
1298 clk_enable(msm_uport->clk);
1299 disable_irq_nosync(msm_uport->rx_wakeup.irq);
1300 /* fall-through */
1301 case MSM_HS_CLK_REQUEST_OFF:
1302 if (msm_uport->rx.flush == FLUSH_STOP ||
1303 msm_uport->rx.flush == FLUSH_SHUTDOWN) {
1304 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX);
1305 data = msm_hs_read(uport, UARTDM_DMEN_ADDR);
1306 data |= UARTDM_RX_DM_EN_BMSK;
1307 msm_hs_write(uport, UARTDM_DMEN_ADDR, data);
1308 }
1309 hrtimer_try_to_cancel(&msm_uport->clk_off_timer);
1310 if (msm_uport->rx.flush == FLUSH_SHUTDOWN)
1311 msm_hs_start_rx_locked(uport);
1312 if (!use_low_power_rx_wakeup(msm_uport))
1313 set_rfr_locked(uport, 1);
1314 if (msm_uport->rx.flush == FLUSH_STOP)
1315 msm_uport->rx.flush = FLUSH_IGNORE;
1316 msm_uport->clk_state = MSM_HS_CLK_ON;
1317 break;
1318 case MSM_HS_CLK_ON:
1319 break;
1320 case MSM_HS_CLK_PORT_OFF:
1321 break;
1322 }
1323}
1324
1325/**
1326 * msm_hs_request_clock_on - Switch the device from partially active low
1327 * power mode to fully active (i.e. clock on) mode.
1328 * @uport: uart_port structure for the device.
1329 *
1330 * This function switches on the input clock, puts UART HW into DMA mode
1331 * and enqueues an Rx DMA command if the device was in partially active
1332 * mode. It has no effect if called with the device in inactive state.
1333 */
1334void msm_hs_request_clock_on(struct uart_port *uport)
1335{
1336 unsigned long flags;
1337
1338 spin_lock_irqsave(&uport->lock, flags);
1339 msm_hs_request_clock_on_locked(uport);
1340 spin_unlock_irqrestore(&uport->lock, flags);
1341}
1342
1343static irqreturn_t msm_hs_rx_wakeup_isr(int irq, void *dev)
1344{
1345 unsigned int wakeup = 0;
1346 unsigned long flags;
1347 struct msm_hs_port *msm_uport = dev;
1348 struct uart_port *uport = &msm_uport->uport;
1349 struct tty_struct *tty = NULL;
1350
1351 spin_lock_irqsave(&uport->lock, flags);
1352 if (msm_uport->clk_state == MSM_HS_CLK_OFF) {
1353 /* ignore the first irq - it is a pending irq that occured
1354 * before enable_irq() */
1355 if (msm_uport->rx_wakeup.ignore)
1356 msm_uport->rx_wakeup.ignore = 0;
1357 else
1358 wakeup = 1;
1359 }
1360
1361 if (wakeup) {
1362 /* the uart was clocked off during an rx, wake up and
1363 * optionally inject char into tty rx */
1364 msm_hs_request_clock_on_locked(uport);
1365 if (msm_uport->rx_wakeup.inject_rx) {
1366 tty = uport->state->port.tty;
1367 tty_insert_flip_char(tty,
1368 msm_uport->rx_wakeup.rx_to_inject,
1369 TTY_NORMAL);
1370 queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work);
1371 }
1372 }
1373
1374 spin_unlock_irqrestore(&uport->lock, flags);
1375
1376 return IRQ_HANDLED;
1377}
1378
1379static const char *msm_hs_type(struct uart_port *port)
1380{
1381 return (port->type == PORT_MSM) ? "MSM_HS_UART" : NULL;
1382}
1383
1384/* Called when port is opened */
1385static int msm_hs_startup(struct uart_port *uport)
1386{
1387 int ret;
1388 int rfr_level;
1389 unsigned long flags;
1390 unsigned int data;
1391 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1392 struct circ_buf *tx_buf = &uport->state->xmit;
1393 struct msm_hs_tx *tx = &msm_uport->tx;
1394 struct msm_hs_rx *rx = &msm_uport->rx;
1395
1396 rfr_level = uport->fifosize;
1397 if (rfr_level > 16)
1398 rfr_level -= 16;
1399
1400 tx->dma_base = dma_map_single(uport->dev, tx_buf->buf, UART_XMIT_SIZE,
1401 DMA_TO_DEVICE);
1402
1403 /* do not let tty layer execute RX in global workqueue, use a
1404 * dedicated workqueue managed by this driver */
1405 uport->state->port.tty->low_latency = 1;
1406
1407 /* turn on uart clk */
1408 ret = msm_hs_init_clk_locked(uport);
1409 if (unlikely(ret)) {
1410 printk(KERN_ERR "Turning uartclk failed!\n");
1411 goto err_msm_hs_init_clk;
1412 }
1413
1414 /* Set auto RFR Level */
1415 data = msm_hs_read(uport, UARTDM_MR1_ADDR);
1416 data &= ~UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK;
1417 data &= ~UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK;
1418 data |= (UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK & (rfr_level << 2));
1419 data |= (UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK & rfr_level);
1420 msm_hs_write(uport, UARTDM_MR1_ADDR, data);
1421
1422 /* Make sure RXSTALE count is non-zero */
1423 data = msm_hs_read(uport, UARTDM_IPR_ADDR);
1424 if (!data) {
1425 data |= 0x1f & UARTDM_IPR_STALE_LSB_BMSK;
1426 msm_hs_write(uport, UARTDM_IPR_ADDR, data);
1427 }
1428
1429 /* Enable Data Mover Mode */
1430 data = UARTDM_TX_DM_EN_BMSK | UARTDM_RX_DM_EN_BMSK;
1431 msm_hs_write(uport, UARTDM_DMEN_ADDR, data);
1432
1433 /* Reset TX */
1434 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_TX);
1435 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX);
1436 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_ERROR_STATUS);
1437 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_BREAK_INT);
1438 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT);
1439 msm_hs_write(uport, UARTDM_CR_ADDR, RESET_CTS);
1440 msm_hs_write(uport, UARTDM_CR_ADDR, RFR_LOW);
1441 /* Turn on Uart Receiver */
1442 msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_RX_EN_BMSK);
1443
1444 /* Turn on Uart Transmitter */
1445 msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_TX_EN_BMSK);
1446
1447 /* Initialize the tx */
1448 tx->tx_ready_int_en = 0;
1449 tx->dma_in_flight = 0;
1450
1451 tx->xfer.complete_func = msm_hs_dmov_tx_callback;
1452 tx->xfer.execute_func = NULL;
1453
1454 tx->command_ptr->cmd = CMD_LC |
1455 CMD_DST_CRCI(msm_uport->dma_tx_crci) | CMD_MODE_BOX;
1456
1457 tx->command_ptr->src_dst_len = (MSM_UARTDM_BURST_SIZE << 16)
1458 | (MSM_UARTDM_BURST_SIZE);
1459
1460 tx->command_ptr->row_offset = (MSM_UARTDM_BURST_SIZE << 16);
1461
1462 tx->command_ptr->dst_row_addr =
1463 msm_uport->uport.mapbase + UARTDM_TF_ADDR;
1464
1465
1466 /* Turn on Uart Receive */
1467 rx->xfer.complete_func = msm_hs_dmov_rx_callback;
1468 rx->xfer.execute_func = NULL;
1469
1470 rx->command_ptr->cmd = CMD_LC |
1471 CMD_SRC_CRCI(msm_uport->dma_rx_crci) | CMD_MODE_BOX;
1472
1473 rx->command_ptr->src_dst_len = (MSM_UARTDM_BURST_SIZE << 16)
1474 | (MSM_UARTDM_BURST_SIZE);
1475 rx->command_ptr->row_offset = MSM_UARTDM_BURST_SIZE;
1476 rx->command_ptr->src_row_addr = uport->mapbase + UARTDM_RF_ADDR;
1477
1478
1479 msm_uport->imr_reg |= UARTDM_ISR_RXSTALE_BMSK;
1480 /* Enable reading the current CTS, no harm even if CTS is ignored */
1481 msm_uport->imr_reg |= UARTDM_ISR_CURRENT_CTS_BMSK;
1482
1483 msm_hs_write(uport, UARTDM_TFWR_ADDR, 0); /* TXLEV on empty TX fifo */
1484
1485
1486 ret = request_irq(uport->irq, msm_hs_isr, IRQF_TRIGGER_HIGH,
1487 "msm_hs_uart", msm_uport);
1488 if (unlikely(ret)) {
1489 printk(KERN_ERR "Request msm_hs_uart IRQ failed!\n");
1490 goto err_request_irq;
1491 }
1492 if (use_low_power_rx_wakeup(msm_uport)) {
1493 ret = request_irq(msm_uport->rx_wakeup.irq,
1494 msm_hs_rx_wakeup_isr,
1495 IRQF_TRIGGER_FALLING,
1496 "msm_hs_rx_wakeup", msm_uport);
1497 if (unlikely(ret)) {
1498 printk(KERN_ERR "Request msm_hs_rx_wakeup IRQ failed!\n");
1499 free_irq(uport->irq, msm_uport);
1500 goto err_request_irq;
1501 }
1502 disable_irq(msm_uport->rx_wakeup.irq);
1503 }
1504
1505 spin_lock_irqsave(&uport->lock, flags);
1506
1507 msm_hs_write(uport, UARTDM_RFWR_ADDR, 0);
1508 msm_hs_start_rx_locked(uport);
1509
1510 spin_unlock_irqrestore(&uport->lock, flags);
1511 ret = pm_runtime_set_active(uport->dev);
1512 if (ret)
1513 dev_err(uport->dev, "set active error:%d\n", ret);
1514 pm_runtime_enable(uport->dev);
1515
1516 return 0;
1517
1518err_request_irq:
1519err_msm_hs_init_clk:
1520 dma_unmap_single(uport->dev, tx->dma_base,
1521 UART_XMIT_SIZE, DMA_TO_DEVICE);
1522 return ret;
1523}
1524
1525/* Initialize tx and rx data structures */
1526static int __devinit uartdm_init_port(struct uart_port *uport)
1527{
1528 int ret = 0;
1529 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1530 struct msm_hs_tx *tx = &msm_uport->tx;
1531 struct msm_hs_rx *rx = &msm_uport->rx;
1532
1533 /* Allocate the command pointer. Needs to be 64 bit aligned */
1534 tx->command_ptr = kmalloc(sizeof(dmov_box), GFP_KERNEL | __GFP_DMA);
1535 if (!tx->command_ptr)
1536 return -ENOMEM;
1537
1538 tx->command_ptr_ptr = kmalloc(sizeof(u32 *), GFP_KERNEL | __GFP_DMA);
1539 if (!tx->command_ptr_ptr) {
1540 ret = -ENOMEM;
1541 goto err_tx_command_ptr_ptr;
1542 }
1543
1544 tx->mapped_cmd_ptr = dma_map_single(uport->dev, tx->command_ptr,
1545 sizeof(dmov_box), DMA_TO_DEVICE);
1546 tx->mapped_cmd_ptr_ptr = dma_map_single(uport->dev,
1547 tx->command_ptr_ptr,
1548 sizeof(u32 *), DMA_TO_DEVICE);
1549 tx->xfer.cmdptr = DMOV_CMD_ADDR(tx->mapped_cmd_ptr_ptr);
1550
1551 init_waitqueue_head(&rx->wait);
1552
1553 rx->pool = dma_pool_create("rx_buffer_pool", uport->dev,
1554 UARTDM_RX_BUF_SIZE, 16, 0);
1555 if (!rx->pool) {
1556 pr_err("%s(): cannot allocate rx_buffer_pool", __func__);
1557 ret = -ENOMEM;
1558 goto err_dma_pool_create;
1559 }
1560
1561 rx->buffer = dma_pool_alloc(rx->pool, GFP_KERNEL, &rx->rbuffer);
1562 if (!rx->buffer) {
1563 pr_err("%s(): cannot allocate rx->buffer", __func__);
1564 ret = -ENOMEM;
1565 goto err_dma_pool_alloc;
1566 }
1567
1568 /* Allocate the command pointer. Needs to be 64 bit aligned */
1569 rx->command_ptr = kmalloc(sizeof(dmov_box), GFP_KERNEL | __GFP_DMA);
1570 if (!rx->command_ptr) {
1571 pr_err("%s(): cannot allocate rx->command_ptr", __func__);
1572 ret = -ENOMEM;
1573 goto err_rx_command_ptr;
1574 }
1575
1576 rx->command_ptr_ptr = kmalloc(sizeof(u32 *), GFP_KERNEL | __GFP_DMA);
1577 if (!rx->command_ptr_ptr) {
1578 pr_err("%s(): cannot allocate rx->command_ptr_ptr", __func__);
1579 ret = -ENOMEM;
1580 goto err_rx_command_ptr_ptr;
1581 }
1582
1583 rx->command_ptr->num_rows = ((UARTDM_RX_BUF_SIZE >> 4) << 16) |
1584 (UARTDM_RX_BUF_SIZE >> 4);
1585
1586 rx->command_ptr->dst_row_addr = rx->rbuffer;
1587
1588 rx->mapped_cmd_ptr = dma_map_single(uport->dev, rx->command_ptr,
1589 sizeof(dmov_box), DMA_TO_DEVICE);
1590
1591 *rx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(rx->mapped_cmd_ptr);
1592
1593 rx->cmdptr_dmaaddr = dma_map_single(uport->dev, rx->command_ptr_ptr,
1594 sizeof(u32 *), DMA_TO_DEVICE);
1595 rx->xfer.cmdptr = DMOV_CMD_ADDR(rx->cmdptr_dmaaddr);
1596
1597 INIT_WORK(&rx->tty_work, msm_hs_tty_flip_buffer_work);
1598
1599 return ret;
1600
1601err_rx_command_ptr_ptr:
1602 kfree(rx->command_ptr);
1603err_rx_command_ptr:
1604 dma_pool_free(msm_uport->rx.pool, msm_uport->rx.buffer,
1605 msm_uport->rx.rbuffer);
1606err_dma_pool_alloc:
1607 dma_pool_destroy(msm_uport->rx.pool);
1608err_dma_pool_create:
1609 dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr_ptr,
1610 sizeof(u32 *), DMA_TO_DEVICE);
1611 dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr,
1612 sizeof(dmov_box), DMA_TO_DEVICE);
1613 kfree(msm_uport->tx.command_ptr_ptr);
1614err_tx_command_ptr_ptr:
1615 kfree(msm_uport->tx.command_ptr);
1616 return ret;
1617}
1618
1619static int __devinit msm_hs_probe(struct platform_device *pdev)
1620{
1621 int ret;
1622 struct uart_port *uport;
1623 struct msm_hs_port *msm_uport;
1624 struct resource *resource;
1625 const struct msm_serial_hs_platform_data *pdata =
1626 pdev->dev.platform_data;
1627
1628 if (pdev->id < 0 || pdev->id >= UARTDM_NR) {
1629 printk(KERN_ERR "Invalid plaform device ID = %d\n", pdev->id);
1630 return -EINVAL;
1631 }
1632
1633 msm_uport = &q_uart_port[pdev->id];
1634 uport = &msm_uport->uport;
1635
1636 uport->dev = &pdev->dev;
1637
1638 resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1639 if (unlikely(!resource))
1640 return -ENXIO;
1641
1642 uport->mapbase = resource->start;
1643 uport->irq = platform_get_irq(pdev, 0);
1644 if (unlikely(uport->irq < 0))
1645 return -ENXIO;
1646
1647 if (unlikely(set_irq_wake(uport->irq, 1)))
1648 return -ENXIO;
1649
1650 if (pdata == NULL || pdata->rx_wakeup_irq < 0)
1651 msm_uport->rx_wakeup.irq = -1;
1652 else {
1653 msm_uport->rx_wakeup.irq = pdata->rx_wakeup_irq;
1654 msm_uport->rx_wakeup.ignore = 1;
1655 msm_uport->rx_wakeup.inject_rx = pdata->inject_rx_on_wakeup;
1656 msm_uport->rx_wakeup.rx_to_inject = pdata->rx_to_inject;
1657
1658 if (unlikely(msm_uport->rx_wakeup.irq < 0))
1659 return -ENXIO;
1660
1661 if (unlikely(set_irq_wake(msm_uport->rx_wakeup.irq, 1)))
1662 return -ENXIO;
1663 }
1664
1665 if (pdata == NULL)
1666 msm_uport->exit_lpm_cb = NULL;
1667 else
1668 msm_uport->exit_lpm_cb = pdata->exit_lpm_cb;
1669
1670 resource = platform_get_resource_byname(pdev, IORESOURCE_DMA,
1671 "uartdm_channels");
1672 if (unlikely(!resource))
1673 return -ENXIO;
1674
1675 msm_uport->dma_tx_channel = resource->start;
1676 msm_uport->dma_rx_channel = resource->end;
1677
1678 resource = platform_get_resource_byname(pdev, IORESOURCE_DMA,
1679 "uartdm_crci");
1680 if (unlikely(!resource))
1681 return -ENXIO;
1682
1683 msm_uport->dma_tx_crci = resource->start;
1684 msm_uport->dma_rx_crci = resource->end;
1685
1686 uport->iotype = UPIO_MEM;
1687 uport->fifosize = UART_FIFOSIZE;
1688 uport->ops = &msm_hs_ops;
1689 uport->flags = UPF_BOOT_AUTOCONF;
1690 uport->uartclk = UARTCLK;
1691 msm_uport->imr_reg = 0x0;
1692 msm_uport->clk = clk_get(&pdev->dev, "uartdm_clk");
1693 if (IS_ERR(msm_uport->clk))
1694 return PTR_ERR(msm_uport->clk);
1695
1696 ret = uartdm_init_port(uport);
1697 if (unlikely(ret))
1698 return ret;
1699
1700 msm_uport->clk_state = MSM_HS_CLK_PORT_OFF;
1701 hrtimer_init(&msm_uport->clk_off_timer, CLOCK_MONOTONIC,
1702 HRTIMER_MODE_REL);
1703 msm_uport->clk_off_timer.function = msm_hs_clk_off_retry;
1704 msm_uport->clk_off_delay = ktime_set(0, 1000000); /* 1ms */
1705
1706 uport->line = pdev->id;
1707 return uart_add_one_port(&msm_hs_driver, uport);
1708}
1709
1710static int __init msm_serial_hs_init(void)
1711{
1712 int ret, i;
1713
1714 /* Init all UARTS as non-configured */
1715 for (i = 0; i < UARTDM_NR; i++)
1716 q_uart_port[i].uport.type = PORT_UNKNOWN;
1717
1718 msm_hs_workqueue = create_singlethread_workqueue("msm_serial_hs");
1719 if (unlikely(!msm_hs_workqueue))
1720 return -ENOMEM;
1721
1722 ret = uart_register_driver(&msm_hs_driver);
1723 if (unlikely(ret)) {
1724 printk(KERN_ERR "%s failed to load\n", __func__);
1725 goto err_uart_register_driver;
1726 }
1727
1728 ret = platform_driver_register(&msm_serial_hs_platform_driver);
1729 if (ret) {
1730 printk(KERN_ERR "%s failed to load\n", __func__);
1731 goto err_platform_driver_register;
1732 }
1733
1734 return ret;
1735
1736err_platform_driver_register:
1737 uart_unregister_driver(&msm_hs_driver);
1738err_uart_register_driver:
1739 destroy_workqueue(msm_hs_workqueue);
1740 return ret;
1741}
1742module_init(msm_serial_hs_init);
1743
1744/*
1745 * Called by the upper layer when port is closed.
1746 * - Disables the port
1747 * - Unhook the ISR
1748 */
1749static void msm_hs_shutdown(struct uart_port *uport)
1750{
1751 unsigned long flags;
1752 struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
1753
1754 BUG_ON(msm_uport->rx.flush < FLUSH_STOP);
1755
1756 spin_lock_irqsave(&uport->lock, flags);
1757 clk_enable(msm_uport->clk);
1758
1759 /* Disable the transmitter */
1760 msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_TX_DISABLE_BMSK);
1761 /* Disable the receiver */
1762 msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_RX_DISABLE_BMSK);
1763
1764 pm_runtime_disable(uport->dev);
1765 pm_runtime_set_suspended(uport->dev);
1766
1767 /* Free the interrupt */
1768 free_irq(uport->irq, msm_uport);
1769 if (use_low_power_rx_wakeup(msm_uport))
1770 free_irq(msm_uport->rx_wakeup.irq, msm_uport);
1771
1772 msm_uport->imr_reg = 0;
1773 msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
1774
1775 wait_event(msm_uport->rx.wait, msm_uport->rx.flush == FLUSH_SHUTDOWN);
1776
1777 clk_disable(msm_uport->clk); /* to balance local clk_enable() */
1778 if (msm_uport->clk_state != MSM_HS_CLK_OFF)
1779 clk_disable(msm_uport->clk); /* to balance clk_state */
1780 msm_uport->clk_state = MSM_HS_CLK_PORT_OFF;
1781
1782 dma_unmap_single(uport->dev, msm_uport->tx.dma_base,
1783 UART_XMIT_SIZE, DMA_TO_DEVICE);
1784
1785 spin_unlock_irqrestore(&uport->lock, flags);
1786
1787 if (cancel_work_sync(&msm_uport->rx.tty_work))
1788 msm_hs_tty_flip_buffer_work(&msm_uport->rx.tty_work);
1789}
1790
1791static void __exit msm_serial_hs_exit(void)
1792{
1793 flush_workqueue(msm_hs_workqueue);
1794 destroy_workqueue(msm_hs_workqueue);
1795 platform_driver_unregister(&msm_serial_hs_platform_driver);
1796 uart_unregister_driver(&msm_hs_driver);
1797}
1798module_exit(msm_serial_hs_exit);
1799
1800#ifdef CONFIG_PM_RUNTIME
1801static int msm_hs_runtime_idle(struct device *dev)
1802{
1803 /*
1804 * returning success from idle results in runtime suspend to be
1805 * called
1806 */
1807 return 0;
1808}
1809
1810static int msm_hs_runtime_resume(struct device *dev)
1811{
1812 struct platform_device *pdev = container_of(dev, struct
1813 platform_device, dev);
1814 struct msm_hs_port *msm_uport = &q_uart_port[pdev->id];
1815
1816 msm_hs_request_clock_on(&msm_uport->uport);
1817 return 0;
1818}
1819
1820static int msm_hs_runtime_suspend(struct device *dev)
1821{
1822 struct platform_device *pdev = container_of(dev, struct
1823 platform_device, dev);
1824 struct msm_hs_port *msm_uport = &q_uart_port[pdev->id];
1825
1826 msm_hs_request_clock_off(&msm_uport->uport);
1827 return 0;
1828}
1829#else
1830#define msm_hs_runtime_idle NULL
1831#define msm_hs_runtime_resume NULL
1832#define msm_hs_runtime_suspend NULL
1833#endif
1834
1835static const struct dev_pm_ops msm_hs_dev_pm_ops = {
1836 .runtime_suspend = msm_hs_runtime_suspend,
1837 .runtime_resume = msm_hs_runtime_resume,
1838 .runtime_idle = msm_hs_runtime_idle,
1839};
1840
1841static struct platform_driver msm_serial_hs_platform_driver = {
1842 .probe = msm_hs_probe,
1843 .remove = __devexit_p(msm_hs_remove),
1844 .driver = {
1845 .name = "msm_serial_hs",
1846 .owner = THIS_MODULE,
1847 .pm = &msm_hs_dev_pm_ops,
1848 },
1849};
1850
1851static struct uart_driver msm_hs_driver = {
1852 .owner = THIS_MODULE,
1853 .driver_name = "msm_serial_hs",
1854 .dev_name = "ttyHS",
1855 .nr = UARTDM_NR,
1856 .cons = 0,
1857};
1858
1859static struct uart_ops msm_hs_ops = {
1860 .tx_empty = msm_hs_tx_empty,
1861 .set_mctrl = msm_hs_set_mctrl_locked,
1862 .get_mctrl = msm_hs_get_mctrl_locked,
1863 .stop_tx = msm_hs_stop_tx_locked,
1864 .start_tx = msm_hs_start_tx_locked,
1865 .stop_rx = msm_hs_stop_rx_locked,
1866 .enable_ms = msm_hs_enable_ms_locked,
1867 .break_ctl = msm_hs_break_ctl,
1868 .startup = msm_hs_startup,
1869 .shutdown = msm_hs_shutdown,
1870 .set_termios = msm_hs_set_termios,
1871 .pm = msm_hs_pm,
1872 .type = msm_hs_type,
1873 .config_port = msm_hs_config_port,
1874 .release_port = msm_hs_release_port,
1875 .request_port = msm_hs_request_port,
1876};
1877
1878MODULE_DESCRIPTION("High Speed UART Driver for the MSM chipset");
1879MODULE_VERSION("1.2");
1880MODULE_LICENSE("GPL v2");
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c
new file mode 100644
index 000000000000..beeff1e86093
--- /dev/null
+++ b/drivers/tty/serial/msm_smd_tty.c
@@ -0,0 +1,236 @@
1/* drivers/tty/serial/msm_smd_tty.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
5 * Author: Brian Swetland <swetland@google.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#include <linux/module.h>
19#include <linux/fs.h>
20#include <linux/cdev.h>
21#include <linux/device.h>
22#include <linux/wait.h>
23
24#include <linux/tty.h>
25#include <linux/tty_driver.h>
26#include <linux/tty_flip.h>
27
28#include <mach/msm_smd.h>
29
30#define MAX_SMD_TTYS 32
31
32struct smd_tty_info {
33 struct tty_port port;
34 smd_channel_t *ch;
35};
36
37struct smd_tty_channel_desc {
38 int id;
39 const char *name;
40};
41
42static struct smd_tty_info smd_tty[MAX_SMD_TTYS];
43
44static const struct smd_tty_channel_desc smd_default_tty_channels[] = {
45 { .id = 0, .name = "SMD_DS" },
46 { .id = 27, .name = "SMD_GPSNMEA" },
47};
48
49static const struct smd_tty_channel_desc *smd_tty_channels =
50 smd_default_tty_channels;
51static int smd_tty_channels_len = ARRAY_SIZE(smd_default_tty_channels);
52
53static void smd_tty_notify(void *priv, unsigned event)
54{
55 unsigned char *ptr;
56 int avail;
57 struct smd_tty_info *info = priv;
58 struct tty_struct *tty;
59
60 if (event != SMD_EVENT_DATA)
61 return;
62
63 tty = tty_port_tty_get(&info->port);
64 if (!tty)
65 return;
66
67 for (;;) {
68 if (test_bit(TTY_THROTTLED, &tty->flags))
69 break;
70 avail = smd_read_avail(info->ch);
71 if (avail == 0)
72 break;
73
74 avail = tty_prepare_flip_string(tty, &ptr, avail);
75
76 if (smd_read(info->ch, ptr, avail) != avail) {
77 /* shouldn't be possible since we're in interrupt
78 ** context here and nobody else could 'steal' our
79 ** characters.
80 */
81 pr_err("OOPS - smd_tty_buffer mismatch?!");
82 }
83
84 tty_flip_buffer_push(tty);
85 }
86
87 /* XXX only when writable and necessary */
88 tty_wakeup(tty);
89 tty_kref_put(tty);
90}
91
92static int smd_tty_port_activate(struct tty_port *tport, struct tty_struct *tty)
93{
94 int i, res = 0;
95 int n = tty->index;
96 const char *name = NULL;
97 struct smd_tty_info *info = smd_tty + n;
98
99 for (i = 0; i < smd_tty_channels_len; i++) {
100 if (smd_tty_channels[i].id == n) {
101 name = smd_tty_channels[i].name;
102 break;
103 }
104 }
105 if (!name)
106 return -ENODEV;
107
108 if (info->ch)
109 smd_kick(info->ch);
110 else
111 res = smd_open(name, &info->ch, info, smd_tty_notify);
112
113 if (!res)
114 tty->driver_data = info;
115
116 return res;
117}
118
119static void smd_tty_port_shutdown(struct tty_port *tport)
120{
121 struct smd_tty_info *info;
122 struct tty_struct *tty = tty_port_tty_get(tport);
123
124 info = tty->driver_data;
125 if (info->ch) {
126 smd_close(info->ch);
127 info->ch = 0;
128 }
129
130 tty->driver_data = 0;
131 tty_kref_put(tty);
132}
133
134static int smd_tty_open(struct tty_struct *tty, struct file *f)
135{
136 struct smd_tty_info *info = smd_tty + tty->index;
137
138 return tty_port_open(&info->port, tty, f);
139}
140
141static void smd_tty_close(struct tty_struct *tty, struct file *f)
142{
143 struct smd_tty_info *info = tty->driver_data;
144
145 tty_port_close(&info->port, tty, f);
146}
147
148static int smd_tty_write(struct tty_struct *tty,
149 const unsigned char *buf, int len)
150{
151 struct smd_tty_info *info = tty->driver_data;
152 int avail;
153
154 /* if we're writing to a packet channel we will
155 ** never be able to write more data than there
156 ** is currently space for
157 */
158 avail = smd_write_avail(info->ch);
159 if (len > avail)
160 len = avail;
161
162 return smd_write(info->ch, buf, len);
163}
164
165static int smd_tty_write_room(struct tty_struct *tty)
166{
167 struct smd_tty_info *info = tty->driver_data;
168 return smd_write_avail(info->ch);
169}
170
171static int smd_tty_chars_in_buffer(struct tty_struct *tty)
172{
173 struct smd_tty_info *info = tty->driver_data;
174 return smd_read_avail(info->ch);
175}
176
177static void smd_tty_unthrottle(struct tty_struct *tty)
178{
179 struct smd_tty_info *info = tty->driver_data;
180 smd_kick(info->ch);
181}
182
183static const struct tty_port_operations smd_tty_port_ops = {
184 .shutdown = smd_tty_port_shutdown,
185 .activate = smd_tty_port_activate,
186};
187
188static const struct tty_operations smd_tty_ops = {
189 .open = smd_tty_open,
190 .close = smd_tty_close,
191 .write = smd_tty_write,
192 .write_room = smd_tty_write_room,
193 .chars_in_buffer = smd_tty_chars_in_buffer,
194 .unthrottle = smd_tty_unthrottle,
195};
196
197static struct tty_driver *smd_tty_driver;
198
199static int __init smd_tty_init(void)
200{
201 int ret, i;
202
203 smd_tty_driver = alloc_tty_driver(MAX_SMD_TTYS);
204 if (smd_tty_driver == 0)
205 return -ENOMEM;
206
207 smd_tty_driver->owner = THIS_MODULE;
208 smd_tty_driver->driver_name = "smd_tty_driver";
209 smd_tty_driver->name = "smd";
210 smd_tty_driver->major = 0;
211 smd_tty_driver->minor_start = 0;
212 smd_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
213 smd_tty_driver->subtype = SERIAL_TYPE_NORMAL;
214 smd_tty_driver->init_termios = tty_std_termios;
215 smd_tty_driver->init_termios.c_iflag = 0;
216 smd_tty_driver->init_termios.c_oflag = 0;
217 smd_tty_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
218 smd_tty_driver->init_termios.c_lflag = 0;
219 smd_tty_driver->flags = TTY_DRIVER_RESET_TERMIOS |
220 TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
221 tty_set_operations(smd_tty_driver, &smd_tty_ops);
222
223 ret = tty_register_driver(smd_tty_driver);
224 if (ret)
225 return ret;
226
227 for (i = 0; i < smd_tty_channels_len; i++) {
228 tty_port_init(&smd_tty[smd_tty_channels[i].id].port);
229 smd_tty[smd_tty_channels[i].id].port.ops = &smd_tty_port_ops;
230 tty_register_device(smd_tty_driver, smd_tty_channels[i].id, 0);
231 }
232
233 return 0;
234}
235
236module_init(smd_tty_init);
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 5c7abe4c94dd..6a18ca6ddaa9 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -160,17 +160,17 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
160 * A few common types, add more as needed. 160 * A few common types, add more as needed.
161 */ 161 */
162static struct of_device_id __devinitdata of_platform_serial_table[] = { 162static struct of_device_id __devinitdata of_platform_serial_table[] = {
163 { .type = "serial", .compatible = "ns8250", .data = (void *)PORT_8250, }, 163 { .compatible = "ns8250", .data = (void *)PORT_8250, },
164 { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, 164 { .compatible = "ns16450", .data = (void *)PORT_16450, },
165 { .type = "serial", .compatible = "ns16550a", .data = (void *)PORT_16550A, }, 165 { .compatible = "ns16550a", .data = (void *)PORT_16550A, },
166 { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, 166 { .compatible = "ns16550", .data = (void *)PORT_16550, },
167 { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, 167 { .compatible = "ns16750", .data = (void *)PORT_16750, },
168 { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, }, 168 { .compatible = "ns16850", .data = (void *)PORT_16850, },
169#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL 169#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
170 { .type = "serial", .compatible = "ibm,qpace-nwp-serial", 170 { .compatible = "ibm,qpace-nwp-serial",
171 .data = (void *)PORT_NWPSERIAL, }, 171 .data = (void *)PORT_NWPSERIAL, },
172#endif 172#endif
173 { .type = "serial", .data = (void *)PORT_UNKNOWN, }, 173 { .type = "serial", .data = (void *)PORT_UNKNOWN, },
174 { /* end of list */ }, 174 { /* end of list */ },
175}; 175};
176 176
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 7f2f01058789..763537943a53 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -20,6 +20,10 @@
20 * this driver as required for the omap-platform. 20 * this driver as required for the omap-platform.
21 */ 21 */
22 22
23#if defined(CONFIG_SERIAL_OMAP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
24#define SUPPORT_SYSRQ
25#endif
26
23#include <linux/module.h> 27#include <linux/module.h>
24#include <linux/init.h> 28#include <linux/init.h>
25#include <linux/console.h> 29#include <linux/console.h>
@@ -190,7 +194,6 @@ static inline void receive_chars(struct uart_omap_port *up, int *status)
190 if (up->port.line == up->port.cons->index) { 194 if (up->port.line == up->port.cons->index) {
191 /* Recover the break flag from console xmit */ 195 /* Recover the break flag from console xmit */
192 lsr |= up->lsr_break_flag; 196 lsr |= up->lsr_break_flag;
193 up->lsr_break_flag = 0;
194 } 197 }
195#endif 198#endif
196 if (lsr & UART_LSR_BI) 199 if (lsr & UART_LSR_BI)
@@ -517,6 +520,9 @@ static int serial_omap_startup(struct uart_port *port)
517 up->ier = UART_IER_RLSI | UART_IER_RDI; 520 up->ier = UART_IER_RLSI | UART_IER_RDI;
518 serial_out(up, UART_IER, up->ier); 521 serial_out(up, UART_IER, up->ier);
519 522
523 /* Enable module level wake up */
524 serial_out(up, UART_OMAP_WER, OMAP_UART_WER_MOD_WKUP);
525
520 up->port_activity = jiffies; 526 up->port_activity = jiffies;
521 return 0; 527 return 0;
522} 528}
@@ -824,9 +830,6 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
824 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 830 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
825 serial_out(up, UART_EFR, efr); 831 serial_out(up, UART_EFR, efr);
826 serial_out(up, UART_LCR, 0); 832 serial_out(up, UART_LCR, 0);
827 /* Enable module level wake up */
828 serial_out(up, UART_OMAP_WER,
829 (state != 0) ? OMAP_UART_WER_MOD_WKUP : 0);
830} 833}
831 834
832static void serial_omap_release_port(struct uart_port *port) 835static void serial_omap_release_port(struct uart_port *port)
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 70a61458ec42..a9ad7f33526d 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -21,6 +21,7 @@
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/dmi.h>
24 25
25#include <linux/dmaengine.h> 26#include <linux/dmaengine.h>
26#include <linux/pch_dma.h> 27#include <linux/pch_dma.h>
@@ -40,10 +41,11 @@ enum {
40 41
41#define PCH_UART_DRIVER_DEVICE "ttyPCH" 42#define PCH_UART_DRIVER_DEVICE "ttyPCH"
42 43
43#define PCH_UART_NR_GE_256FIFO 1 44/* Set the max number of UART port
44#define PCH_UART_NR_GE_64FIFO 3 45 * Intel EG20T PCH: 4 port
45#define PCH_UART_NR_GE (PCH_UART_NR_GE_256FIFO+PCH_UART_NR_GE_64FIFO) 46 * OKI SEMICONDUCTOR ML7213 IOH: 3 port
46#define PCH_UART_NR PCH_UART_NR_GE 47*/
48#define PCH_UART_NR 4
47 49
48#define PCH_UART_HANDLED_RX_INT (1<<((PCH_UART_HANDLED_RX_INT_SHIFT)<<1)) 50#define PCH_UART_HANDLED_RX_INT (1<<((PCH_UART_HANDLED_RX_INT_SHIFT)<<1))
49#define PCH_UART_HANDLED_TX_INT (1<<((PCH_UART_HANDLED_TX_INT_SHIFT)<<1)) 51#define PCH_UART_HANDLED_TX_INT (1<<((PCH_UART_HANDLED_TX_INT_SHIFT)<<1))
@@ -192,6 +194,8 @@ enum {
192#define PCH_UART_HAL_LOOP (PCH_UART_MCR_LOOP) 194#define PCH_UART_HAL_LOOP (PCH_UART_MCR_LOOP)
193#define PCH_UART_HAL_AFE (PCH_UART_MCR_AFE) 195#define PCH_UART_HAL_AFE (PCH_UART_MCR_AFE)
194 196
197#define PCI_VENDOR_ID_ROHM 0x10DB
198
195struct pch_uart_buffer { 199struct pch_uart_buffer {
196 unsigned char *buf; 200 unsigned char *buf;
197 int size; 201 int size;
@@ -215,6 +219,7 @@ struct eg20t_port {
215 struct pch_uart_buffer rxbuf; 219 struct pch_uart_buffer rxbuf;
216 unsigned int dmsr; 220 unsigned int dmsr;
217 unsigned int fcr; 221 unsigned int fcr;
222 unsigned int mcr;
218 unsigned int use_dma; 223 unsigned int use_dma;
219 unsigned int use_dma_flag; 224 unsigned int use_dma_flag;
220 struct dma_async_tx_descriptor *desc_tx; 225 struct dma_async_tx_descriptor *desc_tx;
@@ -223,13 +228,44 @@ struct eg20t_port {
223 struct pch_dma_slave param_rx; 228 struct pch_dma_slave param_rx;
224 struct dma_chan *chan_tx; 229 struct dma_chan *chan_tx;
225 struct dma_chan *chan_rx; 230 struct dma_chan *chan_rx;
226 struct scatterlist sg_tx; 231 struct scatterlist *sg_tx_p;
232 int nent;
227 struct scatterlist sg_rx; 233 struct scatterlist sg_rx;
228 int tx_dma_use; 234 int tx_dma_use;
229 void *rx_buf_virt; 235 void *rx_buf_virt;
230 dma_addr_t rx_buf_dma; 236 dma_addr_t rx_buf_dma;
231}; 237};
232 238
239/**
240 * struct pch_uart_driver_data - private data structure for UART-DMA
241 * @port_type: The number of DMA channel
242 * @line_no: UART port line number (0, 1, 2...)
243 */
244struct pch_uart_driver_data {
245 int port_type;
246 int line_no;
247};
248
249enum pch_uart_num_t {
250 pch_et20t_uart0 = 0,
251 pch_et20t_uart1,
252 pch_et20t_uart2,
253 pch_et20t_uart3,
254 pch_ml7213_uart0,
255 pch_ml7213_uart1,
256 pch_ml7213_uart2,
257};
258
259static struct pch_uart_driver_data drv_dat[] = {
260 [pch_et20t_uart0] = {PCH_UART_8LINE, 0},
261 [pch_et20t_uart1] = {PCH_UART_2LINE, 1},
262 [pch_et20t_uart2] = {PCH_UART_2LINE, 2},
263 [pch_et20t_uart3] = {PCH_UART_2LINE, 3},
264 [pch_ml7213_uart0] = {PCH_UART_8LINE, 0},
265 [pch_ml7213_uart1] = {PCH_UART_2LINE, 1},
266 [pch_ml7213_uart2] = {PCH_UART_2LINE, 2},
267};
268
233static unsigned int default_baud = 9600; 269static unsigned int default_baud = 9600;
234static const int trigger_level_256[4] = { 1, 64, 128, 224 }; 270static const int trigger_level_256[4] = { 1, 64, 128, 224 };
235static const int trigger_level_64[4] = { 1, 16, 32, 56 }; 271static const int trigger_level_64[4] = { 1, 16, 32, 56 };
@@ -278,7 +314,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud,
278 314
279 div = DIV_ROUND(priv->base_baud / 16, baud); 315 div = DIV_ROUND(priv->base_baud / 16, baud);
280 if (div < 0 || USHRT_MAX <= div) { 316 if (div < 0 || USHRT_MAX <= div) {
281 pr_err("Invalid Baud(div=0x%x)\n", div); 317 dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div);
282 return -EINVAL; 318 return -EINVAL;
283 } 319 }
284 320
@@ -286,17 +322,17 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud,
286 dlm = ((unsigned int)div >> 8) & 0x00FFU; 322 dlm = ((unsigned int)div >> 8) & 0x00FFU;
287 323
288 if (parity & ~(PCH_UART_LCR_PEN | PCH_UART_LCR_EPS | PCH_UART_LCR_SP)) { 324 if (parity & ~(PCH_UART_LCR_PEN | PCH_UART_LCR_EPS | PCH_UART_LCR_SP)) {
289 pr_err("Invalid parity(0x%x)\n", parity); 325 dev_err(priv->port.dev, "Invalid parity(0x%x)\n", parity);
290 return -EINVAL; 326 return -EINVAL;
291 } 327 }
292 328
293 if (bits & ~PCH_UART_LCR_WLS) { 329 if (bits & ~PCH_UART_LCR_WLS) {
294 pr_err("Invalid bits(0x%x)\n", bits); 330 dev_err(priv->port.dev, "Invalid bits(0x%x)\n", bits);
295 return -EINVAL; 331 return -EINVAL;
296 } 332 }
297 333
298 if (stb & ~PCH_UART_LCR_STB) { 334 if (stb & ~PCH_UART_LCR_STB) {
299 pr_err("Invalid STB(0x%x)\n", stb); 335 dev_err(priv->port.dev, "Invalid STB(0x%x)\n", stb);
300 return -EINVAL; 336 return -EINVAL;
301 } 337 }
302 338
@@ -304,7 +340,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud,
304 lcr |= bits; 340 lcr |= bits;
305 lcr |= stb; 341 lcr |= stb;
306 342
307 pr_debug("%s:baud = %d, div = %04x, lcr = %02x (%lu)\n", 343 dev_dbg(priv->port.dev, "%s:baud = %d, div = %04x, lcr = %02x (%lu)\n",
308 __func__, baud, div, lcr, jiffies); 344 __func__, baud, div, lcr, jiffies);
309 iowrite8(PCH_UART_LCR_DLAB, priv->membase + UART_LCR); 345 iowrite8(PCH_UART_LCR_DLAB, priv->membase + UART_LCR);
310 iowrite8(dll, priv->membase + PCH_UART_DLL); 346 iowrite8(dll, priv->membase + PCH_UART_DLL);
@@ -318,7 +354,8 @@ static int pch_uart_hal_fifo_reset(struct eg20t_port *priv,
318 unsigned int flag) 354 unsigned int flag)
319{ 355{
320 if (flag & ~(PCH_UART_FCR_TFR | PCH_UART_FCR_RFR)) { 356 if (flag & ~(PCH_UART_FCR_TFR | PCH_UART_FCR_RFR)) {
321 pr_err("%s:Invalid flag(0x%x)\n", __func__, flag); 357 dev_err(priv->port.dev, "%s:Invalid flag(0x%x)\n",
358 __func__, flag);
322 return -EINVAL; 359 return -EINVAL;
323 } 360 }
324 361
@@ -337,17 +374,20 @@ static int pch_uart_hal_set_fifo(struct eg20t_port *priv,
337 u8 fcr; 374 u8 fcr;
338 375
339 if (dmamode & ~PCH_UART_FCR_DMS) { 376 if (dmamode & ~PCH_UART_FCR_DMS) {
340 pr_err("%s:Invalid DMA Mode(0x%x)\n", __func__, dmamode); 377 dev_err(priv->port.dev, "%s:Invalid DMA Mode(0x%x)\n",
378 __func__, dmamode);
341 return -EINVAL; 379 return -EINVAL;
342 } 380 }
343 381
344 if (fifo_size & ~(PCH_UART_FCR_FIFOE | PCH_UART_FCR_FIFO256)) { 382 if (fifo_size & ~(PCH_UART_FCR_FIFOE | PCH_UART_FCR_FIFO256)) {
345 pr_err("%s:Invalid FIFO SIZE(0x%x)\n", __func__, fifo_size); 383 dev_err(priv->port.dev, "%s:Invalid FIFO SIZE(0x%x)\n",
384 __func__, fifo_size);
346 return -EINVAL; 385 return -EINVAL;
347 } 386 }
348 387
349 if (trigger & ~PCH_UART_FCR_RFTL) { 388 if (trigger & ~PCH_UART_FCR_RFTL) {
350 pr_err("%s:Invalid TRIGGER(0x%x)\n", __func__, trigger); 389 dev_err(priv->port.dev, "%s:Invalid TRIGGER(0x%x)\n",
390 __func__, trigger);
351 return -EINVAL; 391 return -EINVAL;
352 } 392 }
353 393
@@ -386,7 +426,7 @@ static u8 pch_uart_hal_get_modem(struct eg20t_port *priv)
386 return get_msr(priv, priv->membase); 426 return get_msr(priv, priv->membase);
387} 427}
388 428
389static int pch_uart_hal_write(struct eg20t_port *priv, 429static void pch_uart_hal_write(struct eg20t_port *priv,
390 const unsigned char *buf, int tx_size) 430 const unsigned char *buf, int tx_size)
391{ 431{
392 int i; 432 int i;
@@ -396,7 +436,6 @@ static int pch_uart_hal_write(struct eg20t_port *priv,
396 thr = buf[i++]; 436 thr = buf[i++];
397 iowrite8(thr, priv->membase + PCH_UART_THR); 437 iowrite8(thr, priv->membase + PCH_UART_THR);
398 } 438 }
399 return i;
400} 439}
401 440
402static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf, 441static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf,
@@ -452,7 +491,7 @@ static int push_rx(struct eg20t_port *priv, const unsigned char *buf,
452 port = &priv->port; 491 port = &priv->port;
453 tty = tty_port_tty_get(&port->state->port); 492 tty = tty_port_tty_get(&port->state->port);
454 if (!tty) { 493 if (!tty) {
455 pr_debug("%s:tty is busy now", __func__); 494 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
456 return -EBUSY; 495 return -EBUSY;
457 } 496 }
458 497
@@ -469,8 +508,8 @@ static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf)
469 struct uart_port *port = &priv->port; 508 struct uart_port *port = &priv->port;
470 509
471 if (port->x_char) { 510 if (port->x_char) {
472 pr_debug("%s:X character send %02x (%lu)\n", __func__, 511 dev_dbg(priv->port.dev, "%s:X character send %02x (%lu)\n",
473 port->x_char, jiffies); 512 __func__, port->x_char, jiffies);
474 buf[0] = port->x_char; 513 buf[0] = port->x_char;
475 port->x_char = 0; 514 port->x_char = 0;
476 ret = 1; 515 ret = 1;
@@ -490,7 +529,7 @@ static int dma_push_rx(struct eg20t_port *priv, int size)
490 port = &priv->port; 529 port = &priv->port;
491 tty = tty_port_tty_get(&port->state->port); 530 tty = tty_port_tty_get(&port->state->port);
492 if (!tty) { 531 if (!tty) {
493 pr_debug("%s:tty is busy now", __func__); 532 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
494 return 0; 533 return 0;
495 } 534 }
496 535
@@ -560,11 +599,13 @@ static void pch_request_dma(struct uart_port *port)
560 /* Set Tx DMA */ 599 /* Set Tx DMA */
561 param = &priv->param_tx; 600 param = &priv->param_tx;
562 param->dma_dev = &dma_dev->dev; 601 param->dma_dev = &dma_dev->dev;
563 param->chan_id = priv->port.line; 602 param->chan_id = priv->port.line * 2; /* Tx = 0, 2, 4, ... */
603
564 param->tx_reg = port->mapbase + UART_TX; 604 param->tx_reg = port->mapbase + UART_TX;
565 chan = dma_request_channel(mask, filter, param); 605 chan = dma_request_channel(mask, filter, param);
566 if (!chan) { 606 if (!chan) {
567 pr_err("%s:dma_request_channel FAILS(Tx)\n", __func__); 607 dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Tx)\n",
608 __func__);
568 return; 609 return;
569 } 610 }
570 priv->chan_tx = chan; 611 priv->chan_tx = chan;
@@ -572,11 +613,13 @@ static void pch_request_dma(struct uart_port *port)
572 /* Set Rx DMA */ 613 /* Set Rx DMA */
573 param = &priv->param_rx; 614 param = &priv->param_rx;
574 param->dma_dev = &dma_dev->dev; 615 param->dma_dev = &dma_dev->dev;
575 param->chan_id = priv->port.line + 1; /* Rx = Tx + 1 */ 616 param->chan_id = priv->port.line * 2 + 1; /* Rx = Tx + 1 */
617
576 param->rx_reg = port->mapbase + UART_RX; 618 param->rx_reg = port->mapbase + UART_RX;
577 chan = dma_request_channel(mask, filter, param); 619 chan = dma_request_channel(mask, filter, param);
578 if (!chan) { 620 if (!chan) {
579 pr_err("%s:dma_request_channel FAILS(Rx)\n", __func__); 621 dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n",
622 __func__);
580 dma_release_channel(priv->chan_tx); 623 dma_release_channel(priv->chan_tx);
581 return; 624 return;
582 } 625 }
@@ -592,16 +635,20 @@ static void pch_dma_rx_complete(void *arg)
592 struct eg20t_port *priv = arg; 635 struct eg20t_port *priv = arg;
593 struct uart_port *port = &priv->port; 636 struct uart_port *port = &priv->port;
594 struct tty_struct *tty = tty_port_tty_get(&port->state->port); 637 struct tty_struct *tty = tty_port_tty_get(&port->state->port);
638 int count;
595 639
596 if (!tty) { 640 if (!tty) {
597 pr_debug("%s:tty is busy now", __func__); 641 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
598 return; 642 return;
599 } 643 }
600 644
601 if (dma_push_rx(priv, priv->trigger_level)) 645 dma_sync_sg_for_cpu(port->dev, &priv->sg_rx, 1, DMA_FROM_DEVICE);
646 count = dma_push_rx(priv, priv->trigger_level);
647 if (count)
602 tty_flip_buffer_push(tty); 648 tty_flip_buffer_push(tty);
603
604 tty_kref_put(tty); 649 tty_kref_put(tty);
650 async_tx_ack(priv->desc_rx);
651 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT);
605} 652}
606 653
607static void pch_dma_tx_complete(void *arg) 654static void pch_dma_tx_complete(void *arg)
@@ -609,16 +656,23 @@ static void pch_dma_tx_complete(void *arg)
609 struct eg20t_port *priv = arg; 656 struct eg20t_port *priv = arg;
610 struct uart_port *port = &priv->port; 657 struct uart_port *port = &priv->port;
611 struct circ_buf *xmit = &port->state->xmit; 658 struct circ_buf *xmit = &port->state->xmit;
659 struct scatterlist *sg = priv->sg_tx_p;
660 int i;
612 661
613 xmit->tail += sg_dma_len(&priv->sg_tx); 662 for (i = 0; i < priv->nent; i++, sg++) {
663 xmit->tail += sg_dma_len(sg);
664 port->icount.tx += sg_dma_len(sg);
665 }
614 xmit->tail &= UART_XMIT_SIZE - 1; 666 xmit->tail &= UART_XMIT_SIZE - 1;
615 port->icount.tx += sg_dma_len(&priv->sg_tx);
616
617 async_tx_ack(priv->desc_tx); 667 async_tx_ack(priv->desc_tx);
668 dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE);
618 priv->tx_dma_use = 0; 669 priv->tx_dma_use = 0;
670 priv->nent = 0;
671 kfree(priv->sg_tx_p);
672 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT);
619} 673}
620 674
621static int pop_tx(struct eg20t_port *priv, unsigned char *buf, int size) 675static int pop_tx(struct eg20t_port *priv, int size)
622{ 676{
623 int count = 0; 677 int count = 0;
624 struct uart_port *port = &priv->port; 678 struct uart_port *port = &priv->port;
@@ -631,13 +685,13 @@ static int pop_tx(struct eg20t_port *priv, unsigned char *buf, int size)
631 int cnt_to_end = 685 int cnt_to_end =
632 CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); 686 CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
633 int sz = min(size - count, cnt_to_end); 687 int sz = min(size - count, cnt_to_end);
634 memcpy(&buf[count], &xmit->buf[xmit->tail], sz); 688 pch_uart_hal_write(priv, &xmit->buf[xmit->tail], sz);
635 xmit->tail = (xmit->tail + sz) & (UART_XMIT_SIZE - 1); 689 xmit->tail = (xmit->tail + sz) & (UART_XMIT_SIZE - 1);
636 count += sz; 690 count += sz;
637 } while (!uart_circ_empty(xmit) && count < size); 691 } while (!uart_circ_empty(xmit) && count < size);
638 692
639pop_tx_end: 693pop_tx_end:
640 pr_debug("%d characters. Remained %d characters. (%lu)\n", 694 dev_dbg(priv->port.dev, "%d characters. Remained %d characters.(%lu)\n",
641 count, size - count, jiffies); 695 count, size - count, jiffies);
642 696
643 return count; 697 return count;
@@ -679,7 +733,7 @@ static int dma_handle_rx(struct eg20t_port *priv)
679 733
680 sg_init_table(&priv->sg_rx, 1); /* Initialize SG table */ 734 sg_init_table(&priv->sg_rx, 1); /* Initialize SG table */
681 735
682 sg_dma_len(sg) = priv->fifo_size; 736 sg_dma_len(sg) = priv->trigger_level;
683 737
684 sg_set_page(&priv->sg_rx, virt_to_page(priv->rx_buf_virt), 738 sg_set_page(&priv->sg_rx, virt_to_page(priv->rx_buf_virt),
685 sg_dma_len(sg), (unsigned long)priv->rx_buf_virt & 739 sg_dma_len(sg), (unsigned long)priv->rx_buf_virt &
@@ -689,7 +743,8 @@ static int dma_handle_rx(struct eg20t_port *priv)
689 743
690 desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx, 744 desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx,
691 sg, 1, DMA_FROM_DEVICE, 745 sg, 1, DMA_FROM_DEVICE,
692 DMA_PREP_INTERRUPT); 746 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
747
693 if (!desc) 748 if (!desc)
694 return 0; 749 return 0;
695 750
@@ -706,14 +761,14 @@ static unsigned int handle_tx(struct eg20t_port *priv)
706{ 761{
707 struct uart_port *port = &priv->port; 762 struct uart_port *port = &priv->port;
708 struct circ_buf *xmit = &port->state->xmit; 763 struct circ_buf *xmit = &port->state->xmit;
709 int ret;
710 int fifo_size; 764 int fifo_size;
711 int tx_size; 765 int tx_size;
712 int size; 766 int size;
713 int tx_empty; 767 int tx_empty;
714 768
715 if (!priv->start_tx) { 769 if (!priv->start_tx) {
716 pr_info("%s:Tx isn't started. (%lu)\n", __func__, jiffies); 770 dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n",
771 __func__, jiffies);
717 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); 772 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
718 priv->tx_empty = 1; 773 priv->tx_empty = 1;
719 return 0; 774 return 0;
@@ -728,17 +783,21 @@ static unsigned int handle_tx(struct eg20t_port *priv)
728 fifo_size--; 783 fifo_size--;
729 } 784 }
730 size = min(xmit->head - xmit->tail, fifo_size); 785 size = min(xmit->head - xmit->tail, fifo_size);
731 tx_size = pop_tx(priv, xmit->buf, size); 786 if (size < 0)
787 size = fifo_size;
788
789 tx_size = pop_tx(priv, size);
732 if (tx_size > 0) { 790 if (tx_size > 0) {
733 ret = pch_uart_hal_write(priv, xmit->buf, tx_size); 791 port->icount.tx += tx_size;
734 port->icount.tx += ret;
735 tx_empty = 0; 792 tx_empty = 0;
736 } 793 }
737 794
738 priv->tx_empty = tx_empty; 795 priv->tx_empty = tx_empty;
739 796
740 if (tx_empty) 797 if (tx_empty) {
741 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); 798 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
799 uart_write_wakeup(port);
800 }
742 801
743 return PCH_UART_HANDLED_TX_INT; 802 return PCH_UART_HANDLED_TX_INT;
744} 803}
@@ -747,14 +806,28 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
747{ 806{
748 struct uart_port *port = &priv->port; 807 struct uart_port *port = &priv->port;
749 struct circ_buf *xmit = &port->state->xmit; 808 struct circ_buf *xmit = &port->state->xmit;
750 struct scatterlist *sg = &priv->sg_tx; 809 struct scatterlist *sg;
751 int nent; 810 int nent;
752 int fifo_size; 811 int fifo_size;
753 int tx_empty; 812 int tx_empty;
754 struct dma_async_tx_descriptor *desc; 813 struct dma_async_tx_descriptor *desc;
814 int num;
815 int i;
816 int bytes;
817 int size;
818 int rem;
755 819
756 if (!priv->start_tx) { 820 if (!priv->start_tx) {
757 pr_info("%s:Tx isn't started. (%lu)\n", __func__, jiffies); 821 dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n",
822 __func__, jiffies);
823 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
824 priv->tx_empty = 1;
825 return 0;
826 }
827
828 if (priv->tx_dma_use) {
829 dev_dbg(priv->port.dev, "%s:Tx is not completed. (%lu)\n",
830 __func__, jiffies);
758 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); 831 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
759 priv->tx_empty = 1; 832 priv->tx_empty = 1;
760 return 0; 833 return 0;
@@ -769,37 +842,73 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
769 fifo_size--; 842 fifo_size--;
770 } 843 }
771 844
772 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); 845 bytes = min((int)CIRC_CNT(xmit->head, xmit->tail,
846 UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head,
847 xmit->tail, UART_XMIT_SIZE));
848 if (!bytes) {
849 dev_dbg(priv->port.dev, "%s 0 bytes return\n", __func__);
850 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT);
851 uart_write_wakeup(port);
852 return 0;
853 }
854
855 if (bytes > fifo_size) {
856 num = bytes / fifo_size + 1;
857 size = fifo_size;
858 rem = bytes % fifo_size;
859 } else {
860 num = 1;
861 size = bytes;
862 rem = bytes;
863 }
864
865 dev_dbg(priv->port.dev, "%s num=%d size=%d rem=%d\n",
866 __func__, num, size, rem);
773 867
774 priv->tx_dma_use = 1; 868 priv->tx_dma_use = 1;
775 869
776 sg_init_table(&priv->sg_tx, 1); /* Initialize SG table */ 870 priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
777 871
778 sg_set_page(&priv->sg_tx, virt_to_page(xmit->buf), 872 sg_init_table(priv->sg_tx_p, num); /* Initialize SG table */
779 UART_XMIT_SIZE, (int)xmit->buf & ~PAGE_MASK); 873 sg = priv->sg_tx_p;
780 874
781 nent = dma_map_sg(port->dev, &priv->sg_tx, 1, DMA_TO_DEVICE); 875 for (i = 0; i < num; i++, sg++) {
876 if (i == (num - 1))
877 sg_set_page(sg, virt_to_page(xmit->buf),
878 rem, fifo_size * i);
879 else
880 sg_set_page(sg, virt_to_page(xmit->buf),
881 size, fifo_size * i);
882 }
883
884 sg = priv->sg_tx_p;
885 nent = dma_map_sg(port->dev, sg, num, DMA_TO_DEVICE);
782 if (!nent) { 886 if (!nent) {
783 pr_err("%s:dma_map_sg Failed\n", __func__); 887 dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__);
784 return 0; 888 return 0;
785 } 889 }
786 890 priv->nent = nent;
787 sg->offset = xmit->tail & (UART_XMIT_SIZE - 1); 891
788 sg_dma_address(sg) = (sg_dma_address(sg) & ~(UART_XMIT_SIZE - 1)) + 892 for (i = 0; i < nent; i++, sg++) {
789 sg->offset; 893 sg->offset = (xmit->tail & (UART_XMIT_SIZE - 1)) +
790 sg_dma_len(sg) = min((int)CIRC_CNT(xmit->head, xmit->tail, 894 fifo_size * i;
791 UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head, 895 sg_dma_address(sg) = (sg_dma_address(sg) &
792 xmit->tail, UART_XMIT_SIZE)); 896 ~(UART_XMIT_SIZE - 1)) + sg->offset;
897 if (i == (nent - 1))
898 sg_dma_len(sg) = rem;
899 else
900 sg_dma_len(sg) = size;
901 }
793 902
794 desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx, 903 desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx,
795 sg, nent, DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 904 priv->sg_tx_p, nent, DMA_TO_DEVICE,
905 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
796 if (!desc) { 906 if (!desc) {
797 pr_err("%s:device_prep_slave_sg Failed\n", __func__); 907 dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n",
908 __func__);
798 return 0; 909 return 0;
799 } 910 }
800 911 dma_sync_sg_for_device(port->dev, priv->sg_tx_p, nent, DMA_TO_DEVICE);
801 dma_sync_sg_for_device(port->dev, sg, 1, DMA_TO_DEVICE);
802
803 priv->desc_tx = desc; 912 priv->desc_tx = desc;
804 desc->callback = pch_dma_tx_complete; 913 desc->callback = pch_dma_tx_complete;
805 desc->callback_param = priv; 914 desc->callback_param = priv;
@@ -854,10 +963,16 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
854 } 963 }
855 break; 964 break;
856 case PCH_UART_IID_RDR: /* Received Data Ready */ 965 case PCH_UART_IID_RDR: /* Received Data Ready */
857 if (priv->use_dma) 966 if (priv->use_dma) {
967 pch_uart_hal_disable_interrupt(priv,
968 PCH_UART_HAL_RX_INT);
858 ret = dma_handle_rx(priv); 969 ret = dma_handle_rx(priv);
859 else 970 if (!ret)
971 pch_uart_hal_enable_interrupt(priv,
972 PCH_UART_HAL_RX_INT);
973 } else {
860 ret = handle_rx(priv); 974 ret = handle_rx(priv);
975 }
861 break; 976 break;
862 case PCH_UART_IID_RDR_TO: /* Received Data Ready 977 case PCH_UART_IID_RDR_TO: /* Received Data Ready
863 (FIFO Timeout) */ 978 (FIFO Timeout) */
@@ -874,7 +989,8 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
874 ret = PCH_UART_HANDLED_MS_INT; 989 ret = PCH_UART_HANDLED_MS_INT;
875 break; 990 break;
876 default: /* Never junp to this label */ 991 default: /* Never junp to this label */
877 pr_err("%s:iid=%d (%lu)\n", __func__, iid, jiffies); 992 dev_err(priv->port.dev, "%s:iid=%d (%lu)\n", __func__,
993 iid, jiffies);
878 ret = -1; 994 ret = -1;
879 break; 995 break;
880 } 996 }
@@ -932,7 +1048,6 @@ static unsigned int pch_uart_get_mctrl(struct uart_port *port)
932static void pch_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) 1048static void pch_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
933{ 1049{
934 u32 mcr = 0; 1050 u32 mcr = 0;
935 unsigned int dat;
936 struct eg20t_port *priv = container_of(port, struct eg20t_port, port); 1051 struct eg20t_port *priv = container_of(port, struct eg20t_port, port);
937 1052
938 if (mctrl & TIOCM_DTR) 1053 if (mctrl & TIOCM_DTR)
@@ -942,11 +1057,11 @@ static void pch_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
942 if (mctrl & TIOCM_LOOP) 1057 if (mctrl & TIOCM_LOOP)
943 mcr |= UART_MCR_LOOP; 1058 mcr |= UART_MCR_LOOP;
944 1059
945 if (mctrl) { 1060 if (priv->mcr & UART_MCR_AFE)
946 dat = pch_uart_get_mctrl(port); 1061 mcr |= UART_MCR_AFE;
947 dat |= mcr; 1062
948 iowrite8(dat, priv->membase + UART_MCR); 1063 if (mctrl)
949 } 1064 iowrite8(mcr, priv->membase + UART_MCR);
950} 1065}
951 1066
952static void pch_uart_stop_tx(struct uart_port *port) 1067static void pch_uart_stop_tx(struct uart_port *port)
@@ -963,9 +1078,13 @@ static void pch_uart_start_tx(struct uart_port *port)
963 1078
964 priv = container_of(port, struct eg20t_port, port); 1079 priv = container_of(port, struct eg20t_port, port);
965 1080
966 if (priv->use_dma) 1081 if (priv->use_dma) {
967 if (priv->tx_dma_use) 1082 if (priv->tx_dma_use) {
1083 dev_dbg(priv->port.dev, "%s : Tx DMA is NOT empty.\n",
1084 __func__);
968 return; 1085 return;
1086 }
1087 }
969 1088
970 priv->start_tx = 1; 1089 priv->start_tx = 1;
971 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); 1090 pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT);
@@ -1010,7 +1129,12 @@ static int pch_uart_startup(struct uart_port *port)
1010 1129
1011 priv = container_of(port, struct eg20t_port, port); 1130 priv = container_of(port, struct eg20t_port, port);
1012 priv->tx_empty = 1; 1131 priv->tx_empty = 1;
1013 port->uartclk = priv->base_baud; 1132
1133 if (port->uartclk)
1134 priv->base_baud = port->uartclk;
1135 else
1136 port->uartclk = priv->base_baud;
1137
1014 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_ALL_INT); 1138 pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_ALL_INT);
1015 ret = pch_uart_hal_set_line(priv, default_baud, 1139 ret = pch_uart_hal_set_line(priv, default_baud,
1016 PCH_UART_HAL_PARITY_NONE, PCH_UART_HAL_8BIT, 1140 PCH_UART_HAL_PARITY_NONE, PCH_UART_HAL_8BIT,
@@ -1081,7 +1205,8 @@ static void pch_uart_shutdown(struct uart_port *port)
1081 ret = pch_uart_hal_set_fifo(priv, PCH_UART_HAL_DMA_MODE0, 1205 ret = pch_uart_hal_set_fifo(priv, PCH_UART_HAL_DMA_MODE0,
1082 PCH_UART_HAL_FIFO_DIS, PCH_UART_HAL_TRIGGER1); 1206 PCH_UART_HAL_FIFO_DIS, PCH_UART_HAL_TRIGGER1);
1083 if (ret) 1207 if (ret)
1084 pr_err("pch_uart_hal_set_fifo Failed(ret=%d)\n", ret); 1208 dev_err(priv->port.dev,
1209 "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret);
1085 1210
1086 if (priv->use_dma_flag) 1211 if (priv->use_dma_flag)
1087 pch_free_dma(port); 1212 pch_free_dma(port);
@@ -1130,6 +1255,13 @@ static void pch_uart_set_termios(struct uart_port *port,
1130 } else { 1255 } else {
1131 parity = PCH_UART_HAL_PARITY_NONE; 1256 parity = PCH_UART_HAL_PARITY_NONE;
1132 } 1257 }
1258
1259 /* Only UART0 has auto hardware flow function */
1260 if ((termios->c_cflag & CRTSCTS) && (priv->fifo_size == 256))
1261 priv->mcr |= UART_MCR_AFE;
1262 else
1263 priv->mcr &= ~UART_MCR_AFE;
1264
1133 termios->c_cflag &= ~CMSPAR; /* Mark/Space parity is not supported */ 1265 termios->c_cflag &= ~CMSPAR; /* Mark/Space parity is not supported */
1134 1266
1135 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16); 1267 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
@@ -1202,17 +1334,19 @@ static int pch_uart_verify_port(struct uart_port *port,
1202 1334
1203 priv = container_of(port, struct eg20t_port, port); 1335 priv = container_of(port, struct eg20t_port, port);
1204 if (serinfo->flags & UPF_LOW_LATENCY) { 1336 if (serinfo->flags & UPF_LOW_LATENCY) {
1205 pr_info("PCH UART : Use PIO Mode (without DMA)\n"); 1337 dev_info(priv->port.dev,
1338 "PCH UART : Use PIO Mode (without DMA)\n");
1206 priv->use_dma = 0; 1339 priv->use_dma = 0;
1207 serinfo->flags &= ~UPF_LOW_LATENCY; 1340 serinfo->flags &= ~UPF_LOW_LATENCY;
1208 } else { 1341 } else {
1209#ifndef CONFIG_PCH_DMA 1342#ifndef CONFIG_PCH_DMA
1210 pr_err("%s : PCH DMA is not Loaded.\n", __func__); 1343 dev_err(priv->port.dev, "%s : PCH DMA is not Loaded.\n",
1344 __func__);
1211 return -EOPNOTSUPP; 1345 return -EOPNOTSUPP;
1212#endif 1346#endif
1213 priv->use_dma = 1; 1347 priv->use_dma = 1;
1214 priv->use_dma_flag = 1; 1348 priv->use_dma_flag = 1;
1215 pr_info("PCH UART : Use DMA Mode\n"); 1349 dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n");
1216 } 1350 }
1217 1351
1218 return 0; 1352 return 0;
@@ -1249,7 +1383,7 @@ static struct uart_driver pch_uart_driver = {
1249}; 1383};
1250 1384
1251static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, 1385static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1252 int port_type) 1386 const struct pci_device_id *id)
1253{ 1387{
1254 struct eg20t_port *priv; 1388 struct eg20t_port *priv;
1255 int ret; 1389 int ret;
@@ -1257,7 +1391,11 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1257 unsigned int mapbase; 1391 unsigned int mapbase;
1258 unsigned char *rxbuf; 1392 unsigned char *rxbuf;
1259 int fifosize, base_baud; 1393 int fifosize, base_baud;
1260 static int num; 1394 int port_type;
1395 struct pch_uart_driver_data *board;
1396
1397 board = &drv_dat[id->driver_data];
1398 port_type = board->port_type;
1261 1399
1262 priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL); 1400 priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL);
1263 if (priv == NULL) 1401 if (priv == NULL)
@@ -1267,14 +1405,18 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1267 if (!rxbuf) 1405 if (!rxbuf)
1268 goto init_port_free_txbuf; 1406 goto init_port_free_txbuf;
1269 1407
1408 base_baud = 1843200; /* 1.8432MHz */
1409
1410 /* quirk for CM-iTC board */
1411 if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
1412 base_baud = 192000000; /* 192.0MHz */
1413
1270 switch (port_type) { 1414 switch (port_type) {
1271 case PORT_UNKNOWN: 1415 case PORT_UNKNOWN:
1272 fifosize = 256; /* UART0 */ 1416 fifosize = 256; /* EG20T/ML7213: UART0 */
1273 base_baud = 1843200; /* 1.8432MHz */
1274 break; 1417 break;
1275 case PORT_8250: 1418 case PORT_8250:
1276 fifosize = 64; /* UART1~3 */ 1419 fifosize = 64; /* EG20T:UART1~3 ML7213: UART1~2*/
1277 base_baud = 1843200; /* 1.8432MHz */
1278 break; 1420 break;
1279 default: 1421 default:
1280 dev_err(&pdev->dev, "Invalid Port Type(=%d)\n", port_type); 1422 dev_err(&pdev->dev, "Invalid Port Type(=%d)\n", port_type);
@@ -1302,11 +1444,14 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1302 priv->port.ops = &pch_uart_ops; 1444 priv->port.ops = &pch_uart_ops;
1303 priv->port.flags = UPF_BOOT_AUTOCONF; 1445 priv->port.flags = UPF_BOOT_AUTOCONF;
1304 priv->port.fifosize = fifosize; 1446 priv->port.fifosize = fifosize;
1305 priv->port.line = num++; 1447 priv->port.line = board->line_no;
1306 priv->trigger = PCH_UART_HAL_TRIGGER_M; 1448 priv->trigger = PCH_UART_HAL_TRIGGER_M;
1307 1449
1450 spin_lock_init(&priv->port.lock);
1451
1308 pci_set_drvdata(pdev, priv); 1452 pci_set_drvdata(pdev, priv);
1309 pch_uart_hal_request(pdev, fifosize, base_baud); 1453 pch_uart_hal_request(pdev, fifosize, base_baud);
1454
1310 ret = uart_add_one_port(&pch_uart_driver, &priv->port); 1455 ret = uart_add_one_port(&pch_uart_driver, &priv->port);
1311 if (ret < 0) 1456 if (ret < 0)
1312 goto init_port_hal_free; 1457 goto init_port_hal_free;
@@ -1377,13 +1522,19 @@ static int pch_uart_pci_resume(struct pci_dev *pdev)
1377 1522
1378static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = { 1523static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = {
1379 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8811), 1524 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8811),
1380 .driver_data = PCH_UART_8LINE}, 1525 .driver_data = pch_et20t_uart0},
1381 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8812), 1526 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8812),
1382 .driver_data = PCH_UART_2LINE}, 1527 .driver_data = pch_et20t_uart1},
1383 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8813), 1528 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8813),
1384 .driver_data = PCH_UART_2LINE}, 1529 .driver_data = pch_et20t_uart2},
1385 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8814), 1530 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8814),
1386 .driver_data = PCH_UART_2LINE}, 1531 .driver_data = pch_et20t_uart3},
1532 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8027),
1533 .driver_data = pch_ml7213_uart0},
1534 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8028),
1535 .driver_data = pch_ml7213_uart1},
1536 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8029),
1537 .driver_data = pch_ml7213_uart2},
1387 {0,}, 1538 {0,},
1388}; 1539};
1389 1540
@@ -1397,7 +1548,7 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
1397 if (ret < 0) 1548 if (ret < 0)
1398 goto probe_error; 1549 goto probe_error;
1399 1550
1400 priv = pch_uart_init_port(pdev, id->driver_data); 1551 priv = pch_uart_init_port(pdev, id);
1401 if (!priv) { 1552 if (!priv) {
1402 ret = -EBUSY; 1553 ret = -EBUSY;
1403 goto probe_disable_device; 1554 goto probe_disable_device;
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 460a72d91bb7..733fe8e73f0f 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -905,7 +905,7 @@ static int uart_get_lsr_info(struct tty_struct *tty,
905 return put_user(result, value); 905 return put_user(result, value);
906} 906}
907 907
908static int uart_tiocmget(struct tty_struct *tty, struct file *file) 908static int uart_tiocmget(struct tty_struct *tty)
909{ 909{
910 struct uart_state *state = tty->driver_data; 910 struct uart_state *state = tty->driver_data;
911 struct tty_port *port = &state->port; 911 struct tty_port *port = &state->port;
@@ -913,10 +913,8 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
913 int result = -EIO; 913 int result = -EIO;
914 914
915 mutex_lock(&port->mutex); 915 mutex_lock(&port->mutex);
916 if ((!file || !tty_hung_up_p(file)) && 916 if (!(tty->flags & (1 << TTY_IO_ERROR))) {
917 !(tty->flags & (1 << TTY_IO_ERROR))) {
918 result = uport->mctrl; 917 result = uport->mctrl;
919
920 spin_lock_irq(&uport->lock); 918 spin_lock_irq(&uport->lock);
921 result |= uport->ops->get_mctrl(uport); 919 result |= uport->ops->get_mctrl(uport);
922 spin_unlock_irq(&uport->lock); 920 spin_unlock_irq(&uport->lock);
@@ -927,8 +925,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
927} 925}
928 926
929static int 927static int
930uart_tiocmset(struct tty_struct *tty, struct file *file, 928uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
931 unsigned int set, unsigned int clear)
932{ 929{
933 struct uart_state *state = tty->driver_data; 930 struct uart_state *state = tty->driver_data;
934 struct uart_port *uport = state->uart_port; 931 struct uart_port *uport = state->uart_port;
@@ -936,8 +933,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
936 int ret = -EIO; 933 int ret = -EIO;
937 934
938 mutex_lock(&port->mutex); 935 mutex_lock(&port->mutex);
939 if ((!file || !tty_hung_up_p(file)) && 936 if (!(tty->flags & (1 << TTY_IO_ERROR))) {
940 !(tty->flags & (1 << TTY_IO_ERROR))) {
941 uart_update_mctrl(uport, set, clear); 937 uart_update_mctrl(uport, set, clear);
942 ret = 0; 938 ret = 0;
943 } 939 }
@@ -1103,7 +1099,7 @@ static int uart_get_icount(struct tty_struct *tty,
1103 * Called via sys_ioctl. We can use spin_lock_irq() here. 1099 * Called via sys_ioctl. We can use spin_lock_irq() here.
1104 */ 1100 */
1105static int 1101static int
1106uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, 1102uart_ioctl(struct tty_struct *tty, unsigned int cmd,
1107 unsigned long arg) 1103 unsigned long arg)
1108{ 1104{
1109 struct uart_state *state = tty->driver_data; 1105 struct uart_state *state = tty->driver_data;
@@ -1156,7 +1152,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1156 1152
1157 mutex_lock(&port->mutex); 1153 mutex_lock(&port->mutex);
1158 1154
1159 if (tty_hung_up_p(filp)) { 1155 if (tty->flags & (1 << TTY_IO_ERROR)) {
1160 ret = -EIO; 1156 ret = -EIO;
1161 goto out_up; 1157 goto out_up;
1162 } 1158 }
@@ -2064,7 +2060,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
2064 /* 2060 /*
2065 * Re-enable the console device after suspending. 2061 * Re-enable the console device after suspending.
2066 */ 2062 */
2067 if (console_suspend_enabled && uart_console(uport)) { 2063 if (uart_console(uport)) {
2068 /* 2064 /*
2069 * First try to use the console cflag setting. 2065 * First try to use the console cflag setting.
2070 */ 2066 */
@@ -2077,9 +2073,9 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
2077 if (port->tty && port->tty->termios && termios.c_cflag == 0) 2073 if (port->tty && port->tty->termios && termios.c_cflag == 0)
2078 termios = *(port->tty->termios); 2074 termios = *(port->tty->termios);
2079 2075
2080 uart_change_pm(state, 0);
2081 uport->ops->set_termios(uport, &termios, NULL); 2076 uport->ops->set_termios(uport, &termios, NULL);
2082 console_start(uport->cons); 2077 if (console_suspend_enabled)
2078 console_start(uport->cons);
2083 } 2079 }
2084 2080
2085 if (port->flags & ASYNC_SUSPENDED) { 2081 if (port->flags & ASYNC_SUSPENDED) {
diff --git a/drivers/char/synclink.c b/drivers/tty/synclink.c
index 3a6824f12be2..18888d005a0a 100644
--- a/drivers/char/synclink.c
+++ b/drivers/tty/synclink.c
@@ -823,8 +823,8 @@ static isr_dispatch_func UscIsrTable[7] =
823/* 823/*
824 * ioctl call handlers 824 * ioctl call handlers
825 */ 825 */
826static int tiocmget(struct tty_struct *tty, struct file *file); 826static int tiocmget(struct tty_struct *tty);
827static int tiocmset(struct tty_struct *tty, struct file *file, 827static int tiocmset(struct tty_struct *tty,
828 unsigned int set, unsigned int clear); 828 unsigned int set, unsigned int clear);
829static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount 829static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount
830 __user *user_icount); 830 __user *user_icount);
@@ -2846,7 +2846,7 @@ static int modem_input_wait(struct mgsl_struct *info,int arg)
2846 2846
2847/* return the state of the serial control and status signals 2847/* return the state of the serial control and status signals
2848 */ 2848 */
2849static int tiocmget(struct tty_struct *tty, struct file *file) 2849static int tiocmget(struct tty_struct *tty)
2850{ 2850{
2851 struct mgsl_struct *info = tty->driver_data; 2851 struct mgsl_struct *info = tty->driver_data;
2852 unsigned int result; 2852 unsigned int result;
@@ -2871,8 +2871,8 @@ static int tiocmget(struct tty_struct *tty, struct file *file)
2871 2871
2872/* set modem control signals (DTR/RTS) 2872/* set modem control signals (DTR/RTS)
2873 */ 2873 */
2874static int tiocmset(struct tty_struct *tty, struct file *file, 2874static int tiocmset(struct tty_struct *tty,
2875 unsigned int set, unsigned int clear) 2875 unsigned int set, unsigned int clear)
2876{ 2876{
2877 struct mgsl_struct *info = tty->driver_data; 2877 struct mgsl_struct *info = tty->driver_data;
2878 unsigned long flags; 2878 unsigned long flags;
@@ -2962,13 +2962,12 @@ static int msgl_get_icount(struct tty_struct *tty,
2962 * Arguments: 2962 * Arguments:
2963 * 2963 *
2964 * tty pointer to tty instance data 2964 * tty pointer to tty instance data
2965 * file pointer to associated file object for device
2966 * cmd IOCTL command code 2965 * cmd IOCTL command code
2967 * arg command argument/context 2966 * arg command argument/context
2968 * 2967 *
2969 * Return Value: 0 if success, otherwise error code 2968 * Return Value: 0 if success, otherwise error code
2970 */ 2969 */
2971static int mgsl_ioctl(struct tty_struct *tty, struct file * file, 2970static int mgsl_ioctl(struct tty_struct *tty,
2972 unsigned int cmd, unsigned long arg) 2971 unsigned int cmd, unsigned long arg)
2973{ 2972{
2974 struct mgsl_struct * info = tty->driver_data; 2973 struct mgsl_struct * info = tty->driver_data;
diff --git a/drivers/char/synclink_gt.c b/drivers/tty/synclink_gt.c
index d01fffeac951..a35dd549a008 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -154,7 +154,7 @@ static void flush_buffer(struct tty_struct *tty);
154static void tx_hold(struct tty_struct *tty); 154static void tx_hold(struct tty_struct *tty);
155static void tx_release(struct tty_struct *tty); 155static void tx_release(struct tty_struct *tty);
156 156
157static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); 157static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
158static int chars_in_buffer(struct tty_struct *tty); 158static int chars_in_buffer(struct tty_struct *tty);
159static void throttle(struct tty_struct * tty); 159static void throttle(struct tty_struct * tty);
160static void unthrottle(struct tty_struct * tty); 160static void unthrottle(struct tty_struct * tty);
@@ -512,9 +512,9 @@ static int tx_abort(struct slgt_info *info);
512static int rx_enable(struct slgt_info *info, int enable); 512static int rx_enable(struct slgt_info *info, int enable);
513static int modem_input_wait(struct slgt_info *info,int arg); 513static int modem_input_wait(struct slgt_info *info,int arg);
514static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr); 514static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr);
515static int tiocmget(struct tty_struct *tty, struct file *file); 515static int tiocmget(struct tty_struct *tty);
516static int tiocmset(struct tty_struct *tty, struct file *file, 516static int tiocmset(struct tty_struct *tty,
517 unsigned int set, unsigned int clear); 517 unsigned int set, unsigned int clear);
518static int set_break(struct tty_struct *tty, int break_state); 518static int set_break(struct tty_struct *tty, int break_state);
519static int get_interface(struct slgt_info *info, int __user *if_mode); 519static int get_interface(struct slgt_info *info, int __user *if_mode);
520static int set_interface(struct slgt_info *info, int if_mode); 520static int set_interface(struct slgt_info *info, int if_mode);
@@ -1030,13 +1030,12 @@ static void tx_release(struct tty_struct *tty)
1030 * Arguments 1030 * Arguments
1031 * 1031 *
1032 * tty pointer to tty instance data 1032 * tty pointer to tty instance data
1033 * file pointer to associated file object for device
1034 * cmd IOCTL command code 1033 * cmd IOCTL command code
1035 * arg command argument/context 1034 * arg command argument/context
1036 * 1035 *
1037 * Return 0 if success, otherwise error code 1036 * Return 0 if success, otherwise error code
1038 */ 1037 */
1039static int ioctl(struct tty_struct *tty, struct file *file, 1038static int ioctl(struct tty_struct *tty,
1040 unsigned int cmd, unsigned long arg) 1039 unsigned int cmd, unsigned long arg)
1041{ 1040{
1042 struct slgt_info *info = tty->driver_data; 1041 struct slgt_info *info = tty->driver_data;
@@ -1200,7 +1199,7 @@ static long set_params32(struct slgt_info *info, struct MGSL_PARAMS32 __user *ne
1200 return 0; 1199 return 0;
1201} 1200}
1202 1201
1203static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file, 1202static long slgt_compat_ioctl(struct tty_struct *tty,
1204 unsigned int cmd, unsigned long arg) 1203 unsigned int cmd, unsigned long arg)
1205{ 1204{
1206 struct slgt_info *info = tty->driver_data; 1205 struct slgt_info *info = tty->driver_data;
@@ -1239,7 +1238,7 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file,
1239 case MGSL_IOCSIF: 1238 case MGSL_IOCSIF:
1240 case MGSL_IOCSXSYNC: 1239 case MGSL_IOCSXSYNC:
1241 case MGSL_IOCSXCTRL: 1240 case MGSL_IOCSXCTRL:
1242 rc = ioctl(tty, file, cmd, arg); 1241 rc = ioctl(tty, cmd, arg);
1243 break; 1242 break;
1244 } 1243 }
1245 1244
@@ -3195,7 +3194,7 @@ static int modem_input_wait(struct slgt_info *info,int arg)
3195/* 3194/*
3196 * return state of serial control and status signals 3195 * return state of serial control and status signals
3197 */ 3196 */
3198static int tiocmget(struct tty_struct *tty, struct file *file) 3197static int tiocmget(struct tty_struct *tty)
3199{ 3198{
3200 struct slgt_info *info = tty->driver_data; 3199 struct slgt_info *info = tty->driver_data;
3201 unsigned int result; 3200 unsigned int result;
@@ -3223,7 +3222,7 @@ static int tiocmget(struct tty_struct *tty, struct file *file)
3223 * TIOCMSET = set/clear signal values 3222 * TIOCMSET = set/clear signal values
3224 * value bit mask for command 3223 * value bit mask for command
3225 */ 3224 */
3226static int tiocmset(struct tty_struct *tty, struct file *file, 3225static int tiocmset(struct tty_struct *tty,
3227 unsigned int set, unsigned int clear) 3226 unsigned int set, unsigned int clear)
3228{ 3227{
3229 struct slgt_info *info = tty->driver_data; 3228 struct slgt_info *info = tty->driver_data;
diff --git a/drivers/char/synclinkmp.c b/drivers/tty/synclinkmp.c
index 2f9eb4b0dec1..327343694473 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -520,7 +520,7 @@ static void flush_buffer(struct tty_struct *tty);
520static void tx_hold(struct tty_struct *tty); 520static void tx_hold(struct tty_struct *tty);
521static void tx_release(struct tty_struct *tty); 521static void tx_release(struct tty_struct *tty);
522 522
523static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); 523static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
524static int chars_in_buffer(struct tty_struct *tty); 524static int chars_in_buffer(struct tty_struct *tty);
525static void throttle(struct tty_struct * tty); 525static void throttle(struct tty_struct * tty);
526static void unthrottle(struct tty_struct * tty); 526static void unthrottle(struct tty_struct * tty);
@@ -546,9 +546,9 @@ static int tx_abort(SLMP_INFO *info);
546static int rx_enable(SLMP_INFO *info, int enable); 546static int rx_enable(SLMP_INFO *info, int enable);
547static int modem_input_wait(SLMP_INFO *info,int arg); 547static int modem_input_wait(SLMP_INFO *info,int arg);
548static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr); 548static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr);
549static int tiocmget(struct tty_struct *tty, struct file *file); 549static int tiocmget(struct tty_struct *tty);
550static int tiocmset(struct tty_struct *tty, struct file *file, 550static int tiocmset(struct tty_struct *tty,
551 unsigned int set, unsigned int clear); 551 unsigned int set, unsigned int clear);
552static int set_break(struct tty_struct *tty, int break_state); 552static int set_break(struct tty_struct *tty, int break_state);
553 553
554static void add_device(SLMP_INFO *info); 554static void add_device(SLMP_INFO *info);
@@ -1248,13 +1248,12 @@ static void tx_release(struct tty_struct *tty)
1248 * Arguments: 1248 * Arguments:
1249 * 1249 *
1250 * tty pointer to tty instance data 1250 * tty pointer to tty instance data
1251 * file pointer to associated file object for device
1252 * cmd IOCTL command code 1251 * cmd IOCTL command code
1253 * arg command argument/context 1252 * arg command argument/context
1254 * 1253 *
1255 * Return Value: 0 if success, otherwise error code 1254 * Return Value: 0 if success, otherwise error code
1256 */ 1255 */
1257static int ioctl(struct tty_struct *tty, struct file *file, 1256static int ioctl(struct tty_struct *tty,
1258 unsigned int cmd, unsigned long arg) 1257 unsigned int cmd, unsigned long arg)
1259{ 1258{
1260 SLMP_INFO *info = tty->driver_data; 1259 SLMP_INFO *info = tty->driver_data;
@@ -3207,7 +3206,7 @@ static int modem_input_wait(SLMP_INFO *info,int arg)
3207 3206
3208/* return the state of the serial control and status signals 3207/* return the state of the serial control and status signals
3209 */ 3208 */
3210static int tiocmget(struct tty_struct *tty, struct file *file) 3209static int tiocmget(struct tty_struct *tty)
3211{ 3210{
3212 SLMP_INFO *info = tty->driver_data; 3211 SLMP_INFO *info = tty->driver_data;
3213 unsigned int result; 3212 unsigned int result;
@@ -3232,8 +3231,8 @@ static int tiocmget(struct tty_struct *tty, struct file *file)
3232 3231
3233/* set modem control signals (DTR/RTS) 3232/* set modem control signals (DTR/RTS)
3234 */ 3233 */
3235static int tiocmset(struct tty_struct *tty, struct file *file, 3234static int tiocmset(struct tty_struct *tty,
3236 unsigned int set, unsigned int clear) 3235 unsigned int set, unsigned int clear)
3237{ 3236{
3238 SLMP_INFO *info = tty->driver_data; 3237 SLMP_INFO *info = tty->driver_data;
3239 unsigned long flags; 3238 unsigned long flags;
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index f64582b0f623..7c5866920622 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -95,8 +95,10 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid,
95{ 95{
96 if (buf->valid == 0) 96 if (buf->valid == 0)
97 return; 97 return;
98 if (audit_enabled == 0) 98 if (audit_enabled == 0) {
99 buf->valid = 0;
99 return; 100 return;
101 }
100 tty_audit_log("tty", tsk, loginuid, sessionid, buf->major, buf->minor, 102 tty_audit_log("tty", tsk, loginuid, sessionid, buf->major, buf->minor,
101 buf->data, buf->valid); 103 buf->data, buf->valid);
102 buf->valid = 0; 104 buf->valid = 0;
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 0065da4b11c1..8ef2d69470ec 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2465,12 +2465,12 @@ out:
2465 * Locking: none (up to the driver) 2465 * Locking: none (up to the driver)
2466 */ 2466 */
2467 2467
2468static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p) 2468static int tty_tiocmget(struct tty_struct *tty, int __user *p)
2469{ 2469{
2470 int retval = -EINVAL; 2470 int retval = -EINVAL;
2471 2471
2472 if (tty->ops->tiocmget) { 2472 if (tty->ops->tiocmget) {
2473 retval = tty->ops->tiocmget(tty, file); 2473 retval = tty->ops->tiocmget(tty);
2474 2474
2475 if (retval >= 0) 2475 if (retval >= 0)
2476 retval = put_user(retval, p); 2476 retval = put_user(retval, p);
@@ -2481,7 +2481,6 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p
2481/** 2481/**
2482 * tty_tiocmset - set modem status 2482 * tty_tiocmset - set modem status
2483 * @tty: tty device 2483 * @tty: tty device
2484 * @file: user file pointer
2485 * @cmd: command - clear bits, set bits or set all 2484 * @cmd: command - clear bits, set bits or set all
2486 * @p: pointer to desired bits 2485 * @p: pointer to desired bits
2487 * 2486 *
@@ -2491,7 +2490,7 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p
2491 * Locking: none (up to the driver) 2490 * Locking: none (up to the driver)
2492 */ 2491 */
2493 2492
2494static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, 2493static int tty_tiocmset(struct tty_struct *tty, unsigned int cmd,
2495 unsigned __user *p) 2494 unsigned __user *p)
2496{ 2495{
2497 int retval; 2496 int retval;
@@ -2518,7 +2517,7 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int
2518 } 2517 }
2519 set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; 2518 set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
2520 clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; 2519 clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
2521 return tty->ops->tiocmset(tty, file, set, clear); 2520 return tty->ops->tiocmset(tty, set, clear);
2522} 2521}
2523 2522
2524static int tty_tiocgicount(struct tty_struct *tty, void __user *arg) 2523static int tty_tiocgicount(struct tty_struct *tty, void __user *arg)
@@ -2627,6 +2626,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2627 return put_user(tty->ldisc->ops->num, (int __user *)p); 2626 return put_user(tty->ldisc->ops->num, (int __user *)p);
2628 case TIOCSETD: 2627 case TIOCSETD:
2629 return tiocsetd(tty, p); 2628 return tiocsetd(tty, p);
2629 case TIOCVHANGUP:
2630 if (!capable(CAP_SYS_ADMIN))
2631 return -EPERM;
2632 tty_vhangup(tty);
2633 return 0;
2630 case TIOCGDEV: 2634 case TIOCGDEV:
2631 { 2635 {
2632 unsigned int ret = new_encode_dev(tty_devnum(real_tty)); 2636 unsigned int ret = new_encode_dev(tty_devnum(real_tty));
@@ -2655,11 +2659,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2655 return send_break(tty, arg ? arg*100 : 250); 2659 return send_break(tty, arg ? arg*100 : 250);
2656 2660
2657 case TIOCMGET: 2661 case TIOCMGET:
2658 return tty_tiocmget(tty, file, p); 2662 return tty_tiocmget(tty, p);
2659 case TIOCMSET: 2663 case TIOCMSET:
2660 case TIOCMBIC: 2664 case TIOCMBIC:
2661 case TIOCMBIS: 2665 case TIOCMBIS:
2662 return tty_tiocmset(tty, file, cmd, p); 2666 return tty_tiocmset(tty, cmd, p);
2663 case TIOCGICOUNT: 2667 case TIOCGICOUNT:
2664 retval = tty_tiocgicount(tty, p); 2668 retval = tty_tiocgicount(tty, p);
2665 /* For the moment allow fall through to the old method */ 2669 /* For the moment allow fall through to the old method */
@@ -2677,7 +2681,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2677 break; 2681 break;
2678 } 2682 }
2679 if (tty->ops->ioctl) { 2683 if (tty->ops->ioctl) {
2680 retval = (tty->ops->ioctl)(tty, file, cmd, arg); 2684 retval = (tty->ops->ioctl)(tty, cmd, arg);
2681 if (retval != -ENOIOCTLCMD) 2685 if (retval != -ENOIOCTLCMD)
2682 return retval; 2686 return retval;
2683 } 2687 }
@@ -2705,7 +2709,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
2705 return -EINVAL; 2709 return -EINVAL;
2706 2710
2707 if (tty->ops->compat_ioctl) { 2711 if (tty->ops->compat_ioctl) {
2708 retval = (tty->ops->compat_ioctl)(tty, file, cmd, arg); 2712 retval = (tty->ops->compat_ioctl)(tty, cmd, arg);
2709 if (retval != -ENOIOCTLCMD) 2713 if (retval != -ENOIOCTLCMD)
2710 return retval; 2714 return retval;
2711 } 2715 }
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 0c1889971459..1a1135d580a2 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -486,7 +486,7 @@ int tty_termios_hw_change(struct ktermios *a, struct ktermios *b)
486EXPORT_SYMBOL(tty_termios_hw_change); 486EXPORT_SYMBOL(tty_termios_hw_change);
487 487
488/** 488/**
489 * change_termios - update termios values 489 * tty_set_termios - update termios values
490 * @tty: tty to update 490 * @tty: tty to update
491 * @new_termios: desired new value 491 * @new_termios: desired new value
492 * 492 *
@@ -497,7 +497,7 @@ EXPORT_SYMBOL(tty_termios_hw_change);
497 * Locking: termios_mutex 497 * Locking: termios_mutex
498 */ 498 */
499 499
500static void change_termios(struct tty_struct *tty, struct ktermios *new_termios) 500int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
501{ 501{
502 struct ktermios old_termios; 502 struct ktermios old_termios;
503 struct tty_ldisc *ld; 503 struct tty_ldisc *ld;
@@ -553,7 +553,9 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios)
553 tty_ldisc_deref(ld); 553 tty_ldisc_deref(ld);
554 } 554 }
555 mutex_unlock(&tty->termios_mutex); 555 mutex_unlock(&tty->termios_mutex);
556 return 0;
556} 557}
558EXPORT_SYMBOL_GPL(tty_set_termios);
557 559
558/** 560/**
559 * set_termios - set termios values for a tty 561 * set_termios - set termios values for a tty
@@ -562,7 +564,7 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios)
562 * @opt: option information 564 * @opt: option information
563 * 565 *
564 * Helper function to prepare termios data and run necessary other 566 * Helper function to prepare termios data and run necessary other
565 * functions before using change_termios to do the actual changes. 567 * functions before using tty_set_termios to do the actual changes.
566 * 568 *
567 * Locking: 569 * Locking:
568 * Called functions take ldisc and termios_mutex locks 570 * Called functions take ldisc and termios_mutex locks
@@ -620,7 +622,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
620 return -EINTR; 622 return -EINTR;
621 } 623 }
622 624
623 change_termios(tty, &tmp_termios); 625 tty_set_termios(tty, &tmp_termios);
624 626
625 /* FIXME: Arguably if tmp_termios == tty->termios AND the 627 /* FIXME: Arguably if tmp_termios == tty->termios AND the
626 actual requested termios was not tmp_termios then we may 628 actual requested termios was not tmp_termios then we may
@@ -797,7 +799,7 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
797 termios.c_ospeed); 799 termios.c_ospeed);
798#endif 800#endif
799 mutex_unlock(&tty->termios_mutex); 801 mutex_unlock(&tty->termios_mutex);
800 change_termios(tty, &termios); 802 tty_set_termios(tty, &termios);
801 return 0; 803 return 0;
802} 804}
803#endif 805#endif
@@ -951,6 +953,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
951 int ret = 0; 953 int ret = 0;
952 struct ktermios kterm; 954 struct ktermios kterm;
953 955
956 BUG_ON(file == NULL);
957
954 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 958 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
955 tty->driver->subtype == PTY_TYPE_MASTER) 959 tty->driver->subtype == PTY_TYPE_MASTER)
956 real_tty = tty->link; 960 real_tty = tty->link;
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 4214d58276f7..c42f402db9ba 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -535,6 +535,19 @@ static int tty_ldisc_halt(struct tty_struct *tty)
535} 535}
536 536
537/** 537/**
538 * tty_ldisc_flush_works - flush all works of a tty
539 * @tty: tty device to flush works for
540 *
541 * Sync flush all works belonging to @tty.
542 */
543static void tty_ldisc_flush_works(struct tty_struct *tty)
544{
545 flush_work_sync(&tty->hangup_work);
546 flush_work_sync(&tty->SAK_work);
547 flush_delayed_work_sync(&tty->buf.work);
548}
549
550/**
538 * tty_ldisc_wait_idle - wait for the ldisc to become idle 551 * tty_ldisc_wait_idle - wait for the ldisc to become idle
539 * @tty: tty to wait for 552 * @tty: tty to wait for
540 * 553 *
@@ -653,7 +666,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
653 666
654 mutex_unlock(&tty->ldisc_mutex); 667 mutex_unlock(&tty->ldisc_mutex);
655 668
656 flush_scheduled_work(); 669 tty_ldisc_flush_works(tty);
657 670
658 retval = tty_ldisc_wait_idle(tty); 671 retval = tty_ldisc_wait_idle(tty);
659 672
@@ -905,7 +918,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
905 918
906 tty_unlock(); 919 tty_unlock();
907 tty_ldisc_halt(tty); 920 tty_ldisc_halt(tty);
908 flush_scheduled_work(); 921 tty_ldisc_flush_works(tty);
909 tty_lock(); 922 tty_lock();
910 923
911 mutex_lock(&tty->ldisc_mutex); 924 mutex_lock(&tty->ldisc_mutex);
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index e95d7876ca6b..6dd3c68c13ad 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -654,7 +654,8 @@ static void k_spec(struct vc_data *vc, unsigned char value, char up_flag)
654 if (value >= ARRAY_SIZE(fn_handler)) 654 if (value >= ARRAY_SIZE(fn_handler))
655 return; 655 return;
656 if ((kbd->kbdmode == VC_RAW || 656 if ((kbd->kbdmode == VC_RAW ||
657 kbd->kbdmode == VC_MEDIUMRAW) && 657 kbd->kbdmode == VC_MEDIUMRAW ||
658 kbd->kbdmode == VC_OFF) &&
658 value != KVAL(K_SAK)) 659 value != KVAL(K_SAK))
659 return; /* SAK is allowed even in raw mode */ 660 return; /* SAK is allowed even in raw mode */
660 fn_handler[value](vc); 661 fn_handler[value](vc);
@@ -1295,7 +1296,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1295 if (rc == NOTIFY_STOP) 1296 if (rc == NOTIFY_STOP)
1296 return; 1297 return;
1297 1298
1298 if (raw_mode && type != KT_SPEC && type != KT_SHIFT) 1299 if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT)
1299 return; 1300 return;
1300 1301
1301 (*k_handler[type])(vc, keysym & 0xff, !down); 1302 (*k_handler[type])(vc, keysym & 0xff, !down);
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index a672ed192d33..7b3bfbe2e6de 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -28,7 +28,6 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/mutex.h>
32#include <linux/vt_kern.h> 31#include <linux/vt_kern.h>
33#include <linux/selection.h> 32#include <linux/selection.h>
34#include <linux/kbd_kern.h> 33#include <linux/kbd_kern.h>
@@ -51,6 +50,8 @@
51#undef addr 50#undef addr
52#define HEADER_SIZE 4 51#define HEADER_SIZE 4
53 52
53#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
54
54struct vcs_poll_data { 55struct vcs_poll_data {
55 struct notifier_block notifier; 56 struct notifier_block notifier;
56 unsigned int cons_num; 57 unsigned int cons_num;
@@ -131,21 +132,45 @@ vcs_poll_data_get(struct file *file)
131 return poll; 132 return poll;
132} 133}
133 134
135/*
136 * Returns VC for inode.
137 * Must be called with console_lock.
138 */
139static struct vc_data*
140vcs_vc(struct inode *inode, int *viewed)
141{
142 unsigned int currcons = iminor(inode) & 127;
143
144 WARN_CONSOLE_UNLOCKED();
145
146 if (currcons == 0) {
147 currcons = fg_console;
148 if (viewed)
149 *viewed = 1;
150 } else {
151 currcons--;
152 if (viewed)
153 *viewed = 0;
154 }
155 return vc_cons[currcons].d;
156}
157
158/*
159 * Returns size for VC carried by inode.
160 * Must be called with console_lock.
161 */
134static int 162static int
135vcs_size(struct inode *inode) 163vcs_size(struct inode *inode)
136{ 164{
137 int size; 165 int size;
138 int minor = iminor(inode); 166 int minor = iminor(inode);
139 int currcons = minor & 127;
140 struct vc_data *vc; 167 struct vc_data *vc;
141 168
142 if (currcons == 0) 169 WARN_CONSOLE_UNLOCKED();
143 currcons = fg_console; 170
144 else 171 vc = vcs_vc(inode, NULL);
145 currcons--; 172 if (!vc)
146 if (!vc_cons_allocated(currcons))
147 return -ENXIO; 173 return -ENXIO;
148 vc = vc_cons[currcons].d;
149 174
150 size = vc->vc_rows * vc->vc_cols; 175 size = vc->vc_rows * vc->vc_cols;
151 176
@@ -158,11 +183,13 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
158{ 183{
159 int size; 184 int size;
160 185
161 mutex_lock(&con_buf_mtx); 186 console_lock();
162 size = vcs_size(file->f_path.dentry->d_inode); 187 size = vcs_size(file->f_path.dentry->d_inode);
188 console_unlock();
189 if (size < 0)
190 return size;
163 switch (orig) { 191 switch (orig) {
164 default: 192 default:
165 mutex_unlock(&con_buf_mtx);
166 return -EINVAL; 193 return -EINVAL;
167 case 2: 194 case 2:
168 offset += size; 195 offset += size;
@@ -173,11 +200,9 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
173 break; 200 break;
174 } 201 }
175 if (offset < 0 || offset > size) { 202 if (offset < 0 || offset > size) {
176 mutex_unlock(&con_buf_mtx);
177 return -EINVAL; 203 return -EINVAL;
178 } 204 }
179 file->f_pos = offset; 205 file->f_pos = offset;
180 mutex_unlock(&con_buf_mtx);
181 return file->f_pos; 206 return file->f_pos;
182} 207}
183 208
@@ -190,12 +215,15 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
190 struct vc_data *vc; 215 struct vc_data *vc;
191 struct vcs_poll_data *poll; 216 struct vcs_poll_data *poll;
192 long pos; 217 long pos;
193 long viewed, attr, read; 218 long attr, read;
194 int col, maxcol; 219 int col, maxcol, viewed;
195 unsigned short *org = NULL; 220 unsigned short *org = NULL;
196 ssize_t ret; 221 ssize_t ret;
222 char *con_buf;
197 223
198 mutex_lock(&con_buf_mtx); 224 con_buf = (char *) __get_free_page(GFP_KERNEL);
225 if (!con_buf)
226 return -ENOMEM;
199 227
200 pos = *ppos; 228 pos = *ppos;
201 229
@@ -205,18 +233,10 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
205 console_lock(); 233 console_lock();
206 234
207 attr = (currcons & 128); 235 attr = (currcons & 128);
208 currcons = (currcons & 127);
209 if (currcons == 0) {
210 currcons = fg_console;
211 viewed = 1;
212 } else {
213 currcons--;
214 viewed = 0;
215 }
216 ret = -ENXIO; 236 ret = -ENXIO;
217 if (!vc_cons_allocated(currcons)) 237 vc = vcs_vc(inode, &viewed);
238 if (!vc)
218 goto unlock_out; 239 goto unlock_out;
219 vc = vc_cons[currcons].d;
220 240
221 ret = -EINVAL; 241 ret = -EINVAL;
222 if (pos < 0) 242 if (pos < 0)
@@ -237,6 +257,12 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
237 * could sleep. 257 * could sleep.
238 */ 258 */
239 size = vcs_size(inode); 259 size = vcs_size(inode);
260 if (size < 0) {
261 if (read)
262 break;
263 ret = size;
264 goto unlock_out;
265 }
240 if (pos >= size) 266 if (pos >= size)
241 break; 267 break;
242 if (count > size - pos) 268 if (count > size - pos)
@@ -355,7 +381,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
355 ret = read; 381 ret = read;
356unlock_out: 382unlock_out:
357 console_unlock(); 383 console_unlock();
358 mutex_unlock(&con_buf_mtx); 384 free_page((unsigned long) con_buf);
359 return ret; 385 return ret;
360} 386}
361 387
@@ -366,13 +392,16 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
366 unsigned int currcons = iminor(inode); 392 unsigned int currcons = iminor(inode);
367 struct vc_data *vc; 393 struct vc_data *vc;
368 long pos; 394 long pos;
369 long viewed, attr, size, written; 395 long attr, size, written;
370 char *con_buf0; 396 char *con_buf0;
371 int col, maxcol; 397 int col, maxcol, viewed;
372 u16 *org0 = NULL, *org = NULL; 398 u16 *org0 = NULL, *org = NULL;
373 size_t ret; 399 size_t ret;
400 char *con_buf;
374 401
375 mutex_lock(&con_buf_mtx); 402 con_buf = (char *) __get_free_page(GFP_KERNEL);
403 if (!con_buf)
404 return -ENOMEM;
376 405
377 pos = *ppos; 406 pos = *ppos;
378 407
@@ -382,19 +411,10 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
382 console_lock(); 411 console_lock();
383 412
384 attr = (currcons & 128); 413 attr = (currcons & 128);
385 currcons = (currcons & 127);
386
387 if (currcons == 0) {
388 currcons = fg_console;
389 viewed = 1;
390 } else {
391 currcons--;
392 viewed = 0;
393 }
394 ret = -ENXIO; 414 ret = -ENXIO;
395 if (!vc_cons_allocated(currcons)) 415 vc = vcs_vc(inode, &viewed);
416 if (!vc)
396 goto unlock_out; 417 goto unlock_out;
397 vc = vc_cons[currcons].d;
398 418
399 size = vcs_size(inode); 419 size = vcs_size(inode);
400 ret = -EINVAL; 420 ret = -EINVAL;
@@ -436,6 +456,12 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
436 * Return data written up to now on failure. 456 * Return data written up to now on failure.
437 */ 457 */
438 size = vcs_size(inode); 458 size = vcs_size(inode);
459 if (size < 0) {
460 if (written)
461 break;
462 ret = size;
463 goto unlock_out;
464 }
439 if (pos >= size) 465 if (pos >= size)
440 break; 466 break;
441 if (this_round > size - pos) 467 if (this_round > size - pos)
@@ -543,9 +569,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
543 569
544unlock_out: 570unlock_out:
545 console_unlock(); 571 console_unlock();
546 572 free_page((unsigned long) con_buf);
547 mutex_unlock(&con_buf_mtx);
548
549 return ret; 573 return ret;
550} 574}
551 575
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 147ede3423df..798df6f89110 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2068,18 +2068,6 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
2068 } 2068 }
2069} 2069}
2070 2070
2071/* This is a temporary buffer used to prepare a tty console write
2072 * so that we can easily avoid touching user space while holding the
2073 * console spinlock. It is allocated in con_init and is shared by
2074 * this code and the vc_screen read/write tty calls.
2075 *
2076 * We have to allocate this statically in the kernel data section
2077 * since console_init (and thus con_init) are called before any
2078 * kernel memory allocation is available.
2079 */
2080char con_buf[CON_BUF_SIZE];
2081DEFINE_MUTEX(con_buf_mtx);
2082
2083/* is_double_width() is based on the wcwidth() implementation by 2071/* is_double_width() is based on the wcwidth() implementation by
2084 * Markus Kuhn -- 2007-05-26 (Unicode 5.0) 2072 * Markus Kuhn -- 2007-05-26 (Unicode 5.0)
2085 * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c 2073 * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
@@ -2157,10 +2145,10 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
2157 2145
2158 currcons = vc->vc_num; 2146 currcons = vc->vc_num;
2159 if (!vc_cons_allocated(currcons)) { 2147 if (!vc_cons_allocated(currcons)) {
2160 /* could this happen? */ 2148 /* could this happen? */
2161 printk_once("con_write: tty %d not allocated\n", currcons+1); 2149 pr_warn_once("con_write: tty %d not allocated\n", currcons+1);
2162 console_unlock(); 2150 console_unlock();
2163 return 0; 2151 return 0;
2164 } 2152 }
2165 2153
2166 himask = vc->vc_hi_font_mask; 2154 himask = vc->vc_hi_font_mask;
@@ -2940,7 +2928,7 @@ static int __init con_init(void)
2940 gotoxy(vc, vc->vc_x, vc->vc_y); 2928 gotoxy(vc, vc->vc_x, vc->vc_y);
2941 csi_J(vc, 0); 2929 csi_J(vc, 0);
2942 update_screen(vc); 2930 update_screen(vc);
2943 printk("Console: %s %s %dx%d", 2931 pr_info("Console: %s %s %dx%d",
2944 vc->vc_can_do_color ? "colour" : "mono", 2932 vc->vc_can_do_color ? "colour" : "mono",
2945 display_desc, vc->vc_cols, vc->vc_rows); 2933 display_desc, vc->vc_cols, vc->vc_rows);
2946 printable = 1; 2934 printable = 1;
@@ -3103,7 +3091,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
3103 clear_buffer_attributes(vc); 3091 clear_buffer_attributes(vc);
3104 } 3092 }
3105 3093
3106 printk("Console: switching "); 3094 pr_info("Console: switching ");
3107 if (!deflt) 3095 if (!deflt)
3108 printk("consoles %d-%d ", first+1, last+1); 3096 printk("consoles %d-%d ", first+1, last+1);
3109 if (j >= 0) { 3097 if (j >= 0) {
@@ -3809,7 +3797,8 @@ void do_unblank_screen(int leaving_gfx)
3809 return; 3797 return;
3810 if (!vc_cons_allocated(fg_console)) { 3798 if (!vc_cons_allocated(fg_console)) {
3811 /* impossible */ 3799 /* impossible */
3812 printk("unblank_screen: tty %d not allocated ??\n", fg_console+1); 3800 pr_warning("unblank_screen: tty %d not allocated ??\n",
3801 fg_console+1);
3813 return; 3802 return;
3814 } 3803 }
3815 vc = vc_cons[fg_console].d; 3804 vc = vc_cons[fg_console].d;
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 1235ebda6e1c..b64804965316 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -495,7 +495,7 @@ do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, struct vc_
495 * We handle the console-specific ioctl's here. We allow the 495 * We handle the console-specific ioctl's here. We allow the
496 * capability to modify any console, not just the fg_console. 496 * capability to modify any console, not just the fg_console.
497 */ 497 */
498int vt_ioctl(struct tty_struct *tty, struct file * file, 498int vt_ioctl(struct tty_struct *tty,
499 unsigned int cmd, unsigned long arg) 499 unsigned int cmd, unsigned long arg)
500{ 500{
501 struct vc_data *vc = tty->driver_data; 501 struct vc_data *vc = tty->driver_data;
@@ -688,6 +688,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
688 kbd->kbdmode = VC_UNICODE; 688 kbd->kbdmode = VC_UNICODE;
689 compute_shiftstate(); 689 compute_shiftstate();
690 break; 690 break;
691 case K_OFF:
692 kbd->kbdmode = VC_OFF;
693 break;
691 default: 694 default:
692 ret = -EINVAL; 695 ret = -EINVAL;
693 goto out; 696 goto out;
@@ -1007,8 +1010,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1007 if (ret) 1010 if (ret)
1008 break; 1011 break;
1009 /* Commence switch and lock */ 1012 /* Commence switch and lock */
1010 set_console(arg); 1013 set_console(vsa.console);
1011 } 1014 }
1015 break;
1012 } 1016 }
1013 1017
1014 /* 1018 /*
@@ -1491,7 +1495,7 @@ compat_unimap_ioctl(unsigned int cmd, struct compat_unimapdesc __user *user_ud,
1491 return 0; 1495 return 0;
1492} 1496}
1493 1497
1494long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 1498long vt_compat_ioctl(struct tty_struct *tty,
1495 unsigned int cmd, unsigned long arg) 1499 unsigned int cmd, unsigned long arg)
1496{ 1500{
1497 struct vc_data *vc = tty->driver_data; 1501 struct vc_data *vc = tty->driver_data;
@@ -1577,7 +1581,7 @@ out:
1577 1581
1578fallback: 1582fallback:
1579 tty_unlock(); 1583 tty_unlock();
1580 return vt_ioctl(tty, file, cmd, arg); 1584 return vt_ioctl(tty, cmd, arg);
1581} 1585}
1582 1586
1583 1587
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 4ab49d4eebf4..f492a7f2b6ee 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -776,7 +776,7 @@ static int acm_tty_break_ctl(struct tty_struct *tty, int state)
776 return retval; 776 return retval;
777} 777}
778 778
779static int acm_tty_tiocmget(struct tty_struct *tty, struct file *file) 779static int acm_tty_tiocmget(struct tty_struct *tty)
780{ 780{
781 struct acm *acm = tty->driver_data; 781 struct acm *acm = tty->driver_data;
782 782
@@ -791,7 +791,7 @@ static int acm_tty_tiocmget(struct tty_struct *tty, struct file *file)
791 TIOCM_CTS; 791 TIOCM_CTS;
792} 792}
793 793
794static int acm_tty_tiocmset(struct tty_struct *tty, struct file *file, 794static int acm_tty_tiocmset(struct tty_struct *tty,
795 unsigned int set, unsigned int clear) 795 unsigned int set, unsigned int clear)
796{ 796{
797 struct acm *acm = tty->driver_data; 797 struct acm *acm = tty->driver_data;
@@ -813,7 +813,7 @@ static int acm_tty_tiocmset(struct tty_struct *tty, struct file *file,
813 return acm_set_control(acm, acm->ctrlout = newctrl); 813 return acm_set_control(acm, acm->ctrlout = newctrl);
814} 814}
815 815
816static int acm_tty_ioctl(struct tty_struct *tty, struct file *file, 816static int acm_tty_ioctl(struct tty_struct *tty,
817 unsigned int cmd, unsigned long arg) 817 unsigned int cmd, unsigned long arg)
818{ 818{
819 struct acm *acm = tty->driver_data; 819 struct acm *acm = tty->driver_data;
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 8f1d4fb19d24..5cdb9d912275 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -431,7 +431,7 @@ static int ark3116_get_icount(struct tty_struct *tty,
431 return 0; 431 return 0;
432} 432}
433 433
434static int ark3116_ioctl(struct tty_struct *tty, struct file *file, 434static int ark3116_ioctl(struct tty_struct *tty,
435 unsigned int cmd, unsigned long arg) 435 unsigned int cmd, unsigned long arg)
436{ 436{
437 struct usb_serial_port *port = tty->driver_data; 437 struct usb_serial_port *port = tty->driver_data;
@@ -485,7 +485,7 @@ static int ark3116_ioctl(struct tty_struct *tty, struct file *file,
485 return -ENOIOCTLCMD; 485 return -ENOIOCTLCMD;
486} 486}
487 487
488static int ark3116_tiocmget(struct tty_struct *tty, struct file *file) 488static int ark3116_tiocmget(struct tty_struct *tty)
489{ 489{
490 struct usb_serial_port *port = tty->driver_data; 490 struct usb_serial_port *port = tty->driver_data;
491 struct ark3116_private *priv = usb_get_serial_port_data(port); 491 struct ark3116_private *priv = usb_get_serial_port_data(port);
@@ -511,7 +511,7 @@ static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
511 (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0); 511 (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0);
512} 512}
513 513
514static int ark3116_tiocmset(struct tty_struct *tty, struct file *file, 514static int ark3116_tiocmset(struct tty_struct *tty,
515 unsigned set, unsigned clr) 515 unsigned set, unsigned clr)
516{ 516{
517 struct usb_serial_port *port = tty->driver_data; 517 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 36df35295db2..d6921fa1403c 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -100,8 +100,8 @@ static void belkin_sa_process_read_urb(struct urb *urb);
100static void belkin_sa_set_termios(struct tty_struct *tty, 100static void belkin_sa_set_termios(struct tty_struct *tty,
101 struct usb_serial_port *port, struct ktermios * old); 101 struct usb_serial_port *port, struct ktermios * old);
102static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state); 102static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state);
103static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file); 103static int belkin_sa_tiocmget(struct tty_struct *tty);
104static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, 104static int belkin_sa_tiocmset(struct tty_struct *tty,
105 unsigned int set, unsigned int clear); 105 unsigned int set, unsigned int clear);
106 106
107 107
@@ -497,7 +497,7 @@ static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state)
497 dev_err(&port->dev, "Set break_ctl %d\n", break_state); 497 dev_err(&port->dev, "Set break_ctl %d\n", break_state);
498} 498}
499 499
500static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file) 500static int belkin_sa_tiocmget(struct tty_struct *tty)
501{ 501{
502 struct usb_serial_port *port = tty->driver_data; 502 struct usb_serial_port *port = tty->driver_data;
503 struct belkin_sa_private *priv = usb_get_serial_port_data(port); 503 struct belkin_sa_private *priv = usb_get_serial_port_data(port);
@@ -513,7 +513,7 @@ static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file)
513 return control_state; 513 return control_state;
514} 514}
515 515
516static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, 516static int belkin_sa_tiocmset(struct tty_struct *tty,
517 unsigned int set, unsigned int clear) 517 unsigned int set, unsigned int clear)
518{ 518{
519 struct usb_serial_port *port = tty->driver_data; 519 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 14ac87ee9251..6ae1c0688b5e 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -432,7 +432,7 @@ out:
432 kfree(break_reg); 432 kfree(break_reg);
433} 433}
434 434
435static int ch341_tiocmset(struct tty_struct *tty, struct file *file, 435static int ch341_tiocmset(struct tty_struct *tty,
436 unsigned int set, unsigned int clear) 436 unsigned int set, unsigned int clear)
437{ 437{
438 struct usb_serial_port *port = tty->driver_data; 438 struct usb_serial_port *port = tty->driver_data;
@@ -553,8 +553,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
553 return 0; 553 return 0;
554} 554}
555 555
556/*static int ch341_ioctl(struct usb_serial_port *port, struct file *file,*/ 556static int ch341_ioctl(struct tty_struct *tty,
557static int ch341_ioctl(struct tty_struct *tty, struct file *file,
558 unsigned int cmd, unsigned long arg) 557 unsigned int cmd, unsigned long arg)
559{ 558{
560 struct usb_serial_port *port = tty->driver_data; 559 struct usb_serial_port *port = tty->driver_data;
@@ -573,7 +572,7 @@ static int ch341_ioctl(struct tty_struct *tty, struct file *file,
573 return -ENOIOCTLCMD; 572 return -ENOIOCTLCMD;
574} 573}
575 574
576static int ch341_tiocmget(struct tty_struct *tty, struct file *file) 575static int ch341_tiocmget(struct tty_struct *tty)
577{ 576{
578 struct usb_serial_port *port = tty->driver_data; 577 struct usb_serial_port *port = tty->driver_data;
579 struct ch341_private *priv = usb_get_serial_port_data(port); 578 struct ch341_private *priv = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 735ea03157ab..4df3e0cecbae 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -41,10 +41,9 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
41 unsigned int *cflagp, unsigned int *baudp); 41 unsigned int *cflagp, unsigned int *baudp);
42static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *, 42static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *,
43 struct ktermios*); 43 struct ktermios*);
44static int cp210x_tiocmget(struct tty_struct *, struct file *); 44static int cp210x_tiocmget(struct tty_struct *);
45static int cp210x_tiocmset(struct tty_struct *, struct file *, 45static int cp210x_tiocmset(struct tty_struct *, unsigned int, unsigned int);
46 unsigned int, unsigned int); 46static int cp210x_tiocmset_port(struct usb_serial_port *port,
47static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *,
48 unsigned int, unsigned int); 47 unsigned int, unsigned int);
49static void cp210x_break_ctl(struct tty_struct *, int); 48static void cp210x_break_ctl(struct tty_struct *, int);
50static int cp210x_startup(struct usb_serial *); 49static int cp210x_startup(struct usb_serial *);
@@ -698,14 +697,14 @@ static void cp210x_set_termios(struct tty_struct *tty,
698 697
699} 698}
700 699
701static int cp210x_tiocmset (struct tty_struct *tty, struct file *file, 700static int cp210x_tiocmset (struct tty_struct *tty,
702 unsigned int set, unsigned int clear) 701 unsigned int set, unsigned int clear)
703{ 702{
704 struct usb_serial_port *port = tty->driver_data; 703 struct usb_serial_port *port = tty->driver_data;
705 return cp210x_tiocmset_port(port, file, set, clear); 704 return cp210x_tiocmset_port(port, set, clear);
706} 705}
707 706
708static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file, 707static int cp210x_tiocmset_port(struct usb_serial_port *port,
709 unsigned int set, unsigned int clear) 708 unsigned int set, unsigned int clear)
710{ 709{
711 unsigned int control = 0; 710 unsigned int control = 0;
@@ -737,12 +736,12 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file,
737static void cp210x_dtr_rts(struct usb_serial_port *p, int on) 736static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
738{ 737{
739 if (on) 738 if (on)
740 cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0); 739 cp210x_tiocmset_port(p, TIOCM_DTR|TIOCM_RTS, 0);
741 else 740 else
742 cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); 741 cp210x_tiocmset_port(p, 0, TIOCM_DTR|TIOCM_RTS);
743} 742}
744 743
745static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) 744static int cp210x_tiocmget (struct tty_struct *tty)
746{ 745{
747 struct usb_serial_port *port = tty->driver_data; 746 struct usb_serial_port *port = tty->driver_data;
748 unsigned int control; 747 unsigned int control;
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 2edf238b00b9..987e9bf7bd02 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -169,12 +169,12 @@ static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port,
169 const unsigned char *buf, int count); 169 const unsigned char *buf, int count);
170static void cypress_send(struct usb_serial_port *port); 170static void cypress_send(struct usb_serial_port *port);
171static int cypress_write_room(struct tty_struct *tty); 171static int cypress_write_room(struct tty_struct *tty);
172static int cypress_ioctl(struct tty_struct *tty, struct file *file, 172static int cypress_ioctl(struct tty_struct *tty,
173 unsigned int cmd, unsigned long arg); 173 unsigned int cmd, unsigned long arg);
174static void cypress_set_termios(struct tty_struct *tty, 174static void cypress_set_termios(struct tty_struct *tty,
175 struct usb_serial_port *port, struct ktermios *old); 175 struct usb_serial_port *port, struct ktermios *old);
176static int cypress_tiocmget(struct tty_struct *tty, struct file *file); 176static int cypress_tiocmget(struct tty_struct *tty);
177static int cypress_tiocmset(struct tty_struct *tty, struct file *file, 177static int cypress_tiocmset(struct tty_struct *tty,
178 unsigned int set, unsigned int clear); 178 unsigned int set, unsigned int clear);
179static int cypress_chars_in_buffer(struct tty_struct *tty); 179static int cypress_chars_in_buffer(struct tty_struct *tty);
180static void cypress_throttle(struct tty_struct *tty); 180static void cypress_throttle(struct tty_struct *tty);
@@ -864,7 +864,7 @@ static int cypress_write_room(struct tty_struct *tty)
864} 864}
865 865
866 866
867static int cypress_tiocmget(struct tty_struct *tty, struct file *file) 867static int cypress_tiocmget(struct tty_struct *tty)
868{ 868{
869 struct usb_serial_port *port = tty->driver_data; 869 struct usb_serial_port *port = tty->driver_data;
870 struct cypress_private *priv = usb_get_serial_port_data(port); 870 struct cypress_private *priv = usb_get_serial_port_data(port);
@@ -892,7 +892,7 @@ static int cypress_tiocmget(struct tty_struct *tty, struct file *file)
892} 892}
893 893
894 894
895static int cypress_tiocmset(struct tty_struct *tty, struct file *file, 895static int cypress_tiocmset(struct tty_struct *tty,
896 unsigned int set, unsigned int clear) 896 unsigned int set, unsigned int clear)
897{ 897{
898 struct usb_serial_port *port = tty->driver_data; 898 struct usb_serial_port *port = tty->driver_data;
@@ -917,7 +917,7 @@ static int cypress_tiocmset(struct tty_struct *tty, struct file *file,
917} 917}
918 918
919 919
920static int cypress_ioctl(struct tty_struct *tty, struct file *file, 920static int cypress_ioctl(struct tty_struct *tty,
921 unsigned int cmd, unsigned long arg) 921 unsigned int cmd, unsigned long arg)
922{ 922{
923 struct usb_serial_port *port = tty->driver_data; 923 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 666e5a6edd82..86fbba6336c9 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -445,11 +445,11 @@ static void digi_rx_unthrottle(struct tty_struct *tty);
445static void digi_set_termios(struct tty_struct *tty, 445static void digi_set_termios(struct tty_struct *tty,
446 struct usb_serial_port *port, struct ktermios *old_termios); 446 struct usb_serial_port *port, struct ktermios *old_termios);
447static void digi_break_ctl(struct tty_struct *tty, int break_state); 447static void digi_break_ctl(struct tty_struct *tty, int break_state);
448static int digi_tiocmget(struct tty_struct *tty, struct file *file); 448static int digi_tiocmget(struct tty_struct *tty);
449static int digi_tiocmset(struct tty_struct *tty, struct file *file, 449static int digi_tiocmset(struct tty_struct *tty, unsigned int set,
450 unsigned int set, unsigned int clear); 450 unsigned int clear);
451static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, 451static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
452 const unsigned char *buf, int count); 452 const unsigned char *buf, int count);
453static void digi_write_bulk_callback(struct urb *urb); 453static void digi_write_bulk_callback(struct urb *urb);
454static int digi_write_room(struct tty_struct *tty); 454static int digi_write_room(struct tty_struct *tty);
455static int digi_chars_in_buffer(struct tty_struct *tty); 455static int digi_chars_in_buffer(struct tty_struct *tty);
@@ -1118,7 +1118,7 @@ static void digi_break_ctl(struct tty_struct *tty, int break_state)
1118} 1118}
1119 1119
1120 1120
1121static int digi_tiocmget(struct tty_struct *tty, struct file *file) 1121static int digi_tiocmget(struct tty_struct *tty)
1122{ 1122{
1123 struct usb_serial_port *port = tty->driver_data; 1123 struct usb_serial_port *port = tty->driver_data;
1124 struct digi_port *priv = usb_get_serial_port_data(port); 1124 struct digi_port *priv = usb_get_serial_port_data(port);
@@ -1134,8 +1134,8 @@ static int digi_tiocmget(struct tty_struct *tty, struct file *file)
1134} 1134}
1135 1135
1136 1136
1137static int digi_tiocmset(struct tty_struct *tty, struct file *file, 1137static int digi_tiocmset(struct tty_struct *tty,
1138 unsigned int set, unsigned int clear) 1138 unsigned int set, unsigned int clear)
1139{ 1139{
1140 struct usb_serial_port *port = tty->driver_data; 1140 struct usb_serial_port *port = tty->driver_data;
1141 struct digi_port *priv = usb_get_serial_port_data(port); 1141 struct digi_port *priv = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index a75f9298d88f..65967b36365f 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -866,10 +866,10 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port,
866 void *dest, size_t size); 866 void *dest, size_t size);
867static void ftdi_set_termios(struct tty_struct *tty, 867static void ftdi_set_termios(struct tty_struct *tty,
868 struct usb_serial_port *port, struct ktermios *old); 868 struct usb_serial_port *port, struct ktermios *old);
869static int ftdi_tiocmget(struct tty_struct *tty, struct file *file); 869static int ftdi_tiocmget(struct tty_struct *tty);
870static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, 870static int ftdi_tiocmset(struct tty_struct *tty,
871 unsigned int set, unsigned int clear); 871 unsigned int set, unsigned int clear);
872static int ftdi_ioctl(struct tty_struct *tty, struct file *file, 872static int ftdi_ioctl(struct tty_struct *tty,
873 unsigned int cmd, unsigned long arg); 873 unsigned int cmd, unsigned long arg);
874static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 874static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
875 875
@@ -2178,7 +2178,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
2178 } 2178 }
2179} 2179}
2180 2180
2181static int ftdi_tiocmget(struct tty_struct *tty, struct file *file) 2181static int ftdi_tiocmget(struct tty_struct *tty)
2182{ 2182{
2183 struct usb_serial_port *port = tty->driver_data; 2183 struct usb_serial_port *port = tty->driver_data;
2184 struct ftdi_private *priv = usb_get_serial_port_data(port); 2184 struct ftdi_private *priv = usb_get_serial_port_data(port);
@@ -2231,7 +2231,7 @@ out:
2231 return ret; 2231 return ret;
2232} 2232}
2233 2233
2234static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, 2234static int ftdi_tiocmset(struct tty_struct *tty,
2235 unsigned int set, unsigned int clear) 2235 unsigned int set, unsigned int clear)
2236{ 2236{
2237 struct usb_serial_port *port = tty->driver_data; 2237 struct usb_serial_port *port = tty->driver_data;
@@ -2239,7 +2239,7 @@ static int ftdi_tiocmset(struct tty_struct *tty, struct file *file,
2239 return update_mctrl(port, set, clear); 2239 return update_mctrl(port, set, clear);
2240} 2240}
2241 2241
2242static int ftdi_ioctl(struct tty_struct *tty, struct file *file, 2242static int ftdi_ioctl(struct tty_struct *tty,
2243 unsigned int cmd, unsigned long arg) 2243 unsigned int cmd, unsigned long arg)
2244{ 2244{
2245 struct usb_serial_port *port = tty->driver_data; 2245 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 76e3e502c23d..f1aedfa7c420 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -216,11 +216,11 @@ static void edge_unthrottle(struct tty_struct *tty);
216static void edge_set_termios(struct tty_struct *tty, 216static void edge_set_termios(struct tty_struct *tty,
217 struct usb_serial_port *port, 217 struct usb_serial_port *port,
218 struct ktermios *old_termios); 218 struct ktermios *old_termios);
219static int edge_ioctl(struct tty_struct *tty, struct file *file, 219static int edge_ioctl(struct tty_struct *tty,
220 unsigned int cmd, unsigned long arg); 220 unsigned int cmd, unsigned long arg);
221static void edge_break(struct tty_struct *tty, int break_state); 221static void edge_break(struct tty_struct *tty, int break_state);
222static int edge_tiocmget(struct tty_struct *tty, struct file *file); 222static int edge_tiocmget(struct tty_struct *tty);
223static int edge_tiocmset(struct tty_struct *tty, struct file *file, 223static int edge_tiocmset(struct tty_struct *tty,
224 unsigned int set, unsigned int clear); 224 unsigned int set, unsigned int clear);
225static int edge_get_icount(struct tty_struct *tty, 225static int edge_get_icount(struct tty_struct *tty,
226 struct serial_icounter_struct *icount); 226 struct serial_icounter_struct *icount);
@@ -1568,7 +1568,7 @@ static int get_lsr_info(struct edgeport_port *edge_port,
1568 return 0; 1568 return 0;
1569} 1569}
1570 1570
1571static int edge_tiocmset(struct tty_struct *tty, struct file *file, 1571static int edge_tiocmset(struct tty_struct *tty,
1572 unsigned int set, unsigned int clear) 1572 unsigned int set, unsigned int clear)
1573{ 1573{
1574 struct usb_serial_port *port = tty->driver_data; 1574 struct usb_serial_port *port = tty->driver_data;
@@ -1599,7 +1599,7 @@ static int edge_tiocmset(struct tty_struct *tty, struct file *file,
1599 return 0; 1599 return 0;
1600} 1600}
1601 1601
1602static int edge_tiocmget(struct tty_struct *tty, struct file *file) 1602static int edge_tiocmget(struct tty_struct *tty)
1603{ 1603{
1604 struct usb_serial_port *port = tty->driver_data; 1604 struct usb_serial_port *port = tty->driver_data;
1605 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1605 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
@@ -1679,7 +1679,7 @@ static int get_serial_info(struct edgeport_port *edge_port,
1679 * SerialIoctl 1679 * SerialIoctl
1680 * this function handles any ioctl calls to the driver 1680 * this function handles any ioctl calls to the driver
1681 *****************************************************************************/ 1681 *****************************************************************************/
1682static int edge_ioctl(struct tty_struct *tty, struct file *file, 1682static int edge_ioctl(struct tty_struct *tty,
1683 unsigned int cmd, unsigned long arg) 1683 unsigned int cmd, unsigned long arg)
1684{ 1684{
1685 struct usb_serial_port *port = tty->driver_data; 1685 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 22506b095c4f..d8434910fa7b 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2444,7 +2444,7 @@ static void edge_set_termios(struct tty_struct *tty,
2444 change_port_settings(tty, edge_port, old_termios); 2444 change_port_settings(tty, edge_port, old_termios);
2445} 2445}
2446 2446
2447static int edge_tiocmset(struct tty_struct *tty, struct file *file, 2447static int edge_tiocmset(struct tty_struct *tty,
2448 unsigned int set, unsigned int clear) 2448 unsigned int set, unsigned int clear)
2449{ 2449{
2450 struct usb_serial_port *port = tty->driver_data; 2450 struct usb_serial_port *port = tty->driver_data;
@@ -2477,7 +2477,7 @@ static int edge_tiocmset(struct tty_struct *tty, struct file *file,
2477 return 0; 2477 return 0;
2478} 2478}
2479 2479
2480static int edge_tiocmget(struct tty_struct *tty, struct file *file) 2480static int edge_tiocmget(struct tty_struct *tty)
2481{ 2481{
2482 struct usb_serial_port *port = tty->driver_data; 2482 struct usb_serial_port *port = tty->driver_data;
2483 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2483 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
@@ -2552,7 +2552,7 @@ static int get_serial_info(struct edgeport_port *edge_port,
2552 return 0; 2552 return 0;
2553} 2553}
2554 2554
2555static int edge_ioctl(struct tty_struct *tty, struct file *file, 2555static int edge_ioctl(struct tty_struct *tty,
2556 unsigned int cmd, unsigned long arg) 2556 unsigned int cmd, unsigned long arg)
2557{ 2557{
2558 struct usb_serial_port *port = tty->driver_data; 2558 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 99b97c04896f..6aca631a407a 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -150,7 +150,7 @@ static void iuu_release(struct usb_serial *serial)
150 } 150 }
151} 151}
152 152
153static int iuu_tiocmset(struct tty_struct *tty, struct file *file, 153static int iuu_tiocmset(struct tty_struct *tty,
154 unsigned int set, unsigned int clear) 154 unsigned int set, unsigned int clear)
155{ 155{
156 struct usb_serial_port *port = tty->driver_data; 156 struct usb_serial_port *port = tty->driver_data;
@@ -179,7 +179,7 @@ static int iuu_tiocmset(struct tty_struct *tty, struct file *file,
179 * When no card , the reader respond with TIOCM_CD 179 * When no card , the reader respond with TIOCM_CD
180 * This is known as CD autodetect mechanism 180 * This is known as CD autodetect mechanism
181 */ 181 */
182static int iuu_tiocmget(struct tty_struct *tty, struct file *file) 182static int iuu_tiocmget(struct tty_struct *tty)
183{ 183{
184 struct usb_serial_port *port = tty->driver_data; 184 struct usb_serial_port *port = tty->driver_data;
185 struct iuu_private *priv = usb_get_serial_port_data(port); 185 struct iuu_private *priv = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 67f41b526570..a442352d7b61 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -301,7 +301,7 @@ static void keyspan_set_termios(struct tty_struct *tty,
301 keyspan_send_setup(port, 0); 301 keyspan_send_setup(port, 0);
302} 302}
303 303
304static int keyspan_tiocmget(struct tty_struct *tty, struct file *file) 304static int keyspan_tiocmget(struct tty_struct *tty)
305{ 305{
306 struct usb_serial_port *port = tty->driver_data; 306 struct usb_serial_port *port = tty->driver_data;
307 struct keyspan_port_private *p_priv = usb_get_serial_port_data(port); 307 struct keyspan_port_private *p_priv = usb_get_serial_port_data(port);
@@ -317,7 +317,7 @@ static int keyspan_tiocmget(struct tty_struct *tty, struct file *file)
317 return value; 317 return value;
318} 318}
319 319
320static int keyspan_tiocmset(struct tty_struct *tty, struct file *file, 320static int keyspan_tiocmset(struct tty_struct *tty,
321 unsigned int set, unsigned int clear) 321 unsigned int set, unsigned int clear)
322{ 322{
323 struct usb_serial_port *port = tty->driver_data; 323 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index ce134dc28ddf..13fa1d1cc900 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -58,10 +58,9 @@ static void keyspan_set_termios (struct tty_struct *tty,
58 struct ktermios *old); 58 struct ktermios *old);
59static void keyspan_break_ctl (struct tty_struct *tty, 59static void keyspan_break_ctl (struct tty_struct *tty,
60 int break_state); 60 int break_state);
61static int keyspan_tiocmget (struct tty_struct *tty, 61static int keyspan_tiocmget (struct tty_struct *tty);
62 struct file *file);
63static int keyspan_tiocmset (struct tty_struct *tty, 62static int keyspan_tiocmset (struct tty_struct *tty,
64 struct file *file, unsigned int set, 63 unsigned int set,
65 unsigned int clear); 64 unsigned int clear);
66static int keyspan_fake_startup (struct usb_serial *serial); 65static int keyspan_fake_startup (struct usb_serial *serial);
67 66
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 7b690f3282a2..d5c0c6ab4966 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -458,7 +458,7 @@ static int keyspan_pda_set_modem_info(struct usb_serial *serial,
458 return rc; 458 return rc;
459} 459}
460 460
461static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file) 461static int keyspan_pda_tiocmget(struct tty_struct *tty)
462{ 462{
463 struct usb_serial_port *port = tty->driver_data; 463 struct usb_serial_port *port = tty->driver_data;
464 struct usb_serial *serial = port->serial; 464 struct usb_serial *serial = port->serial;
@@ -479,7 +479,7 @@ static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file)
479 return value; 479 return value;
480} 480}
481 481
482static int keyspan_pda_tiocmset(struct tty_struct *tty, struct file *file, 482static int keyspan_pda_tiocmset(struct tty_struct *tty,
483 unsigned int set, unsigned int clear) 483 unsigned int set, unsigned int clear)
484{ 484{
485 struct usb_serial_port *port = tty->driver_data; 485 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index e8a65ce45a2f..19373cb7c5bf 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -68,8 +68,8 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port);
68static void klsi_105_close(struct usb_serial_port *port); 68static void klsi_105_close(struct usb_serial_port *port);
69static void klsi_105_set_termios(struct tty_struct *tty, 69static void klsi_105_set_termios(struct tty_struct *tty,
70 struct usb_serial_port *port, struct ktermios *old); 70 struct usb_serial_port *port, struct ktermios *old);
71static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file); 71static int klsi_105_tiocmget(struct tty_struct *tty);
72static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file, 72static int klsi_105_tiocmset(struct tty_struct *tty,
73 unsigned int set, unsigned int clear); 73 unsigned int set, unsigned int clear);
74static void klsi_105_process_read_urb(struct urb *urb); 74static void klsi_105_process_read_urb(struct urb *urb);
75static int klsi_105_prepare_write_buffer(struct usb_serial_port *port, 75static int klsi_105_prepare_write_buffer(struct usb_serial_port *port,
@@ -637,7 +637,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state)
637} 637}
638#endif 638#endif
639 639
640static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file) 640static int klsi_105_tiocmget(struct tty_struct *tty)
641{ 641{
642 struct usb_serial_port *port = tty->driver_data; 642 struct usb_serial_port *port = tty->driver_data;
643 struct klsi_105_private *priv = usb_get_serial_port_data(port); 643 struct klsi_105_private *priv = usb_get_serial_port_data(port);
@@ -661,7 +661,7 @@ static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file)
661 return (int)line_state; 661 return (int)line_state;
662} 662}
663 663
664static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file, 664static int klsi_105_tiocmset(struct tty_struct *tty,
665 unsigned int set, unsigned int clear) 665 unsigned int set, unsigned int clear)
666{ 666{
667 int retval = -EINVAL; 667 int retval = -EINVAL;
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index b382d9a0274d..ddd146300ddb 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -75,10 +75,10 @@ static void kobil_close(struct usb_serial_port *port);
75static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, 75static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
76 const unsigned char *buf, int count); 76 const unsigned char *buf, int count);
77static int kobil_write_room(struct tty_struct *tty); 77static int kobil_write_room(struct tty_struct *tty);
78static int kobil_ioctl(struct tty_struct *tty, struct file *file, 78static int kobil_ioctl(struct tty_struct *tty,
79 unsigned int cmd, unsigned long arg); 79 unsigned int cmd, unsigned long arg);
80static int kobil_tiocmget(struct tty_struct *tty, struct file *file); 80static int kobil_tiocmget(struct tty_struct *tty);
81static int kobil_tiocmset(struct tty_struct *tty, struct file *file, 81static int kobil_tiocmset(struct tty_struct *tty,
82 unsigned int set, unsigned int clear); 82 unsigned int set, unsigned int clear);
83static void kobil_read_int_callback(struct urb *urb); 83static void kobil_read_int_callback(struct urb *urb);
84static void kobil_write_callback(struct urb *purb); 84static void kobil_write_callback(struct urb *purb);
@@ -504,7 +504,7 @@ static int kobil_write_room(struct tty_struct *tty)
504} 504}
505 505
506 506
507static int kobil_tiocmget(struct tty_struct *tty, struct file *file) 507static int kobil_tiocmget(struct tty_struct *tty)
508{ 508{
509 struct usb_serial_port *port = tty->driver_data; 509 struct usb_serial_port *port = tty->driver_data;
510 struct kobil_private *priv; 510 struct kobil_private *priv;
@@ -544,7 +544,7 @@ static int kobil_tiocmget(struct tty_struct *tty, struct file *file)
544 return result; 544 return result;
545} 545}
546 546
547static int kobil_tiocmset(struct tty_struct *tty, struct file *file, 547static int kobil_tiocmset(struct tty_struct *tty,
548 unsigned int set, unsigned int clear) 548 unsigned int set, unsigned int clear)
549{ 549{
550 struct usb_serial_port *port = tty->driver_data; 550 struct usb_serial_port *port = tty->driver_data;
@@ -668,7 +668,7 @@ static void kobil_set_termios(struct tty_struct *tty,
668 ); 668 );
669} 669}
670 670
671static int kobil_ioctl(struct tty_struct *tty, struct file *file, 671static int kobil_ioctl(struct tty_struct *tty,
672 unsigned int cmd, unsigned long arg) 672 unsigned int cmd, unsigned long arg)
673{ 673{
674 struct usb_serial_port *port = tty->driver_data; 674 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 1e225aacf46e..d2c019637e45 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -103,8 +103,8 @@ static void mct_u232_read_int_callback(struct urb *urb);
103static void mct_u232_set_termios(struct tty_struct *tty, 103static void mct_u232_set_termios(struct tty_struct *tty,
104 struct usb_serial_port *port, struct ktermios *old); 104 struct usb_serial_port *port, struct ktermios *old);
105static void mct_u232_break_ctl(struct tty_struct *tty, int break_state); 105static void mct_u232_break_ctl(struct tty_struct *tty, int break_state);
106static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file); 106static int mct_u232_tiocmget(struct tty_struct *tty);
107static int mct_u232_tiocmset(struct tty_struct *tty, struct file *file, 107static int mct_u232_tiocmset(struct tty_struct *tty,
108 unsigned int set, unsigned int clear); 108 unsigned int set, unsigned int clear);
109static int mct_u232_ioctl(struct tty_struct *tty, struct file *file, 109static int mct_u232_ioctl(struct tty_struct *tty, struct file *file,
110 unsigned int cmd, unsigned long arg); 110 unsigned int cmd, unsigned long arg);
@@ -790,7 +790,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state)
790} /* mct_u232_break_ctl */ 790} /* mct_u232_break_ctl */
791 791
792 792
793static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file) 793static int mct_u232_tiocmget(struct tty_struct *tty)
794{ 794{
795 struct usb_serial_port *port = tty->driver_data; 795 struct usb_serial_port *port = tty->driver_data;
796 struct mct_u232_private *priv = usb_get_serial_port_data(port); 796 struct mct_u232_private *priv = usb_get_serial_port_data(port);
@@ -806,7 +806,7 @@ static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file)
806 return control_state; 806 return control_state;
807} 807}
808 808
809static int mct_u232_tiocmset(struct tty_struct *tty, struct file *file, 809static int mct_u232_tiocmset(struct tty_struct *tty,
810 unsigned int set, unsigned int clear) 810 unsigned int set, unsigned int clear)
811{ 811{
812 struct usb_serial_port *port = tty->driver_data; 812 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index ae506f4ee29d..40abedbc5943 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1833,7 +1833,7 @@ static int get_lsr_info(struct tty_struct *tty,
1833 return 0; 1833 return 0;
1834} 1834}
1835 1835
1836static int mos7720_tiocmget(struct tty_struct *tty, struct file *file) 1836static int mos7720_tiocmget(struct tty_struct *tty)
1837{ 1837{
1838 struct usb_serial_port *port = tty->driver_data; 1838 struct usb_serial_port *port = tty->driver_data;
1839 struct moschip_port *mos7720_port = usb_get_serial_port_data(port); 1839 struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
@@ -1858,14 +1858,14 @@ static int mos7720_tiocmget(struct tty_struct *tty, struct file *file)
1858 return result; 1858 return result;
1859} 1859}
1860 1860
1861static int mos7720_tiocmset(struct tty_struct *tty, struct file *file, 1861static int mos7720_tiocmset(struct tty_struct *tty,
1862 unsigned int set, unsigned int clear) 1862 unsigned int set, unsigned int clear)
1863{ 1863{
1864 struct usb_serial_port *port = tty->driver_data; 1864 struct usb_serial_port *port = tty->driver_data;
1865 struct moschip_port *mos7720_port = usb_get_serial_port_data(port); 1865 struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
1866 unsigned int mcr ; 1866 unsigned int mcr ;
1867 dbg("%s - port %d", __func__, port->number); 1867 dbg("%s - port %d", __func__, port->number);
1868 dbg("he was at tiocmget"); 1868 dbg("he was at tiocmset");
1869 1869
1870 mcr = mos7720_port->shadowMCR; 1870 mcr = mos7720_port->shadowMCR;
1871 1871
@@ -1987,7 +1987,7 @@ static int get_serial_info(struct moschip_port *mos7720_port,
1987 return 0; 1987 return 0;
1988} 1988}
1989 1989
1990static int mos7720_ioctl(struct tty_struct *tty, struct file *file, 1990static int mos7720_ioctl(struct tty_struct *tty,
1991 unsigned int cmd, unsigned long arg) 1991 unsigned int cmd, unsigned long arg)
1992{ 1992{
1993 struct usb_serial_port *port = tty->driver_data; 1993 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 5627993f9e41..7b50aa122752 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1644,7 +1644,7 @@ static void mos7840_unthrottle(struct tty_struct *tty)
1644 } 1644 }
1645} 1645}
1646 1646
1647static int mos7840_tiocmget(struct tty_struct *tty, struct file *file) 1647static int mos7840_tiocmget(struct tty_struct *tty)
1648{ 1648{
1649 struct usb_serial_port *port = tty->driver_data; 1649 struct usb_serial_port *port = tty->driver_data;
1650 struct moschip_port *mos7840_port; 1650 struct moschip_port *mos7840_port;
@@ -1674,7 +1674,7 @@ static int mos7840_tiocmget(struct tty_struct *tty, struct file *file)
1674 return result; 1674 return result;
1675} 1675}
1676 1676
1677static int mos7840_tiocmset(struct tty_struct *tty, struct file *file, 1677static int mos7840_tiocmset(struct tty_struct *tty,
1678 unsigned int set, unsigned int clear) 1678 unsigned int set, unsigned int clear)
1679{ 1679{
1680 struct usb_serial_port *port = tty->driver_data; 1680 struct usb_serial_port *port = tty->driver_data;
@@ -2235,7 +2235,7 @@ static int mos7840_get_icount(struct tty_struct *tty,
2235 * this function handles any ioctl calls to the driver 2235 * this function handles any ioctl calls to the driver
2236 *****************************************************************************/ 2236 *****************************************************************************/
2237 2237
2238static int mos7840_ioctl(struct tty_struct *tty, struct file *file, 2238static int mos7840_ioctl(struct tty_struct *tty,
2239 unsigned int cmd, unsigned long arg) 2239 unsigned int cmd, unsigned long arg)
2240{ 2240{
2241 struct usb_serial_port *port = tty->driver_data; 2241 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index ce82396fc4e8..201f6096844b 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -391,7 +391,7 @@ static void opticon_unthrottle(struct tty_struct *tty)
391 } 391 }
392} 392}
393 393
394static int opticon_tiocmget(struct tty_struct *tty, struct file *file) 394static int opticon_tiocmget(struct tty_struct *tty)
395{ 395{
396 struct usb_serial_port *port = tty->driver_data; 396 struct usb_serial_port *port = tty->driver_data;
397 struct opticon_private *priv = usb_get_serial_data(port->serial); 397 struct opticon_private *priv = usb_get_serial_data(port->serial);
@@ -468,7 +468,7 @@ static int get_serial_info(struct opticon_private *priv,
468 return 0; 468 return 0;
469} 469}
470 470
471static int opticon_ioctl(struct tty_struct *tty, struct file *file, 471static int opticon_ioctl(struct tty_struct *tty,
472 unsigned int cmd, unsigned long arg) 472 unsigned int cmd, unsigned long arg)
473{ 473{
474 struct usb_serial_port *port = tty->driver_data; 474 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index 73613205be7a..4c29e6c2bda7 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -135,7 +135,7 @@ static void oti6858_close(struct usb_serial_port *port);
135static void oti6858_set_termios(struct tty_struct *tty, 135static void oti6858_set_termios(struct tty_struct *tty,
136 struct usb_serial_port *port, struct ktermios *old); 136 struct usb_serial_port *port, struct ktermios *old);
137static void oti6858_init_termios(struct tty_struct *tty); 137static void oti6858_init_termios(struct tty_struct *tty);
138static int oti6858_ioctl(struct tty_struct *tty, struct file *file, 138static int oti6858_ioctl(struct tty_struct *tty,
139 unsigned int cmd, unsigned long arg); 139 unsigned int cmd, unsigned long arg);
140static void oti6858_read_int_callback(struct urb *urb); 140static void oti6858_read_int_callback(struct urb *urb);
141static void oti6858_read_bulk_callback(struct urb *urb); 141static void oti6858_read_bulk_callback(struct urb *urb);
@@ -144,8 +144,8 @@ static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port,
144 const unsigned char *buf, int count); 144 const unsigned char *buf, int count);
145static int oti6858_write_room(struct tty_struct *tty); 145static int oti6858_write_room(struct tty_struct *tty);
146static int oti6858_chars_in_buffer(struct tty_struct *tty); 146static int oti6858_chars_in_buffer(struct tty_struct *tty);
147static int oti6858_tiocmget(struct tty_struct *tty, struct file *file); 147static int oti6858_tiocmget(struct tty_struct *tty);
148static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, 148static int oti6858_tiocmset(struct tty_struct *tty,
149 unsigned int set, unsigned int clear); 149 unsigned int set, unsigned int clear);
150static int oti6858_startup(struct usb_serial *serial); 150static int oti6858_startup(struct usb_serial *serial);
151static void oti6858_release(struct usb_serial *serial); 151static void oti6858_release(struct usb_serial *serial);
@@ -624,7 +624,7 @@ static void oti6858_close(struct usb_serial_port *port)
624 usb_kill_urb(port->interrupt_in_urb); 624 usb_kill_urb(port->interrupt_in_urb);
625} 625}
626 626
627static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, 627static int oti6858_tiocmset(struct tty_struct *tty,
628 unsigned int set, unsigned int clear) 628 unsigned int set, unsigned int clear)
629{ 629{
630 struct usb_serial_port *port = tty->driver_data; 630 struct usb_serial_port *port = tty->driver_data;
@@ -657,7 +657,7 @@ static int oti6858_tiocmset(struct tty_struct *tty, struct file *file,
657 return 0; 657 return 0;
658} 658}
659 659
660static int oti6858_tiocmget(struct tty_struct *tty, struct file *file) 660static int oti6858_tiocmget(struct tty_struct *tty)
661{ 661{
662 struct usb_serial_port *port = tty->driver_data; 662 struct usb_serial_port *port = tty->driver_data;
663 struct oti6858_private *priv = usb_get_serial_port_data(port); 663 struct oti6858_private *priv = usb_get_serial_port_data(port);
@@ -728,7 +728,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
728 return 0; 728 return 0;
729} 729}
730 730
731static int oti6858_ioctl(struct tty_struct *tty, struct file *file, 731static int oti6858_ioctl(struct tty_struct *tty,
732 unsigned int cmd, unsigned long arg) 732 unsigned int cmd, unsigned long arg)
733{ 733{
734 struct usb_serial_port *port = tty->driver_data; 734 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 08c9181b8e48..30461fcc2206 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -505,7 +505,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
505 return 0; 505 return 0;
506} 506}
507 507
508static int pl2303_tiocmset(struct tty_struct *tty, struct file *file, 508static int pl2303_tiocmset(struct tty_struct *tty,
509 unsigned int set, unsigned int clear) 509 unsigned int set, unsigned int clear)
510{ 510{
511 struct usb_serial_port *port = tty->driver_data; 511 struct usb_serial_port *port = tty->driver_data;
@@ -531,7 +531,7 @@ static int pl2303_tiocmset(struct tty_struct *tty, struct file *file,
531 return set_control_lines(port->serial->dev, control); 531 return set_control_lines(port->serial->dev, control);
532} 532}
533 533
534static int pl2303_tiocmget(struct tty_struct *tty, struct file *file) 534static int pl2303_tiocmget(struct tty_struct *tty)
535{ 535{
536 struct usb_serial_port *port = tty->driver_data; 536 struct usb_serial_port *port = tty->driver_data;
537 struct pl2303_private *priv = usb_get_serial_port_data(port); 537 struct pl2303_private *priv = usb_get_serial_port_data(port);
@@ -606,7 +606,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
606 return 0; 606 return 0;
607} 607}
608 608
609static int pl2303_ioctl(struct tty_struct *tty, struct file *file, 609static int pl2303_ioctl(struct tty_struct *tty,
610 unsigned int cmd, unsigned long arg) 610 unsigned int cmd, unsigned long arg)
611{ 611{
612 struct serial_struct ser; 612 struct serial_struct ser;
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 5b88b6836a81..d5d136a53b61 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -395,7 +395,7 @@ static void sierra_set_termios(struct tty_struct *tty,
395 sierra_send_setup(port); 395 sierra_send_setup(port);
396} 396}
397 397
398static int sierra_tiocmget(struct tty_struct *tty, struct file *file) 398static int sierra_tiocmget(struct tty_struct *tty)
399{ 399{
400 struct usb_serial_port *port = tty->driver_data; 400 struct usb_serial_port *port = tty->driver_data;
401 unsigned int value; 401 unsigned int value;
@@ -414,7 +414,7 @@ static int sierra_tiocmget(struct tty_struct *tty, struct file *file)
414 return value; 414 return value;
415} 415}
416 416
417static int sierra_tiocmset(struct tty_struct *tty, struct file *file, 417static int sierra_tiocmset(struct tty_struct *tty,
418 unsigned int set, unsigned int clear) 418 unsigned int set, unsigned int clear)
419{ 419{
420 struct usb_serial_port *port = tty->driver_data; 420 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index cbfb70bffdd0..180ea6c7911c 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -576,7 +576,7 @@ static int spcp8x5_wait_modem_info(struct usb_serial_port *port,
576 return 0; 576 return 0;
577} 577}
578 578
579static int spcp8x5_ioctl(struct tty_struct *tty, struct file *file, 579static int spcp8x5_ioctl(struct tty_struct *tty,
580 unsigned int cmd, unsigned long arg) 580 unsigned int cmd, unsigned long arg)
581{ 581{
582 struct usb_serial_port *port = tty->driver_data; 582 struct usb_serial_port *port = tty->driver_data;
@@ -595,7 +595,7 @@ static int spcp8x5_ioctl(struct tty_struct *tty, struct file *file,
595 return -ENOIOCTLCMD; 595 return -ENOIOCTLCMD;
596} 596}
597 597
598static int spcp8x5_tiocmset(struct tty_struct *tty, struct file *file, 598static int spcp8x5_tiocmset(struct tty_struct *tty,
599 unsigned int set, unsigned int clear) 599 unsigned int set, unsigned int clear)
600{ 600{
601 struct usb_serial_port *port = tty->driver_data; 601 struct usb_serial_port *port = tty->driver_data;
@@ -618,7 +618,7 @@ static int spcp8x5_tiocmset(struct tty_struct *tty, struct file *file,
618 return spcp8x5_set_ctrlLine(port->serial->dev, control , priv->type); 618 return spcp8x5_set_ctrlLine(port->serial->dev, control , priv->type);
619} 619}
620 620
621static int spcp8x5_tiocmget(struct tty_struct *tty, struct file *file) 621static int spcp8x5_tiocmget(struct tty_struct *tty)
622{ 622{
623 struct usb_serial_port *port = tty->driver_data; 623 struct usb_serial_port *port = tty->driver_data;
624 struct spcp8x5_private *priv = usb_get_serial_port_data(port); 624 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index 8359ec798959..87362e48796e 100644
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -439,7 +439,7 @@ static int ssu100_get_icount(struct tty_struct *tty,
439 439
440 440
441 441
442static int ssu100_ioctl(struct tty_struct *tty, struct file *file, 442static int ssu100_ioctl(struct tty_struct *tty,
443 unsigned int cmd, unsigned long arg) 443 unsigned int cmd, unsigned long arg)
444{ 444{
445 struct usb_serial_port *port = tty->driver_data; 445 struct usb_serial_port *port = tty->driver_data;
@@ -484,7 +484,7 @@ static int ssu100_attach(struct usb_serial *serial)
484 return ssu100_initdevice(serial->dev); 484 return ssu100_initdevice(serial->dev);
485} 485}
486 486
487static int ssu100_tiocmget(struct tty_struct *tty, struct file *file) 487static int ssu100_tiocmget(struct tty_struct *tty)
488{ 488{
489 struct usb_serial_port *port = tty->driver_data; 489 struct usb_serial_port *port = tty->driver_data;
490 struct usb_device *dev = port->serial->dev; 490 struct usb_device *dev = port->serial->dev;
@@ -517,7 +517,7 @@ mget_out:
517 return r; 517 return r;
518} 518}
519 519
520static int ssu100_tiocmset(struct tty_struct *tty, struct file *file, 520static int ssu100_tiocmset(struct tty_struct *tty,
521 unsigned int set, unsigned int clear) 521 unsigned int set, unsigned int clear)
522{ 522{
523 struct usb_serial_port *port = tty->driver_data; 523 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index a910004f4079..c6d92a530086 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -106,14 +106,14 @@ static int ti_write_room(struct tty_struct *tty);
106static int ti_chars_in_buffer(struct tty_struct *tty); 106static int ti_chars_in_buffer(struct tty_struct *tty);
107static void ti_throttle(struct tty_struct *tty); 107static void ti_throttle(struct tty_struct *tty);
108static void ti_unthrottle(struct tty_struct *tty); 108static void ti_unthrottle(struct tty_struct *tty);
109static int ti_ioctl(struct tty_struct *tty, struct file *file, 109static int ti_ioctl(struct tty_struct *tty,
110 unsigned int cmd, unsigned long arg); 110 unsigned int cmd, unsigned long arg);
111static int ti_get_icount(struct tty_struct *tty, 111static int ti_get_icount(struct tty_struct *tty,
112 struct serial_icounter_struct *icount); 112 struct serial_icounter_struct *icount);
113static void ti_set_termios(struct tty_struct *tty, 113static void ti_set_termios(struct tty_struct *tty,
114 struct usb_serial_port *port, struct ktermios *old_termios); 114 struct usb_serial_port *port, struct ktermios *old_termios);
115static int ti_tiocmget(struct tty_struct *tty, struct file *file); 115static int ti_tiocmget(struct tty_struct *tty);
116static int ti_tiocmset(struct tty_struct *tty, struct file *file, 116static int ti_tiocmset(struct tty_struct *tty,
117 unsigned int set, unsigned int clear); 117 unsigned int set, unsigned int clear);
118static void ti_break(struct tty_struct *tty, int break_state); 118static void ti_break(struct tty_struct *tty, int break_state);
119static void ti_interrupt_callback(struct urb *urb); 119static void ti_interrupt_callback(struct urb *urb);
@@ -818,7 +818,7 @@ static int ti_get_icount(struct tty_struct *tty,
818 return 0; 818 return 0;
819} 819}
820 820
821static int ti_ioctl(struct tty_struct *tty, struct file *file, 821static int ti_ioctl(struct tty_struct *tty,
822 unsigned int cmd, unsigned long arg) 822 unsigned int cmd, unsigned long arg)
823{ 823{
824 struct usb_serial_port *port = tty->driver_data; 824 struct usb_serial_port *port = tty->driver_data;
@@ -1000,7 +1000,7 @@ static void ti_set_termios(struct tty_struct *tty,
1000} 1000}
1001 1001
1002 1002
1003static int ti_tiocmget(struct tty_struct *tty, struct file *file) 1003static int ti_tiocmget(struct tty_struct *tty)
1004{ 1004{
1005 struct usb_serial_port *port = tty->driver_data; 1005 struct usb_serial_port *port = tty->driver_data;
1006 struct ti_port *tport = usb_get_serial_port_data(port); 1006 struct ti_port *tport = usb_get_serial_port_data(port);
@@ -1033,8 +1033,8 @@ static int ti_tiocmget(struct tty_struct *tty, struct file *file)
1033} 1033}
1034 1034
1035 1035
1036static int ti_tiocmset(struct tty_struct *tty, struct file *file, 1036static int ti_tiocmset(struct tty_struct *tty,
1037 unsigned int set, unsigned int clear) 1037 unsigned int set, unsigned int clear)
1038{ 1038{
1039 struct usb_serial_port *port = tty->driver_data; 1039 struct usb_serial_port *port = tty->driver_data;
1040 struct ti_port *tport = usb_get_serial_port_data(port); 1040 struct ti_port *tport = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 2ff90a9c8f47..1c031309ab25 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -406,7 +406,7 @@ static void serial_unthrottle(struct tty_struct *tty)
406 port->serial->type->unthrottle(tty); 406 port->serial->type->unthrottle(tty);
407} 407}
408 408
409static int serial_ioctl(struct tty_struct *tty, struct file *file, 409static int serial_ioctl(struct tty_struct *tty,
410 unsigned int cmd, unsigned long arg) 410 unsigned int cmd, unsigned long arg)
411{ 411{
412 struct usb_serial_port *port = tty->driver_data; 412 struct usb_serial_port *port = tty->driver_data;
@@ -417,7 +417,7 @@ static int serial_ioctl(struct tty_struct *tty, struct file *file,
417 /* pass on to the driver specific version of this function 417 /* pass on to the driver specific version of this function
418 if it is available */ 418 if it is available */
419 if (port->serial->type->ioctl) { 419 if (port->serial->type->ioctl) {
420 retval = port->serial->type->ioctl(tty, file, cmd, arg); 420 retval = port->serial->type->ioctl(tty, cmd, arg);
421 } else 421 } else
422 retval = -ENOIOCTLCMD; 422 retval = -ENOIOCTLCMD;
423 return retval; 423 return retval;
@@ -496,18 +496,18 @@ static const struct file_operations serial_proc_fops = {
496 .release = single_release, 496 .release = single_release,
497}; 497};
498 498
499static int serial_tiocmget(struct tty_struct *tty, struct file *file) 499static int serial_tiocmget(struct tty_struct *tty)
500{ 500{
501 struct usb_serial_port *port = tty->driver_data; 501 struct usb_serial_port *port = tty->driver_data;
502 502
503 dbg("%s - port %d", __func__, port->number); 503 dbg("%s - port %d", __func__, port->number);
504 504
505 if (port->serial->type->tiocmget) 505 if (port->serial->type->tiocmget)
506 return port->serial->type->tiocmget(tty, file); 506 return port->serial->type->tiocmget(tty);
507 return -EINVAL; 507 return -EINVAL;
508} 508}
509 509
510static int serial_tiocmset(struct tty_struct *tty, struct file *file, 510static int serial_tiocmset(struct tty_struct *tty,
511 unsigned int set, unsigned int clear) 511 unsigned int set, unsigned int clear)
512{ 512{
513 struct usb_serial_port *port = tty->driver_data; 513 struct usb_serial_port *port = tty->driver_data;
@@ -515,7 +515,7 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file,
515 dbg("%s - port %d", __func__, port->number); 515 dbg("%s - port %d", __func__, port->number);
516 516
517 if (port->serial->type->tiocmset) 517 if (port->serial->type->tiocmset)
518 return port->serial->type->tiocmset(tty, file, set, clear); 518 return port->serial->type->tiocmset(tty, set, clear);
519 return -EINVAL; 519 return -EINVAL;
520} 520}
521 521
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
index 3ab77c5d9819..c47b6ec03063 100644
--- a/drivers/usb/serial/usb-wwan.h
+++ b/drivers/usb/serial/usb-wwan.h
@@ -15,10 +15,10 @@ extern int usb_wwan_write_room(struct tty_struct *tty);
15extern void usb_wwan_set_termios(struct tty_struct *tty, 15extern void usb_wwan_set_termios(struct tty_struct *tty,
16 struct usb_serial_port *port, 16 struct usb_serial_port *port,
17 struct ktermios *old); 17 struct ktermios *old);
18extern int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file); 18extern int usb_wwan_tiocmget(struct tty_struct *tty);
19extern int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file, 19extern int usb_wwan_tiocmset(struct tty_struct *tty,
20 unsigned int set, unsigned int clear); 20 unsigned int set, unsigned int clear);
21extern int usb_wwan_ioctl(struct tty_struct *tty, struct file *file, 21extern int usb_wwan_ioctl(struct tty_struct *tty,
22 unsigned int cmd, unsigned long arg); 22 unsigned int cmd, unsigned long arg);
23extern int usb_wwan_send_setup(struct usb_serial_port *port); 23extern int usb_wwan_send_setup(struct usb_serial_port *port);
24extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, 24extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index eb95aecc0015..a65ddd543869 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -79,7 +79,7 @@ void usb_wwan_set_termios(struct tty_struct *tty,
79} 79}
80EXPORT_SYMBOL(usb_wwan_set_termios); 80EXPORT_SYMBOL(usb_wwan_set_termios);
81 81
82int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file) 82int usb_wwan_tiocmget(struct tty_struct *tty)
83{ 83{
84 struct usb_serial_port *port = tty->driver_data; 84 struct usb_serial_port *port = tty->driver_data;
85 unsigned int value; 85 unsigned int value;
@@ -98,7 +98,7 @@ int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file)
98} 98}
99EXPORT_SYMBOL(usb_wwan_tiocmget); 99EXPORT_SYMBOL(usb_wwan_tiocmget);
100 100
101int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file, 101int usb_wwan_tiocmset(struct tty_struct *tty,
102 unsigned int set, unsigned int clear) 102 unsigned int set, unsigned int clear)
103{ 103{
104 struct usb_serial_port *port = tty->driver_data; 104 struct usb_serial_port *port = tty->driver_data;
@@ -178,7 +178,7 @@ static int set_serial_info(struct usb_serial_port *port,
178 return retval; 178 return retval;
179} 179}
180 180
181int usb_wwan_ioctl(struct tty_struct *tty, struct file *file, 181int usb_wwan_ioctl(struct tty_struct *tty,
182 unsigned int cmd, unsigned long arg) 182 unsigned int cmd, unsigned long arg)
183{ 183{
184 struct usb_serial_port *port = tty->driver_data; 184 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 3f9ac88d588c..5b073bcc807b 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -152,12 +152,12 @@ static int whiteheat_write(struct tty_struct *tty,
152 struct usb_serial_port *port, 152 struct usb_serial_port *port,
153 const unsigned char *buf, int count); 153 const unsigned char *buf, int count);
154static int whiteheat_write_room(struct tty_struct *tty); 154static int whiteheat_write_room(struct tty_struct *tty);
155static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, 155static int whiteheat_ioctl(struct tty_struct *tty,
156 unsigned int cmd, unsigned long arg); 156 unsigned int cmd, unsigned long arg);
157static void whiteheat_set_termios(struct tty_struct *tty, 157static void whiteheat_set_termios(struct tty_struct *tty,
158 struct usb_serial_port *port, struct ktermios *old); 158 struct usb_serial_port *port, struct ktermios *old);
159static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file); 159static int whiteheat_tiocmget(struct tty_struct *tty);
160static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file, 160static int whiteheat_tiocmset(struct tty_struct *tty,
161 unsigned int set, unsigned int clear); 161 unsigned int set, unsigned int clear);
162static void whiteheat_break_ctl(struct tty_struct *tty, int break_state); 162static void whiteheat_break_ctl(struct tty_struct *tty, int break_state);
163static int whiteheat_chars_in_buffer(struct tty_struct *tty); 163static int whiteheat_chars_in_buffer(struct tty_struct *tty);
@@ -833,7 +833,7 @@ static int whiteheat_write_room(struct tty_struct *tty)
833 return (room); 833 return (room);
834} 834}
835 835
836static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file) 836static int whiteheat_tiocmget(struct tty_struct *tty)
837{ 837{
838 struct usb_serial_port *port = tty->driver_data; 838 struct usb_serial_port *port = tty->driver_data;
839 struct whiteheat_private *info = usb_get_serial_port_data(port); 839 struct whiteheat_private *info = usb_get_serial_port_data(port);
@@ -850,7 +850,7 @@ static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file)
850 return modem_signals; 850 return modem_signals;
851} 851}
852 852
853static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file, 853static int whiteheat_tiocmset(struct tty_struct *tty,
854 unsigned int set, unsigned int clear) 854 unsigned int set, unsigned int clear)
855{ 855{
856 struct usb_serial_port *port = tty->driver_data; 856 struct usb_serial_port *port = tty->driver_data;
@@ -874,7 +874,7 @@ static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file,
874} 874}
875 875
876 876
877static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, 877static int whiteheat_ioctl(struct tty_struct *tty,
878 unsigned int cmd, unsigned long arg) 878 unsigned int cmd, unsigned long arg)
879{ 879{
880 struct usb_serial_port *port = tty->driver_data; 880 struct usb_serial_port *port = tty->driver_data;