projects/linux·commit 41d5e08e

Merge tag 'tty-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

41d5e08e · Linus Torvalds <[email protected]> · 2015-04-21 09:33:10 -07:00

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

  It was delayed for a bit due to some questions surrounding some of the
  console command line parsing changes that are in here.  There's still
  one tiny regression for people who were previously putting multiple
  console command lines and expecting them all to be ignored for some
  odd reason, but Peter is working on fixing that.  If not, I'll send a
  revert for the offending patch, but I have faith that Peter can
  address it.

  Other than the console work here, there's the usual serial driver
  updates and changes, and a buch of 8250 reworks to try to make that
  driver easier to maintain over time, and have it support more devices
  in the future.

  All of these have been in linux-next for a while"

* tag 'tty-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (119 commits)
  n_gsm: Drop unneeded cast on netdev_priv
  sc16is7xx: expose RTS inversion in RS-485 mode
  serial: 8250_pci: port failed after wakeup from S3
  earlycon: 8250: Document kernel command line options
  earlycon: 8250: Fix command line regression
  earlycon: Fix __earlycon_table stride
  tty: clean up the tty time logic a bit
  serial: 8250_dw: only get the clock rate in one place
  serial: 8250_dw: remove useless ACPI ID check
  dmaengine: hsu: move memory allocation to GFP_NOWAIT
  dmaengine: hsu: remove redundant pieces of code
  serial: 8250_pci: add Intel Tangier support
  dmaengine: hsu: add Intel Tangier PCI ID
  serial: 8250_pci: replace switch-case by formula for Intel MID
  serial: 8250_pci: replace switch-case by formula
  tty: cpm_uart: replace CONFIG_8xx by CONFIG_CPM1
  serial: jsm: some off by one bugs
  serial: xuartps: Fix check in console_setup().
  serial: xuartps: Get rid of register access macros.
  serial: xuartps: Fix iobase use.
  ...
Commit
41d5e08ea86af3359239d5a6f7021cdc61beaa49
Parents
8d582b94 · 5dbc32a8

Merge commit. Changes below are compared with the first parent: 8d582b94.

Changes

79 files changed · +2357 −4743

