@@ -35,6 +35,8 @@
#define UARTDM_MR2 0x04
#define UARTDM_CSR 0xA0
+#define MSM_UART_MR1_RX_RDY_CTL BIT(7)
+
#define UARTDM_SR 0xA4 /* Status register */
#define UARTDM_SR_RX_READY (1 << 0) /* Word is the receiver FIFO */
#define UARTDM_SR_TX_EMPTY (1 << 3) /* Transmitter underrun */
@@ -193,13 +195,18 @@ static int msm_uart_clk_init(struct udevice *dev)
return 0;
}
-static void uart_dm_init(struct msm_serial_data *priv)
+static void uart_dm_init(struct msm_serial_data *priv, bool is_rs232)
{
/* Delay initialization for a bit to let pins stabilize if necessary */
mdelay(5);
writel(priv->clk_bit_rate, priv->base + UARTDM_CSR);
- writel(0x0, priv->base + UARTDM_MR1);
+
+ if (is_rs232)
+ writel(MSM_UART_MR1_RX_RDY_CTL, priv->base + UARTDM_MR1);
+ else
+ writel(0x0, priv->base + UARTDM_MR1);
+
writel(MSM_BOOT_UART_DM_8_N_1_MODE, priv->base + UARTDM_MR2);
writel(MSM_BOOT_UART_DM_CMD_RESET_RX, priv->base + UARTDM_CR);
writel(MSM_BOOT_UART_DM_CMD_RESET_TX, priv->base + UARTDM_CR);
@@ -212,6 +219,7 @@ static int msm_serial_probe(struct udevice *dev)
int ret;
struct msm_serial_data *priv = dev_get_priv(dev);
struct gpio_desc rs232_0, rs232_1;
+ bool is_rs232 = false;
/* No need to reinitialize the UART after relocation */
if (gd->flags & GD_FLG_RELOC)
@@ -221,13 +229,15 @@ static int msm_serial_probe(struct udevice *dev)
if (ret)
return ret;
- if (!gpio_request_by_name(dev, "gpios", 0, &rs232_0, GPIOD_IS_OUT))
+ if (!gpio_request_by_name(dev, "gpios", 0, &rs232_0, GPIOD_IS_OUT)) {
dm_gpio_set_value(&rs232_0, 1);
+ is_rs232 = true;
+ }
if (!gpio_request_by_name(dev, "gpios", 1, &rs232_1, GPIOD_IS_OUT))
dm_gpio_set_value(&rs232_1, 0);
pinctrl_select_state(dev, "uart");
- uart_dm_init(priv);
+ uart_dm_init(priv, is_rs232);
return 0;
}
SE HMIBSC board debug console requires RS232 flow control, so enable corresponding support if RS232 gpios are present. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> --- drivers/serial/serial_msm.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)