Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp346677rdh; Thu, 23 Nov 2023 05:43:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwJx03YsPT0VIDlAwoCL5x6JBydaerWLjHvzU2dWhh8FKFIbPKBt8zOKkuYIj1/j758zEC X-Received: by 2002:a05:6a20:3944:b0:18b:cdd5:10c1 with SMTP id r4-20020a056a20394400b0018bcdd510c1mr9518pzg.26.1700747011951; Thu, 23 Nov 2023 05:43:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700747011; cv=none; d=google.com; s=arc-20160816; b=Vhw41MiPiO6WLXauFsDJtQQLNRKYWl93lldK0ISiJNl7Xea8/LqusA2CebgZa9S2A6 6g5fZfueLYLA8Mv5NBKbg5dM4O5c+TPY+z4CrDcVr1Udxo5ZHIn25Huy8P4Fv/0V+liP 3f9lwFOYXHz/PJc/IucQYlFqiSzmap0gKjrByG3DmSCSq2OxbYLminGLPQjdxMmfujOP GibpZ2cAOskG+6TJSaCh0yzlsrA4nea4Pse8ZGeSX57wHxyLNMltcFD/gYl2SFsoRpTs 3YeHaMI9jI34uEIW6pUTS3MxLcu96Nua+u/+tIO4tBFZBlKdJGwF6k4z1gx/kSLJmG5Z 69zw== 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=CVBDCS1NTDb3ab3cFjXMUr783QzZPSiK8Mrwk5FgGVk=; fh=AHZzcI0NKFNU1WuuS/FWF2LprSMGsTAGL8gmMiTfjNU=; b=uZytTX5aJu/PEc8L0kCh77P89eTvuQNI63gbRGwM1ecPtqLszcDTZ/ssBVCCoT6TG3 8tJilXlawK7cRSdm7iY3sEsEkzcv9cmBueBWu1f2qpqU/SnP4AN/+nJGOQeLq0mCFJfI WCcmQRFiaMIiXY2kLcxuG0GwvNruDDHweSScQf3YA0SdyT0csREJHKGGmtEceztmeF2E LebY8d4iEsEsNSp7VcdcwiTT3WeWZAF5PXLpDxdBZnyUFMQLe6JPtLRb/v67A1GcENQY FXedfh9KRljcEgyUSy22vRmweCp8Kr3u3RZ7PVZ45e3DyKXTtmnPC2e1e1WfzAWLOao/ EurA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=NRAK1wIg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p32-20020a056a000a2000b006cbb1347e8esi1309269pfh.257.2023.11.23.05.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 05:43:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=NRAK1wIg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 4DA988299E25; Thu, 23 Nov 2023 05:43:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345586AbjKWNm4 (ORCPT + 99 others); Thu, 23 Nov 2023 08:42:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345564AbjKWNmn (ORCPT ); Thu, 23 Nov 2023 08:42:43 -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 2E78CD49; Thu, 23 Nov 2023 05:42:49 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 58A5D20007; Thu, 23 Nov 2023 13:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700746967; 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=CVBDCS1NTDb3ab3cFjXMUr783QzZPSiK8Mrwk5FgGVk=; b=NRAK1wIgVmhdjMNjKWvEyu+zXOcx+/cQ7TRdPSsMRujvRiMpre+IHWlYH70bj1OWEgfWuf LX7cwaRXkncLiZLjfknzSmBQMlgBjoS7RlPWuqtR24GKk2rxnCTa2YPtyjNjnQLgVKBsDy UP4p14COSaKs8f98niq3z+XvevTn1a7/PPguFX7hoBsoTKVjn5F6tN0DHuDd96J6ax1HX9 mkIS25+RS6I973GJVb2bDd+tyrIwqoASaTc3HB6mOr2r+qOHBWqug+w5gLJs6rA4VcGRMY G43ylCTHCeq/R9IAtcnY8fdbtzouQE09xgUB89woDmAd+/iqUlEjZwTOhjizOA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 23 Nov 2023 14:42:44 +0100 Subject: [PATCH v4 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: <20231123-mbly-uart-v4-6-7f913a74ff89@bootlin.com> References: <20231123-mbly-uart-v4-0-7f913a74ff89@bootlin.com> In-Reply-To: <20231123-mbly-uart-v4-0-7f913a74ff89@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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 23 Nov 2023 05:43:26 -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..f42f4a94c239 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