Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2101889rdb; Mon, 20 Nov 2023 01:50:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGT3Dm3zPSsjI2AixailNs71kIQ5QPeeb0vpMOAouliArMAsEn7CZtqH8G+BEBGanceCejS X-Received: by 2002:a17:902:9683:b0:1cc:345b:c7f5 with SMTP id n3-20020a170902968300b001cc345bc7f5mr5388011plp.23.1700473815894; Mon, 20 Nov 2023 01:50:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700473815; cv=none; d=google.com; s=arc-20160816; b=D3cLIXqG8VPJpbNGN0D+oYXZtE+FVenX6D7kHVAaE10oA+1L9x4EWD7DsMy/dOL8Tg dZDWi7UWZm+SZLcfV1PecvpsJBXLBDXij+7hRR5KFyb8POHfWAoKZjAdzNlixkCxI4AS qfb2pqoXGNz+XPjRCMTcD9WPfG3xFvtY8qZTFqSRWGbD8dHiJFroygd+g579wnODFWV6 F3qbL6xIfA66J+6ttn1PpImZk60Zmo/nNcyv/sEEAay3Nbubam9YIieq1l0F/ECYrZUR 0ATbe09ghwjnVXl/NSD6cW6a3k0e2xXBcVVNKjq7ELXLvAfi8DF2wtkUuZJ0+8E+G+QL PwQA== 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 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id jc18-20020a17090325d200b001c72325d6f4si7353417plb.605.2023.11.20.01.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:50:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; 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 2620:137:e000::3:7 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 51A6E80A30D3; Mon, 20 Nov 2023 01:49:09 -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 S232698AbjKTJsw (ORCPT + 99 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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?Th=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:09 -0800 (PST) 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; -- 2.42.0