mirror of
https://github.com/torvalds/linux.git
synced 2026-04-25 18:12:26 -04:00
The Synopsys DesignWare UART can be configured to have HW support for the RS485 protocol from IP version 4.0 onward. Add support for hardware-controlled half duplex and full duplex modes. HW will take care of managing DE and RE, the driver just gives it permission to use either by setting both to 1. To ask for full duplex mode, userspace sets SER_RS485_RX_DURING_TX flag and HW will take care of the rest. Set delay_rts_before_send and delay_rts_after_send to zero for now. The granularity of that ABI is too coarse to be useful. Co-developed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Co-developed-by: Raymond Tan <raymond.tan@intel.com> Signed-off-by: Raymond Tan <raymond.tan@intel.com> Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20220426122448.38997-2-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/* Synopsys DesignWare 8250 library header file. */
|
|
|
|
#include <linux/io.h>
|
|
#include <linux/notifier.h>
|
|
#include <linux/types.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
#include "8250.h"
|
|
|
|
struct clk;
|
|
struct reset_control;
|
|
|
|
struct dw8250_port_data {
|
|
/* Port properties */
|
|
int line;
|
|
|
|
/* DMA operations */
|
|
struct uart_8250_dma dma;
|
|
|
|
/* Hardware configuration */
|
|
u8 dlf_size;
|
|
|
|
/* RS485 variables */
|
|
bool hw_rs485_support;
|
|
};
|
|
|
|
struct dw8250_platform_data {
|
|
u8 usr_reg;
|
|
u32 cpr_val;
|
|
unsigned int quirks;
|
|
};
|
|
|
|
struct dw8250_data {
|
|
struct dw8250_port_data data;
|
|
const struct dw8250_platform_data *pdata;
|
|
|
|
int msr_mask_on;
|
|
int msr_mask_off;
|
|
struct clk *clk;
|
|
struct clk *pclk;
|
|
struct notifier_block clk_notifier;
|
|
struct work_struct clk_work;
|
|
struct reset_control *rst;
|
|
|
|
unsigned int skip_autocfg:1;
|
|
unsigned int uart_16550_compatible:1;
|
|
};
|
|
|
|
void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, struct ktermios *old);
|
|
void dw8250_setup_port(struct uart_port *p);
|
|
|
|
static inline struct dw8250_data *to_dw8250_data(struct dw8250_port_data *data)
|
|
{
|
|
return container_of(data, struct dw8250_data, data);
|
|
}
|
|
|
|
static inline u32 dw8250_readl_ext(struct uart_port *p, int offset)
|
|
{
|
|
if (p->iotype == UPIO_MEM32BE)
|
|
return ioread32be(p->membase + offset);
|
|
return readl(p->membase + offset);
|
|
}
|
|
|
|
static inline void dw8250_writel_ext(struct uart_port *p, int offset, u32 reg)
|
|
{
|
|
if (p->iotype == UPIO_MEM32BE)
|
|
iowrite32be(reg, p->membase + offset);
|
|
else
|
|
writel(reg, p->membase + offset);
|
|
}
|