mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] ARM: imx6: add OF fixup to delete nonexistent CPU cores
Date: Tue, 27 Oct 2015 17:08:17 +0100	[thread overview]
Message-ID: <20151027160817.GO25308@pengutronix.de> (raw)
In-Reply-To: <1445958569-23525-1-git-send-email-l.stach@pengutronix.de>

On Tue, Oct 27, 2015 at 04:09:29PM +0100, Lucas Stach wrote:
> Make sure that the DT passed to Linux reflects the actual number of CPU
> cores present in the system by reading the SCU configuration. As both
> the Q and DL variants of the MX6 have versions with cores fused away,
> but the DTs have the maximum number of cores specified, this just deletes
> any nonexistent CPU core nodes.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> v2:
> - make sure to only install the fixup on i.MX6

Applied, thanks

Sascha

> ---
>  arch/arm/mach-imx/imx6.c | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
> index c49de49209f3..0fdd785c6dc6 100644
> --- a/arch/arm/mach-imx/imx6.c
> +++ b/arch/arm/mach-imx/imx6.c
> @@ -238,3 +238,42 @@ static int imx6_mmu_init(void)
>  	return 0;
>  }
>  postmmu_initcall(imx6_mmu_init);
> +
> +#define SCU_CONFIG	0x04
> +
> +static int imx6_fixup_cpus(struct device_node *root, void *context)
> +{
> +	struct device_node *cpus_node, *np, *tmp;
> +	unsigned long scu_phys_base;
> +	unsigned int max_core_index;
> +
> +	cpus_node = of_find_node_by_name(root, "cpus");
> +	if (!cpus_node)
> +		return 0;
> +
> +	/* get actual number of available CPU cores from SCU */
> +	asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (scu_phys_base));
> +	max_core_index = (readl(IOMEM(scu_phys_base) + SCU_CONFIG) & 0x03);
> +
> +	for_each_child_of_node_safe(cpus_node, tmp, np) {
> +		u32 cpu_index;
> +
> +		if (of_property_read_u32(np, "reg", &cpu_index))
> +			continue;
> +
> +		if (cpu_index > max_core_index)
> +			of_delete_node(np);
> +	}
> +
> +	return 0;
> +}
> +
> +static int imx6_fixup_cpus_register(void)
> +{
> +	if (!of_machine_is_compatible("fsl,imx6q") &&
> +	    !of_machine_is_compatible("fsl,imx6dl"))
> +		return 0;
> +
> +	return of_register_fixup(imx6_fixup_cpus, NULL);
> +}
> +device_initcall(imx6_fixup_cpus_register);
> -- 
> 2.6.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2015-10-27 16:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 15:09 Lucas Stach
2015-10-27 16:08 ` Sascha Hauer [this message]

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=20151027160817.GO25308@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@pengutronix.de \
    /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