Message ID | 20230725142343.1724130-2-hugo@hugovil.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2511438vqg; Tue, 25 Jul 2023 07:30:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlEzzHnu2Zrwy1gdsoobLHeYis/fbvnxFuxD+DQdNrflwrGEdQfJ8vl0blIbaU2ZcHf6Bm+Y X-Received: by 2002:a17:902:7404:b0:1bb:bbd4:aadf with SMTP id g4-20020a170902740400b001bbbbd4aadfmr2021339pll.61.1690295429052; Tue, 25 Jul 2023 07:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690295429; cv=none; d=google.com; s=arc-20160816; b=lqqUnMHxpB94OPWDnKmIYAN9/oN+eP2v++iZvioCfvZ+ggnlrbL9ytoSDZMbfqFYa9 /Z25Mw+KVkibcwBcxhbFzT5S83RxMzhJ9RjRk+lnmoWBXnrssiGI326wS1T+8tKAJCJY 0tDsoro9GmpQHEikmpeMtsV6yNoDubu18PfTT/pvewtqKoIMBXifICl5dn9BxLjJYNAH 2njJK52sB/AP0vq+shRDELK6KF+NADdhonGoHFWdjXpkAdmbyRkcdKzJD6nxFZjISqxj VLHDjTMpdR2ob9/YEZLoJJDvgThsw+wplNOtZb2n1rshpNhZqO8Fi6MwLVTAcGAU+oTs Ulow== 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=HLAfhnw1WprbhugNEy0MHgtKacMiD1NxwsnN5n5U29I=; b=XYQSTfUbzg9zrcqbvlfze7gieMsKjTdB/3Zi1cHVYceimjT/Rq1CsL1h9EyLCriyTA YXpcFRxUX1sSObr4oJmUO9OJfkBbubmPmhrMZqrud82gQfEIKRcgliZVMRjtsmi14T4T 9Xj0KWBfF2EgGx/DfNvzC9BDOwM83mQLFreihnTrp9vrX2ALDT9qEZcmAwlPmXN7VHnt y0q9q3M503AdX998T+ayh+2ShwXNKV4H/mx6eEh+Jjx8xuNyyq4k2NjXT/RFXK/4ew5I O1eXHiMWcsH2b0I67QPtJboNj9eJnhr/7Eykh+mloEKva+nvgkB1uO9Dm3it6v6fjhY9 dNyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=xsFBO3i1; 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 b11-20020a170903228b00b001b9d2982362si12779162plh.36.2023.07.25.07.30.14; Tue, 25 Jul 2023 07:30:29 -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=xsFBO3i1; 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 S232754AbjGYOYN (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Tue, 25 Jul 2023 10:24:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbjGYOYH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 10:24:07 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9310D2697; Tue, 25 Jul 2023 07:23:59 -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=xsFBO3i1TLHsOEqAFt17vLy3Ch LB0vgbhT6rKkFx0AZYV7s/uTCXXC3iUigoqqtaMyHHnV1B49aQ7rOPZnZxECfaej+AqImnN0rQDSq HIvnwa8s6ZU74SzHwbDe6I0lE7+YMPTQpgDA/ImGNAVCaj1nt5mx+0nuNqSh92sQqU0U=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:34256 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from <hugo@hugovil.com>) id 1qOIx3-0003Kt-17; Tue, 25 Jul 2023 10:23:49 -0400 From: Hugo Villeneuve <hugo@hugovil.com> 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, 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 <hvilleneuve@dimonoff.com>, stable@vger.kernel.org, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Lech Perczak <lech.perczak@camlingroup.com> Date: Tue, 25 Jul 2023 10:23:33 -0400 Message-Id: <20230725142343.1724130-2-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230725142343.1724130-1-hugo@hugovil.com> References: <20230725142343.1724130-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: [PATCH v9 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772403219657916234 X-GMAIL-MSGID: 1772403219657916234 |
Series |
serial: sc16is7xx: fix GPIO regression and rs485 improvements
|
|
Commit Message
Hugo Villeneuve
July 25, 2023, 2:23 p.m. UTC
From: Hugo Villeneuve <hvilleneuve@dimonoff.com> 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: <stable@vger.kernel.org> # 6.1.x Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Lech Perczak <lech.perczak@camlingroup.com> Tested-by: Lech Perczak <lech.perczak@camlingroup.com> --- drivers/tty/serial/sc16is7xx.c | 1 + 1 file changed, 1 insertion(+)
Comments
On Tue, Jul 25, 2023 at 10:23:33AM -0400, Hugo Villeneuve wrote: > From: Hugo Villeneuve <hvilleneuve@dimonoff.com> > > 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") That commit is in a very old 3.x release. > Cc: <stable@vger.kernel.org> # 6.1.x But you say this should only go to 6.1.y? Why? What is wrong with the older kernels? > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > Reviewed-by: Lech Perczak <lech.perczak@camlingroup.com> > Tested-by: Lech Perczak <lech.perczak@camlingroup.com> > --- > 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; That's a magic value, some comment should be added here to explain why setting all bits is ok. Why does this work exactly? You only say that the max310x driver does this, but not why it does this at all. confused, greg k-h
On Mon, 31 Jul 2023 17:52:26 +0200 Greg KH <gregkh@linuxfoundation.org> wrote: > On Tue, Jul 25, 2023 at 10:23:33AM -0400, Hugo Villeneuve wrote: > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com> > > > > 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") > > That commit is in a very old 3.x release. > > > Cc: <stable@vger.kernel.org> # 6.1.x > > But you say this should only go to 6.1.y? Why? What is wrong with the > older kernels? Hi Greg, I have read (and reread a couple of times) Documentation/process/stable-kernel-rules.rst to try to understand how to format the tags, but unfortunately it doesn't contain "Everything you ever wanted to know about Linux -stable releases" as the title claims :) In particular, it doesn't explain or advise which older version we should target, that is why since I was not sure I specified 6.1.y because I could test it properly, but not v3.x. Maybe it would be best to simply drop for now all the "Cc: <stable@vger.kernel.org>" tags for this series, and following Option 2, I send an email to stable@vger.kernel.org once the patches have been merged to Linus' tree? > > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> > > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > > Reviewed-by: Lech Perczak <lech.perczak@camlingroup.com> > > Tested-by: Lech Perczak <lech.perczak@camlingroup.com> > > --- > > 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; > > That's a magic value, some comment should be added here to explain why > setting all bits is ok. Why does this work exactly? You only say that > the max310x driver does this, but not why it does this at all. I do not understand, because my commit log message is quite long and, it seems to me, well documenting why this works the way it does when calling uart_configure_port() in serial_core.c? I say that the max310x driver also does this, because there is also no comment in the max310x driver for using the (void __iomem *)~0; construct. I also located the original commit message for the max310x driver but no comments were usefull there also. So, what about adding this comment: /* * Use all ones as membase to make sure uart_configure_port() in * serial_core.c does not abort for SPI/I2C devices where the * membase address is not applicable. */ s->p[i].port.membase = (void __iomem *)~0; Also, keep in mind that in the original discussion about that patch, there was the following comment from Ilpo Järvinen: ------ This changelog was really well describing the problem! :-) Yeah, some other solution should be devised. Maybe we should add another .iotype for thse kind of devices. But I'm fine with this for this fix. After editing the changelog, feel free to add: Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> ------ If wou want, I could also add the same comment to the max310 driver? Hugo.
On Tue, Aug 01, 2023 at 01:16:55PM -0400, Hugo Villeneuve wrote: > On Mon, 31 Jul 2023 17:52:26 +0200 > Greg KH <gregkh@linuxfoundation.org> wrote: > > > On Tue, Jul 25, 2023 at 10:23:33AM -0400, Hugo Villeneuve wrote: > > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com> > > > > > > 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") > > > > That commit is in a very old 3.x release. > > > > > Cc: <stable@vger.kernel.org> # 6.1.x > > > > But you say this should only go to 6.1.y? Why? What is wrong with the > > older kernels? > > Hi Greg, > I have read (and reread a couple of times) > Documentation/process/stable-kernel-rules.rst to try to understand how > to format the tags, but unfortunately it doesn't contain "Everything > you ever wanted to know about Linux -stable releases" as the title > claims :) > > In particular, it doesn't explain or advise which older version we > should target, that is why since I was not sure I specified 6.1.y > because I could test it properly, but not v3.x. If you think this fixes an issue back to 3.x, then just leave it at that, there's no need to have to test all of these. If when I apply the patch to the stable trees, and it does not go back to all of the active versions specified by Fixes: then you will get an email saying so and can handle it then if you want to. > Maybe it would be best to simply drop for now all the "Cc: > <stable@vger.kernel.org>" tags for this series, and following Option 2, > I send an email to stable@vger.kernel.org once the patches have been > merged to Linus' tree? That will just mean more work for both of us, leave it as is, just drop the "# 6.1.x" portion please. > > > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> > > > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > > > Reviewed-by: Lech Perczak <lech.perczak@camlingroup.com> > > > Tested-by: Lech Perczak <lech.perczak@camlingroup.com> > > > --- > > > 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; > > > > That's a magic value, some comment should be added here to explain why > > setting all bits is ok. Why does this work exactly? You only say that > > the max310x driver does this, but not why it does this at all. > > I do not understand, because my commit log message is quite long > and, it seems to me, well documenting why this works the way it > does when calling uart_configure_port() in serial_core.c? > > I say that the max310x driver also does this, because there is also no > comment in the max310x driver for using the (void __iomem *)~0; > construct. I also located the original commit message for the max310x > driver but no comments were usefull there also. > > So, what about adding this comment: > > /* > * Use all ones as membase to make sure uart_configure_port() in > * serial_core.c does not abort for SPI/I2C devices where the > * membase address is not applicable. > */ > s->p[i].port.membase = (void __iomem *)~0; Yes, that would be good, thank you. > If wou want, I could also add the same comment to the max310 driver? Yes please. thanks, greg k-h
On Thu, 3 Aug 2023 09:54:37 +0200 Greg KH <gregkh@linuxfoundation.org> wrote: > On Tue, Aug 01, 2023 at 01:16:55PM -0400, Hugo Villeneuve wrote: > > On Mon, 31 Jul 2023 17:52:26 +0200 > > Greg KH <gregkh@linuxfoundation.org> wrote: > > > > > On Tue, Jul 25, 2023 at 10:23:33AM -0400, Hugo Villeneuve wrote: > > > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com> > > > > > > > > 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") > > > > > > That commit is in a very old 3.x release. > > > > > > > Cc: <stable@vger.kernel.org> # 6.1.x > > > > > > But you say this should only go to 6.1.y? Why? What is wrong with the > > > older kernels? > > > > Hi Greg, > > I have read (and reread a couple of times) > > Documentation/process/stable-kernel-rules.rst to try to understand how > > to format the tags, but unfortunately it doesn't contain "Everything > > you ever wanted to know about Linux -stable releases" as the title > > claims :) > > > > In particular, it doesn't explain or advise which older version we > > should target, that is why since I was not sure I specified 6.1.y > > because I could test it properly, but not v3.x. > > If you think this fixes an issue back to 3.x, then just leave it at > that, there's no need to have to test all of these. If when I apply the > patch to the stable trees, and it does not go back to all of the > active versions specified by Fixes: then you will get an email saying > so and can handle it then if you want to. > > > Maybe it would be best to simply drop for now all the "Cc: > > <stable@vger.kernel.org>" tags for this series, and following Option 2, > > I send an email to stable@vger.kernel.org once the patches have been > > merged to Linus' tree? > > That will just mean more work for both of us, leave it as is, just drop > the "# 6.1.x" portion please. > > > > > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> > > > > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > > > > Reviewed-by: Lech Perczak <lech.perczak@camlingroup.com> > > > > Tested-by: Lech Perczak <lech.perczak@camlingroup.com> > > > > --- > > > > 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; > > > > > > That's a magic value, some comment should be added here to explain why > > > setting all bits is ok. Why does this work exactly? You only say that > > > the max310x driver does this, but not why it does this at all. > > > > I do not understand, because my commit log message is quite long > > and, it seems to me, well documenting why this works the way it > > does when calling uart_configure_port() in serial_core.c? > > > > I say that the max310x driver also does this, because there is also no > > comment in the max310x driver for using the (void __iomem *)~0; > > construct. I also located the original commit message for the max310x > > driver but no comments were usefull there also. > > > > So, what about adding this comment: > > > > /* > > * Use all ones as membase to make sure uart_configure_port() in > > * serial_core.c does not abort for SPI/I2C devices where the > > * membase address is not applicable. > > */ > > s->p[i].port.membase = (void __iomem *)~0; > > Yes, that would be good, thank you. > > > If wou want, I could also add the same comment to the max310 driver? > > Yes please. Hi Greg, I will send a separate patch specifically for this. Thank you, Hugo.
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;