Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1960824pxk; Mon, 14 Sep 2020 00:20:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwBonVEKnd0LL/60eR+eP9TtvCKGl/YPmy0qDHyfAPp1uWZ1q0ocwpdV/sfXnU/K8So3HP X-Received: by 2002:a17:906:6ce:: with SMTP id v14mr12940644ejb.451.1600068054731; Mon, 14 Sep 2020 00:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600068054; cv=none; d=google.com; s=arc-20160816; b=nL1Wcqk2wFh2mbIlQnJlqU0lAkYupZdTw5DYIPZne9UNAvqXdOp57wb0wqrwoP9aLz npjAf7MkRU6FDYQkJy1LtNgVCurY/afDlQ5wrsyW0pffvllxmHjobpJigq7xOYWSelKY zCxxYLk+S/TWYe/YfchQnz7DDbbS17V6GBN+zxAv0QL0u6FRSRv28pvG6T3cUAsJGf5J Su+mQgKgaNObYDbgPXvNdoaYK9IihQ/FFTAEmu+gyuHFtO3RF4wTIuP31oeJIXpRDfPY VZgk8mUI2jyLm7OUj7S2oO6BXBSVFfuKIJommdagpPmizWXQTYI+uMpVKok2i4M9eMdn 6uDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=MAgxK0vnTi7hs4N1UVsYiUnbZRwaOJ9LfXr07IkamZk=; b=X/0cOA2/XrtX29FryUW8E5TRkwiNbUs3ARSGy7xHLxiBaKFZZ/zz9tB87jLVJGguHs CParrJirF/OIob7hrGt8gWJnZHoBpZ9ji5O0wFfhjjXic92H+dOMvBKYAHflZtxVczaH 3d+VDBRgrOcbjq/U2Ezg1yaBZ5BXkVtES3JHuC79uARqd4IARz94SvhNyq5ucz/wWaqA xixbPCjtLy5bkQHUMp9gbZw7TiHSqbb1evDAYWySHHhwZ+wLp8eGq4MSxIMpW+uSq/aQ w0oXoQ2xpUrMq2mGP60jJvjoGCY1HgaPEYYrcm9EwoaCBQDscPgodVT6Y3fRiy4JWdYD 1hoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si7386180edj.132.2020.09.14.00.20.32; Mon, 14 Sep 2020 00:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725992AbgINHTr (ORCPT + 99 others); Mon, 14 Sep 2020 03:19:47 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:44463 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbgINHTq (ORCPT ); Mon, 14 Sep 2020 03:19:46 -0400 Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 14 Sep 2020 00:19:44 -0700 Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 14 Sep 2020 00:19:43 -0700 Received: from parashar-linux.qualcomm.com ([10.206.13.63]) by ironmsg01-blr.qualcomm.com with ESMTP; 14 Sep 2020 12:49:28 +0530 Received: by parashar-linux.qualcomm.com (Postfix, from userid 2363307) id 8AA7D215D8; Mon, 14 Sep 2020 12:49:27 +0530 (IST) From: Paras Sharma To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, akashast@codeaurora.org, Paras Sharma Subject: [PATCH V4] serial: qcom_geni_serial: To correct QUP Version detection logic Date: Mon, 14 Sep 2020 12:49:17 +0530 Message-Id: <1600067957-8216-1-git-send-email-parashar@codeaurora.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") Signed-off-by: Paras Sharma --- 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(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index f0b1b47..9b74b1e 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -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); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation