[PATCH 06/11] x86/dtb: add support hpet

From: Sebastian Andrzej Siewior
Date: Thu Nov 25 2010 - 12:44:03 EST


Set hpet_address based on information provied form DTB

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
CC: x86@xxxxxxxxxx
Cc: devicetree-discuss@xxxxxxxxxxxxxxxx
Tested-by: Dirk Brandewie <dirk.brandewie@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/