From patchwork Wed Jun 7 14:05:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 104527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp225643vqr; Wed, 7 Jun 2023 07:07:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5eEJknHmjb2HaQcx2o0fHFIMd4YkAvvcRscZDEqhjhZ+QwTloMD7yWKCGL/OEDS0mMKeHK X-Received: by 2002:a17:90b:e93:b0:255:6c5b:3660 with SMTP id fv19-20020a17090b0e9300b002556c5b3660mr1950174pjb.20.1686146861186; Wed, 07 Jun 2023 07:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686146861; cv=none; d=google.com; s=arc-20160816; b=G9SsgNTNP8u28pUcaBBfiTvRltEqkpnk+q1B0wzKa3BlDuk4teT2mLIke1WW2XqZx3 fKlfuY4tYiA1kSZcbDcsUQCMbxhtChExsNmO9yO+rCKL3eDLb5CICoqx1iO3Huw2nEHb St32kU+z4f5z+uGrXjddBFmMCqnUOP0O0tPg46GcIgkk/yvv0MyvbriK4QZRMpfx+ljU sRExpnsO3RPjmqOcZWTCLs68e6HDNi8Sz6DqJ0wpO6z2D+T006Q+f+71poQ5R786HuL6 buPqDrhqJfGCvRyaASwaSbsFryKq/kAFpaWKeSWyX9foTk4Gn3O4hI5tWokKqVxyo6cy H2GQ== 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=vlvSfJ7BB6pGJBxrOhJ5IMJLf95UIyksZ/69U1YnCu4=; b=diLVXarxBwJUD2Ov5rDbNs6QJ94ndakoCqWHPuBvs76li+ZwmJ2eU7g91hLcyTKHu3 e0RdEGbR0Tztc/jIBpm23JgTrgG4SXZVf90JRnl7JUk5+5iKee9Ds1Or/Ml+OdruNXEp 6jSWd3/Wb7APmZfV3UZaPvrOFnXOktj479l9GgbWT3Z8urgDm1Yi2Jirzwq+p7lqYoRS /P/CAozDr7gnxAoETVmS/s4/jlDJcQWWjRkf92s96PxHnrnFCCFFNl7IvqADjLEfPQWs BaSup8QHLlXNOXYCGdTBq8vMW0cRzgLQ8S7Fn+cvDVNJChSxr9rOqtcbRRj43W/XW3gA dDMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=POv28Nir; 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 i194-20020a639dcb000000b005342966f497si8764782pgd.712.2023.06.07.07.07.12; Wed, 07 Jun 2023 07:07:41 -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=POv28Nir; 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 S240770AbjFGOFu (ORCPT + 99 others); Wed, 7 Jun 2023 10:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239775AbjFGOFs (ORCPT ); Wed, 7 Jun 2023 10:05:48 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7A981BEA; Wed, 7 Jun 2023 07:05:45 -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=vlvSfJ7BB6pGJBxrOhJ5IMJLf95UIyksZ/69U1YnCu4=; b=POv28Nirk2T60P1AKXilVsI0kC 1CorlBTZIC+XDqxREYAHHwno6iWiaw1hPK2Mmqc9TZzaMErcGYMnnTnQg9uHDsJs1tcckHWUwfbGy IGx9qxL/2O/boR7xucvMdhJSlx93AmhfGZaLX84K8Q+EVhhnY7KDXuMIktYkHLHstEOk=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:57832 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q6tn2-0005dF-Fn; Wed, 07 Jun 2023 10:05:33 -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, jesse.sung@canonical.com, isaac.true@canonical.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 , stable@vger.kernel.org, =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Lech Perczak Date: Wed, 7 Jun 2023 10:05:15 -0400 Message-Id: <20230607140525.833982-2-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230607140525.833982-1-hugo@hugovil.com> References: <20230607140525.833982-1-hugo@hugovil.com> MIME-Version: 1.0 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,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Subject: [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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768053131424947590?= X-GMAIL-MSGID: =?utf-8?q?1768053131424947590?= 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 abad091baeea..faa51a58671f 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;