Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3225567rwd; Mon, 29 May 2023 07:26:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pX3ww2vQJtJHckRaHdJV6GBe55bEo4YEkEgMX5AD+z9sylF6WsJNKB2761QpCu3AMpNkH X-Received: by 2002:a17:90a:ebcb:b0:255:c5f7:ff3e with SMTP id cf11-20020a17090aebcb00b00255c5f7ff3emr11232415pjb.4.1685370367327; Mon, 29 May 2023 07:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685370367; cv=none; d=google.com; s=arc-20160816; b=NISPB8dPO5tTQg5ThLrVT1j0i7Z8g43DJxb0M8SWchmasBGn73BoJOLDcUcrMxNBWJ NXvIqmhhG5A/Odf0EKFVq+Jbtsj0075Ig76QlWTb8wyo1yGrbV3+zvAm4NWqV7JI4z45 JWpij2b342XA2NDskTqLlGstNoXtfcaSVLR2TrvdqGyrYx75iRKRoK3pFZoctpAm7Ims MmRyZsK2zjKOYhcLB585AWaLXZZvHuND5X4mlxvWz5X82R2Zz3PTM450nGjZ6EoTzqYL deErLBlbtimx8omsI9lcjLcYriqendLIy0zAscdxFHmGsph8So7+XMDORNh0AMfeuBdN fGoA== 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=pHysw7ljZh9N+tWRFFgX01/iKvbeS5p8bGDIrNtFgKs=; b=jinDeiW6SNNXA89CZ3WKTDYVo07NH6iH/wnzfpv1rbCGSLGFpoPYYGEUa6OeM+SGtC 5kB2eDud/yI0PqgNpGzMoYHoY8K4WWtVBVEIqKbh/KMS9zRyAtG4iJEXoyj0+jNSfI0H IABvNXlQlqJ2KwdDXIiSm/Uq2TN7AaT65ZKV2sr8VgUYIahagKZajbBF3V4CKI+5xMwT RZfPVBUhd1/OZlpKi78x1SMeEPNoD7N2cOzOq/SKoQg8cV5khU9L5XeFfx1HESR+AHVP +PpMnJ/eWlqkGJmTg5tbuEYCAnXBkrXdr49JaVT9YD/fgoZVS0aBIO7+kVI2rVuhDnnn G0ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=mExC7gWj; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a17090ae01500b0024ddf3f8a0bsi302421pjy.82.2023.05.29.07.25.53; Mon, 29 May 2023 07:26:07 -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=mExC7gWj; 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 S229697AbjE2OHg (ORCPT + 99 others); Mon, 29 May 2023 10:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbjE2OHd (ORCPT ); Mon, 29 May 2023 10:07:33 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC47BDC; Mon, 29 May 2023 07:07:31 -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=pHysw7ljZh9N+tWRFFgX01/iKvbeS5p8bGDIrNtFgKs=; b=mExC7gWjMc26KAtHRU5GO35bzk RoT9LIvgx6DyVzJQRWLebOsIZuGFWFxsQcx0bGDaS8VjcqOkXqQMc0c2/Dz8xrsXKf3mk0RZzvG0e 06x8IGaMCh6jLLkJ+bylJ52d97+Rhr0JWLgKISa6RLWaE6b5XrV/eIruqqqyikgmqpi8=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:50024 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q3dWs-0004Ht-IY; Mon, 29 May 2023 10:07:24 -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, l.perczak@camlintechnologies.com, tomasz.mon@camlingroup.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 , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Mon, 29 May 2023 10:07:05 -0400 Message-Id: <20230529140711.896830-4-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230529140711.896830-1-hugo@hugovil.com> References: <20230529140711.896830-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 70.80.174.168 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 autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH v4 3/9] 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 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") Reviewed-by: Ilpo Järvinen Signed-off-by: Hugo Villeneuve --- 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 24c9336f6ab2..fdf18add1c49 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1443,6 +1443,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; -- 2.30.2