Skip to content

Commit

Permalink
Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
torvalds committed Mar 16, 2011
2 parents a5e6b13 + 6ae705b commit e6bee32
Show file tree
Hide file tree
Showing 222 changed files with 3,925 additions and 1,357 deletions.
89 changes: 89 additions & 0 deletions Documentation/serial/n_gsm.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
n_gsm.c GSM 0710 tty multiplexor HOWTO
===================================================

This line discipline implements the GSM 07.10 multiplexing protocol
detailed in the following 3GPP document :
http://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip

This document give some hints on how to use this driver with GPRS and 3G
modems connected to a physical serial port.

How to use it
-------------
1- initialize the modem in 0710 mux mode (usually AT+CMUX= command) through
its serial port. Depending on the modem used, you can pass more or less
parameters to this command,
2- switch the serial line to using the n_gsm line discipline by using
TIOCSETD ioctl,
3- configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl,

Major parts of the initialization program :
(a good starting point is util-linux-ng/sys-utils/ldattach.c)
#include <linux/gsmmux.h>
#define N_GSM0710 21 /* GSM 0710 Mux */
#define DEFAULT_SPEED B115200
#define SERIAL_PORT /dev/ttyS0

int ldisc = N_GSM0710;
struct gsm_config c;
struct termios configuration;

/* open the serial port connected to the modem */
fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY);

/* configure the serial port : speed, flow control ... */

/* send the AT commands to switch the modem to CMUX mode
and check that it's succesful (should return OK) */
write(fd, "AT+CMUX=0\r", 10);

/* experience showed that some modems need some time before
being able to answer to the first MUX packet so a delay
may be needed here in some case */
sleep(3);

/* use n_gsm line discipline */
ioctl(fd, TIOCSETD, &ldisc);

/* get n_gsm configuration */
ioctl(fd, GSMIOC_GETCONF, &c);
/* we are initiator and need encoding 0 (basic) */
c.initiator = 1;
c.encapsulation = 0;
/* our modem defaults to a maximum size of 127 bytes */
c.mru = 127;
c.mtu = 127;
/* set the new configuration */
ioctl(fd, GSMIOC_SETCONF, &c);

/* and wait for ever to keep the line discipline enabled */
daemon(0,0);
pause();

4- create the devices corresponding to the "virtual" serial ports (take care,
each modem has its configuration and some DLC have dedicated functions,
for example GPS), starting with minor 1 (DLC0 is reserved for the management
of the mux)

MAJOR=`cat /proc/devices |grep gsmtty | awk '{print $1}`
for i in `seq 1 4`; do
mknod /dev/ttygsm$i c $MAJOR $i
done

5- use these devices as plain serial ports.
for example, it's possible :
- and to use gnokii to send / receive SMS on ttygsm1
- to use ppp to establish a datalink on ttygsm2

6- first close all virtual ports before closing the physical port.

Additional Documentation
------------------------
More practical details on the protocol and how it's supported by industrial
modems can be found in the following documents :
http://www.telit.com/module/infopool/download.php?id=616
http://www.u-blox.com/images/downloads/Product_Docs/LEON-G100-G200-MuxImplementation_ApplicationNote_%28GSM%20G1-CS-10002%29.pdf
http://www.sierrawireless.com/Support/Downloads/AirPrime/WMP_Series/~/media/Support_Downloads/AirPrime/Application_notes/CMUX_Feature_Application_Note-Rev004.ashx
http://wm.sim.com/sim/News/photo/2010721161442.pdf

11-03-08 - Eric Bénard - <[email protected]>
16 changes: 13 additions & 3 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,16 @@ M: Matt Turner <[email protected]>
L: [email protected]
F: arch/alpha/

ALTERA UART/JTAG UART SERIAL DRIVERS
M: Tobias Klauser <[email protected]>
L: [email protected]
L: [email protected] (moderated for non-subscribers)
S: Maintained
F: drivers/tty/serial/altera_uart.c
F: drivers/tty/serial/altera_jtaguart.c
F: include/linux/altera_uart.h
F: include/linux/altera_jtaguart.h

AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER
M: Thomas Dahlmann <[email protected]>
L: [email protected] (moderated for non-subscribers)
Expand Down Expand Up @@ -2833,7 +2843,7 @@ F: mm/hwpoison-inject.c
HYPERVISOR VIRTUAL CONSOLE DRIVER
L: [email protected]
S: Odd Fixes
F: drivers/char/hvc_*
F: drivers/tty/hvc/

iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER
M: Peter Jones <[email protected]>
Expand Down Expand Up @@ -3448,7 +3458,7 @@ M: Jiri Kosina <[email protected]>
M: David Sterba <[email protected]>
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/ipwireless_cs.git
F: drivers/char/pcmcia/ipwireless/
F: drivers/tty/ipwireless/

