[PATCH 06/11] x86/dtb: add support hpet
Sebastian Andrzej Siewior
bigeasy at linutronix.de
Fri Nov 26 04:39:56 EST 2010
Set hpet_address based on information provied form DTB
Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
CC: x86 at kernel.org
Cc: devicetree-discuss at lists.ozlabs.org
Tested-by: Dirk Brandewie <dirk.brandewie at gmail.com>
---
arch/x86/kernel/prom.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/prom.c b/arch/x86/kernel/prom.c
index 9551f2f..f61c541 100644
--- a/arch/x86/kernel/prom.c
+++ b/arch/x86/kernel/prom.c
@@ -9,6 +9,7 @@
#include <linux/of_platform.h>
#include <linux/slab.h>
+#include <asm/hpet.h>
#include <asm/irq_controller.h>
#include <asm/io_apic.h>
@@ -99,6 +100,27 @@ void __init add_dtb(u64 data)
offsetof(struct setup_data, data));
}
+static int __init early_scan_hpet(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ unsigned long l;
+ int ret;
+ __be32 *cell;
+
+ if (depth != 2)
+ return 0;
+
+ ret = of_flat_dt_is_compatible(node, "intel,hpet");
+ if (!ret)
+ return 0;
+
+ cell = of_get_flat_dt_prop(node, "phys_reg", &l);
+ if (!cell)
+ return 0;
+ hpet_address = of_read_ulong(cell, l / 4);
+ return 1;
+}
+
static void __init of_lapic_setup(void)
{
#ifdef CONFIG_X86_LOCAL_APIC
@@ -195,6 +217,7 @@ void __init x86_early_of_parse(void)
/* root level address cells */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
+ of_scan_flat_dt(early_scan_hpet, NULL);
of_apic_setup();
early_iounmap(initial_boot_params, size);
--
1.7.3.2
More information about the devicetree-discuss
mailing list