Skip to content

Commit 99dff58

Browse files
committed
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: (48 commits) serial: 8250_pci: add support for Cronyx Omega PCI multiserial board. tty/serial: Fix break handling for PORT_TEGRA tty/serial: Add explicit PORT_TEGRA type n_tracerouter and n_tracesink ldisc additions. Intel PTI implementaiton of MIPI 1149.7. Kernel documentation for the PTI feature. export kernel call get_task_comm(). tty: Remove to support serial for S5P6442 pch_phub: Support new device ML7223 8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter ASoC: Update cx20442 for TTY API change pch_uart: Support new device ML7223 IOH parport: Use request_muxed_region for IT87 probe and lock tty/serial: add support for Xilinx PS UART n_gsm: Use print_hex_dump_bytes drivers/tty/moxa.c: Put correct tty value TTY: tty_io, annotate locking functions TTY: serial_core, remove superfluous set_task_state TTY: serial_core, remove invalid test Char: moxa, fix locking in moxa_write ... Fix up trivial conflicts in drivers/bluetooth/hci_ldisc.c and drivers/tty/serial/Makefile. I did the hci_ldisc thing as an evil merge, cleaning things up.
2 parents bb74e8c + d9a0fbf commit 99dff58

103 files changed

Lines changed: 3348 additions & 517 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
The Intel MID PTI project is HW implemented in Intel Atom
2+
system-on-a-chip designs based on the Parallel Trace
3+
Interface for MIPI P1149.7 cJTAG standard. The kernel solution
4+
for this platform involves the following files:
5+
6+
./include/linux/pti.h
7+
./drivers/.../n_tracesink.h
8+
./drivers/.../n_tracerouter.c
9+
./drivers/.../n_tracesink.c
10+
./drivers/.../pti.c
11+
12+
pti.c is the driver that enables various debugging features
13+
popular on platforms from certain mobile manufacturers.
14+
n_tracerouter.c and n_tracesink.c allow extra system information to
15+
be collected and routed to the pti driver, such as trace
16+
debugging data from a modem. Although n_tracerouter
17+
and n_tracesink are a part of the complete PTI solution,
18+
these two line disciplines can work separately from
19+
pti.c and route any data stream from one /dev/tty node
20+
to another /dev/tty node via kernel-space. This provides
21+
a stable, reliable connection that will not break unless
22+
the user-space application shuts down (plus avoids
23+
kernel->user->kernel context switch overheads of routing
24+
data).
25+
26+
An example debugging usage for this driver system:
27+
*Hook /dev/ttyPTI0 to syslogd. Opening this port will also start
28+
a console device to further capture debugging messages to PTI.
29+
*Hook /dev/ttyPTI1 to modem debugging data to write to PTI HW.
30+
This is where n_tracerouter and n_tracesink are used.
31+
*Hook /dev/pti to a user-level debugging application for writing
32+
to PTI HW.
33+
*Use mipi_* Kernel Driver API in other device drivers for
34+
debugging to PTI by first requesting a PTI write address via
35+
mipi_request_masterchannel(1).
36+
37+
Below is example pseudo-code on how a 'privileged' application
38+
can hook up n_tracerouter and n_tracesink to any tty on
39+
a system. 'Privileged' means the application has enough
40+
privileges to successfully manipulate the ldisc drivers
41+
but is not just blindly executing as 'root'. Keep in mind
42+
the use of ioctl(,TIOCSETD,) is not specific to the n_tracerouter
43+
and n_tracesink line discpline drivers but is a generic
44+
operation for a program to use a line discpline driver
45+
on a tty port other than the default n_tty.
46+
47+
/////////// To hook up n_tracerouter and n_tracesink /////////
48+
49+
// Note that n_tracerouter depends on n_tracesink.
50+
#include <errno.h>
51+
#define ONE_TTY "/dev/ttyOne"
52+
#define TWO_TTY "/dev/ttyTwo"
53+
54+
// needed global to hand onto ldisc connection
55+
static int g_fd_source = -1;
56+
static int g_fd_sink = -1;
57+
58+
// these two vars used to grab LDISC values from loaded ldisc drivers
59+
// in OS. Look at /proc/tty/ldiscs to get the right numbers from
60+
// the ldiscs loaded in the system.
61+
int source_ldisc_num, sink_ldisc_num = -1;
62+
int retval;
63+
64+
g_fd_source = open(ONE_TTY, O_RDWR); // must be R/W
65+
g_fd_sink = open(TWO_TTY, O_RDWR); // must be R/W
66+
67+
if (g_fd_source <= 0) || (g_fd_sink <= 0) {
68+
// doubt you'll want to use these exact error lines of code
69+
printf("Error on open(). errno: %d\n",errno);
70+
return errno;
71+
}
72+
73+
retval = ioctl(g_fd_sink, TIOCSETD, &sink_ldisc_num);
74+
if (retval < 0) {
75+
printf("Error on ioctl(). errno: %d\n", errno);
76+
return errno;
77+
}
78+
79+
retval = ioctl(g_fd_source, TIOCSETD, &source_ldisc_num);
80+
if (retval < 0) {
81+
printf("Error on ioctl(). errno: %d\n", errno);
82+
return errno;
83+
}
84+
85+
/////////// To disconnect n_tracerouter and n_tracesink ////////
86+
87+
// First make sure data through the ldiscs has stopped.
88+
89+
// Second, disconnect ldiscs. This provides a
90+
// little cleaner shutdown on tty stack.
91+
sink_ldisc_num = 0;
92+
source_ldisc_num = 0;
93+
ioctl(g_fd_uart, TIOCSETD, &sink_ldisc_num);
94+
ioctl(g_fd_gadget, TIOCSETD, &source_ldisc_num);
95+
96+
// Three, program closes connection, and cleanup:
97+
close(g_fd_uart);
98+
close(g_fd_gadget);
99+
g_fd_uart = g_fd_gadget = NULL;

