- syscon: Phandle to SYSCON node, which contain UART control bits.
Optional properties:
-- uart-use-ms: Indicate the UART has modem signal (DCD, DSR, CTS).
+- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD
+ line respectively.
Note: Each UART port should have an alias correctly numbered
in "aliases" node.
interrupts = <12 13>;
clocks = <&clks 11>;
syscon = <&syscon1>;
- uart-use-ms;
+ cts-gpios = <&sysgpio 0 GPIO_ACTIVE_LOW>;
+ dsr-gpios = <&sysgpio 1 GPIO_ACTIVE_LOW>;
+ dcd-gpios = <&sysgpio 2 GPIO_ACTIVE_LOW>;
};
#include <linux/mfd/syscon.h>
#include <linux/mfd/syscon/clps711x.h>
+#include "serial_mctrl_gpio.h"
+
#define UART_CLPS711X_DEVNAME "ttyCL"
#define UART_CLPS711X_NR 2
#define UART_CLPS711X_MAJOR 204
unsigned int tx_enabled;
int rx_irq;
struct regmap *syscon;
- bool use_ms;
+ struct mctrl_gpios *gpios;
};
static struct uart_driver clps711x_uart = {
static unsigned int uart_clps711x_get_mctrl(struct uart_port *port)
{
+ unsigned int result = TIOCM_DSR | TIOCM_CTS | TIOCM_CAR;
struct clps711x_port *s = dev_get_drvdata(port->dev);
- unsigned int result = 0;
-
- if (s->use_ms) {
- u32 sysflg = 0;
-
- regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg);
- if (sysflg & SYSFLG1_DCD)
- result |= TIOCM_CAR;
- if (sysflg & SYSFLG1_DSR)
- result |= TIOCM_DSR;
- if (sysflg & SYSFLG1_CTS)
- result |= TIOCM_CTS;
- } else
- result = TIOCM_DSR | TIOCM_CTS | TIOCM_CAR;
- return result;
+ return mctrl_gpio_get(s->gpios, &result);
}
static void uart_clps711x_set_mctrl(struct uart_port *port, unsigned int mctrl)
{
- /* Do nothing */
+ struct clps711x_port *s = dev_get_drvdata(port->dev);
+
+ mctrl_gpio_set(s->gpios, mctrl);
}
static void uart_clps711x_break_ctl(struct uart_port *port, int break_state)
s->syscon = syscon_regmap_lookup_by_pdevname(syscon_name);
if (IS_ERR(s->syscon))
return PTR_ERR(s->syscon);
-
- s->use_ms = !index;
} else {
s->syscon = syscon_regmap_lookup_by_phandle(np, "syscon");
if (IS_ERR(s->syscon))
return PTR_ERR(s->syscon);
-
- if (!index)
- s->use_ms = of_property_read_bool(np, "uart-use-ms");
}
s->port.line = index;
platform_set_drvdata(pdev, s);
+ s->gpios = mctrl_gpio_init(&pdev->dev, 0);
+
ret = uart_add_one_port(&clps711x_uart, &s->port);
if (ret)
return ret;