Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2815075pxk; Mon, 28 Sep 2020 00:03:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygOojMxhX+HVFzbv25MUmVGchlhXyryzB5B7CMna3TaIfaryKKL8jIf9zXTTRrBXmDIRnM X-Received: by 2002:a17:906:29ca:: with SMTP id y10mr277253eje.327.1601276633700; Mon, 28 Sep 2020 00:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601276633; cv=none; d=google.com; s=arc-20160816; b=Rc0KmU/lygHOJHLQSFEZzMzlRIq5HZ9cIZfrObEjJd9cVcCP+P6dTx5plFJCGpIow5 L9wnBOqeR2s4hyi1Pvu7Ap8RuVj3p3ATYi5NZFkk+TI1oLDEeHrQ2ePZIjKSqezT9Hdk mv8AGMSrUmnTelkqlAWREXhZLo0Maw8UB4c89Uo2NWkGJRml4J1dHbnzYfVquUT7Wadz JloOcM2Aho93NMEIhsGMKq1oLKhzfE3a2bKG84GBb3u0WztsiJ/X6Awkz73JDwAhwQJe EOkO7UQJaqf2QEjUjmljdP4y+3F4KfaRhlQvSP8IgpH6PR8B5i9BkK6jBm5BI/P3TTln jM9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=/JyZ8d5a99iI9oGOJYvuVD4+DHu38C9eH3IJHCRQyKE=; b=dHcqQEjh3s+Y3J06DtZ/gMaKCJLyeY+QTQh60nYFqrWjUvl+0U/uaIMZfgPTszFbnE /N7MtJUCGsH2ZOesPk5eQFpDrJ6z6K/p1MkXPWOn/G+mt1/cCtOPO4FdhBgpFZEfI8k/ g+/7/wknwXi3lJ1Pj67aaa5HmAktCKBpsh+OL2Z+Mj7/DXiXw6hugYiTtbQMw/2KP5EZ cU69Q0BNr0UaN4jTAvSHXohbqdWKMJ1J2HSLFUjmtZ51Oq6NY5JcGPSA52v91mgvCDOu vHqrZcLz7BlCHBQpTXAAs+Yy1gdkCqvthLqMVZWntlV7hLJjTW9NO9VE6vaWwjrvisG3 zELA== 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 g8si53581ejm.389.2020.09.28.00.03.30; Mon, 28 Sep 2020 00:03:53 -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 S1726588AbgI1G76 (ORCPT + 99 others); Mon, 28 Sep 2020 02:59:58 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:19494 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbgI1G75 (ORCPT ); Mon, 28 Sep 2020 02:59:57 -0400 Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 27 Sep 2020 23:59:57 -0700 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 27 Sep 2020 23:59:55 -0700 X-QCInternal: smtphost Received: from parashar-linux.qualcomm.com ([10.206.13.63]) by ironmsg01-blr.qualcomm.com with ESMTP; 28 Sep 2020 12:29:42 +0530 Received: by parashar-linux.qualcomm.com (Postfix, from userid 2363307) id 5CC332162F; Mon, 28 Sep 2020 12:29:41 +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 V5] serial: qcom_geni_serial: To correct QUP Version detection logic Date: Mon, 28 Sep 2020 12:29:38 +0530 Message-Id: <1601276378-4325-1-git-send-email-parashar@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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