Skip to contentSkip to conversation

serial: qcom_geni_serial: To correct QUP Version detection logic

PATCH Superseded Paras Sharma 3 participants 3 messages Sep 14, 2020 – Sep 16, 2020

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 serial: qcom_geni_serial: To correct QUP Version detection logic

The current implementation reduces the sampling rate by half if qup HW version is greater is than 2.5 by checking if the geni SE major version is greater than 2 and geni SE minor version is greater than 5.This implementation fails when the version is greater than or equal to 3.

Hence, a new macro QUP_SE_VERSION_2_5 is defined having value for major number 2 and minor number 5 as 0x20050000.Hence,if ver is greater than this value,sampling rate is halved. This logic would work for any future qup version.

Fixes ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate")

---
Changes in V4:
Created a new macro QUP_SE_VERSION_2_5 for Qup se version 2.5

 drivers/tty/serial/qcom_geni_serial.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/qcom_geni_serial.c +4 -1
index f0b1b47..9b74b1e 100644
@@ -106,6 +106,9 @@
 /* We always configure 4 bytes per FIFO word */
 #define BYTES_PER_FIFO_WORD		4
 
+/* QUP SE VERSION value for major number 2 and minor number 5 */
+#define QUP_SE_VERSION_2_5                  0x20050000
+
 struct qcom_geni_private_data {
 	/* NOTE: earlycon port will have NULL here */
 	struct uart_driver *drv;
@@ -1000,7 +1003,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
 	sampling_rate = UART_OVERSAMPLING;
 	/* Sampling rate is halved for IP versions >= 2.5 */
 	ver = geni_se_get_qup_hw_version(&port->se);
-	if (GENI_SE_VERSION_MAJOR(ver) >= 2 && GENI_SE_VERSION_MINOR(ver) >= 5)
+	if (ver >= QUP_SE_VERSION_2_5)
 		sampling_rate /= 2;
 
 	clk_rate = get_clk_div_rate(baud, sampling_rate, &clk_div);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

Hi Paras,

Quoted 10 lines · Paras Sharma

The current implementation reduces the sampling rate by half if qup HW version is greater is than 2.5 by checking if the geni SE major version is greater than 2 and geni SE minor version is greater than 5.This implementation fails when the version is greater than or equal to 3.

Hence, a new macro QUP_SE_VERSION_2_5 is defined having value for major number 2 and minor number 5 as 0x20050000.Hence,if ver is greater than this value,sampling rate is halved. This logic would work for any future qup version.

Can we rewrite commit message something like below:

For QUP IP versions 2.5 and above the oversampling rate is halved from 32 to 16.

Commit ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate") is pushed to handle this scenario.

But the existing logic is failing to classify QUP 3.0 to correct group ( 2.5 and above).

As result SE clocks are not configured properly for baud rate and garbage data is sampled to FIFOs from the line.

So, fix the logic to detect QUP with versions 2.5 and above.

Quoted 6 lines
Fixes ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate")

---
Changes in V4:
Created a new macro QUP_SE_VERSION_2_5 for Qup se version 2.5

You can mention changes in V3 and V2 here.

Quoted 9 lines
  drivers/tty/serial/qcom_geni_serial.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/qcom_geni_serial.c +0 -0
index f0b1b47..9b74b1e 100644

drivers/tty/serial/qcom_geni_serial.c line 111

Quoted 6 lines
drivers/tty/serial/qcom_geni_serial.c +3 -0
@@ -106,6 +106,9 @@
  /* We always configure 4 bytes per FIFO word */
  #define BYTES_PER_FIFO_WORD		4
 
+/* QUP SE VERSION value for major number 2 and minor number 5 */
+#define QUP_SE_VERSION_2_5                  0x20050000
+

How about moving this Macro to common header, qcom-geni-se.h so that if needed other QUP driver also can use it.

Regards,

Akash

Quoted 12 lines
drivers/tty/serial/qcom_geni_serial.c +1 -1
  struct qcom_geni_private_data {
  	/* NOTE: earlycon port will have NULL here */
  	struct uart_driver *drv;
@@ -1000,7 +1003,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
  	sampling_rate = UART_OVERSAMPLING;
  	/* Sampling rate is halved for IP versions >= 2.5 */
  	ver = geni_se_get_qup_hw_version(&port->se);
-	if (GENI_SE_VERSION_MAJOR(ver) >= 2 && GENI_SE_VERSION_MINOR(ver) >= 5)
+	if (ver >= QUP_SE_VERSION_2_5)
  		sampling_rate /= 2;
 
  	clk_rate = get_clk_div_rate(baud, sampling_rate, &clk_div);
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
#2 lore raw
In reply to Paras Sharma
Quoted 2 lines · Paras Sharma

The current implementation reduces the sampling rate by half if qup HW version is greater is than 2.5 by checking if the

2 space characters?

And what is "qup"?

What is "HW"?

Quoted 1 line

geni SE major version is greater than 2 and geni SE minor version

what is "geni"?

What is "SE"?

Quoted 5 lines

is greater than 5.This implementation fails when the version is greater than or equal to 3.

Hence, a new macro QUP_SE_VERSION_2_5 is defined having value for major number 2 and minor number 5 as 0x20050000.Hence,if

That's not a "macro", it is a simple #define.

And can you use a ' ' after a '.' please? That's all over this changelog, including trailing whitespace for some reason :(

Quoted 2 lines

ver is greater than this value,sampling rate is halved. This logic would work for any future qup version.

"will work"?

Quoted 7 lines
Fixes ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate")

---
Changes in V4:
Created a new macro QUP_SE_VERSION_2_5 for Qup se version 2.5

What changed from previous versions than v4?

thanks,

greg k-h