From patchwork Mon Feb 17 11:36:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1239143 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=ms+5EvII; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Lhlr2PY3z9sNg for ; Mon, 17 Feb 2020 22:36:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BBF1812A7; Mon, 17 Feb 2020 12:36:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1581939410; bh=BFy+82ueBamM8UAOAmg/J+PLJifPUHIEX/bK5xZAOfc=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=ms+5EvIIlnnpivNN/58LPEFqfBT2UeuUpvK5vUwPh9YiVQz3CfVn/e/b3xTB7TSbs O/MXsr0ns3SWCQYHlBxAroKGAQ73ECO6mdphhFlBVqcTC6vOb29OSEhTZ4CtHJRWbd oa8oIMYDZAZJA8e064o7WBHEaFOfK/iBBApy10bZ7WCMWJyYWSuLMPyjTCWOQ26N6p 1AtOAwLybcR+tt3h219MYra2DaKl2cReT5uB0embZw7QMTb80OXQ+qAfe6aRaauBp5 yzI4HJHlaNNe8uy4PCCJro52KuSx70+P3wFyjoNsETEzJwlLV+N7xKTXSa8epAMRtx dSVLzbIOqj0Lw== Received: by phobos.denx.de (Postfix, from userid 109) id F1C0B812A7; Mon, 17 Feb 2020 12:36:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5A35A8071B for ; Mon, 17 Feb 2020 12:36:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=agust@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 48Lhlf03c2z1rh7v; Mon, 17 Feb 2020 12:36:45 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 48Lhld6Xcpz1qrmQ; Mon, 17 Feb 2020 12:36:45 +0100 (CET) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id KUe1UJpR8sno; Mon, 17 Feb 2020 12:36:45 +0100 (CET) X-Auth-Info: RRisgizihZ+7lExz2Vaxd76PNx77r5GoBNnMiXP7jYI= Received: from crub.agik.hopto.org (pD95F11D0.dip0.t-ipconnect.de [217.95.17.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 17 Feb 2020 12:36:45 +0100 (CET) From: Anatolij Gustschin To: u-boot@lists.denx.de Cc: narmstrong@baylibre.com, lokeshvutla@ti.com, trini@konsulko.com, sjg@chromium.org Subject: [PATCH 1/2] dm: core: Add a flag for power domain control on device removal Date: Mon, 17 Feb 2020 12:36:43 +0100 Message-Id: <20200217113644.21434-1-agust@denx.de> X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean In various cases a power domain must stay enabled after device removal when booting OS (i.e. serial debug console or display). Add a flag to selectively skip switching off a power domain. Fixes: 52edfed65de9 ("dm: core: device: switch off power domain after device removal") Signed-off-by: Anatolij Gustschin Acked-by: Neil Armstrong Tested-by: Guillaume La Roque Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- drivers/core/device-remove.c | 5 +++-- include/dm/device.h | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 444e34b492..ff5b28cb6a 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -194,8 +194,9 @@ int device_remove(struct udevice *dev, uint flags) } } - if (!(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF) && - (dev != gd->cur_serial_dev)) + if (!(drv->flags & + (DM_FLAG_DEFAULT_PD_CTRL_OFF | DM_FLAG_REMOVE_WITH_PD_ON)) && + dev != gd->cur_serial_dev) dev_power_domain_off(dev); if (flags_remove(flags, drv->flags)) { diff --git a/include/dm/device.h b/include/dm/device.h index ab806d0b7e..a56164b19b 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -67,6 +67,12 @@ struct driver_info; /* Driver platdata has been read. Cleared when the device is removed */ #define DM_FLAG_PLATDATA_VALID (1 << 12) +/* + * Device is removed without switching off its power domain. This might + * be required, i. e. for serial console (debug) output when booting OS. + */ +#define DM_FLAG_REMOVE_WITH_PD_ON (1 << 13) + /* * One or multiple of these flags are passed to device_remove() so that * a selective device removal as specified by the remove-stage and the