From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/PATCH 1/4 PATCH] ARM: mvebu: use dt_fixup to provide fallback for enable-method
Date: Fri, 12 Dec 2014 12:35:56 +0100 [thread overview]
Message-ID: <2005632.nq5F7SJD3S@wuerfel> (raw)
In-Reply-To: <1418360035-27975-1-git-send-email-chris.packham@alliedtelesis.co.nz>
On Friday 12 December 2014 17:53:55 Chris Packham wrote:
> > I briefly explored that approach here[1]. The tricky part would be
> > handling the fact that the enable method can be attached to either the
> > /cpus node or and individual /cpu entry (or is that something I can
> > ignore?).
> >
> > In the end I thought that the unconditional setting of smp_ops was
> > easier to implement and would achieve the same result.
>
> Actually as it turns out it's not that hard to implement something that
> checks both /cpus and /cpus/cpu at n. I'll include this with the next round
> after I've waited for anymore feedback.
Ah, very nice!
> ---8<---
> Subject: [PATCH] ARM: mvebu: use dt_fixup to provide fallback for enable-method
>
> When the device tree doesn't define an enable-method insert a property
> into the flattened device tree. arm_dt_init_cpu_maps() will then parse
> this an set smp_ops appropriately. Now that we have this fallback it is
> no longer necessary to set .smp in the DT_MACHINE definition.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> arch/arm/mach-mvebu/Makefile | 2 ++
> arch/arm/mach-mvebu/board-v7.c | 37 ++++++++++++++++++++++++++++++++++++-
> 2 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
> index e24136b..68310f8 100644
> --- a/arch/arm/mach-mvebu/Makefile
> +++ b/arch/arm/mach-mvebu/Makefile
> @@ -14,3 +14,5 @@ endif
> obj-$(CONFIG_MACH_DOVE) += dove.o
> obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o
> obj-$(CONFIG_MACH_NETXBIG) += netxbig.o
> +
> +CFLAGS_board-v7.o = -I$(src)/../../../scripts/dtc/libfdt
> \ No newline at end of file
Why is this needed? Can't you just include <linux/libfdt.h> ?
> +static void __init armada_370_xp_dt_fixup(void)
> +{
> + int offset, node;
> + int i, len;
> + void *prop;
> + char buffer[20];
> +
> + offset = fdt_path_offset(initial_boot_params, "/cpus");
> + if (offset < 0)
> + return;
> +
> + prop = fdt_getprop(initial_boot_params, offset, "enable-method", &len);
> + if (prop)
> + return;
> +
> + for (i = 0; i < NR_CPUS; i++) {
> + snprintf(buffer, sizeof(buffer), "cpu@%d", i);
> + node = fdt_subnode_offset(initial_boot_params, offset, buffer);
> + if (node < 0)
> + break;
> + prop = fdt_getprop(initial_boot_params, node,
> + "enable-method", &len);
> + if (prop)
> + return;
> + }
> +
> + pr_info("No enable-method defined. "
> + "Falling back to \"marvell,armada-xp-smp\"\n");
> +
> + fdt_setprop(initial_boot_params, offset, "enable-method",
> + "marvell,armada-xp-smp", sizeof("marvell,armada-xp-smp"));
> +}
I think it would be good to first check whether you are running on Armada XP
or Armada 370, because the latter does not require this.
Arnd
next prev parent reply other threads:[~2014-12-12 11:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 2:39 [RFC/PATCH 0/4] Add support for Marvell's RD-DXBC2 Chris Packham
2014-12-10 2:39 ` [RFC/PATCH 1/4] ARM: mvebu: use dt_fixup to provide fallback for enable-method Chris Packham
2014-12-10 9:44 ` Arnd Bergmann
2014-12-10 19:45 ` Chris Packham
2014-12-12 4:53 ` [RFC/PATCH 1/4 PATCH] " Chris Packham
2014-12-12 11:35 ` Arnd Bergmann [this message]
2014-12-14 21:11 ` Chris Packham
2014-12-15 0:57 ` Chris Packham
2014-12-15 10:37 ` Arnd Bergmann
2014-12-15 20:12 ` Chris Packham
2014-12-16 2:21 ` Chris Packham
2014-12-16 8:57 ` Arnd Bergmann
2014-12-16 2:13 ` [PATCH] dtc: Use quotes to include header files Chris Packham
2014-12-16 14:44 ` Jon Loeliger
2015-01-29 15:56 ` Grant Likely
2015-01-29 16:30 ` Rob Herring
2015-01-30 16:21 ` Chris Packham
2014-12-10 2:39 ` [RFC/PATCH 2/4] clk: mvebu: armada-xp: Support for 98DX4251 Chris Packham
2014-12-10 2:39 ` [RFC/PATCH 3/4] ARM: mvebu: Initial support for rd-dxbc2 Chris Packham
2014-12-10 2:39 ` [RFC/PATCH 4/4] ARM: mvebu: Custom smp_ops for 98DX4251 Chris Packham
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=2005632.nq5F7SJD3S@wuerfel \
--to=arnd@arndb.de \
--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