From patchwork Wed Jul 3 11:25:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 13722111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB5BCC30653 for ; Wed, 3 Jul 2024 11:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=A+2MqGa7e9k/H+mBR0AcQlM4kYrNvHVCP7g1hxy4Qxw=; b=bcN5RKFeHoFBpia05EdYpkKxip ms/HWFBButYjUWCfg0BhcFTxDG023cV3XjQMZTKeHlnJqq/lIzT0Nig9tm/L09/HO2msFPtmOTbn9 jUSNA/szZ88dSAL+NMgAelfqmXgAoDFnjz9s2bNPbtzkn9Hnz8eovjtWeMwI3H9KzjY114Lzs+TaL T8qds4SBiVeCroYQD4zKs+hbMQzSGh8xulIls4DmcgfZSldXzrr0NIyU/+Q5vtGKUg8GL0UQR8ta4 jMbnrfB+6icZdod9OQJD4vPWS4T9n1HR5Qk38uNsUHVJKpd1E9jWRYZjmuENrv5k8jy/NvwWR1YgV lGDQtFsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOy85-0000000A0cB-2GIX; Wed, 03 Jul 2024 11:26:32 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOy7t-0000000A0bf-15hh for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 11:26:18 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2ec6635aa43so52352781fa.1 for ; Wed, 03 Jul 2024 04:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720005975; x=1720610775; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=A+2MqGa7e9k/H+mBR0AcQlM4kYrNvHVCP7g1hxy4Qxw=; b=eOPWV6pyjTO7YP00IBCzyfAKHwvDc1uK7bs+HV4Xiv/eKXwRr3XU0GwoXTO5McuAvX JraoAcx4zfqaqmvzMh6Ow3VC0+5xBbVPn6EaoCTIE/9IeeIwCCrbOp+agmSMFwazHrX2 B4tQgtsqpVyE+XQwEN7mPDO1dCZ+UbuviG3MSGnXCoDKmlYgqLQfMX1ZeWqcpkmKgoSP QPmF1l1z32VBX6YAZHAhUeUbhFSHREDB9Wc9mD2R7E5GQyljBUJtSId8zEIvuNNWs7o9 AhJOvCfetCwVnfA9IzL+2ahuMgDpfFi5LxfJfuTzSoLXPJxLlOyVh5lBcDasOY9g0e4D RoVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720005975; x=1720610775; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A+2MqGa7e9k/H+mBR0AcQlM4kYrNvHVCP7g1hxy4Qxw=; b=qRV6EQqDWjlzDsLVRGrTmVJmsbVsrI1vBMMnCWNQSK9wbrOoGpuKHsermM5sBmc1sg 24uewsiAXGkaoqU3M9eMvFafNJJ4Wn5j9nBjFLPTtHSPPozvQO7ksO3s/twaUdbp8Z+q dlKK/n/JxbRP1vN73VSNtsqye5dtBG5uB1SnI3SxYGgV8KdJ2Vz4fdqYY/sK2xb16SPj 0UlYr3hkV8k8GFpMhPJ3FtSrXD50j0r2JQDsbW7bDWSZcfwa/zYhK0zLzFNY5kQKN+Od aZVUvciasR04WxNx5Jit8kh2Hm8KqifE0YUdecKOvltPpJz2Zy92MD/wc1t+pobmwpho v30A== X-Forwarded-Encrypted: i=1; AJvYcCUtZpelZyBbol2Bl3k8vTRfyY+CxQf7QR4y88T2vCioeRxxRK6xlqF4C2eo9jT7L/WgjGxQALWmsq8jPj/VcbKnTtJXdLJPNAEBogWXtv2tlTSo/kk= X-Gm-Message-State: AOJu0Yxf6oIya/Aa5lavHqNta8fEHRAMnLPgs4TF8VlQXVPgBzWfDxbJ SJzFTJVOpn1v4m6oIn88jdxF12e3+IAEOf+3ptk2JPSnxJoewN0lxn6ho/W9 X-Google-Smtp-Source: AGHT+IEJXFekNY3fsB5tfjE9fQZRtx+cCV4tRGUY0n2mFuccdc2QjvzsFIB813RbvbxYXhi1K/b+xw== X-Received: by 2002:a2e:2409:0:b0:2ee:4d91:3d88 with SMTP id 38308e7fff4ca-2ee5e39e5e2mr64257721fa.16.1720005974635; Wed, 03 Jul 2024 04:26:14 -0700 (PDT) Received: from eichest-laptop.corp.toradex.com (31-10-206-125.static.upc.ch. [31.10.206.125]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af37828sm242351875e9.9.2024.07.03.04.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 04:26:14 -0700 (PDT) From: Stefan Eichenberger To: gregkh@linuxfoundation.org, jirislaby@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, cniedermaier@dh-electronics.com, stefan.eichenberger@toradex.com, l.sanfilippo@kunbus.com, tglx@linutronix.de, rickaran@axis.com, francesco.dolcini@toradex.com Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1] serial: imx: only set receiver level if it is zero Date: Wed, 3 Jul 2024 13:25:40 +0200 Message-ID: <20240703112543.148304-1-eichest@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_042617_326214_ECED193C X-CRM114-Status: GOOD ( 15.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Stefan Eichenberger With commit a81dbd0463ec ("serial: imx: set receiver level before starting uart") we set the receiver level to its default value. This caused a regression when using SDMA, where the receiver level is 9 instead of 8 (default). This change will first check if the receiver level is zero and only then set it to the default. This still avoids the interrupt storm when the receiver level is zero. Fixes: a81dbd0463ec ("serial: imx: set receiver level before starting uart") Signed-off-by: Stefan Eichenberger --- drivers/tty/serial/imx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index f4f40c9373c2f..e22be8f45c93e 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -120,6 +120,7 @@ #define UCR4_OREN (1<<1) /* Receiver overrun interrupt enable */ #define UCR4_DREN (1<<0) /* Recv data ready interrupt enable */ #define UFCR_RXTL_SHF 0 /* Receiver trigger level shift */ +#define UFCR_RXTL_MASK 0x3F /* Receiver trigger 6 bits wide */ #define UFCR_DCEDTE (1<<6) /* DCE/DTE mode select */ #define UFCR_RFDIV (7<<7) /* Reference freq divider mask */ #define UFCR_RFDIV_REG(x) (((x) < 7 ? 6 - (x) : 6) << 7) @@ -1933,7 +1934,7 @@ static int imx_uart_rs485_config(struct uart_port *port, struct ktermios *termio struct serial_rs485 *rs485conf) { struct imx_port *sport = (struct imx_port *)port; - u32 ucr2; + u32 ucr2, ufcr; if (rs485conf->flags & SER_RS485_ENABLED) { /* Enable receiver if low-active RTS signal is requested */ @@ -1953,7 +1954,10 @@ static int imx_uart_rs485_config(struct uart_port *port, struct ktermios *termio /* Make sure Rx is enabled in case Tx is active with Rx disabled */ if (!(rs485conf->flags & SER_RS485_ENABLED) || rs485conf->flags & SER_RS485_RX_DURING_TX) { - imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); + /* If the receiver trigger is 0, set it to a default value */ + ufcr = imx_uart_readl(sport, UFCR); + if ((ufcr & UFCR_RXTL_MASK) == 0) + imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); imx_uart_start_rx(port); }