public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] arm/imx6q: add smp and cpu hotplug support
Date: Tue, 06 Sep 2011 20:53:07 +0200	[thread overview]
Message-ID: <1588593.gaQsrFqt8B@wuerfel> (raw)
In-Reply-To: <1315303120-24203-5-git-send-email-shawn.guo@linaro.org>

On Tuesday 06 September 2011 17:58:38 Shawn Guo wrote:
> It adds smp and cpu hotplug support for imx6q.
> +static u32 twd_saved_regs[4];
> +static int twd_irq;
> +
> +/*
> + * Resuming from ARM Dormant/Shutdown mode, the boot procedure will
> + * re-setup local timer for secondary cores.  For primary core, it
> + * has to take care of itself with the following pair of functions
> + * during suspend/resume.
> + */
> +void imx_local_timer_pre_suspend(void)
> +{
> +	twd_saved_regs[0] = __raw_readl(twd_base + TWD_TIMER_LOAD);
> +	twd_saved_regs[1] = __raw_readl(twd_base + TWD_TIMER_COUNTER);
> +	twd_saved_regs[2] = __raw_readl(twd_base + TWD_TIMER_CONTROL);
> +	twd_saved_regs[3] = __raw_readl(twd_base + TWD_TIMER_INTSTAT);
> +}
> +
> +void imx_local_timer_post_resume(void)
> +{
> +	__raw_writel(twd_saved_regs[0], twd_base + TWD_TIMER_LOAD);
> +	__raw_writel(twd_saved_regs[1], twd_base + TWD_TIMER_COUNTER);
> +	__raw_writel(twd_saved_regs[2], twd_base + TWD_TIMER_CONTROL);
> +	__raw_writel(twd_saved_regs[3], twd_base + TWD_TIMER_INTSTAT);
> +
> +	gic_enable_ppi(twd_irq);
> +}

readl_relaxed()?

> +extern void v7_secondary_startup(void);
> +
> +#define IMX_SCU_VIRT_BASE	0xf4a00000
> +
> +static void __iomem *scu_base = ((void __iomem *)(IMX_SCU_VIRT_BASE));

It's a little bit silly to have a variable for the base and then initialize
it statically. Not sure what the best solution is here.

> +static struct map_desc scu_io_desc __initdata = {
> +	.virtual	= IMX_SCU_VIRT_BASE,
> +	.pfn		= 0, /* run-time */
> +	.length		= SZ_4K,
> +	.type		= MT_DEVICE,
> +};
> +
> +void __init imx_scu_map_io(void)
> +{
> +	unsigned long base;
> +
> +	/* Get SCU base */
> +	asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
> +
> +	scu_io_desc.pfn = __phys_to_pfn(base);
> +	iotable_init(&scu_io_desc, 1);
> +}

Maybe we can simply define a platform-independent where the SCU gets mapped?
That would get rid of most of the platform specific SCU code, at least for
those platforms that can reliably read the scu base.

> +/*
> + * Initialise the CPU possible map early - this describes the CPUs
> + * which may be present or become present in the system.
> + */
> +void __init smp_init_cpus(void)
> +{
> +	int i, ncores;
> +
> +	ncores = scu_get_core_count(scu_base);
> +
> +	for (i = 0; i < ncores; i++)
> +		set_cpu_possible(i, true);
> +
> +	set_smp_cross_call(gic_raise_softirq);
> +}
> +
> +void imx_smp_prepare(void)
> +{
> +	scu_enable(scu_base);
> +}
> +
> +void __init platform_smp_prepare_cpus(unsigned int max_cpus)
> +{
> +	imx_smp_prepare();
> +}

