From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH, RFC] default machine descriptor for multiplatform
Date: Tue, 5 Feb 2013 15:37:25 -0600 [thread overview]
Message-ID: <CAL_JsqJ2SyGeJePvNh5fREWP5LcAxnvNsiq2=kKNxKrnquyy3Q@mail.gmail.com> (raw)
In-Reply-To: <1638002.UJ7zfj1Wn5@wuerfel>
On 01/31/2013 11:51 AM, Arnd Bergmann wrote:
> This is what I think it would look like to do a default platform
> with an empty machine descriptor on ARM. It makes the few required
> entries in the descriptor optional by using the new irqchip_init()
> and clocksource_of_init() functions as defaults, and adds
> a fallback for the DT case to customize_machine to probe all
> the default devices.
>
> For the case that CONFIG_MULTIPLATFORM is enabled, it then
> adds a machine descriptor that never matches any machine but
> is used as a fallback if nothing else matches.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 3e3444e..8ff1d38 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -979,7 +979,6 @@ config ARCH_MULTI_V7
> bool "ARMv7 based platforms (Cortex-A, PJ4, Krait)"
> default y
> select ARCH_MULTI_V6_V7
> - select ARCH_VEXPRESS
> select CPU_V7
>
> config ARCH_MULTI_V6_V7
> diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
> index 70f1bde..e6e34ba 100644
> --- a/arch/arm/kernel/devtree.c
> +++ b/arch/arm/kernel/devtree.c
> @@ -180,6 +180,13 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
> unsigned long dt_root;
> const char *model;
>
> + if (IS_ENABLED(CONFIG_ARCH_MULTIPLATFORM)) {
> + DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
> + MACHINE_END
I assume this works, but it looks a bit strange declared here.
> +
> + mdesc_best = (struct machine_desc *)&__mach_desc_GENERIC_DT;
> + }
> +
> if (!dt_phys)
> return NULL;
>
> @@ -199,7 +206,7 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
> mdesc_score = score;
> }
> }
> - if (!mdesc_best) {
> + if (!mdesc_best && !IS_ENABLED(CONFIG_ARCH_MULTIPLATFORM)) {
> const char *prop;
> long size;
>
> diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
> index 8e4ef4c..df6f9a1 100644
> --- a/arch/arm/kernel/irq.c
> +++ b/arch/arm/kernel/irq.c
> @@ -26,6 +26,7 @@
> #include <linux/ioport.h>
> #include <linux/interrupt.h>
> #include <linux/irq.h>
> +#include <linux/irqchip.h>
> #include <linux/random.h>
> #include <linux/smp.h>
> #include <linux/init.h>
> @@ -114,7 +115,10 @@ EXPORT_SYMBOL_GPL(set_irq_flags);
>
> void __init init_IRQ(void)
> {
> - machine_desc->init_irq();
> + if (machine_desc->init_irq)
> + machine_desc->init_irq();
> + else
> + irqchip_init();
> }
>
> #ifdef CONFIG_MULTI_IRQ_HANDLER
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 3f6cbb2..1d40c9d 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -18,6 +18,7 @@
> #include <linux/bootmem.h>
> #include <linux/seq_file.h>
> #include <linux/screen_info.h>
> +#include <linux/of_platform.h>
> #include <linux/init.h>
> #include <linux/kexec.h>
> #include <linux/of_fdt.h>
> @@ -640,9 +641,17 @@ struct screen_info screen_info = {
>
> static int __init customize_machine(void)
> {
> - /* customizes platform devices, or adds new ones */
> + /*
> + * customizes platform devices, or adds new ones
> + * On DT based machines, we fall back to populating the
> + * machine from the device tree, if no callback is provided,
> + * otherwise we would always need an init_machine callback.
> + */
> if (machine_desc->init_machine)
> machine_desc->init_machine();
> + else
> + of_platform_populate(NULL, of_default_bus_match_table,
> + NULL, NULL);
Could this be unconditional? It should be safe to call multiple times
if a platform calls this first because ordering matters or there are
custom match tables. I would guess any ordering requirements need to
happen before this call anyway.
Rob
next prev parent reply other threads:[~2013-02-05 21:37 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-31 1:49 Failure to boot Russell King - ARM Linux
2013-01-31 3:02 ` Olof Johansson
2013-01-31 4:19 ` Nicolas Pitre
2013-01-31 9:20 ` Russell King - ARM Linux
2013-01-31 10:40 ` Russell King - ARM Linux
2013-01-31 12:49 ` Santosh Shilimkar
2013-01-31 13:04 ` Russell King - ARM Linux
2013-01-31 14:00 ` Santosh Shilimkar
2013-01-31 14:10 ` Santosh Shilimkar
2013-01-31 14:13 ` Russell King - ARM Linux
2013-01-31 14:16 ` Russell King - ARM Linux
2013-01-31 14:20 ` Santosh Shilimkar
2013-01-31 14:27 ` Russell King - ARM Linux
2013-01-31 14:43 ` Santosh Shilimkar
2013-01-31 16:00 ` Tony Lindgren
2013-01-31 16:19 ` Russell King - ARM Linux
2013-01-31 16:01 ` Fabio Estevam
2013-01-31 16:18 ` Russell King - ARM Linux
2013-01-31 16:27 ` Arnd Bergmann
2013-01-31 17:51 ` [PATCH, RFC] default machine descriptor for multiplatform Arnd Bergmann
2013-01-31 18:52 ` Stephen Warren
2013-01-31 20:57 ` Arnd Bergmann
2013-01-31 20:34 ` Nicolas Pitre
2013-02-01 11:47 ` Santosh Shilimkar
2013-02-01 12:34 ` Arnd Bergmann
2013-02-05 21:37 ` Rob Herring [this message]
2013-02-05 22:23 ` Arnd Bergmann
2013-02-05 21:39 ` Olof Johansson
2013-03-03 13:27 ` Rob Herring
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='CAL_JsqJ2SyGeJePvNh5fREWP5LcAxnvNsiq2=kKNxKrnquyy3Q@mail.gmail.com' \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).