From: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 09/11] arm-dt: probe for device-tree enabled platforms
Date: Tue, 22 Dec 2009 18:54:56 +0800 [thread overview]
Message-ID: <1261479296.248359.837563567032.9.gpush@pororo> (raw)
In-Reply-To: <1261479296.245235.191110925832.0.gpush@pororo>
Add a probe_dt pointer to struct machine_desc, which can be populated by
platforms that support discovery via device trees.
At setup_arch time, each compiled-in machine_desc with a dt_probe member
will be probed. If the probe function returns 1, we have a match.
Signed-off-by: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
arch/arm/include/asm/mach/arch.h | 10 ++++++++++
arch/arm/kernel/devtree.c | 19 ++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index c59842d..b83af35 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -41,6 +41,7 @@ struct machine_desc {
void (*init_irq)(void);
struct sys_timer *timer; /* system tick timer */
void (*init_machine)(void);
+ int (*probe_dt)(unsigned long root);
};
/*
@@ -57,4 +58,13 @@ static const struct machine_desc __mach_desc_##_type \
#define MACHINE_END \
};
+#define MACH_TYPE_DT 0xffffffff
+
+#define DT_MACHINE_START(_name, _namestr) \
+static const struct machine_desc __mach_desc_##_name \
+ __used \
+ __attribute__((__section__(".arch.info.init"))) = { \
+ .nr = MACH_TYPE_DT, \
+ .name = _namestr,
+
#endif
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index a8496f6..2ff4bd0 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -17,6 +17,7 @@
#include <asm/setup.h>
#include <asm/page.h>
+#include <asm/mach/arch.h>
struct device_node *of_chosen;
@@ -52,5 +53,21 @@ int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
struct machine_desc * __init parse_devicetree(void *devtree)
{
- return NULL;
+ extern struct machine_desc __arch_info_begin, __arch_info_end;
+ struct machine_desc *mdesc;
+ unsigned long dt_root;
+
+ early_init_devtree(devtree);
+
+ dt_root = of_get_flat_dt_root();
+
+ for (mdesc = &__arch_info_begin; mdesc < &__arch_info_end; mdesc++) {
+ if (mdesc->probe_dt && mdesc->probe_dt(dt_root))
+ break;
+ }
+
+ if (mdesc >= &__arch_info_end)
+ return NULL;
+
+ return mdesc;
}
next prev parent reply other threads:[~2009-12-22 10:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 10:54 [PATCH 00/11] Device-tree support for ARM Jeremy Kerr
2009-12-22 10:54 ` [PATCH 02/11] arm: use generic infrastructure for early params Jeremy Kerr
2010-01-06 16:27 ` Russell King - ARM Linux
[not found] ` <20100106162731.GB1728-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2010-01-06 22:31 ` Jeremy Kerr
[not found] ` <201003060733.57636.rob@landley.net>
[not found] ` <201003060733.57636.rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org>
2010-03-06 16:01 ` Grant Likely
2009-12-22 10:54 ` [PATCH 01/11] arm: change command_line to cmd_line, and export it Jeremy Kerr
2009-12-22 10:54 ` [PATCH 11/11] arm/versatile: probe via device tree Jeremy Kerr
2009-12-22 10:54 ` [PATCH 04/11] arm-dt: Add ATAG_DEVTREE tag Jeremy Kerr
2009-12-22 10:54 ` [PATCH 08/11] arm-dt: parse memory info from DT Jeremy Kerr
2009-12-22 10:54 ` [PATCH 05/11] arm-dt: Add CONFIG_ARM_DEVTREE Jeremy Kerr
2009-12-22 10:54 ` [PATCH 03/11] arm: export arm_add_memory Jeremy Kerr
2009-12-22 10:54 ` [PATCH 06/11] arm-dt: postpone machine detection until setup_arch with CONFIG_ARM_DEVTREE Jeremy Kerr
2010-01-04 16:36 ` Ben Dooks
[not found] ` <4B421903.4050200-Y5A6D6n0/KfQXOPxS62xeg@public.gmane.org>
2010-01-04 22:26 ` Jeremy Kerr
2009-12-22 10:54 ` [PATCH 10/11] arm-dt: parse initrd from device tree Jeremy Kerr
2009-12-22 10:54 ` Jeremy Kerr [this message]
2009-12-22 10:54 ` [PATCH 07/11] arm-dt: parse devtree pointer on boot Jeremy Kerr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1261479296.248359.837563567032.9.gpush@pororo \
--to=jeremy.kerr-z7wlfzj8ewms+fvcfc7uqw@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox