Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2693475rdb; Mon, 4 Dec 2023 05:10:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+0C3JZ26YkUWQJUcQb944Jc+aC5w2h82OK60zwJ43tZk4H3PhG07Bm0TyNFKGQnbghjwW X-Received: by 2002:a17:902:c14c:b0:1cf:cd31:6b85 with SMTP id 12-20020a170902c14c00b001cfcd316b85mr3897551plj.27.1701695454758; Mon, 04 Dec 2023 05:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701695454; cv=none; d=google.com; s=arc-20160816; b=BGCoGDW6UarqYKxP7ajRvAjoKkTRTdSieQ9W3/Wb3gzJK0usglC+B3XQjFHn0LGJ2/ X0fhqAPpozKtf3PhwR1oh3ymomle+M58xNqMWaQMazTNW697q9Tahx+IrrhR76BtfraL uIhlKAwxojBpr+EVQvf0pg38aEHh6VaVnmtsZtBTVJa6qx5GovSTNo+w1oXSla0Uzsdm Udd1cW6mtmm82cccf3vk996lB5fv/bRuhO87m+btvB4qSIOLGD52V/ZKAoxmT2xxbt8g wYuWo2FkNOq+wPLpt2/LAshpo+SH9WA36Nx2lOlWvM4WjZjHjgOQZ0l7VezBEFOteMoN tlsQ== 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 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id n9-20020a170903110900b001cfce7988edsi4466552plh.417.2023.12.04.05.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:10:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 3DEBC80615CB; Mon, 4 Dec 2023 05:10:51 -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 + 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 ); 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 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 , 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: 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:51 -0800 (PST) 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 --- 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; -- 2.27.0