‎drivers/bluetooth/hci_ldisc.c‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,26 +355,29 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
355355
* flags pointer to flags for data
356356
* count count of received data in bytes
357357
*
358-
* Return Value: None
358+
* Return Value: Number of bytes received
359359
*/
360-
static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count)
360+
static unsigned int hci_uart_tty_receive(struct tty_struct *tty,
361+
const u8 *data, char *flags, int count)
361362
{
362-
int ret;
363363
struct hci_uart *hu = (void *)tty->disc_data;
364+
int received;
364365

365366
if (!hu || tty != hu->tty)
366-
return;
367+
return -ENODEV;
367368

368369
if (!test_bit(HCI_UART_PROTO_SET, &hu->flags))
369-
return;
370+
return -EINVAL;
370371

371372
spin_lock(&hu->rx_lock);
372-
ret = hu->proto->recv(hu, (void *) data, count);
373-
if (ret > 0)
374-
hu->hdev->stat.byte_rx += count;
373+
received = hu->proto->recv(hu, (void *) data, count);
374+
if (received > 0)
375+
hu->hdev->stat.byte_rx += received;
375376
spin_unlock(&hu->rx_lock);
376377

377378
tty_unthrottle(tty);
379+
380+
return received;
378381
}
379382

380383
static int hci_uart_register_dev(struct hci_uart *hu)

‎drivers/input/serio/serport.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,21 @@ static void serport_ldisc_close(struct tty_struct *tty)
120120
* 'interrupt' routine.
121121
*/
122122

