Skip to content

Commit

Permalink
Merge tag 'tty-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/gregkh/tty

Pull tty/serial driver update from Greg KH:
 "Here's the big tty/serial driver update for 3.15-rc1.

  Nothing major, a number of serial driver updates and a few tty core
  fixes as well.

  All have been in linux-next for a while"

* tag 'tty-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (71 commits)
  tty/serial: omap: empty the RX FIFO at the end of half-duplex TX
  tty/serial: omap: fix RX interrupt enable/disable in half-duplex TX
  serial: sh-sci: Neaten dev_<level> uses
  serial: sh-sci: Replace hardcoded 3 by UART_PM_STATE_OFF
  serial: sh-sci: Add more register documentation
  serial: sh-sci: Remove useless casts
  serial: sh-sci: Replace printk() by pr_*()
  serial_core: Avoid NULL pointer dereference in uart_close()
  serial_core: Get a reference for port->tty in uart_remove_one_port()
  serial: clps711x: Give a chance to perform useful tasks during wait loop
  serial_core: Grammar s/ports/port's/
  serial_core: Spelling s/contro/control/
  serial: efm32: properly namespace location property
  serial: max310x: Add missing #include <linux/uaccess.h>
  synclink: fix info leak in ioctl
  serial: 8250: Clean up the locking for -rt
  serial: 8250_pci: change BayTrail default uartclk
  serial: 8250_pci: more BayTrail error-free bauds
  serial: sh-sci: Add missing call to uart_remove_one_port() in failure path
  serial_core: Unregister console in uart_remove_one_port()
  ...
  • Loading branch information
Linus Torvalds committed Apr 1, 2014
2 parents c12e69c + 3a13884 commit cb15955
Show file tree
Hide file tree
Showing 43 changed files with 1,233 additions and 847 deletions.
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/serial/efm32-uart.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Required properties:
- interrupts : Should contain uart interrupt

Optional properties:
- location : Decides the location of the USART I/O pins.
- efm32,location : Decides the location of the USART I/O pins.
Allowed range : [0 .. 5]
Default: 0

Expand All @@ -16,5 +16,5 @@ uart@0x4000c400 {
compatible = "efm32,uart";
reg = <0x4000c400 0x400>;
interrupts = <15>;
location = <0>;
efm32,location = <0>;
};
21 changes: 17 additions & 4 deletions Documentation/devicetree/bindings/serial/fsl-lpuart.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@ Required properties:
- compatible : Should be "fsl,<soc>-lpuart"
- reg : Address and length of the register set for the device
- interrupts : Should contain uart interrupt
- clocks : phandle + clock specifier pairs, one for each entry in clock-names
- clock-names : should contain: "ipg" - the uart clock

Optional properties:
- dmas: A list of two dma specifiers, one for each entry in dma-names.
- dma-names: should contain "tx" and "rx".

Note: Optional properties for DMA support. Write them both or both not.

Example:

uart0: serial@40027000 {
compatible = "fsl,vf610-lpuart";
reg = <0x40027000 0x1000>;
interrupts = <0 61 0x00>;
};
compatible = "fsl,vf610-lpuart";
reg = <0x40027000 0x1000>;
interrupts = <0 61 0x00>;
clocks = <&clks VF610_CLK_UART0>;
clock-names = "ipg";
dmas = <&edma0 0 2>,
<&edma0 0 3>;
dma-names = "rx","tx";
};
36 changes: 36 additions & 0 deletions Documentation/devicetree/bindings/serial/maxim,max310x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
* Maxim MAX310X advanced Universal Asynchronous Receiver-Transmitter (UART)

Required properties:
- compatible: Should be one of the following:
- "maxim,max3107" for Maxim MAX3107,
- "maxim,max3108" for Maxim MAX3108,
- "maxim,max3109" for Maxim MAX3109,
- "maxim,max14830" for Maxim MAX14830.
- reg: SPI chip select number.
- interrupt-parent: The phandle for the interrupt controller that
services interrupts for this IC.
- interrupts: Specifies the interrupt source of the parent interrupt
controller. The format of the interrupt specifier depends on the
parent interrupt controller.
- clocks: phandle to the IC source clock.
- clock-names: Should be "xtal" if clock is an external crystal or
"osc" if an external clock source is used.

Optional properties:
- gpio-controller: Marks the device node as a GPIO controller.
- #gpio-cells: Should be two. The first cell is the GPIO number and
the second cell is used to specify the GPIO polarity:
0 = active high,
1 = active low.

Example:
max14830: max14830@0 {
compatible = "maxim,max14830";
reg = <0>;
clocks = <&clk20m>;
clock-names = "osc";
interrupt-parent = <&gpio3>;
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
gpio-controller;
#gpio-cells = <2>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Example:
};

