Skip to contentSkip to conversation

tty: serial: qcom_geni_serial: Configure UART_IO_MACRO_CTRL register

PATCH In review Roja Rani Yarubandi 4 participants 5 messages Jan 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover tty: serial: qcom_geni_serial: Configure UART_IO_MACRO_CTRL register

Configure UART_IO_MACRO_CTRL register if UART lines are swapped.

Roja Rani Yarubandi (1):
tty: serial: qcom_geni_serial: Configure UART_IO_MACRO_CTRL register

 drivers/tty/serial/qcom_geni_serial.c | 6 ++++++
 1 file changed, 6 insertions(+)
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of the Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

PATCH v2 1/1 tty: serial: qcom_geni_serial: Configure UART_IO_MACRO_CTRL register

Configure UART_IO_MACRO_CTRL register if UART lines are swapped.

---
 drivers/tty/serial/qcom_geni_serial.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/tty/serial/qcom_geni_serial.c +6 -0
index ff63728a95f4..24b862937c1e 100644
@@ -24,6 +24,7 @@
 
 /* UART specific GENI registers */
 #define SE_UART_LOOPBACK_CFG		0x22c
+#define SE_UART_IO_MACRO_CTRL		0x240
 #define SE_UART_TX_TRANS_CFG		0x25c
 #define SE_UART_TX_WORD_LEN		0x268
 #define SE_UART_TX_STOP_BIT_LEN		0x26c
@@ -1260,6 +1261,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 	int irq;
 	bool console = false;
 	struct uart_driver *drv;
+	u32 val;
 
 	if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart"))
 		console = true;
@@ -1309,6 +1311,10 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 		return irq;
 	uport->irq = irq;
 
+	ret = of_property_read_u32(pdev->dev.of_node, "qcom,pin_inverse", &val);
+	if (!ret)
+		writel(val, uport->membase + SE_UART_IO_MACRO_CTRL);
+
 	irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
 	ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
 			IRQF_TRIGGER_HIGH, port->name, uport);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of the Code Aurora Forum, hosted by The Linux Foundation
#2 lore raw
Quoted 6 lines · Roja Rani Yarubandi

Configure UART_IO_MACRO_CTRL register if UART lines are swapped.

---
 drivers/tty/serial/qcom_geni_serial.c | 6 ++++++
 1 file changed, 6 insertions(+)

What changed from v1? Always put that below the --- line.

And no need for a 0/1 email for a single patch, just put everything in the patch changelog itself as it is standalone.

thanks,

greg k-h

#3 lore raw
In reply to Roja Rani Yarubandi
Quoted 28 lines · Roja Rani Yarubandi

Configure UART_IO_MACRO_CTRL register if UART lines are swapped.

---
 drivers/tty/serial/qcom_geni_serial.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/tty/serial/qcom_geni_serial.c +2 -0
index ff63728a95f4..24b862937c1e 100644
@@ -24,6 +24,7 @@
 
 /* UART specific GENI registers */
 #define SE_UART_LOOPBACK_CFG		0x22c
+#define SE_UART_IO_MACRO_CTRL		0x240
 #define SE_UART_TX_TRANS_CFG		0x25c
 #define SE_UART_TX_WORD_LEN		0x268
 #define SE_UART_TX_STOP_BIT_LEN		0x26c
@@ -1260,6 +1261,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 	int irq;
 	bool console = false;
 	struct uart_driver *drv;
+	u32 val;
 
 	if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart"))
 		console = true;

drivers/tty/serial/qcom_geni_serial.c static int qcom_geni_serial_probe(struct platform_device *pdev) · line 1314

Quoted 4 lines
drivers/tty/serial/qcom_geni_serial.c +1 -0
@@ -1309,6 +1311,10 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 		return irq;
 	uport->irq = irq;
 
+	ret = of_property_read_u32(pdev->dev.of_node, "qcom,pin_inverse", &val);

This needs to be documented in the DT binding document. And I assume it's better suited as a bool property to be read using of_property_read_bool().

Also avoid '_' in property names and make it a '-'.

Regards,
Bjorn

Quoted 10 lines
drivers/tty/serial/qcom_geni_serial.c +3 -0
+	if (!ret)
+		writel(val, uport->membase + SE_UART_IO_MACRO_CTRL);
+
 	irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
 	ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
 			IRQF_TRIGGER_HIGH, port->name, uport);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of the Code Aurora Forum, hosted by The Linux Foundation
#4 lore raw
In reply to Roja Rani Yarubandi

Hi Roja,

Quoted 1 line · Roja Rani Yarubandi

subject: tty: serial: qcom_geni_serial: Configure UART_IO_MACRO_CTRL register

Something like 'Support pin swapping' would be more useful.

Quoted 28 lines

Configure UART_IO_MACRO_CTRL register if UART lines are swapped.

---
 drivers/tty/serial/qcom_geni_serial.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/tty/serial/qcom_geni_serial.c +2 -0
index ff63728a95f4..24b862937c1e 100644
@@ -24,6 +24,7 @@
 
 /* UART specific GENI registers */
 #define SE_UART_LOOPBACK_CFG		0x22c
+#define SE_UART_IO_MACRO_CTRL		0x240
 #define SE_UART_TX_TRANS_CFG		0x25c
 #define SE_UART_TX_WORD_LEN		0x268
 #define SE_UART_TX_STOP_BIT_LEN		0x26c
@@ -1260,6 +1261,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 	int irq;
 	bool console = false;
 	struct uart_driver *drv;
+	u32 val;
 
 	if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart"))
 		console = true;

drivers/tty/serial/qcom_geni_serial.c static int qcom_geni_serial_probe(struct platform_device *pdev) · line 1317

Quoted 7 lines
drivers/tty/serial/qcom_geni_serial.c +4 -0
@@ -1309,6 +1311,10 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 		return irq;
 	uport->irq = irq;
 
+	ret = of_property_read_u32(pdev->dev.of_node, "qcom,pin_inverse", &val);
+	if (!ret)
+		writel(val, uport->membase + SE_UART_IO_MACRO_CTRL);
+

Which pins are/can be inversed only RX/TX or also CTS/RTS? If both pairs can be inversed individually it would be nice to support that.

As Bjorn commented, it's probably better to have boolean properties and keep the magic values in the driver.