Message ID | 20231204130820.2823688-1-dawei.li@shingroup.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2750423vqy; Mon, 4 Dec 2023 05:11:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRxjQ7zfQTvRsnRz8ccY0IsVc62S/hWkR7Neq6oAeCN3YOQQvP0jZhu2lKF7bys9Z80cDF X-Received: by 2002:a05:6a21:279e:b0:18b:fc33:a617 with SMTP id rn30-20020a056a21279e00b0018bfc33a617mr3425766pzb.1.1701695472127; Mon, 04 Dec 2023 05:11:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701695472; cv=none; d=google.com; s=arc-20160816; b=BO10pAbthNYdmK/GLkxEtiG0lJt6XVm3ZneVJ4FMJO2DT/IQoJAvzOiSwBPlmWaDJp zheu57W1SyLWT4gAFqGa71bHEQr/ccc+DmhHAEbAzTM/kIY0P71Q+EF6WBEtvB+1IXMU bgbCrJQ0N8hH59975tYdLduaI/NURDs+QlmCz1nSDgwBrENxJl4UzN6xJrrJRi5lVaqC 6CQJcsCrfP7ba+CfmdIAHE+s4cEbkz1xBFXMFFC+gCCy5cu2yzWtEeIVN9HLZwmzzcKy WHOQcxJixe1fydVRFP94Rf1arvpa9/G5ungsq/atLqyQBBTDSlCBHfNbmlx4fTjcO/+w HDgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=kQjlQRKJGW4qUJTaRE+EBC2luuhv5AFvCi3JJuX9FXM=; fh=g0K795DDbDPFlRYcqrw6oULrB0/Jp3zaUSvFlrgV7bM=; b=DyM287NuTWMvOeQHZrR23uQFK67E0b1g2qgYODLGwmgp/qr6VuvwEySTQngFeKEPik wlbDHTaXIXSXzYp4V5T1onerm4pD8M6rlBcECSPIw8bai7BLgNnAtMUoQN6kY7lsU0V3 +rI+KM5kZQHOFl//7x3u17LdTu7ugy+G6SX2+ls0oeKE58zaXa997oZ1bNtNJx9sTEPc K0OBT3zA9rIHkc5HRfZI4AEj4TM3F2YyCbZW++4CR1f3SF82mOn0VvFmeOuZbRcK6Oyh sLFj8bHMg//hJPOSfPLElCVcFrjBCrEJaDsIoJyjlVniqvEvDEy5RdZ+z5NI9OJdSFBA Lm8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id z5-20020a656645000000b005c690ba4060si1438772pgv.261.2023.12.04.05.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:11:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C4CBE80615CC; Mon, 4 Dec 2023 05:10:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235445AbjLDNKh (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Mon, 4 Dec 2023 08:10:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235435AbjLDNKV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 4 Dec 2023 08:10:21 -0500 Received: from smtpbguseast3.qq.com (smtpbguseast3.qq.com [54.243.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30BF9171C; Mon, 4 Dec 2023 05:10:04 -0800 (PST) X-QQ-mid: bizesmtp64t1701695309t3n1mps1 Received: from localhost ( [183.209.108.253]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 04 Dec 2023 21:08:27 +0800 (CST) X-QQ-SSF: 01400000000000502000000A0000000 X-QQ-FEAT: G7QNoC8aK8jCw2Cy7bzCegXSBk+GBMFxbHnjmWKfko8QStACzMyB7stW8UTSN MsCRsemUMOpAq2FCY0nIjHRbMrfPlAWXav0JNsqXjOsZDPwdSKpbHtafGMUD5u8fGoav6d5 VK2UDQPiiO5qtyyRXXlEa2TdFQeQ4G54D23eeWLq21qV7e3oEyXVWBHh/hE93x4U+tR9lME F3Su97oUB/BCiiMk/iFZTPhed7wCftT5ZyPruqk3NsWbKTgXJCLFn7nrcnlefMsMJgyJkjc iW3ECNqtTC2WTqKFBWmvjNqUf5uSN0fTdc1TalaWI8FUB444CeyIFNqykgUuuTgGuDG7e2U KuFzjn7Uw//mODHfM/23j786A3v7yhkJ5o8E/yRP5Dt5ryB5z2/1jieW56EWULaD8OiGCV/ X-QQ-GoodBg: 2 X-BIZMAIL-ID: 13229479588945865013 From: Dawei Li <dawei.li@shingroup.cn> To: gregkh@linuxfoundation.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: jirislaby@kernel.org, jszhang@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, set_pte_at@outlook.com, Dawei Li <dawei.li@shingroup.cn>, stable@kernel.org Subject: [PATCH] serial: dw8250: Make DLF feature independent of ADDITIONAL_FEATURE Date: Mon, 4 Dec 2023 21:08:20 +0800 Message-Id: <20231204130820.2823688-1-dawei.li@shingroup.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:shingroup.cn:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 04 Dec 2023 05:10:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784357031232982884 X-GMAIL-MSGID: 1784357031232982884 |
Series |
serial: dw8250: Make DLF feature independent of ADDITIONAL_FEATURE
|
|
Commit Message
Dawei Li
Dec. 4, 2023, 1:08 p.m. UTC
DW apb uart databook defines couples of configuration parameters of
dw8250 IP, among which there are 2 of them:
- ADDTIONAL_FEATURE
" Configure the peripheral to have the option to include FIFO status
registers, shadow registers and encoded parameter register. Also
configures the peripheral to have UART component version and the
peripheral ID registers. "
- FRACTIONAL_BAUD_DIVISOR_EN
" Configures the peripheral to have Fractional Baud Rate Divisor.
.... "
These two parameters are completely irrelevant, and supposed to be
independent of each other. However, in current dw8250 driver
implementation, they are hooked together.
The bug was hit when we are bringing up dw8250 IP on our hardware
platform, in which parameters are configured in such combination:
- ADDTIONAL_FEATURE disabled;
- FRACTIONAL_BAUD_DIVISOR_EN enabled;
Fixes: 701c5e73b296 ("serial: 8250_dw: add fractional divisor support")
Cc: stable@kernel.org
Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
---
drivers/tty/serial/8250/8250_dwlib.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
Comments
On Mon, 4 Dec 2023, Dawei Li wrote: > DW apb uart databook defines couples of configuration parameters of > dw8250 IP, among which there are 2 of them: > - ADDTIONAL_FEATURE > " Configure the peripheral to have the option to include FIFO status > registers, shadow registers and encoded parameter register. Also > configures the peripheral to have UART component version and the > peripheral ID registers. " > > - FRACTIONAL_BAUD_DIVISOR_EN > " Configures the peripheral to have Fractional Baud Rate Divisor. > .... " > > These two parameters are completely irrelevant, and supposed to be > independent of each other. However, in current dw8250 driver > implementation, they are hooked together. > > The bug was hit when we are bringing up dw8250 IP on our hardware > platform, in which parameters are configured in such combination: > - ADDTIONAL_FEATURE disabled; > - FRACTIONAL_BAUD_DIVISOR_EN enabled; > > Fixes: 701c5e73b296 ("serial: 8250_dw: add fractional divisor support") > Cc: stable@kernel.org > Signed-off-by: Dawei Li <dawei.li@shingroup.cn> > --- > drivers/tty/serial/8250/8250_dwlib.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_dwlib.c b/drivers/tty/serial/8250/8250_dwlib.c > index 84843e204a5e..136ad093c5b6 100644 > --- a/drivers/tty/serial/8250/8250_dwlib.c > +++ b/drivers/tty/serial/8250/8250_dwlib.c > @@ -259,17 +259,6 @@ void dw8250_setup_port(struct uart_port *p) > } > up->capabilities |= UART_CAP_NOTEMT; > > - /* > - * If the Component Version Register returns zero, we know that > - * ADDITIONAL_FEATURES are not enabled. No need to go any further. > - */ > - reg = dw8250_readl_ext(p, DW_UART_UCV); > - if (!reg) > - return; > - > - dev_dbg(p->dev, "Designware UART version %c.%c%c\n", > - (reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff); > - > /* Preserve value written by firmware or bootloader */ > old_dlf = dw8250_readl_ext(p, DW_UART_DLF); > dw8250_writel_ext(p, DW_UART_DLF, ~0U); > @@ -282,6 +271,17 @@ void dw8250_setup_port(struct uart_port *p) > p->set_divisor = dw8250_set_divisor; > } > > + /* > + * If the Component Version Register returns zero, we know that > + * ADDITIONAL_FEATURES are not enabled. No need to go any further. > + */ > + reg = dw8250_readl_ext(p, DW_UART_UCV); > + if (!reg) > + return; > + > + dev_dbg(p->dev, "Designware UART version %c.%c%c\n", > + (reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff); > + > reg = dw8250_readl_ext(p, DW_UART_CPR); > if (!reg) { > reg = data->pdata->cpr_val; > The very same code change is already in tty-next (from another author).
On Mon, Dec 04, 2023 at 03:20:09PM +0200, Ilpo Järvinen wrote: > On Mon, 4 Dec 2023, Dawei Li wrote: > > > DW apb uart databook defines couples of configuration parameters of DW_apb_uart (as it's part of file name, or spell this fully). > > dw8250 IP, among which there are 2 of them: DesignWare 8250 IP ... > > The bug was hit when we are bringing up dw8250 IP on our hardware Ditto. > > platform, in which parameters are configured in such combination: > > - ADDTIONAL_FEATURE disabled; > > - FRACTIONAL_BAUD_DIVISOR_EN enabled; ... > The very same code change is already in tty-next (from another author). For your convenience: d804987153e7 ("serial: 8250_dw: Decouple DLF register check from UCV")
Hi Ilpo, Andy, On Mon, Dec 04, 2023 at 03:29:35PM +0200, Andy Shevchenko wrote: > On Mon, Dec 04, 2023 at 03:20:09PM +0200, Ilpo Järvinen wrote: > > On Mon, 4 Dec 2023, Dawei Li wrote: > > > > > DW apb uart databook defines couples of configuration parameters of > > DW_apb_uart (as it's part of file name, or spell this fully). > > > > dw8250 IP, among which there are 2 of them: > > DesignWare 8250 IP > > .. > > > > The bug was hit when we are bringing up dw8250 IP on our hardware > > Ditto. > > > > platform, in which parameters are configured in such combination: > > > - ADDTIONAL_FEATURE disabled; > > > - FRACTIONAL_BAUD_DIVISOR_EN enabled; > > .. > > > The very same code change is already in tty-next (from another author). > > For your convenience: > > d804987153e7 ("serial: 8250_dw: Decouple DLF register check from UCV") [sigh] Apparently I thought tty/for-linus is the "bug fixing" branch for tty by mistake, and didn't realize the same fix patch has been landed in tty-next for a while. Thanks for the update. Anyway, I believe the fixing patch should cc stable and be getting backported? I hit the bug on 5.10.x, it's possible the bug has been there before that. Thanks, dawei > > -- > With Best Regards, > Andy Shevchenko > > >
On Tue, Dec 05, 2023 at 09:55:44AM +0800, Dawei Li wrote: > On Mon, Dec 04, 2023 at 03:29:35PM +0200, Andy Shevchenko wrote: > > On Mon, Dec 04, 2023 at 03:20:09PM +0200, Ilpo Järvinen wrote: > > > On Mon, 4 Dec 2023, Dawei Li wrote: ... > > > The very same code change is already in tty-next (from another author). > > > > For your convenience: > > > > d804987153e7 ("serial: 8250_dw: Decouple DLF register check from UCV") > > [sigh] > > Apparently I thought tty/for-linus is the "bug fixing" branch for tty by > mistake, and didn't realize the same fix patch has been landed in tty-next > for a while. > > Thanks for the update. > > Anyway, I believe the fixing patch should cc stable and be getting backported? > I hit the bug on 5.10.x, it's possible the bug has been there before that. When that commit meets upstream you can always resend it for stable. The process is documented.
diff --git a/drivers/tty/serial/8250/8250_dwlib.c b/drivers/tty/serial/8250/8250_dwlib.c index 84843e204a5e..136ad093c5b6 100644 --- a/drivers/tty/serial/8250/8250_dwlib.c +++ b/drivers/tty/serial/8250/8250_dwlib.c @@ -259,17 +259,6 @@ void dw8250_setup_port(struct uart_port *p) } up->capabilities |= UART_CAP_NOTEMT; - /* - * If the Component Version Register returns zero, we know that - * ADDITIONAL_FEATURES are not enabled. No need to go any further. - */ - reg = dw8250_readl_ext(p, DW_UART_UCV); - if (!reg) - return; - - dev_dbg(p->dev, "Designware UART version %c.%c%c\n", - (reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff); - /* Preserve value written by firmware or bootloader */ old_dlf = dw8250_readl_ext(p, DW_UART_DLF); dw8250_writel_ext(p, DW_UART_DLF, ~0U); @@ -282,6 +271,17 @@ void dw8250_setup_port(struct uart_port *p) p->set_divisor = dw8250_set_divisor; } + /* + * If the Component Version Register returns zero, we know that + * ADDITIONAL_FEATURES are not enabled. No need to go any further. + */ + reg = dw8250_readl_ext(p, DW_UART_UCV); + if (!reg) + return; + + dev_dbg(p->dev, "Designware UART version %c.%c%c\n", + (reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff); + reg = dw8250_readl_ext(p, DW_UART_CPR); if (!reg) { reg = data->pdata->cpr_val;