FileStatusAddDelContent
Documentation/kernel-parameters.txtmodified+15−3View file
arch/mips/mti-malta/malta-init.cmodified+2−2View file
arch/x86/Kconfig.debugmodified+0−4View file
arch/x86/include/asm/intel-mid.hmodified+0−3View file
arch/x86/include/asm/serial.hmodified+4−4View file
arch/x86/kernel/early_printk.cmodified+0−6View file
arch/x86/platform/intel-mid/Makefilemodified+0−1View file
arch/x86/platform/intel-mid/early_printk_intel_mid.cdeleted+0−112View before deletion
drivers/dma/Kconfigmodified+2−0View file
drivers/dma/Makefilemodified+1−0View file
drivers/dma/hsu/Kconfigadded+14−0View file
drivers/dma/hsu/Makefileadded+5−0View file
drivers/dma/hsu/hsu.cadded+495−0View file
drivers/dma/hsu/hsu.hadded+118−0View file
drivers/dma/hsu/pci.cadded+124−0View file
drivers/firmware/pcdp.cmodified+2−2View file
drivers/tty/hvc/hvc_opal.cmodified+1−1View file
drivers/tty/n_gsm.cmodified+6−6View file
drivers/tty/serial/8250/8250.hmodified+18−5View file
drivers/tty/serial/8250/8250_core.cmodified+328−165View file
drivers/tty/serial/8250/8250_dw.cmodified+28−30View file
drivers/tty/serial/8250/8250_early.cmodified+10−59View file
drivers/tty/serial/8250/8250_em.cmodified+0−1View file
drivers/tty/serial/8250/8250_hp300.cmodified+0−1View file
drivers/tty/serial/8250/8250_omap.cmodified+0−1View file
drivers/tty/serial/8250/8250_pci.cmodified+296−118View file
drivers/tty/serial/8250/Kconfigmodified+1−0View file
drivers/tty/serial/Kconfigmodified+5−27View file
drivers/tty/serial/Makefilemodified+0−2View file
drivers/tty/serial/amba-pl011.cmodified+129−105View file
drivers/tty/serial/apbuart.cmodified+1−1View file
drivers/tty/serial/ar933x_uart.cmodified+1−1View file
drivers/tty/serial/atmel_serial.cmodified+17−12View file
drivers/tty/serial/bcm63xx_uart.cmodified+2−2View file
drivers/tty/serial/bfin_uart.cmodified+2−0View file
drivers/tty/serial/clps711x.cmodified+2−0View file
drivers/tty/serial/cpm_uart/Makefilemodified+1−1View file
drivers/tty/serial/cpm_uart/cpm_uart.hmodified+1−1View file
drivers/tty/serial/cpm_uart/cpm_uart_core.cmodified+1−1View file
drivers/tty/serial/earlycon.cmodified+95−45View file
drivers/tty/serial/fsl_lpuart.cmodified+1−1View file
drivers/tty/serial/imx.cmodified+121−196View file
drivers/tty/serial/jsm/jsm_cls.cmodified+1−1View file
drivers/tty/serial/jsm/jsm_neo.cmodified+3−3View file
drivers/tty/serial/max3100.cmodified+1−1View file
drivers/tty/serial/mfd.cdeleted+0−1505View before deletion
drivers/tty/serial/mpc52xx_uart.cmodified+1−1View file
drivers/tty/serial/msm_serial.hmodified+0−9View file
drivers/tty/serial/msm_serial_hs.cdeleted+0−1874View before deletion
drivers/tty/serial/mxs-auart.cmodified+10−8View file
drivers/tty/serial/of_serial.cmodified+3−2View file
drivers/tty/serial/omap-serial.cmodified+5−5View file
drivers/tty/serial/pmac_zilog.cmodified+1−1View file
drivers/tty/serial/pxa.cmodified+1−1View file
drivers/tty/serial/sc16is7xx.cmodified+34−12View file
drivers/tty/serial/serial-tegra.cmodified+1−1View file
drivers/tty/serial/serial_core.cmodified+49−3View file
drivers/tty/serial/serial_mctrl_gpio.cmodified+13−37View file
drivers/tty/serial/sh-sci.cmodified+67−21View file
drivers/tty/serial/sirfsoc_uart.cmodified+1−1View file
drivers/tty/serial/sprd_serial.cmodified+5−1View file
drivers/tty/serial/st-asc.cmodified+1−1View file
drivers/tty/serial/uartlite.cmodified+1−1View file
drivers/tty/serial/ucc_uart.cmodified+1−1View file
drivers/tty/serial/xilinx_uartps.cmodified+124−118View file
drivers/tty/tty_io.cmodified+18−6View file
drivers/tty/vt/vt.cmodified+33−41View file
drivers/tty/vt/vt_ioctl.cmodified+1−1View file
include/asm-generic/vmlinux.lds.hmodified+9−0View file
include/linux/console.hmodified+1−2View file
include/linux/dma/hsu.hadded+48−0View file
include/linux/platform_data/dma-hsu.hadded+25−0View file
include/linux/platform_data/msm_serial_hs.hdeleted+0−49View before deletion
include/linux/platform_data/serial-imx.hmodified+0−5View file
include/linux/serial_8250.hmodified+17−3View file
include/linux/serial_core.hmodified+15−8View file
include/linux/serial_mfd.hdeleted+0−47View before deletion
include/uapi/linux/serial_reg.hmodified+0−19View file
kernel/printk/printk.cmodified+18−35View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/kernel-parameters.txt

