mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] serial: ns16550: support reg-offset device-tree property
@ 2019-06-28 15:56 Marcin Niestroj
  2019-07-02  6:17 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Niestroj @ 2019-06-28 15:56 UTC (permalink / raw)
  To: barebox; +Cc: Marcin Niestroj

Some SoC have serial registers shifted by fixed offset. Support them by
respecting 'reg-offset' device-tree property.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
---
 drivers/serial/serial_ns16550.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 4c84d27bd..3edeb0dcb 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -314,12 +314,15 @@ static int ns16550_tstc(struct console_device *cdev)
 static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv)
 {
 	struct device_node *np = dev->device_node;
+	u32 offset;
 	u32 width = 1;
 
 	if (!IS_ENABLED(CONFIG_OFDEVICE))
 		return;
 
 	of_property_read_u32(np, "clock-frequency", &priv->plat.clock);
+	if (of_property_read_u32(np, "reg-offset", &offset) == 0)
+		priv->mmiobase += offset;
 	of_property_read_u32(np, "reg-shift", &priv->plat.shift);
 	of_property_read_u32(np, "reg-io-width", &width);
 	switch (width) {
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-02  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-28 15:56 [PATCH] serial: ns16550: support reg-offset device-tree property Marcin Niestroj
2019-07-02  6:17 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox