Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp331717rdb; Thu, 30 Nov 2023 06:08:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1aw3z5LxHVdg9E3CJgJApiIX5xjf+wgSchHQaGVPelWRjeT2sjhGJPkZjQGRgCS8Er6CH X-Received: by 2002:a05:6830:16ca:b0:6d8:327c:e0b3 with SMTP id l10-20020a05683016ca00b006d8327ce0b3mr11605911otr.11.1701353306109; Thu, 30 Nov 2023 06:08:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701353306; cv=none; d=google.com; s=arc-20160816; b=jBZuI+/Frtz4DMiIgDUTVud8NSimmoUt/fSokH1p0MiTk1cFkwhNmbiEw0J8ah0KCr F2mwNanJxIm7V4IoUqGQQ11zp2/CWLh7fj/ftZ23V8lPw1kCC66UaLfIMY7+5mik8Rwd dYgl7INwbP9Y545vMJra3dLNGJtHekzMeBy71xtKzDkU8TxpjDMy6XgTRTTcZQ7knaiE u3bD0Z5V/7tF1owwf7dtIO7YNOPtHrw7cC20vXzDhlB2zD8bv5DUClojf1+/mDuAgsKE zoT7a4h7jvzO75jpLlascOytEXjI+FEVqLRKpDt53qcU9Hyg8YbyP5725kDMrvBuiwbC Oh8A== 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=+sPV5HLoRY51KAmBzr1P1nmrX5oNWMM/Fl0J4fOzMcw=; fh=AHZzcI0NKFNU1WuuS/FWF2LprSMGsTAGL8gmMiTfjNU=; b=QK+DfrmgiuDhDdgaBiwPB1abRyYu86GVEDf9pbaL0LcxmhxFju3wK/mTk6DPK0ef8Z crwJFMQIL0STJYsfvN6wt3106qB/aLYbHWP3OV+dagkV7jC2as3X1vPvaRT4k1u+ZEsx tqYnaZddrMXAd+KcpoPbXeir+UmRzMCvSYI4s1hRzmKcECaGwy6Tfp0VASOzJ6MAB04d xuzGSDqHrrbqpIm8sRCwUNqYY4lmXhE0vVkVPv8LQ+P+6dT2xqZVVydueJ2c1k8tlwX3 JA0ehLUPhygTknq1E4CbHzXh/ne5IOaA5GA/MHeYHEXP7kItrrmlfn4UF+UqUH7dYEDH 2Qrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dmPnnFHn; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id v9-20020a05683018c900b006ce2ec2a675si453054ote.38.2023.11.30.06.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:08:26 -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=dmPnnFHn; 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 0CEAC8027679; Thu, 30 Nov 2023 06:08:15 -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 S1345944AbjK3OHx (ORCPT + 99 others); Thu, 30 Nov 2023 09:07:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345853AbjK3OHe (ORCPT ); Thu, 30 Nov 2023 09:07:34 -0500 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69D710F2; Thu, 30 Nov 2023 06:07:39 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 084854000C; Thu, 30 Nov 2023 14:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701353258; 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=+sPV5HLoRY51KAmBzr1P1nmrX5oNWMM/Fl0J4fOzMcw=; b=dmPnnFHnMQC+V9BPhSHgfl5r2gTpn3MzFkurvB/l9sipbC71rbO8QbXABTv5omqPMsZn/N EJSGM4gpHL2MrNuLwykHRcEbXZ+vSiCj+XY/+wYHDbjlB10Nj2+cGDRN/MfRzbAmF91vVe yM8cXo1QdSfwfybH3eAl2r7+cqWubdG9C5F69dutwmVnjqD8FYQ2w4bsWtbvmgTLVrlkD3 ElsUmKCHY7lrxDz97XLBOVmB2fhBcEE7xWfkLxXXOj2f7x3Pgv+gJJU7CcAStbQTjBVgIB 30sgYFK7aj/qbYvTFkVMV8LqMuwuOBLFrG0w22w+g6FxbQkOKTnO9frOnjn35Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 30 Nov 2023 15:07:21 +0100 Subject: [PATCH v5 9/9] 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: <20231130-mbly-uart-v5-9-6566703a04b5@bootlin.com> References: <20231130-mbly-uart-v5-0-6566703a04b5@bootlin.com> In-Reply-To: <20231130-mbly-uart-v5-0-6566703a04b5@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, 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]); Thu, 30 Nov 2023 06:08:15 -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 fe910c5f3489..d50e3c14b0e4 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2869,6 +2869,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; @@ -2904,13 +2920,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.43.0