View file
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 274252f..84960c6 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -713,10 +713,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
uart[8250],io,<addr>[,options]
uart[8250],mmio,<addr>[,options]
+ uart[8250],mmio32,<addr>[,options]
+ uart[8250],0x<addr>[,options]
Start an early, polled-mode console on the 8250/16550
UART at the specified I/O port or MMIO address,
- switching to the matching ttyS device later. The
- options are the same as for ttyS, above.
+ switching to the matching ttyS device later.
+ MMIO inter-register address stride is either 8-bit
+ (mmio) or 32-bit (mmio32).
+ If none of [io|mmio|mmio32], <addr> is assumed to be
+ equivalent to 'mmio'. 'options' are specified in the
+ same format described for ttyS above; if unspecified,
+ the h/w is not re-initialized.
+
hvc<n> Use the hypervisor console device <n>. This is for
both Xen and PowerPC hypervisors.
@@ -950,11 +958,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
uart[8250],io,<addr>[,options]
uart[8250],mmio,<addr>[,options]
uart[8250],mmio32,<addr>[,options]
+ uart[8250],0x<addr>[,options]
Start an early, polled-mode console on the 8250/16550
UART at the specified I/O port or MMIO address.
MMIO inter-register address stride is either 8-bit
(mmio) or 32-bit (mmio32).
- The options are the same as for ttyS, above.
+ If none of [io|mmio|mmio32], <addr> is assumed to be
+ equivalent to 'mmio'. 'options' are specified in the
+ same format described for "console=ttyS<n>"; if
+ unspecified, the h/w is not initialized.
pl011,<addr>
Start an early, polled-mode console on a pl011 serial

arch/mips/mti-malta/malta-init.c

View file
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index 6849f53..cec3e18 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -14,7 +14,7 @@
#include <linux/init.h>
#include <linux/string.h>
#include <linux/kernel.h>
-#include <linux/serial_8250.h>
+#include <linux/serial_core.h>
#include <asm/cacheflush.h>
#include <asm/smp-ops.h>
@@ -75,7 +75,7 @@ static void __init console_config(void)
if ((strstr(fw_getcmdline(), "earlycon=")) == NULL) {
sprintf(console_string, "uart8250,io,0x3f8,%d%c%c", baud,
parity, bits);
- setup_early_serial8250_console(console_string);
+ setup_earlycon(console_string);
}
if ((strstr(fw_getcmdline(), "console=")) == NULL) {

arch/x86/Kconfig.debug

View file
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 20028da..72484a6 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -43,10 +43,6 @@ config EARLY_PRINTK
with klogd/syslogd or the X server. You should normally N here,
unless you want to debug such a crash.
-config EARLY_PRINTK_INTEL_MID
- bool "Early printk for Intel MID platform support"
- depends on EARLY_PRINTK && X86_INTEL_MID
-
config EARLY_PRINTK_DBGP
bool "Early printk via EHCI debug port"
depends on EARLY_PRINTK && PCI

arch/x86/include/asm/intel-mid.h

View file
diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h
index 705d357..7c5af12 100644
--- a/arch/x86/include/asm/intel-mid.h
+++ b/arch/x86/include/asm/intel-mid.h
@@ -136,9 +136,6 @@ extern enum intel_mid_timer_options intel_mid_timer_options;
#define SFI_MTMR_MAX_NUM 8
#define SFI_MRTC_MAX 8
-extern struct console early_hsu_console;
-extern void hsu_early_console_init(const char *);
-
extern void intel_scu_devices_create(void);
extern void intel_scu_devices_destroy(void);

arch/x86/include/asm/serial.h

View file
diff --git a/arch/x86/include/asm/serial.h b/arch/x86/include/asm/serial.h
index 460b84f..8378b8c 100644
--- a/arch/x86/include/asm/serial.h
+++ b/arch/x86/include/asm/serial.h
@@ -12,11 +12,11 @@
/* Standard COM flags (except for COM4, because of the 8514 problem) */
#ifdef CONFIG_SERIAL_DETECT_IRQ
-# define STD_COMX_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
-# define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | 0 | ASYNC_AUTO_IRQ)
+# define STD_COMX_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ)
+# define STD_COM4_FLAGS (UPF_BOOT_AUTOCONF | 0 | UPF_AUTO_IRQ)
#else
-# define STD_COMX_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | 0 )
-# define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | 0 | 0 )
+# define STD_COMX_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 0 )
+# define STD_COM4_FLAGS (UPF_BOOT_AUTOCONF | 0 | 0 )
#endif
#define SERIAL_PORT_DFNS \

arch/x86/kernel/early_printk.c

View file
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 49ff55e..89427d8 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -375,12 +375,6 @@ static int __init setup_early_printk(char *buf)
if (!strncmp(buf, "xen", 3))
early_console_register(&xenboot_console, keep);
#endif
-#ifdef CONFIG_EARLY_PRINTK_INTEL_MID
- if (!strncmp(buf, "hsu", 3)) {
- hsu_early_console_init(buf + 3);
- early_console_register(&early_hsu_console, keep);
- }
-#endif
#ifdef CONFIG_EARLY_PRINTK_EFI
if (!strncmp(buf, "efi", 3))
early_console_register(&early_efi_console, keep);

arch/x86/platform/intel-mid/Makefile

View file
diff --git a/arch/x86/platform/intel-mid/Makefile b/arch/x86/platform/intel-mid/Makefile
index 0a8ee70..0ce1b19 100644
--- a/arch/x86/platform/intel-mid/Makefile
+++ b/arch/x86/platform/intel-mid/Makefile
@@ -1,5 +1,4 @@
obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o intel_mid_vrtc.o mfld.o mrfl.o
-obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o
# SFI specific code
ifdef CONFIG_X86_INTEL_MID

arch/x86/platform/intel-mid/early_printk_intel_mid.c

View before deletion
diff --git a/arch/x86/platform/intel-mid/early_printk_intel_mid.c b/arch/x86/platform/intel-mid/early_printk_intel_mid.c
deleted file mode 100644
index 4e72082..0000000
--- a/arch/x86/platform/intel-mid/early_printk_intel_mid.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * early_printk_intel_mid.c - early consoles for Intel MID platforms
- *
- * Copyright (c) 2008-2010, Intel Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2
- * of the License.
- */
-
-/*
- * This file implements early console named hsu.
- * hsu is based on a High Speed UART device which only exists in the Medfield
- * platform
- */
-
-#include <linux/serial_reg.h>
-#include <linux/serial_mfd.h>
-#include <linux/console.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-
-#include <asm/fixmap.h>
-#include <asm/pgtable.h>
-#include <asm/intel-mid.h>
-
-/*
- * Following is the early console based on Medfield HSU (High
- * Speed UART) device.
- */
-#define HSU_PORT_BASE 0xffa28080
-
-static void __iomem *phsu;
-
-void hsu_early_console_init(const char *s)
-{
- unsigned long paddr, port = 0;
- u8 lcr;
-
- /*
- * Select the early HSU console port if specified by user in the
- * kernel command line.
- */
- if (*s && !kstrtoul(s, 10, &port))
- port = clamp_val(port, 0, 2);
-
- paddr = HSU_PORT_BASE + port * 0x80;
- phsu = (void __iomem *)set_fixmap_offset_nocache(FIX_EARLYCON_MEM_BASE, paddr);
-
- /* Disable FIFO */
- writeb(0x0, phsu + UART_FCR);
-
- /* Set to default 115200 bps, 8n1 */
- lcr = readb(phsu + UART_LCR);
- writeb((0x80 | lcr), phsu + UART_LCR);
- writeb(0x18, phsu + UART_DLL);
- writeb(lcr, phsu + UART_LCR);
- writel(0x3600, phsu + UART_MUL*4);
-
- writeb(0x8, phsu + UART_MCR);
- writeb(0x7, phsu + UART_FCR);
- writeb(0x3, phsu + UART_LCR);
-
- /* Clear IRQ status */
- readb(phsu + UART_LSR);
- readb(phsu + UART_RX);
- readb(phsu + UART_IIR);
- readb(phsu + UART_MSR);
-
- /* Enable FIFO */
- writeb(0x7, phsu + UART_FCR);
-}
-
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
-static void early_hsu_putc(char ch)
-{
- unsigned int timeout = 10000; /* 10ms */
- u8 status;
-
- while (--timeout) {
- status = readb(phsu + UART_LSR);
- if (status & BOTH_EMPTY)
- break;
- udelay(1);
- }
-
- /* Only write the char when there was no timeout */
- if (timeout)
- writeb(ch, phsu + UART_TX);
-}
-
-static void early_hsu_write(struct console *con, const char *str, unsigned n)
-{
- int i;
-
- for (i = 0; i < n && *str; i++) {
- if (*str == '\n')
- early_hsu_putc('\r');
- early_hsu_putc(*str);
- str++;
- }
-}
-
-struct console early_hsu_console = {
- .name = "earlyhsu",
- .write = early_hsu_write,
- .flags = CON_PRINTBUFFER,
- .index = -1,
-};

drivers/dma/Kconfig

View file
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 942ca54..91eced0 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -112,6 +112,8 @@ config FSL_DMA
EloPlus is on mpc85xx and mpc86xx and Pxxx parts, and the Elo3 is on
some Txxx and Bxxx parts.
+source "drivers/dma/hsu/Kconfig"
+
config MPC512X_DMA
tristate "Freescale MPC512x built-in DMA engine support"
depends on PPC_MPC512x || PPC_MPC831x

drivers/dma/Makefile

View file
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index 539d482..7e8301c 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_DMATEST) += dmatest.o
obj-$(CONFIG_INTEL_IOATDMA) += ioat/
obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o
obj-$(CONFIG_FSL_DMA) += fsldma.o
+obj-$(CONFIG_HSU_DMA) += hsu/
obj-$(CONFIG_MPC512X_DMA) += mpc512x_dma.o
obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/
obj-$(CONFIG_MV_XOR) += mv_xor.o