123-
static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
123+
static unsigned int serport_ldisc_receive(struct tty_struct *tty,
124+
const unsigned char *cp, char *fp, int count)
124125
{
125126
struct serport *serport = (struct serport*) tty->disc_data;
126127
unsigned long flags;
127128
unsigned int ch_flags;
129+
int ret = 0;
128130
int i;
129131

130132
spin_lock_irqsave(&serport->lock, flags);
131133

132-
if (!test_bit(SERPORT_ACTIVE, &serport->flags))
134+
if (!test_bit(SERPORT_ACTIVE, &serport->flags)) {
135+
ret = -EINVAL;
133136
goto out;
137+
}
134138

135139
for (i = 0; i < count; i++) {
136140
switch (fp[i]) {
@@ -152,6 +156,8 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c
152156

153157
out:
154158
spin_unlock_irqrestore(&serport->lock, flags);
159+
160+
return ret == 0 ? count : ret;
155161
}
156162

157163
/*

‎drivers/isdn/gigaset/ser-gigaset.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ gigaset_tty_ioctl(struct tty_struct *tty, struct file *file,
674674
* cflags buffer containing error flags for received characters (ignored)
675675
* count number of received characters
676676
*/
677-
static void
677+
static unsigned int
678678
gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,
679679
char *cflags, int count)
680680
{
@@ -683,12 +683,12 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,
683683
struct inbuf_t *inbuf;
684684

685685
if (!cs)
686-
return;
686+
return -ENODEV;
687687
inbuf = cs->inbuf;
688688
if (!inbuf) {
689689
dev_err(cs->dev, "%s: no inbuf\n", __func__);
690690
cs_put(cs);
691-
return;
691+
return -EINVAL;
692692
}
693693

694694
tail = inbuf->tail;
@@ -725,6 +725,8 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,
725725
gig_dbg(DEBUG_INTR, "%s-->BH", __func__);
726726
gigaset_schedule_event(cs);
727727
cs_put(cs);
728+
729+
return count;
728730
}
729731

730732
/*

‎drivers/misc/Kconfig‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,19 @@ config PHANTOM
144144
If you choose to build module, its name will be phantom. If unsure,
145145
say N here.
146146

147+
config INTEL_MID_PTI
148+
tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard"
149+
default n
150+
help
151+
The PTI (Parallel Trace Interface) driver directs
152+
trace data routed from various parts in the system out
153+
through an Intel Penwell PTI port and out of the mobile
154+
device for analysis with a debugging tool (Lauterbach or Fido).
155+
156+
You should select this driver if the target kernel is meant for
157+
an Intel Atom (non-netbook) mobile device containing a MIPI
158+
P1149.7 standard implementation.
159+
147160
config SGI_IOC4
148161
tristate "SGI IOC4 Base IO support"
149162
depends on PCI
@@ -459,18 +472,20 @@ config BMP085
459472
module will be called bmp085.
460473

461474
config PCH_PHUB
462-
tristate "PCH Packet Hub of Intel Topcliff / OKI SEMICONDUCTOR ML7213"
475+
tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) PHUB"
463476
depends on PCI
464477
help
465478
This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of
466479
Intel Topcliff which is an IOH(Input/Output Hub) for x86 embedded
467480
processor. The Topcliff has MAC address and Option ROM data in SROM.
468481
This driver can access MAC address and Option ROM data in SROM.
469482

470-
This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is
471-
for IVI(In-Vehicle Infotainment) use.
472-
ML7213 is companion chip for Intel Atom E6xx series.
473-
ML7213 is completely compatible for Intel EG20T PCH.
483+
This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
484+
Output Hub), ML7213 and ML7223.
485+
ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is
486+
for MP(Media Phone) use.
487+
ML7213/ML7223 is companion chip for Intel Atom E6xx series.
488+
ML7213/ML7223 is completely compatible for Intel EG20T PCH.
474489

475490
To compile this driver as a module, choose M here: the module will
476491
be called pch_phub.

‎drivers/misc/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/
66
obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o
77
obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o
88
obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o
9+
0bj-$(CONFIG_INTEL_MID_PTI) += pti.o
910
obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
1011
obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
1112
obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o

0 commit comments

Comments
 (0)