public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] serial: lpuart: request dm device removal when booting OS
Date: Wed, 10 Jul 2019 16:09:56 +0200	[thread overview]
Message-ID: <20190710140956.1647-2-agust@denx.de> (raw)
In-Reply-To: <20190710140956.1647-1-agust@denx.de>

Extend the driver to allow dm device removal, but always let the
console serial device power domain enabled, so that U-Boot doesn't
crash when i. e. the serial output is enabled for debugging.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/serial/serial_lpuart.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index a357b00d28..9b56dfb11e 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -488,6 +488,13 @@ static int lpuart_serial_probe(struct udevice *dev)
 		return _lpuart_serial_init(dev);
 }
 
+static int lpuart_serial_remove(struct udevice *dev)
+{
+	if (dev == gd->cur_serial_dev)
+		dev->flags |= DM_FLAG_REMOVE_WITH_PD_ON;
+	return 0;
+}
+
 static int lpuart_serial_ofdata_to_platdata(struct udevice *dev)
 {
 	struct lpuart_serial_platdata *plat = dev->platdata;
@@ -539,5 +546,7 @@ U_BOOT_DRIVER(serial_lpuart) = {
 	.ofdata_to_platdata = lpuart_serial_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata),
 	.probe = lpuart_serial_probe,
+	.remove = lpuart_serial_remove,
 	.ops	= &lpuart_serial_ops,
+	.flags	= DM_FLAG_OS_PREPARE,
 };
-- 
2.17.1

  reply	other threads:[~2019-07-10 14:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 14:09 [U-Boot] [PATCH 1/2] dm: core: device: switch off power domain after device removal Anatolij Gustschin
2019-07-10 14:09 ` Anatolij Gustschin [this message]
2019-07-12 21:05 ` Simon Glass
2019-07-14 16:44   ` Anatolij Gustschin

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=20190710140956.1647-2-agust@denx.de \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /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