drivers/dma/hsu/Kconfig

View file
diff --git a/drivers/dma/hsu/Kconfig b/drivers/dma/hsu/Kconfig
new file mode 100644
index 0000000..7e98eff
--- /dev/null
+++ b/drivers/dma/hsu/Kconfig
@@ -0,0 +1,14 @@
+# DMA engine configuration for hsu
+config HSU_DMA
+ tristate "High Speed UART DMA support"
+ select DMA_ENGINE
+ select DMA_VIRTUAL_CHANNELS
+
+config HSU_DMA_PCI
+ tristate "High Speed UART DMA PCI driver"
+ depends on PCI
+ select HSU_DMA
+ help
+ Support the High Speed UART DMA on the platfroms that
+ enumerate it as a PCI device. For example, Intel Medfield
+ has integrated this HSU DMA controller.

drivers/dma/hsu/Makefile

View file
diff --git a/drivers/dma/hsu/Makefile b/drivers/dma/hsu/Makefile
new file mode 100644
index 0000000..b8f9af0
--- /dev/null
+++ b/drivers/dma/hsu/Makefile
@@ -0,0 +1,5 @@
+obj-$(CONFIG_HSU_DMA) += hsu_dma.o
+hsu_dma-objs := hsu.o
+
+obj-$(CONFIG_HSU_DMA_PCI) += hsu_dma_pci.o
+hsu_dma_pci-objs := pci.o

drivers/dma/hsu/hsu.c

