mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tapio Reijonen <tapio.reijonen@vaisala.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Markus Probst <markus.probst@posteo.de>
Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Lukas Wunner" <lukas@wunner.de>,
	"Christoph Niedermaier" <cniedermaier@dh-electronics.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Lino Sanfilippo" <l.sanfilippo@kunbus.com>,
	"Hugo Villeneuve" <hvilleneuve@dimonoff.com>,
	"Tapio Reijonen" <tapio.reijonen@vaisala.com>
Subject: [PATCH 5/7] serial: max310x: Request the line transceiver per port
Date: Wed, 11 Nov 2026 12:28:04 +0000	[thread overview]
Message-ID: <20261111-serial-transceiver-supply-v1-5-40bad0f912f2@vaisala.com> (raw)
In-Reply-To: <20261111-serial-transceiver-supply-v1-0-40bad0f912f2@vaisala.com>

Serial core requests the transceiver GPIO through the port's device
when the port is added, which for this driver is the chip: the
per-port "serial@N" subnodes, where the transceiver of a multi-channel
part is described, are out of its reach. Request it the way the RS485
properties are requested, while the device's firmware node is
temporarily retargeted at the subnode, so each channel gets its own.
Single-channel variants have no subnode; request it from the chip node
there, so the transceiver is known before uart_add_one_port() for
every variant.

Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
---
 drivers/tty/serial/max310x.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index bdfdf4a9000bbd18509746bbfd8ed0ade8164598..876bdd1f5496dcf46fdc790a89892342fd85a9e4 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -2032,20 +2032,24 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
 
 		/*
 		 * Temporarily retarget dev's fwnode to the per-port subnode
-		 * so uart_get_rs485_mode() picks up the per-port properties.
-		 * For single-port variants, fall back to the chip's own
-		 * fwnode so legacy DTs that declare rs485 properties at the
-		 * top level keep working.
+		 * so uart_get_rs485_mode() and uart_get_transceiver() pick up
+		 * the per-port properties. For single-port variants, fall
+		 * back to the chip's own fwnode so legacy DTs that declare
+		 * rs485 properties at the top level keep working.
 		 */
 		if (port_np) {
 			device_set_node(dev, of_fwnode_handle(port_np));
 			ret = uart_get_rs485_mode(&s->p[i].port);
+			if (!ret)
+				ret = uart_get_transceiver(&s->p[i].port);
 			device_set_node(dev, saved_fwnode);
 			of_node_put(port_np);
 			if (ret)
 				goto out_clk;
 		} else if (devtype->nr == 1) {
 			ret = uart_get_rs485_mode(&s->p[i].port);
+			if (!ret)
+				ret = uart_get_transceiver(&s->p[i].port);
 			if (ret)
 				goto out_clk;
 		}

-- 
2.47.3


  parent reply	other threads:[~2026-11-11 12:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 12:27 [PATCH 0/7] serial: core: Power the line transceiver with the port Tapio Reijonen
2026-11-11 12:28 ` [PATCH 1/7] serial: max310x: Look up all channels before adding any port Tapio Reijonen
2026-11-11 12:28 ` [PATCH 2/7] dt-bindings: serial: Add the line transceiver enable GPIO Tapio Reijonen
2026-11-23  8:03   ` Krzysztof Kozlowski
2026-11-23  8:08     ` Krzysztof Kozlowski
2026-11-11 12:28 ` [PATCH 3/7] dt-bindings: serial: sc16is7xx: Disallow transceiver GPIO on dual parts Tapio Reijonen
2026-11-23  8:00   ` Krzysztof Kozlowski
2026-11-11 12:28 ` [PATCH 4/7] serial: core: Power the line transceiver with the port Tapio Reijonen
2026-11-11 12:28 ` Tapio Reijonen [this message]
2026-11-11 12:28 ` [PATCH 6/7] dt-bindings: serial: max310x: Add maxim,tristate-when-closed Tapio Reijonen
2026-11-23  8:05   ` Krzysztof Kozlowski
2026-11-11 12:28 ` [PATCH 7/7] serial: max310x: Three-state TX and RTS while the port is closed Tapio Reijonen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261111-serial-transceiver-supply-v1-5-40bad0f912f2@vaisala.com \
    --to=tapio.reijonen@vaisala.com \
    --cc=cniedermaier@dh-electronics.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=l.sanfilippo@kunbus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=markus.probst@posteo.de \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®