Linux-Serial Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH V5] serial: qcom_geni_serial: To correct QUP Version detection logic
@ 2020-09-28  6:59 Paras Sharma
  2020-09-28  7:01 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Paras Sharma @ 2020-09-28  6:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, linux-arm-msm, linux-serial, linux-kernel, akashast,
	Paras Sharma

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 Version 3.0 into
the correct group ( 2.5 and above).

As result Serial Engine 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.

Fixes: ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate")
Signed-off-by: Paras Sharma <parashar@codeaurora.org>
---
Changes in V5:
Moved QUP_SE_VERSION_2_5 to common header file qcom-geni-se.h

Changes in V4:
Created a new #define QUP_SE_VERSION_2_5 for Qup serial engine having version 2.5

Changes in V3:
Replaced the condition for detecting Qup version(2.5 or greater) with value 0x20050000

Changes in V2:
Changed subject line and logic for checking Qup version

 drivers/tty/serial/qcom_geni_serial.c | 3 ++-
 include/linux/qcom-geni-se.h          | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index f0b1b47..198ecdd7 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -106,6 +106,7 @@
 /* We always configure 4 bytes per FIFO word */
 #define BYTES_PER_FIFO_WORD		4
 
+
 struct qcom_geni_private_data {
 	/* NOTE: earlycon port will have NULL here */
 	struct uart_driver *drv;
@@ -1000,7 +1001,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);
diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h
index 8f385fb..1c31f26 100644
--- a/include/linux/qcom-geni-se.h
+++ b/include/linux/qcom-geni-se.h
@@ -248,6 +248,9 @@ struct geni_se {
 #define GENI_SE_VERSION_MINOR(ver) ((ver & HW_VER_MINOR_MASK) >> HW_VER_MINOR_SHFT)
 #define GENI_SE_VERSION_STEP(ver) (ver & HW_VER_STEP_MASK)
 
+/* QUP SE VERSION value for major number 2 and minor number 5 */
+#define QUP_SE_VERSION_2_5                  0x20050000
+
 /*
  * Define bandwidth thresholds that cause the underlying Core 2X interconnect
  * clock to run at the named frequency. These baseline values are recommended
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH V5] serial: qcom_geni_serial: To correct QUP Version detection logic
  2020-09-28  6:59 [PATCH V5] serial: qcom_geni_serial: To correct QUP Version detection logic Paras Sharma
@ 2020-09-28  7:01 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2020-09-28  7:01 UTC (permalink / raw)
  To: Paras Sharma
  Cc: Jiri Slaby, linux-arm-msm, linux-serial, linux-kernel, akashast

On Mon, Sep 28, 2020 at 12:29:38PM +0530, Paras Sharma wrote:
> 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 Version 3.0 into
> the correct group ( 2.5 and above).
> 
> As result Serial Engine 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.
> 
> Fixes: ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate")
> Signed-off-by: Paras Sharma <parashar@codeaurora.org>
> ---
> Changes in V5:
> Moved QUP_SE_VERSION_2_5 to common header file qcom-geni-se.h
> 
> Changes in V4:
> Created a new #define QUP_SE_VERSION_2_5 for Qup serial engine having version 2.5
> 
> Changes in V3:
> Replaced the condition for detecting Qup version(2.5 or greater) with value 0x20050000
> 
> Changes in V2:
> Changed subject line and logic for checking Qup version
> 
>  drivers/tty/serial/qcom_geni_serial.c | 3 ++-
>  include/linux/qcom-geni-se.h          | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index f0b1b47..198ecdd7 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -106,6 +106,7 @@
>  /* We always configure 4 bytes per FIFO word */
>  #define BYTES_PER_FIFO_WORD		4
>  
> +
>  struct qcom_geni_private_data {
>  	/* NOTE: earlycon port will have NULL here */
>  	struct uart_driver *drv;

Unneeded change :(



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28  6:59 [PATCH V5] serial: qcom_geni_serial: To correct QUP Version detection logic Paras Sharma
2020-09-28  7:01 ` Greg Kroah-Hartman

Linux-Serial Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-serial/0 linux-serial/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-serial linux-serial/ https://lore.kernel.org/linux-serial \
		linux-serial@vger.kernel.org
	public-inbox-index linux-serial

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-serial


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git