Then these functions could also be moved into the smp_scu file as generic
helpers that can be used by all similar platforms.

	Arnd

  reply	other threads:[~2011-09-06 18:53 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-06  9:58 [PATCH 0/6] add initial imx6q support Shawn Guo
2011-09-06  9:58 ` [PATCH 1/6] arm/imx6q: add device tree source Shawn Guo
2011-09-06 18:31   ` Arnd Bergmann
2011-09-07 11:16     ` Shawn Guo
2011-09-06  9:58 ` [PATCH 2/6] arm/imx6q: add core definitions and low-level debug uart Shawn Guo
2011-09-06 18:39   ` Arnd Bergmann
2011-09-07  8:50     ` Shawn Guo
2011-09-06 20:25   ` Uwe Kleine-König
2011-09-07 11:00     ` Shawn Guo
2011-09-07 12:36       ` Uwe Kleine-König
2011-09-07 14:23         ` Russell King - ARM Linux
2011-09-07 15:36           ` Nicolas Pitre
2011-09-08 14:56             ` Arnd Bergmann
2011-09-09 17:28               ` Tony Lindgren
2011-09-12  2:30         ` Shawn Guo
2011-09-12  7:41           ` Uwe Kleine-König
2011-09-12  8:43             ` Shawn Guo
2011-09-12  8:44       ` Sascha Hauer
2011-09-12 11:36         ` Shawn Guo
2011-09-12 14:14         ` Russell King - ARM Linux
2011-09-17 11:59           ` Russell King - ARM Linux
2011-09-15  1:24     ` Shawn Guo
2011-09-06  9:58 ` [PATCH 3/6] arm/imx6q: add core drivers clock, gpc, mmdc and src Shawn Guo
2011-09-06 19:14   ` Arnd Bergmann
2011-09-07  6:05     ` Shawn Guo
2011-09-07  7:56       ` Arnd Bergmann
2011-09-12 16:12         ` Shawn Guo
2011-09-12 19:40           ` Grant Likely
2011-09-12 20:28             ` Arnd Bergmann
2011-09-12 21:04               ` Grant Likely
2011-09-13  0:07             ` Shawn Guo
2011-09-07 12:43       ` Barry Song
2011-09-08  6:48         ` Shawn Guo
2011-09-11  2:28           ` Barry Song
2011-09-12 19:16           ` Grant Likely
2011-09-12  9:46   ` Sascha Hauer
2011-09-12 11:49     ` Shawn Guo
2011-09-12 12:36       ` Uwe Kleine-König
2011-09-12 12:40         ` Arnd Bergmann
2011-09-12 14:27           ` Shawn Guo
2011-09-15  1:26             ` Shawn Guo
2011-09-06  9:58 ` [PATCH 4/6] arm/imx6q: add smp and cpu hotplug support Shawn Guo
2011-09-06 18:53   ` Arnd Bergmann [this message]
2011-09-07  4:41     ` Shawn Guo
2011-09-07  5:08       ` Shilimkar, Santosh
2011-09-07  7:46         ` Shawn Guo
2011-09-06  9:58 ` [PATCH 5/6] arm/imx6q: add device tree machine support Shawn Guo
2011-09-06 18:55   ` Arnd Bergmann
2011-09-07  3:07     ` Shawn Guo
2011-09-07  7:26       ` Arnd Bergmann
2011-09-06  9:58 ` [PATCH 6/6] arm/imx6q: add suspend/resume support Shawn Guo
2011-09-06 18:56   ` Arnd Bergmann
2011-09-07 13:50   ` Barry Song
2011-09-08  6:23     ` Shawn Guo
2011-09-08  7:47       ` Russell King - ARM Linux
2011-09-08 15:22         ` Shawn Guo
2011-09-08 16:24           ` Russell King - ARM Linux
2011-09-08 17:09             ` Lorenzo Pieralisi
2011-09-09  7:40               ` Shawn Guo
2011-09-09  6:31             ` Barry Song
2011-09-09  7:32             ` Shawn Guo
2011-09-09  8:15               ` Russell King - ARM Linux
2011-09-09 10:15                 ` Shawn Guo
2011-09-09 18:47                   ` Russell King - ARM Linux
2011-09-06 18:28 ` [PATCH 0/6] add initial imx6q support Arnd Bergmann
2011-09-06 19:42   ` Uwe Kleine-König
2011-09-07  2:55     ` Shawn Guo
2011-09-07  9:39       ` Arnd Bergmann
2011-09-07  2:51   ` Shawn Guo

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=1588593.gaQsrFqt8B@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