From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatolij Gustschin Date: Sun, 14 Jul 2019 21:57:32 +0200 Subject: [U-Boot] [PATCH v2 2/2] serial: lpuart: request dm device removal when booting OS In-Reply-To: <20190714195732.31232-1-agust@denx.de> References: <20190714195732.31232-1-agust@denx.de> Message-ID: <20190714195732.31232-2-agust@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.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 --- Changes in v2: - None 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 57dd4a72c6..b028f4b35f 100644 --- a/drivers/serial/serial_lpuart.c +++ b/drivers/serial/serial_lpuart.c @@ -489,6 +489,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; @@ -543,5 +550,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