Commit bf414f55 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

serial: 8250_lpss: switch to use 8250_dwlib library

Since we have a common library module for Synopsys DesignWare UART,
let us use it.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20190806094322.64987-5-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d5675c3
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/dma/dw.h> #include <linux/dma/dw.h>
#include "8250.h" #include "8250_dwlib.h"
#define PCI_DEVICE_ID_INTEL_QRK_UARTx 0x0936 #define PCI_DEVICE_ID_INTEL_QRK_UARTx 0x0936
...@@ -48,21 +48,25 @@ struct lpss8250_board { ...@@ -48,21 +48,25 @@ struct lpss8250_board {
}; };
struct lpss8250 { struct lpss8250 {
int line; struct dw8250_port_data data;
struct lpss8250_board *board; struct lpss8250_board *board;
/* DMA parameters */ /* DMA parameters */
struct uart_8250_dma dma;
struct dw_dma_chip dma_chip; struct dw_dma_chip dma_chip;
struct dw_dma_slave dma_param; struct dw_dma_slave dma_param;
u8 dma_maxburst; u8 dma_maxburst;
}; };
static inline struct lpss8250 *to_lpss8250(struct dw8250_port_data *data)
{
return container_of(data, struct lpss8250, data);
}
static void byt_set_termios(struct uart_port *p, struct ktermios *termios, static void byt_set_termios(struct uart_port *p, struct ktermios *termios,
struct ktermios *old) struct ktermios *old)
{ {
unsigned int baud = tty_termios_baud_rate(termios); unsigned int baud = tty_termios_baud_rate(termios);
struct lpss8250 *lpss = p->private_data; struct lpss8250 *lpss = to_lpss8250(p->private_data);
unsigned long fref = lpss->board->freq, fuart = baud * 16; unsigned long fref = lpss->board->freq, fuart = baud * 16;
unsigned long w = BIT(15) - 1; unsigned long w = BIT(15) - 1;
unsigned long m, n; unsigned long m, n;
...@@ -163,7 +167,7 @@ static const struct dw_dma_platform_data qrk_serial_dma_pdata = { ...@@ -163,7 +167,7 @@ static const struct dw_dma_platform_data qrk_serial_dma_pdata = {
static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port) static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port)
{ {
struct uart_8250_dma *dma = &lpss->dma; struct uart_8250_dma *dma = &lpss->data.dma;
struct dw_dma_chip *chip = &lpss->dma_chip; struct dw_dma_chip *chip = &lpss->dma_chip;
struct dw_dma_slave *param = &lpss->dma_param; struct dw_dma_slave *param = &lpss->dma_param;
struct pci_dev *pdev = to_pci_dev(port->dev); struct pci_dev *pdev = to_pci_dev(port->dev);
...@@ -247,7 +251,7 @@ static bool lpss8250_dma_filter(struct dma_chan *chan, void *param) ...@@ -247,7 +251,7 @@ static bool lpss8250_dma_filter(struct dma_chan *chan, void *param)
static int lpss8250_dma_setup(struct lpss8250 *lpss, struct uart_8250_port *port) static int lpss8250_dma_setup(struct lpss8250 *lpss, struct uart_8250_port *port)
{ {
struct uart_8250_dma *dma = &lpss->dma; struct uart_8250_dma *dma = &lpss->data.dma;
struct dw_dma_slave *rx_param, *tx_param; struct dw_dma_slave *rx_param, *tx_param;
struct device *dev = port->port.dev; struct device *dev = port->port.dev;
...@@ -296,7 +300,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -296,7 +300,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
uart.port.dev = &pdev->dev; uart.port.dev = &pdev->dev;
uart.port.irq = pdev->irq; uart.port.irq = pdev->irq;
uart.port.private_data = lpss; uart.port.private_data = &lpss->data;
uart.port.type = PORT_16550A; uart.port.type = PORT_16550A;
uart.port.iotype = UPIO_MEM; uart.port.iotype = UPIO_MEM;
uart.port.regshift = 2; uart.port.regshift = 2;
...@@ -320,7 +324,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -320,7 +324,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (ret < 0) if (ret < 0)
goto err_exit; goto err_exit;
lpss->line = ret; lpss->data.line = ret;
pci_set_drvdata(pdev, lpss); pci_set_drvdata(pdev, lpss);
return 0; return 0;
...@@ -335,7 +339,7 @@ static void lpss8250_remove(struct pci_dev *pdev) ...@@ -335,7 +339,7 @@ static void lpss8250_remove(struct pci_dev *pdev)
{ {
struct lpss8250 *lpss = pci_get_drvdata(pdev); struct lpss8250 *lpss = pci_get_drvdata(pdev);
serial8250_unregister_port(lpss->line); serial8250_unregister_port(lpss->data.line);
if (lpss->board->exit) if (lpss->board->exit)
lpss->board->exit(lpss); lpss->board->exit(lpss);
......
...@@ -444,6 +444,7 @@ config SERIAL_8250_LPSS ...@@ -444,6 +444,7 @@ config SERIAL_8250_LPSS
default SERIAL_8250 default SERIAL_8250
depends on SERIAL_8250 && PCI depends on SERIAL_8250 && PCI
depends on X86 || COMPILE_TEST depends on X86 || COMPILE_TEST
select SERIAL_8250_DWLIB
select DW_DMAC_CORE if SERIAL_8250_DMA select DW_DMAC_CORE if SERIAL_8250_DMA
select DW_DMAC_PCI if (SERIAL_8250_DMA && X86_INTEL_LPSS) select DW_DMAC_PCI if (SERIAL_8250_DMA && X86_INTEL_LPSS)
select RATIONAL select RATIONAL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment