From patchwork Fri Jul 21 16:18:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 123977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp340079vqg; Fri, 21 Jul 2023 10:00:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlGL6HCx0B7w8Eo5kmpqPnwRt1KI5GRC7Y/ZsbpKR4O1I9BiCh70wAcYiQkfr/QAii7p1CYQ X-Received: by 2002:a05:6a00:c90:b0:64c:c5f9:1533 with SMTP id a16-20020a056a000c9000b0064cc5f91533mr739850pfv.33.1689958812810; Fri, 21 Jul 2023 10:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689958812; cv=none; d=google.com; s=arc-20160816; b=Cy9azOVS+Ni9XzPcdWKceM9tcx43pdy4V7tXNEQDqj3tJV40cdu8n2E2HHofGYA5To nOgIX9F4i16XRcvZql5FByxcTh3pf/b2narYOFhc27vgm6HHUl6SM8Lp98JgydgHeupu GUD4Aqx8PN9uMnynCcArMQE176tFk3Gx3stcfepcGDMqZF1tWFv6nh1QBvSEBlZTD1yU O0v0kMsPC9yGu6RCzuAy7pY51LiWnxf/Anby6WMHgJL0qg47uSV+yAYqlmUBMUEj4nRn AscOsS4KxR/2RTFtc71xcO3RaBXxqOp8BHAHTMGmnH5b5gpqIMFUUazsmEPYstIvKD0B zxzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=5nJGAa1uU81DK4gB/PIFJUn37k+YUGRc051pFa/OAlQ=; fh=ZWZ1kBSEdRQxL6BTnURWRpUE9a4Pl4C0hLQ6ZZmFXXY=; b=SkkCPDG3/p5YtH3fViEfkx5bWUpukobT4u4kl0+gDL4FSE1GGAaFRtNReFNVacrmLJ fxRV3jyP/jyth/YmJptIwq1Lt8GxoHPFDAyZhZ1+96ZTggoWbDPNxHcxcVf6KVPtNi9f Sn/YYXJzB9qtZ6dMXMg0q7TvfF7E4AYGRprKfnNube8LWvs82y8w6HAiKBrvzsD/ewiD jXvA9WT041YsyoQ+12UJSOArnwZuIREGqcVocSuaSIWbo0nCJRVtV6xVq8HjpOvVldmL 2ayxEvbdDLIF16qqMMPsrGtt+QAzPqvCZB/0ncLsJ2+cv6BYJBoDO7aPU8CCBuptq/E6 lEiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=dlO0UqDQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv14-20020a056a00414e00b0068250f2627asi3350161pfb.61.2023.07.21.09.59.55; Fri, 21 Jul 2023 10:00:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=dlO0UqDQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232706AbjGUQUh (ORCPT + 99 others); Fri, 21 Jul 2023 12:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232584AbjGUQUI (ORCPT ); Fri, 21 Jul 2023 12:20:08 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E48B449D; Fri, 21 Jul 2023 09:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5nJGAa1uU81DK4gB/PIFJUn37k+YUGRc051pFa/OAlQ=; b=dlO0UqDQdoI5hYfTYZdpZgK1QD Sz2V3qgdeiJi3ErUW98tb5InJwXHawIyVntxLTzjdDiAH8ZiE9ZyRhWwEa6pFf4uTwZFrEU6ocx2s zOtivUhXWVYQbPU95ppZLf+XXU4etEo9+h5qWrUcq+NzNCmbw7ogynWJUrA+UVQntkH8=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:50368 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1qMsq9-0003IO-4c; Fri, 21 Jul 2023 12:18:49 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, isaac.true@canonical.com, jesse.sung@canonical.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve , stable@vger.kernel.org, =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Lech Perczak Date: Fri, 21 Jul 2023 12:18:31 -0400 Message-Id: <20230721161840.1393996-2-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230721161840.1393996-1-hugo@hugovil.com> References: <20230721161840.1393996-1-hugo@hugovil.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Subject: [RESEND PATCH v8 01/10] serial: sc16is7xx: fix broken port 0 uart init X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772050252362971366 X-GMAIL-MSGID: 1772050252362971366 From: Hugo Villeneuve The sc16is7xx_config_rs485() function is called only for the second port (index 1, channel B), causing initialization problems for the first port. For the sc16is7xx driver, port->membase and port->mapbase are not set, and their default values are 0. And we set port->iobase to the device index. This means that when the first device is registered using the uart_add_one_port() function, the following values will be in the port structure: port->membase = 0 port->mapbase = 0 port->iobase = 0 Therefore, the function uart_configure_port() in serial_core.c will exit early because of the following check: /* * If there isn't a port here, don't do anything further. */ if (!port->iobase && !port->mapbase && !port->membase) return; Typically, I2C and SPI drivers do not set port->membase and port->mapbase. The max310x driver sets port->membase to ~0 (all ones). By implementing the same change in this driver, uart_configure_port() is now correctly executed for all ports. Fixes: dfeae619d781 ("serial: sc16is7xx") Cc: # 6.1.x Signed-off-by: Hugo Villeneuve Reviewed-by: Ilpo Järvinen Reviewed-by: Lech Perczak Tested-by: Lech Perczak --- drivers/tty/serial/sc16is7xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 2e7e7c409cf2..8ae2afc76a9b 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1436,6 +1436,7 @@ static int sc16is7xx_probe(struct device *dev, s->p[i].port.fifosize = SC16IS7XX_FIFO_SIZE; s->p[i].port.flags = UPF_FIXED_TYPE | UPF_LOW_LATENCY; s->p[i].port.iobase = i; + s->p[i].port.membase = (void __iomem *)~0; s->p[i].port.iotype = UPIO_PORT; s->p[i].port.uartclk = freq; s->p[i].port.rs485_config = sc16is7xx_config_rs485;