From patchwork Thu Dec 31 04:09:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1421490 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=L0lien6X; 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 4D5vsy1tqSz9sRN for ; Thu, 31 Dec 2020 15:13:58 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D42B826A4; Thu, 31 Dec 2020 05:11:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="L0lien6X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A4A382645; Thu, 31 Dec 2020 05:10:51 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E9A3982625 for ; Thu, 31 Dec 2020 05:10:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id n4so16298301iow.12 for ; Wed, 30 Dec 2020 20:10:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=415S8M8lk1UM0vAfth6nFXBxEerBYpz5iHLcCJEZXpo=; b=L0lien6Xo3MohcJ6ZSnTXUlXt9279e12Q3+nBGk3v74ywgV+S7Bx0LKD2s1t5XJptb mF5ChnBqI9VvVj0Wbz6AALSfQ7hAOgpfARt7rrnNO6N/5QKTcziMpxj2LN263VwygQWq GtNCnTSS4mWefeBoFpLouZk5wQFLJLc84BGSU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=415S8M8lk1UM0vAfth6nFXBxEerBYpz5iHLcCJEZXpo=; b=Rcj27RarFoWC5j47MCqN6RXdGyhE9lyy9WMEdZmcDhpGtT+jyp6r/8hib1xm5izLye Xa22vBuhw6zxZ79gr2tQSKRaizbMNHCCCNfxdGdZiS4yxjBiEWpubg21EZjB5Z/jBBtQ vrmXTc30gOMWuB5dZD63Snklh04d4omqkLSyhDEi0DkrWWl4rmcelbWCWyA5guBBUG5F mP7ePPD6OjxYR/kPeoGy5urhlvsQniIvTtbLhL3XkHq+GRGDVr58Lhg0v6+kgTIXbatP KAUVLAOg+cfd6tnMAbILToe585DNb9ENZVEWOkE9+Uz29hLvaULQkSr5MyUN3C2gGMsG 4Tnw== X-Gm-Message-State: AOAM5305GxgWvKIWiE1jEBqFUw/d/42jTxPuUJsw84ufMb4KZa/XFuIA 6xz+UFX/LyZ54UGyTbP0QsCPXvfPNyxp2AOX X-Google-Smtp-Source: ABdhPJwFobtd4XCo6QlzH16lz5PbjGQxXTbWhdzE6OK0WC++T0knJNzwP+2rUvxFJDVidYSn+In0kw== X-Received: by 2002:a5e:9512:: with SMTP id r18mr45665106ioj.86.1609387842571; Wed, 30 Dec 2020 20:10:42 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 14sm31959026ilz.7.2020.12.30.20.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 20:10:42 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Marek Vasut , Walter Lozano , Bernhard Messerklinger , Heinrich Schuchardt , Bin Meng , Tom Rini , Simon Glass , Pavel Herrmann Subject: [PATCH 19/30] dm: core: Move flags to device-runtime info Date: Wed, 30 Dec 2020 21:09:49 -0700 Message-Id: <20201230210941.19.I6420b248f58963ecf5c57a67b084d782478ae8c8@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201231041000.660925-1-sjg@chromium.org> References: <20201231041000.660925-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean When of-platdata-inst is active, use the flags in the new udevice_rt table, dropping them from the main struct udevice. This ensures that the latter is not updated at runtime. Signed-off-by: Simon Glass --- drivers/core/device.c | 33 +++++++++++++++++++++++++++++++++ include/dm/device.h | 10 +++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index cdcf5f43ad2..2fe42888e90 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -1077,3 +1077,36 @@ int dev_enable_by_path(const char *path) return lists_bind_fdt(parent, node, NULL, false); } #endif + +#if CONFIG_IS_ENABLED(OF_PLATDATA_RT) +static struct udevice_rt *dev_get_rt(const struct udevice *dev) +{ + struct udevice *base = ll_entry_start(struct udevice, udevice); + int idx = dev - base; + + struct udevice_rt *urt = gd_dm_udevice_rt() + idx; + + return urt; +} + +u32 dev_get_flags(const struct udevice *dev) +{ + const struct udevice_rt *urt = dev_get_rt(dev); + + return urt->flags_; +} + +void dev_or_flags(const struct udevice *dev, u32 or) +{ + struct udevice_rt *urt = dev_get_rt(dev); + + urt->flags_ |= or; +} + +void dev_bic_flags(const struct udevice *dev, u32 bic) +{ + struct udevice_rt *urt = dev_get_rt(dev); + + urt->flags_ &= ~bic; +} +#endif /* OF_PLATDATA_RT */ diff --git a/include/dm/device.h b/include/dm/device.h index ba62b5f0365..b89cc89988e 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -164,11 +164,13 @@ struct udevice { struct list_head uclass_node; struct list_head child_head; struct list_head sibling_node; - u32 flags_; int seq_; #if !CONFIG_IS_ENABLED(OF_PLATDATA_RT) ofnode node_; #endif +#if !CONFIG_IS_ENABLED(OF_PLATDATA_RT) + u32 flags_; +#endif #ifdef CONFIG_DEVRES struct list_head devres_head; #endif @@ -195,6 +197,11 @@ struct udevice_rt { /* Returns the operations for a device */ #define device_get_ops(dev) (dev->driver->ops) +#if CONFIG_IS_ENABLED(OF_PLATDATA_RT) +u32 dev_get_flags(const struct udevice *dev); +void dev_or_flags(const struct udevice *dev, u32 or); +void dev_bic_flags(const struct udevice *dev, u32 bic); +#else static inline u32 dev_get_flags(const struct udevice *dev) { return dev->flags_; @@ -209,6 +216,7 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic) { dev->flags_ &= ~bic; } +#endif /* OF_PLATDATA_RT */ /** * dev_ofnode() - get the DT node reference associated with a udevice