summaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2012-07-25 10:33:05 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2012-11-27 09:16:03 +0100
commitacd7d952514485dbc41fa04b0d16be4002e31019 (patch)
tree97087133cd567818e9d6e2659a1e98b876155b9b /src/devices
parente820e5cb3aed810fa9ba6047ce9b8bf352335e32 (diff)
Add initialization hook for chips
Add an init() function to the chip_operations which will be called before bus enumeration. This allows to disable unused devices before they get enumerated. Change-Id: I63dd9cbfc7b5995ccafb7bf7a81dc71fc67906a0 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/1623 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Marc Jones <marcj303@gmail.com> Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/device.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/devices/device.c b/src/devices/device.c
index f021c9b3a3..03e7ea7c63 100644
--- a/src/devices/device.c
+++ b/src/devices/device.c
@@ -52,6 +52,26 @@ extern struct device *last_dev;
/** Linked list of free resources */
struct resource *free_resources = NULL;
+/**
+ * Initialize all chips of statically known devices.
+ *
+ * Will be called before bus enumeration to initialize chips stated in the
+ * device tree.
+ */
+void dev_initialize_chips(void)
+{
+ struct device *dev;
+
+ for (dev = all_devices; dev; dev = dev->next) {
+ /* Initialize chip if we haven't yet. */
+ if (dev->chip_ops && dev->chip_ops->init &&
+ !dev->chip_ops->initialized) {
+ dev->chip_ops->init(dev->chip_info);
+ dev->chip_ops->initialized = 1;
+ }
+ }
+}
+
DECLARE_SPIN_LOCK(dev_lock)
#if CONFIG_GFXUMA