From patchwork Thu Dec 7 17:56:13 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: 175321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4961248vqy; Thu, 7 Dec 2023 09:58:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnJxmNRolTb2atCYcOd+2ewMS7QeBkO80lqBIw6t+i+fcn7YeCWHdZz/NbFanF1waPklN5 X-Received: by 2002:a05:6a00:9a3:b0:6ce:38f9:b410 with SMTP id u35-20020a056a0009a300b006ce38f9b410mr2937467pfg.69.1701971934100; Thu, 07 Dec 2023 09:58:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701971934; cv=none; d=google.com; s=arc-20160816; b=WejfVSGFK/8lbbuv4NjlbYKmGEllt4Ec6aZKSHbHY7GCAIXqTKFxD/xPSW066xdsLp 6gKSq+isRMpd69QCb7Y++HrftxjweURo3NEHcT+PHSzA5aXmvA08cnZlOvD8aSQk6cHk 2w5qbjIc51KAIa49xdBNotxHaWW3meBzGCqcaUex/nUeF01mThpVlrv5ddet1Q0hIACD npr/ZHFsvhRNmDt040QuoJ/yuPPMcE2J4YAq/Vr1sZmjgKoKZzuF+kSlkIcYtpRFl8UL SR6RUrLstlVMquLQ9OwNedg7FjuD9QYA5jnMQEGIVi/BN4lQ4kmM35pxeS1F8/yRAKIm S6ag== 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=3/wsTmEWxe0ogRl/8Vy0GB64u7O6jbPEVRaQ+GQnwaY=; fh=AHZzcI0NKFNU1WuuS/FWF2LprSMGsTAGL8gmMiTfjNU=; b=hWVsBiG50ttT/rsns1LC7o898RRD3yD7c5yukqXsMFDXs6EKVWhGEcZBkVSFK4hK4j FZlq4gqSV3Gqup2o19wKDviW138Y0P6z0YOD9R6B8NH3ixy+r6GtZdVOqBgpkuoo4D82 sn63dJBplQNz8qId1mVxNsmXJnrcbCKiw1BO9MYAuMPwjeweTx4kBJbOzGlEGHHV42lJ cdHXZTHdHvAZ1TjZhGTW1X+FEQ7WmTQTEskuxOnpYnQ88GYIGLW7G5P1sGEmHRctshHc xmFXqPipPFR0s58+fmoO0+kgFwkNRV0/h/XoiBmIoGwtnJlj0LNm+ixQTpi3c7zsWiX/ x53g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TBi5Jsw3; 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 187-20020a6300c4000000b005c6818b5a28si61941pga.517.2023.12.07.09.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 09:58:54 -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=TBi5Jsw3; 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 9746E802DD19; Thu, 7 Dec 2023 09:56:59 -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 S1443701AbjLGR4u (ORCPT + 99 others); Thu, 7 Dec 2023 12:56:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443664AbjLGR4n (ORCPT ); Thu, 7 Dec 2023 12:56:43 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 262681722; Thu, 7 Dec 2023 09:56:38 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 76BADE000E; Thu, 7 Dec 2023 17:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701971796; 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=3/wsTmEWxe0ogRl/8Vy0GB64u7O6jbPEVRaQ+GQnwaY=; b=TBi5Jsw3+5mnNcW9IhE2m6nUyGUyN0WNMfAZgXLfasNSPCB4rkolx0TkeWOEZ7qBHW7FzW 9nuXRnJQKUxnz08NeZFoFosZrgeNEbcymD/jeV/sW5mZQrDiePn7REoFzET/S7ARTJYC4Y v5rJexcNH/NdUJCMwinEOfk8kc+n9gc/ZioZdAM3ckW2Yo/Pd9vXD7gAvNTSKgD9Xv7FlB uCWJfooNeQidDBNhP7LRJ/uHqrA+uY23ZJaVWYb4hZKMgaI6w8DuAfzpbNRsmNZpb8ta7b bQ2/A0rfPKu+SdKZGbF4Xh1WOcht9fd6GPjfbj7MrgNK8rBfWLNEH/WVvLfSww== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Dec 2023 18:56:13 +0100 Subject: [PATCH v6 8/8] tty: serial: amba-pl011: factor QDF2400 SoC erratum 44 out of probe MIME-Version: 1.0 Message-Id: <20231207-mbly-uart-v6-8-e384afa5e78c@bootlin.com> References: <20231207-mbly-uart-v6-0-e384afa5e78c@bootlin.com> In-Reply-To: <20231207-mbly-uart-v6-0-e384afa5e78c@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.4 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_H3,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]); Thu, 07 Dec 2023 09:56:59 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784646922713203704 X-GMAIL-MSGID: 1784646922713203704 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 Reviewed-by: Linus Walleij Reviewed-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;