scifa0: serial@e6c40000 {
compatible = "renesas,scifa-r8a7790", "renesas,scifa-generic";
compatible = "renesas,scifa-r8a7790", "renesas,scifa";
reg = <0 0xe6c40000 0 64>;
interrupt-parent = <&gic>;
interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
Expand Down
17 changes: 9 additions & 8 deletions arch/arm/boot/dts/atlas6.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@
interrupts = <17>;
fifosize = <128>;
clocks = <&clks 13>;
sirf,uart-dma-rx-channel = <21>;
sirf,uart-dma-tx-channel = <2>;
dmas = <&dmac1 5>, <&dmac0 2>;
dma-names = "rx", "tx";
};

uart1: uart@b0060000 {
Expand All @@ -228,6 +228,7 @@
interrupts = <18>;
fifosize = <32>;
clocks = <&clks 14>;
dma-names = "no-rx", "no-tx";
};

uart2: uart@b0070000 {
Expand All @@ -237,8 +238,8 @@
interrupts = <19>;
fifosize = <128>;
clocks = <&clks 15>;
sirf,uart-dma-rx-channel = <6>;
sirf,uart-dma-tx-channel = <7>;
dmas = <&dmac0 6>, <&dmac0 7>;
dma-names = "rx", "tx";
};

usp0: usp@b0080000 {
Expand All @@ -248,8 +249,8 @@
interrupts = <20>;
fifosize = <128>;
clocks = <&clks 28>;
sirf,usp-dma-rx-channel = <17>;
sirf,usp-dma-tx-channel = <18>;
dmas = <&dmac1 1>, <&dmac1 2>;
dma-names = "rx", "tx";
};

usp1: usp@b0090000 {
Expand All @@ -259,8 +260,8 @@
interrupts = <21>;
fifosize = <128>;
clocks = <&clks 29>;
sirf,usp-dma-rx-channel = <14>;
sirf,usp-dma-tx-channel = <15>;
dmas = <&dmac0 14>, <&dmac0 15>;
dma-names = "rx", "tx";
};

dmac0: dma-controller@b00b0000 {
Expand Down
20 changes: 10 additions & 10 deletions arch/arm/boot/dts/prima2.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@
interrupts = <17>;
fifosize = <128>;
clocks = <&clks 13>;
sirf,uart-dma-rx-channel = <21>;
sirf,uart-dma-tx-channel = <2>;
dmas = <&dmac1 5>, <&dmac0 2>;
dma-names = "rx", "tx";
};

uart1: uart@b0060000 {
Expand All @@ -243,8 +243,8 @@
interrupts = <19>;
fifosize = <128>;
clocks = <&clks 15>;
sirf,uart-dma-rx-channel = <6>;
sirf,uart-dma-tx-channel = <7>;
dmas = <&dmac0 6>, <&dmac0 7>;
dma-names = "rx", "tx";
};

usp0: usp@b0080000 {
Expand All @@ -254,8 +254,8 @@
interrupts = <20>;
fifosize = <128>;
clocks = <&clks 28>;
sirf,usp-dma-rx-channel = <17>;
sirf,usp-dma-tx-channel = <18>;
dmas = <&dmac1 1>, <&dmac1 2>;
dma-names = "rx", "tx";
};

usp1: usp@b0090000 {
Expand All @@ -265,8 +265,8 @@
interrupts = <21>;
fifosize = <128>;
clocks = <&clks 29>;
sirf,usp-dma-rx-channel = <14>;
sirf,usp-dma-tx-channel = <15>;
dmas = <&dmac0 14>, <&dmac0 15>;
dma-names = "rx", "tx";
};

usp2: usp@b00a0000 {
Expand All @@ -276,8 +276,8 @@
interrupts = <22>;
fifosize = <128>;
clocks = <&clks 30>;
sirf,usp-dma-rx-channel = <10>;
sirf,usp-dma-tx-channel = <11>;
dmas = <&dmac0 10>, <&dmac0 11>;
dma-names = "rx", "tx";
};

dmac0: dma-controller@b00b0000 {
Expand Down
21 changes: 5 additions & 16 deletions arch/arm/mach-imx/mach-mx31moboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,27 +128,15 @@ static struct platform_device mx31moboard_flash = {
.num_resources = 1,
};

static int moboard_uart0_init(struct platform_device *pdev)
static void __init moboard_uart0_init(void)
{
int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack");
if (ret)
return ret;

ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
if (ret)
if (!gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack")) {
gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));

return ret;
}

static void moboard_uart0_exit(struct platform_device *pdev)
{
gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));
}
}

static const struct imxuart_platform_data uart0_pdata __initconst = {
.init = moboard_uart0_init,
.exit = moboard_uart0_exit,
};

