Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1985179pxx; Sat, 31 Oct 2020 04:52:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycq11crIXj+ZxBUFljFf/hzhjKidiqYAW4bjmw3WY7wEOgFUXHsEoKwkxdKUE8pClAKz2/ X-Received: by 2002:aa7:c683:: with SMTP id n3mr7063842edq.146.1604145159041; Sat, 31 Oct 2020 04:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604145159; cv=none; d=google.com; s=arc-20160816; b=HF9sFc8sRL3HYNmG7r9oChx+xDw97zjItbKwO2IkoYYbQ/z3zMUpFieuXre7dewj12 T9a+FgcWhHdN0nkn2xfCDyublXkyBub4G9njXyW7jpxnl7Mf94nx1tvcJzxVQscIM5Wg WzOoLLfvrR4xoK5XUiEnnuN8jpRzml9WcJCiiftbry8Yv85/MPnuAYXdfAusU0txy+8D cnP1Zd+mYh4aZzNr9bXXlcqmg9kYtEnMCEZBosrUtgyP3LCX+GOUGA+n6YsRTTq8HWFA bLAJV07/b6x63i5Tl95t1GVsTWRs/lOw9EwsdatkVGdxTXsciv4nHL6UoKioxibyzMmr 4Zlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PjY1tz4/9HBGQYrEOKz4M1anH919Qrx3gQmfHd4FcIo=; b=qDMyTLy3FHsSmT7TlHwZPibEWSX210/x6Mvdu5iharsNbAKi6rq1tvvs5uCNO1J7qa cKVQUKvARplD+yOkV3STdREPZFT04lNWij7W3qza8F5mVJYf95EqJN9pjJfUMtJNB8nm cOSk4WU/Fl50BJ3lDsNGC73epqiBShG0Ww0BrlkevlGzrsWZN4Bp3F+v1ZVrZvaJr3N4 6YDQkwy1tApDeFMnwVimgoxUYO7btP5T04rnB9FPqDJRa+kbbZMJS/656LAiVhjI+TB7 J8ffdW/l7BQ3lCUUejM1wjhB9ibMBt+21mZJNraoAJAU2zqBnu7NkIDRxbTl7dgI7h/W 0Bng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Ploo/Ixu"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce24si3125758edb.279.2020.10.31.04.52.16; Sat, 31 Oct 2020 04:52:39 -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; dkim=pass header.i=@kernel.org header.s=default header.b="Ploo/Ixu"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727372AbgJaLt0 (ORCPT + 99 others); Sat, 31 Oct 2020 07:49:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:42168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbgJaLme (ORCPT ); Sat, 31 Oct 2020 07:42:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A68C2206D5; Sat, 31 Oct 2020 11:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144554; bh=Py3exZaPTOyxbs/1mseBYlDqZei1FpyWXwSXtBTBpzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ploo/IxuKpwkK6Yzogf9LsqKyLOpVCQsvW1LDy+j++RbiXorsXwO7fpo5+92uxj8e 8XdPEDMZxRYi3BBTOLUIQUGgqr2o2XC5H9YGuWzJ70535eki7MCUYgPFnVbelKg7EX 2ad75W8iCIIf5kMpb/Vv17zASDiFvykvnWf8IJVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paras Sharma , Akash Asthana Subject: [PATCH 5.8 63/70] serial: qcom_geni_serial: To correct QUP Version detection logic Date: Sat, 31 Oct 2020 12:36:35 +0100 Message-Id: <20201031113502.510767215@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113459.481803250@linuxfoundation.org> References: <20201031113459.481803250@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paras Sharma commit c9ca43d42ed8d5fd635d327a664ed1d8579eb2af upstream. 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") Cc: stable Signed-off-by: Paras Sharma Reviewed-by: Akash Asthana Link: https://lore.kernel.org/r/1601445926-23673-1-git-send-email-parashar@codeaurora.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/qcom_geni_serial.c | 2 +- include/linux/qcom-geni-se.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -954,7 +954,7 @@ static void qcom_geni_serial_set_termios 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); --- a/include/linux/qcom-geni-se.h +++ b/include/linux/qcom-geni-se.h @@ -229,6 +229,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 + #if IS_ENABLED(CONFIG_QCOM_GENI_SE) u32 geni_se_get_qup_hw_version(struct geni_se *se);