View file
diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c
new file mode 100644
index 0000000..9b84def
--- /dev/null
+++ b/drivers/dma/hsu/hsu.c
@@ -0,0 +1,495 @@
+/*
+ * Core driver for the High Speed UART DMA
+ *
+ * Copyright (C) 2015 Intel Corporation
+ * Author: Andy Shevchenko <[email protected]>
+ *
+ * Partially based on the bits found in drivers/tty/serial/mfd.c.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * DMA channel allocation:
+ * 1. Even number chans are used for DMA Read (UART TX), odd chans for DMA
+ * Write (UART RX).
+ * 2. 0/1 channel are assigned to port 0, 2/3 chan to port 1, 4/5 chan to
+ * port 3, and so on.
+ */
+
+#include <linux/delay.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+
+#include "hsu.h"
+
+#define HSU_DMA_BUSWIDTHS \
+ BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED) | \
+ BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
+ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
+ BIT(DMA_SLAVE_BUSWIDTH_3_BYTES) | \
+ BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \
+ BIT(DMA_SLAVE_BUSWIDTH_8_BYTES) | \
+ BIT(DMA_SLAVE_BUSWIDTH_16_BYTES)
+
+static inline void hsu_chan_disable(struct hsu_dma_chan *hsuc)
+{
+ hsu_chan_writel(hsuc, HSU_CH_CR, 0);
+}
+
+static inline void hsu_chan_enable(struct hsu_dma_chan *hsuc)
+{
+ u32 cr = HSU_CH_CR_CHA;
+
+ if (hsuc->direction == DMA_MEM_TO_DEV)
+ cr &= ~HSU_CH_CR_CHD;
+ else if (hsuc->direction == DMA_DEV_TO_MEM)
+ cr |= HSU_CH_CR_CHD;
+
+ hsu_chan_writel(hsuc, HSU_CH_CR, cr);
+}
+
+static void hsu_dma_chan_start(struct hsu_dma_chan *hsuc)
+{
+ struct dma_slave_config *config = &hsuc->config;
+ struct hsu_dma_desc *desc = hsuc->desc;
+ u32 bsr = 0, mtsr = 0; /* to shut the compiler up */
+ u32 dcr = HSU_CH_DCR_CHSOE | HSU_CH_DCR_CHEI;
+ unsigned int i, count;
+
+ if (hsuc->direction == DMA_MEM_TO_DEV) {
+ bsr = config->dst_maxburst;
+ mtsr = config->dst_addr_width;
+ } else if (hsuc->direction == DMA_DEV_TO_MEM) {
+ bsr = config->src_maxburst;
+ mtsr = config->src_addr_width;
+ }
+
+ hsu_chan_disable(hsuc);
+
+ hsu_chan_writel(hsuc, HSU_CH_DCR, 0);
+ hsu_chan_writel(hsuc, HSU_CH_BSR, bsr);
+ hsu_chan_writel(hsuc, HSU_CH_MTSR, mtsr);
+
+ /* Set descriptors */
+ count = (desc->nents - desc->active) % HSU_DMA_CHAN_NR_DESC;
+ for (i = 0; i < count; i++) {
+ hsu_chan_writel(hsuc, HSU_CH_DxSAR(i), desc->sg[i].addr);
+ hsu_chan_writel(hsuc, HSU_CH_DxTSR(i), desc->sg[i].len);
+
+ /* Prepare value for DCR */
+ dcr |= HSU_CH_DCR_DESCA(i);
+ dcr |= HSU_CH_DCR_CHTOI(i); /* timeout bit, see HSU Errata 1 */
+
+ desc->active++;
+ }
+ /* Only for the last descriptor in the chain */
+ dcr |= HSU_CH_DCR_CHSOD(count - 1);
+ dcr |= HSU_CH_DCR_CHDI(count - 1);
+
+ hsu_chan_writel(hsuc, HSU_CH_DCR, dcr);
+
+ hsu_chan_enable(hsuc);
+}
+
+static void hsu_dma_stop_channel(struct hsu_dma_chan *hsuc)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&hsuc->lock, flags);
+ hsu_chan_disable(hsuc);
+ hsu_chan_writel(hsuc, HSU_CH_DCR, 0);
+ spin_unlock_irqrestore(&hsuc->lock, flags);
+}
+
+static void hsu_dma_start_channel(struct hsu_dma_chan *hsuc)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&hsuc->lock, flags);
+ hsu_dma_chan_start(hsuc);
+ spin_unlock_irqrestore(&hsuc->lock, flags);
+}
+
+static void hsu_dma_start_transfer(struct hsu_dma_chan *hsuc)
+{
+ struct virt_dma_desc *vdesc;
+
+ /* Get the next descriptor */
+ vdesc = vchan_next_desc(&hsuc->vchan);
+ if (!vdesc) {
+ hsuc->desc = NULL;
+ return;
+ }
+
+ list_del(&vdesc->node);
+ hsuc->desc = to_hsu_dma_desc(vdesc);
+
+ /* Start the channel with a new descriptor */
+ hsu_dma_start_channel(hsuc);
+}
+
+static u32 hsu_dma_chan_get_sr(struct hsu_dma_chan *hsuc)
+{
+ unsigned long flags;
+ u32 sr;
+
+ spin_lock_irqsave(&hsuc->lock, flags);
+ sr = hsu_chan_readl(hsuc, HSU_CH_SR);
+ spin_unlock_irqrestore(&hsuc->lock, flags);
+
+ return sr;
+}
+
+irqreturn_t hsu_dma_irq(struct hsu_dma_chip *chip, unsigned short nr)
+{
+ struct hsu_dma_chan *hsuc;
+ struct hsu_dma_desc *desc;
+ unsigned long flags;
+ u32 sr;
+
+ /* Sanity check */
+ if (nr >= chip->pdata->nr_channels)
+ return IRQ_NONE;
+
+ hsuc = &chip->hsu->chan[nr];
+
+ /*
+ * No matter what situation, need read clear the IRQ status
+ * There is a bug, see Errata 5, HSD 2900918
+ */
+ sr = hsu_dma_chan_get_sr(hsuc);
+ if (!sr)
+ return IRQ_NONE;
+
+ /* Timeout IRQ, need wait some time, see Errata 2 */
+ if (hsuc->direction == DMA_DEV_TO_MEM && (sr & HSU_CH_SR_DESCTO_ANY))
+ udelay(2);
+
+ sr &= ~HSU_CH_SR_DESCTO_ANY;
+ if (!sr)
+ return IRQ_HANDLED;
+
+ spin_lock_irqsave(&hsuc->vchan.lock, flags);
+ desc = hsuc->desc;
+ if (desc) {
+ if (sr & HSU_CH_SR_CHE) {
+ desc->status = DMA_ERROR;
+ } else if (desc->active < desc->nents) {
+ hsu_dma_start_channel(hsuc);
+ } else {
+ vchan_cookie_complete(&desc->vdesc);
+ desc->status = DMA_COMPLETE;
+ hsu_dma_start_transfer(hsuc);
+ }
+ }
+ spin_unlock_irqrestore(&hsuc->vchan.lock, flags);
+
+ return IRQ_HANDLED;
+}
+EXPORT_SYMBOL_GPL(hsu_dma_irq);
+
+static struct hsu_dma_desc *hsu_dma_alloc_desc(unsigned int nents)
+{
+ struct hsu_dma_desc *desc;
+
+ desc = kzalloc(sizeof(*desc), GFP_NOWAIT);
+ if (!desc)
+ return NULL;
+
+ desc->sg = kcalloc(nents, sizeof(*desc->sg), GFP_NOWAIT);
+ if (!desc->sg) {
+ kfree(desc);
+ return NULL;
+ }
+
+ return desc;
+}
+
+static void hsu_dma_desc_free(struct virt_dma_desc *vdesc)
+{
+ struct hsu_dma_desc *desc = to_hsu_dma_desc(vdesc);
+
+ kfree(desc->sg);
+ kfree(desc);
+}
+
+static struct dma_async_tx_descriptor *hsu_dma_prep_slave_sg(
+ struct dma_chan *chan, struct scatterlist *sgl,
+ unsigned int sg_len, enum dma_transfer_direction direction,
+ unsigned long flags, void *context)
+{
+ struct hsu_dma_chan *hsuc = to_hsu_dma_chan(chan);
+ struct hsu_dma_desc *desc;
+ struct scatterlist *sg;
+ unsigned int i;
+
+ desc = hsu_dma_alloc_desc(sg_len);
+ if (!desc)
+ return NULL;
+
+ for_each_sg(sgl, sg, sg_len, i) {
+ desc->sg[i].addr = sg_dma_address(sg);
+ desc->sg[i].len = sg_dma_len(sg);
+ }
+
+ desc->nents = sg_len;
+ desc->direction = direction;
+ /* desc->active = 0 by kzalloc */
+ desc->status = DMA_IN_PROGRESS;
+
+ return vchan_tx_prep(&hsuc->vchan, &desc->vdesc, flags);
+}
+
+static void hsu_dma_issue_pending(struct dma_chan *chan)
+{
+ struct hsu_dma_chan *hsuc = to_hsu_dma_chan(chan);
+ unsigned long flags;
+
+ spin_lock_irqsave(&hsuc->vchan.lock, flags);
+ if (vchan_issue_pending(&hsuc->vchan) && !hsuc->desc)
+ hsu_dma_start_transfer(hsuc);
+ spin_unlock_irqrestore(&hsuc->vchan.lock, flags);
+}
+
+static size_t hsu_dma_desc_size(struct hsu_dma_desc *desc)
+{
+ size_t bytes = 0;
+ unsigned int i;
+
+ for (i = desc->active; i < desc->nents; i++)
+ bytes += desc->sg[i].len;
+
+ return bytes;
+}
+
+static size_t hsu_dma_active_desc_size(struct hsu_dma_chan *hsuc)
+{
+ struct hsu_dma_desc *desc = hsuc->desc;
+ size_t bytes = hsu_dma_desc_size(desc);
+ int i;
+ unsigned long flags;
+
+ spin_lock_irqsave(&hsuc->lock, flags);
+ i = desc->active % HSU_DMA_CHAN_NR_DESC;
+ do {

This diff is incomplete. Download the complete patch.

drivers/dma/hsu/hsu.h

View file

This diff is incomplete. Download the complete patch.

drivers/dma/hsu/pci.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/pcdp.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/hvc/hvc_opal.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/n_gsm.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250.h

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250_dw.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250_early.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250_em.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250_hp300.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250_omap.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/8250_pci.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/8250/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/amba-pl011.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/apbuart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/ar933x_uart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/atmel_serial.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/bcm63xx_uart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/bfin_uart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/clps711x.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/cpm_uart/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/cpm_uart/cpm_uart.h

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/cpm_uart/cpm_uart_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/earlycon.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/fsl_lpuart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/imx.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/jsm/jsm_cls.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/jsm/jsm_neo.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/max3100.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/mfd.c

View before deletion

This diff is incomplete. Download the complete patch.

drivers/tty/serial/mpc52xx_uart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/msm_serial.h

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/msm_serial_hs.c

View before deletion

This diff is incomplete. Download the complete patch.

drivers/tty/serial/mxs-auart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/of_serial.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/omap-serial.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/pmac_zilog.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/pxa.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/sc16is7xx.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/serial-tegra.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/serial_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/serial_mctrl_gpio.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/sh-sci.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/sirfsoc_uart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/sprd_serial.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/st-asc.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/uartlite.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/ucc_uart.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/serial/xilinx_uartps.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/tty_io.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/vt/vt.c

View file

This diff is incomplete. Download the complete patch.

drivers/tty/vt/vt_ioctl.c

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/vmlinux.lds.h

View file

This diff is incomplete. Download the complete patch.

include/linux/console.h

View file

This diff is incomplete. Download the complete patch.

include/linux/dma/hsu.h

View file

This diff is incomplete. Download the complete patch.

include/linux/platform_data/dma-hsu.h

View file

This diff is incomplete. Download the complete patch.

include/linux/platform_data/msm_serial_hs.h

View before deletion

This diff is incomplete. Download the complete patch.

include/linux/platform_data/serial-imx.h

View file

This diff is incomplete. Download the complete patch.

include/linux/serial_8250.h

View file

This diff is incomplete. Download the complete patch.

include/linux/serial_core.h

View file

This diff is incomplete. Download the complete patch.

include/linux/serial_mfd.h

View before deletion

This diff is incomplete. Download the complete patch.

include/uapi/linux/serial_reg.h

View file

This diff is incomplete. Download the complete patch.

kernel/printk/printk.c

View file

This diff is incomplete. Download the complete patch.