IPX NETWORK LAYER
M: Arnaldo Carvalho de Melo <[email protected]>
Expand Down Expand Up @@ -6102,7 +6112,7 @@ M: Chris Metcalf <[email protected]>
W: http://www.tilera.com/scm/
S: Supported
F: arch/tile/
F: drivers/char/hvc_tile.c
F: drivers/tty/hvc/hvc_tile.c
F: drivers/net/tile/

TLAN NETWORK DRIVER
Expand Down
1 change: 1 addition & 0 deletions arch/alpha/include/asm/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
#define TIOCVHANGUP 0x5437

#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
Expand Down
3 changes: 1 addition & 2 deletions arch/ia64/hp/sim/simserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ static void rs_unthrottle(struct tty_struct * tty)
}


static int rs_ioctl(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg)
static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
{
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
(cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
Expand Down
8 changes: 0 additions & 8 deletions arch/m68k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,6 @@ config MVME147_SCC
This is the driver for the serial ports on the Motorola MVME147
boards. Everyone using one of these boards should say Y here.

config SERIAL167
bool "CD2401 support for MVME166/7 serial ports"
depends on MVME16x
help
This is the driver for the serial ports on the Motorola MVME166,
167, and 172 boards. Everyone using one of these boards should say
Y here.

config MVME162_SCC
bool "SCC support for MVME162 serial ports"
depends on MVME16x && BROKEN
Expand Down
1 change: 1 addition & 0 deletions arch/mips/include/asm/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
#define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */
#define TIOCVHANGUP 0x5437

/* I hope the range from 0x5480 on is free ... */
#define TIOCSCTTY 0x5480 /* become controlling tty */
Expand Down
1 change: 1 addition & 0 deletions arch/parisc/include/asm/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCGDEV _IOR('T',0x32, int) /* Get primary device node of /dev/console */
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
#define TIOCVHANGUP 0x5437

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
#define TIOCVHANGUP 0x5437

#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
Expand Down
1 change: 1 addition & 0 deletions arch/sh/include/asm/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
#define TIOCVHANGUP _IO('T', 0x37)

#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/include/asm/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define TCSETSW2 _IOW('T', 14, struct termios2)
#define TCSETSF2 _IOW('T', 15, struct termios2)
#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
#define TIOCVHANGUP _IO('T', 0x37)

/* Note that all the ioctls that are not available in Linux have a
* double underscore on the front to: a) avoid some programs to
Expand Down
1 change: 1 addition & 0 deletions arch/xtensa/include/asm/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
#define TIOCVHANGUP _IO('T', 0x37)

#define TIOCSERCONFIG _IO('T', 83)
#define TIOCSERGWILD _IOR('T', 84, int)
Expand Down
26 changes: 13 additions & 13 deletions drivers/bluetooth/hci_ath.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,32 @@ struct ath_struct {

static int ath_wakeup_ar3k(struct tty_struct *tty)
{
struct termios settings;
int status = tty->driver->ops->tiocmget(tty, NULL);
struct ktermios ktermios;
int status = tty->driver->ops->tiocmget(tty);

if (status & TIOCM_CTS)
return status;

/* Disable Automatic RTSCTS */
n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings);
settings.c_cflag &= ~CRTSCTS;
n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings);
memcpy(&ktermios, tty->termios, sizeof(ktermios));
ktermios.c_cflag &= ~CRTSCTS;
tty_set_termios(tty, &ktermios);

/* Clear RTS first */
status = tty->driver->ops->tiocmget(tty, NULL);
tty->driver->ops->tiocmset(tty, NULL, 0x00, TIOCM_RTS);
status = tty->driver->ops->tiocmget(tty);
tty->driver->ops->tiocmset(tty, 0x00, TIOCM_RTS);
mdelay(20);

/* Set RTS, wake up board */
status = tty->driver->ops->tiocmget(tty, NULL);
tty->driver->ops->tiocmset(tty, NULL, TIOCM_RTS, 0x00);
status = tty->driver->ops->tiocmget(tty);
tty->driver->ops->tiocmset(tty, TIOCM_RTS, 0x00);
mdelay(20);

status = tty->driver->ops->tiocmget(tty, NULL);
status = tty->driver->ops->tiocmget(tty);

n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings);
settings.c_cflag |= CRTSCTS;
n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings);
/* Disable Automatic RTSCTS */
ktermios.c_cflag |= CRTSCTS;
status = tty_set_termios(tty, &ktermios);

return status;
}
Expand Down
Loading

0 comments on commit e6bee32

Please sign in to comment.