static const struct imxuart_platform_data uart4_pdata __initconst = {
Expand Down Expand Up @@ -543,6 +531,7 @@ static void __init mx31moboard_init(void)

imx31_add_imx2_wdt();

moboard_uart0_init();
imx31_add_imx_uart0(&uart0_pdata);
imx31_add_imx_uart4(&uart4_pdata);

Expand Down
6 changes: 5 additions & 1 deletion drivers/tty/hvc/hvc_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/major.h>
#include <linux/atomic.h>
#include <linux/sysrq.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
Expand Down Expand Up @@ -70,6 +71,9 @@ static struct task_struct *hvc_task;
/* Picks up late kicks after list walk but before schedule() */
static int hvc_kicked;

/* hvc_init is triggered from hvc_alloc, i.e. only when actually used */
static atomic_t hvc_needs_init __read_mostly = ATOMIC_INIT(-1);

static int hvc_init(void);

#ifdef CONFIG_MAGIC_SYSRQ
Expand Down Expand Up @@ -851,7 +855,7 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
int i;

/* We wait until a driver actually comes along */
if (!hvc_driver) {
if (atomic_inc_not_zero(&hvc_needs_init)) {
int err = hvc_init();
if (err)
return ERR_PTR(err);
Expand Down
3 changes: 0 additions & 3 deletions drivers/tty/ipwireless/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
": %d chars not inserted to flip buffer!\n",
length - work);

/*
* This may sleep if ->low_latency is set
*/
if (work)
tty_flip_buffer_push(&tty->port);
}
Expand Down
11 changes: 4 additions & 7 deletions drivers/tty/n_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1900,13 +1900,10 @@ static inline int input_available_p(struct tty_struct *tty, int poll)
struct n_tty_data *ldata = tty->disc_data;
int amt = poll && !TIME_CHAR(tty) && MIN_CHAR(tty) ? MIN_CHAR(tty) : 1;

if (ldata->icanon && !L_EXTPROC(tty)) {
if (ldata->canon_head != ldata->read_tail)
return 1;
} else if (read_cnt(ldata) >= amt)
return 1;

return 0;
if (ldata->icanon && !L_EXTPROC(tty))
return ldata->canon_head != ldata->read_tail;
else
return read_cnt(ldata) >= amt;
}

/**
Expand Down
19 changes: 9 additions & 10 deletions drivers/tty/serial/8250/8250_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,10 @@ static int serial_link_irq_chain(struct uart_8250_port *up)

static void serial_unlink_irq_chain(struct uart_8250_port *up)
{
/*
* yes, some broken gcc emit "warning: 'i' may be used uninitialized"
* but no, we are not going to take a patch that assigns NULL below.
*/
struct irq_info *i;
struct hlist_node *n;
struct hlist_head *h;
Expand Down Expand Up @@ -2882,14 +2886,10 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)

touch_nmi_watchdog();

local_irq_save(flags);
if (port->sysrq) {
/* serial8250_handle_irq() already took the lock */
locked = 0;
} else if (oops_in_progress) {
locked = spin_trylock(&port->lock);
} else
spin_lock(&port->lock);
if (port->sysrq || oops_in_progress)
locked = spin_trylock_irqsave(&port->lock, flags);
else
spin_lock_irqsave(&port->lock, flags);

/*
* First save the IER then disable the interrupts
Expand Down Expand Up @@ -2921,8 +2921,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
serial8250_modem_status(up);

if (locked)
spin_unlock(&port->lock);
local_irq_restore(flags);
spin_unlock_irqrestore(&port->lock, flags);
}

static int __init serial8250_console_setup(struct console *co, char *options)
Expand Down
43 changes: 34 additions & 9 deletions drivers/tty/serial/8250/8250_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,23 +1366,44 @@ byt_set_termios(struct uart_port *p, struct ktermios *termios,
struct ktermios *old)
{
unsigned int baud = tty_termios_baud_rate(termios);
unsigned int m = 6912;
unsigned int n = 15625;
unsigned int m, n;
u32 reg;

/* For baud rates 1M, 2M, 3M and 4M the dividers must be adjusted. */
if (baud == 1000000 || baud == 2000000 || baud == 4000000) {
/*
* For baud rates 0.5M, 1M, 1.5M, 2M, 2.5M, 3M, 3.5M and 4M the
* dividers must be adjusted.
*
* uartclk = (m / n) * 100 MHz, where m <= n
*/
switch (baud) {
case 500000:
case 1000000:
case 2000000:
case 4000000:
m = 64;
n = 100;

p->uartclk = 64000000;
} else if (baud == 3000000) {
break;
case 3500000:
m = 56;
n = 100;
p->uartclk = 56000000;
break;
case 1500000:
case 3000000:
m = 48;
n = 100;

p->uartclk = 48000000;
} else {
p->uartclk = 44236800;
break;
case 2500000:
m = 40;
n = 100;
p->uartclk = 40000000;
break;
default:
m = 2304;
n = 3125;
p->uartclk = 73728000;
}

/* Reset the clock */
Expand Down Expand Up @@ -3449,6 +3470,10 @@ static struct pciserial_board pci_boards[] = {
.base_baud = 921600,
.reg_shift = 2,
},
/*
* Intel BayTrail HSUART reference clock is 44.2368 MHz at power-on,
* but is overridden by byt_set_termios.
*/
[pbn_byt] = {
.flags = FL_BASE0,
.num_ports = 1,
Expand Down
Loading

0 comments on commit cb15955

Please sign in to comment.