From patchwork Mon Nov 20 09:48:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 167013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp2087648vqn; Mon, 20 Nov 2023 01:50:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrbrTRdWBvZ+53Q0R+13ed7KgNFOYjHEXmdUvUOow+LTmdMbwKg7W6B1IAVrl8eSBOXXFd X-Received: by 2002:a05:6830:10d0:b0:6d6:9ecf:8d8c with SMTP id z16-20020a05683010d000b006d69ecf8d8cmr8782923oto.3.1700473818509; Mon, 20 Nov 2023 01:50:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700473818; cv=none; d=google.com; s=arc-20160816; b=bLWY8e/oYv2FxTUbaUIkYTiXKPl+ZvKq3A14y6iKiSAfqKHTuV1pWmkVlhnZ3EdKEr OM4mGKc/1hXTkjO2JCHJVslvgtzREf1FQisqTwu4KCnpFnJAc0RQQAIJGfY2G47EjTzl 4sjJar/tCfAM5cTNWa2jwYPNbBVoV1pWwuxgNBN6wJa0f+C6eK/QFInHr6+f113ZCjOw s6poKEVD4zy0Opr3JCKugPUb27/vmogPBx7kEj07puNHBI6aUMmPDmp1wTvb8Xt8ZVwY /G9B0h4J6vC5Q7K0YS4tHTolYrE0Pyl9KFLfpsUy59lMWSUftQbaN8PxniILbXWfdl/f vy8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=qvftjY3bOy7SCkj6xxwvE9sFtCaa+9+VIEr8AvSlmhk=; fh=AHZzcI0NKFNU1WuuS/FWF2LprSMGsTAGL8gmMiTfjNU=; b=QZjDWG5/8vLPBB/t+tdBgCK3DboGH9qUY33m4Ka0ioPhVsKq5BO3ZFjKryTyK+mbtb HQoC+to6fFB337RF1p/wSxyTi1I/B0jwADNkABRM0iZUEYalL75Glo6ZGN9I8yJsogKb SyYbSWRAxOMBanbe9dunnn4CZSIBVVP3grdz3RRnQn+ZEXRhei8aIMDxGnHNBEGz4wiC IY7AJEPnNPGVLHIm2+KlVXvwk/hFDwAfUuGDAFQwhmbLdl8U1TJoAvBaKVsT1fjo15lp AEkcEmV1810dkFtLWf6DkmNNLyXkYM70EwMSv+3VGPmJtl1d3KjvCaGTo2RllM6NHPxp oNww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Lv4a5IT2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u23-20020a634557000000b005bdff99b465si7601015pgk.506.2023.11.20.01.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:50:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Lv4a5IT2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F413C802AF36; Mon, 20 Nov 2023 01:49:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232627AbjKTJsw (ORCPT + 27 others); Mon, 20 Nov 2023 04:48:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232541AbjKTJsm (ORCPT ); Mon, 20 Nov 2023 04:48:42 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB9D595; Mon, 20 Nov 2023 01:48:38 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 023F020007; Mon, 20 Nov 2023 09:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700473717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qvftjY3bOy7SCkj6xxwvE9sFtCaa+9+VIEr8AvSlmhk=; b=Lv4a5IT2EQF5bFJyCnpCOmRj9PGBPckvKwOqAcZArn6UIfyTaFebL/gdevxZayI6vg60n8 k2HcuiSLXChPCxUNpHhq3u6V+u3kibjk+yq17bbFLQqFQK1C5SZ29D0CYOIzVgOIqGeTci be3KASC02S3ZyTY9jRHYUNhCDW+EciFXr0t3WQ26kpCuSyHEvMdOXd2sPNxrk2ph7Amdft 9eSbxaC1QBp+s3OWiHBoY2kDRUqTbmTbZWPXALSSd6SjKIsv8EgeB490oAgL3b/ZDAXsOf nVytc69ohyu3Fsbpx0jbpaQSGy+toryWd6aATsqsVKKErTlC5MVRTy2nhe5SdA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Mon, 20 Nov 2023 10:48:29 +0100 Subject: [PATCH v3 6/6] tty: serial: amba-pl011: factor QDF2400 SoC erratum 44 out of probe MIME-Version: 1.0 Message-Id: <20231120-mbly-uart-v3-6-07ae35979f1f@bootlin.com> References: <20231120-mbly-uart-v3-0-07ae35979f1f@bootlin.com> In-Reply-To: <20231120-mbly-uart-v3-0-07ae35979f1f@bootlin.com> To: Russell King , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Linus Walleij , =?utf-8?q?Gr=C3=A9gory_Clement?= , Alexandre Belloni , Thomas Petazzoni , Vladimir Kondratiev , Tawfik Bayouk , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , =?utf-8?q?T?= =?utf-8?q?h=C3=A9o_Lebrun?= X-Mailer: b4 0.12.3 X-GND-Sasl: theo.lebrun@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 01:49:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783076034759145009 X-GMAIL-MSGID: 1783076034759145009 On this platform, different vendor data is used. That requires a compile-time check as we access (1) a global boolean & (2) our local vendor data. Both symbols are accessible only when CONFIG_ACPI_SPCR_TABLE is enabled. Factor the vendor data overriding to a separate function that is empty when CONFIG_ACPI_SPCR_TABLE is not defined. Suggested-by: Ilpo Järvinen Signed-off-by: Théo Lebrun --- drivers/tty/serial/amba-pl011.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 4185d6fd243b..e08a32eb0ed1 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2874,6 +2874,22 @@ static int pl011_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pl011_dev_pm_ops, pl011_suspend, pl011_resume); +#ifdef CONFIG_ACPI_SPCR_TABLE +static void qpdf2400_erratum44_workaround(struct device *dev, + struct uart_amba_port *uap) +{ + if (qdf2400_e44_present) + return; + + dev_info(dev, "working around QDF2400 SoC erratum 44\n"); + uap->vendor = &vendor_qdt_qdf2400_e44; +} +#else +static void qpdf2400_erratum44_workaround(struct device *dev, + struct uart_amba_port *uap) +{ /* empty */ } +#endif + static int sbsa_uart_probe(struct platform_device *pdev) { struct uart_amba_port *uap; @@ -2909,13 +2925,8 @@ static int sbsa_uart_probe(struct platform_device *pdev) return ret; uap->port.irq = ret; -#ifdef CONFIG_ACPI_SPCR_TABLE - if (qdf2400_e44_present) { - dev_info(&pdev->dev, "working around QDF2400 SoC erratum 44\n"); - uap->vendor = &vendor_qdt_qdf2400_e44; - } else -#endif - uap->vendor = &vendor_sbsa; + uap->vendor = &vendor_sbsa; + qpdf2400_erratum44_workaround(&pdev->dev, uap); uap->reg_offset = uap->vendor->reg_offset; uap->fifosize = 32;