All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/10] ARM: clps711x: Add CLPS711X cpuidle driver
Date: Fri, 2 Aug 2013 12:10:32 +0100	[thread overview]
Message-ID: <20130802111031.GG2884@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <1374172501-26796-9-git-send-email-shc_work@mail.ru>

On Thu, Jul 18, 2013 at 07:34:59PM +0100, Alexander Shiyan wrote:
> This adds the cpuidle driver for Cirrus Logic CLPS711X series SoCs.
> Designed primarily for migration CLPS711X subarch for multiplatform & DT.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/cpuidle/Kconfig            |  6 +++
>  drivers/cpuidle/Makefile           |  1 +
>  drivers/cpuidle/cpuidle-clps711x.c | 80 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 87 insertions(+)
>  create mode 100644 drivers/cpuidle/cpuidle-clps711x.c
> 
> diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> index 0e2cd5c..c68a0cf 100644
> --- a/drivers/cpuidle/Kconfig
> +++ b/drivers/cpuidle/Kconfig
> @@ -36,6 +36,12 @@ config CPU_IDLE_CALXEDA
>  	help
>  	  Select this to enable cpuidle on Calxeda processors.
>  
> +config CPU_IDLE_CLPS711X
> +	bool "CPU Idle Driver for CLPS711X processors"
> +	depends on ARCH_CLPS711X
> +	help
> +	  Select this to enable cpuidle on Cirrus Logic CLPS711X processors.
> +
>  config CPU_IDLE_ZYNQ
>  	bool "CPU Idle Driver for Xilinx Zynq processors"
>  	depends on ARCH_ZYNQ
> diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> index 8767a7b..d07d2cb 100644
> --- a/drivers/cpuidle/Makefile
> +++ b/drivers/cpuidle/Makefile
> @@ -6,5 +6,6 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
>  obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
>  
>  obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
> +obj-$(CONFIG_CPU_IDLE_CLPS711X)	+= cpuidle-clps711x.o
>  obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o
>  obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
> diff --git a/drivers/cpuidle/cpuidle-clps711x.c b/drivers/cpuidle/cpuidle-clps711x.c
> new file mode 100644
> index 0000000..9f0129f
> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-clps711x.c
> @@ -0,0 +1,80 @@
> +/*
> + *  CLPS711X CPU idle driver
> + *
> + *  Copyright (C) 2013 Alexander Shiyan <shc_work@mail.ru>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/cpuidle.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +static void __iomem *clps711x_halt;
> +
> +static int clps711x_cpuidle_halt(struct cpuidle_device *dev,
> +				 struct cpuidle_driver *drv, int index)
> +{
> +	writel(1, clps711x_halt);
> +	asm volatile ("mov r0, r0");
> +	asm volatile ("mov r0, r0");

Huh?

> +
> +	return index;
> +}
> +
> +static struct cpuidle_driver clps711x_idle_driver = {
> +	.name			= "clps711x_idle",
> +	.owner			= THIS_MODULE,
> +	.state_count		= 1,
> +	.states[0]	= {
> +		.name		= "HALT",
> +		.desc		= "CLPS711X WFI",
> +		.enter		= clps711x_cpuidle_halt,
> +		.exit_latency	= 1,
> +	},
> +};
> +
> +static int __init clps711x_cpuidle_probe(struct platform_device *pdev)
> +{
> +	struct resource *res;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	clps711x_halt = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(clps711x_halt))
> +		return PTR_ERR(clps711x_halt);
> +
> +	return cpuidle_register(&clps711x_idle_driver, NULL);
> +}
> +
> +static int clps711x_cpuidle_remove(struct platform_device *pdev)
> +{
> +	cpuidle_unregister(&clps711x_idle_driver);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id clps711x_cpuidle_dt_ids[] = {
> +	{ .compatible = "cirrus,clps711x-cpuidle", },
> +	{ }
> +};

I don't like this -- cpuidle is a Linux abstraction, not a real device.
Additionally you haven't provided a binding.

What is the device being poked actually called? Is it a register in a
larger power management unit?

Thanks,
Mark.

> +MODULE_DEVICE_TABLE(of, clps711x_cpuidle_dt_ids);
> +
> +static struct platform_driver clps711x_cpuidle_driver = {
> +	.driver	= {
> +		.name		= "clps711x-cpuidle",
> +		.owner		= THIS_MODULE,
> +		.of_match_table	= clps711x_cpuidle_dt_ids,
> +	},
> +	.remove	= clps711x_cpuidle_remove,
> +};
> +module_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe);
> +
> +MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
> +MODULE_DESCRIPTION("CLPS711X CPU idle driver");
> +MODULE_LICENSE("GPL");
> -- 
> 1.8.1.5
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

  parent reply	other threads:[~2013-08-02 11:10 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 18:34 [PATCH 00/10] ARM: clps711x: Initial DT support / Fixes Alexander Shiyan
2013-07-18 18:34 ` [PATCH 01/10] ARM: clps711x: Remove the special name for the syscon driver Alexander Shiyan
2013-08-14  6:29   ` Olof Johansson
2013-08-14  6:29   ` Olof Johansson
2013-07-18 18:34 ` [PATCH 02/10] ARM: clps711x: Drop fortunet board support Alexander Shiyan
2013-08-14  6:29   ` Olof Johansson
2013-07-18 18:34 ` [PATCH 03/10] ARM: clps711x: autcpu12: Remove incorrect config checking Alexander Shiyan
2013-08-14  6:30   ` Olof Johansson
2013-07-18 18:34 ` [PATCH 04/10] ARM: clps711x: edb7211: Remove extra iotable_init() call Alexander Shiyan
2013-08-14  6:30   ` Olof Johansson
2013-07-18 18:34 ` [PATCH 05/10] ARM: clps711x: Add CLPS711X clk driver Alexander Shiyan
2013-08-02 10:25   ` Mark Rutland
2013-07-18 18:34 ` [PATCH 06/10] ARM: clps711x: Add CLPS711X clocksource driver Alexander Shiyan
2013-07-19 14:38   ` Daniel Lezcano
2013-07-20  3:44     ` Alexander Shiyan
2013-07-20 21:48       ` Daniel Lezcano
2013-07-21  4:30         ` Alexander Shiyan
2013-08-02 10:46   ` Mark Rutland
2013-08-04 12:31     ` Alexander Shiyan
2013-08-05 17:02       ` Mark Rutland
2013-07-18 18:34 ` [PATCH 07/10] ARM: clps711x: Add CLPS711X irqchip driver Alexander Shiyan
2013-08-02 10:57   ` Mark Rutland
2013-08-02 15:55     ` Alexander Shiyan
2013-08-03 19:45       ` Arnd Bergmann
2013-08-04  4:50         ` Alexander Shiyan
2013-08-04 20:46           ` Arnd Bergmann
2013-08-04 20:57             ` Arnd Bergmann
2013-08-05 18:16               ` Alexander Shiyan
2013-08-05 19:26                 ` Arnd Bergmann
2013-08-05 20:42                   ` Alexander Shiyan
2013-08-05 21:00                     ` Arnd Bergmann
2013-08-06 15:25                       ` Alexander Shiyan
2013-08-05 16:36         ` H Hartley Sweeten
2013-07-18 18:34 ` [PATCH 08/10] ARM: clps711x: Add CLPS711X cpuidle driver Alexander Shiyan
2013-07-20 21:42   ` Daniel Lezcano
2013-07-21  4:11     ` Alexander Shiyan
2013-07-21  8:32       ` Daniel Lezcano
2013-07-21 10:04         ` Alexander Shiyan
2013-07-22 11:40       ` Russell King - ARM Linux
2013-08-02 11:10   ` Mark Rutland [this message]
2013-07-18 18:35 ` [PATCH 09/10] ARM: clps711x: Migrate CLPS711X subarch to the new basic drivers Alexander Shiyan
2013-07-18 18:35 ` [PATCH 10/10] ARM: clps711x: Add initial DT support Alexander Shiyan
2013-08-02 11:15   ` Mark Rutland
2013-08-03  3:54 ` [PATCH 00/10] ARM: clps711x: Initial DT support / Fixes Alexander Shiyan
2013-08-14  6:29   ` Olof Johansson
2013-08-17  4:32     ` Alexander Shiyan
2013-08-22  5:00       ` Olof Johansson
2013-08-14  6:31 ` Olof Johansson

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=20130802111031.GG2884@e106331-lin.cambridge.arm.com \
    --to=mark.rutland@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.