diff mbox

[2/4] mvebu: Dove: Instantiate cpufreq driver.

Message ID 1382186261-14482-3-git-send-email-andrew@lunn.ch (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Andrew Lunn Oct. 19, 2013, 12:37 p.m. UTC
Add a platform driver definition to instantiate the dove cpufreq
driver. Also indicate the ARCH has cpufreq support, so allowing the
cpufreq framework to be enabled.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 arch/arm/Kconfig                       |  1 +
 arch/arm/mach-dove/board-dt.c          |  2 ++
 arch/arm/mach-dove/common.c            | 36 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/common.h            |  1 +
 arch/arm/mach-dove/include/mach/dove.h |  1 +
 5 files changed, 41 insertions(+)

Comments

Sebastian Hesselbarth Oct. 21, 2013, 10:47 a.m. UTC | #1
On 10/19/2013 01:37 PM, Andrew Lunn wrote:
> Add a platform driver definition to instantiate the dove cpufreq
> driver. Also indicate the ARCH has cpufreq support, so allowing the
> cpufreq framework to be enabled.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>   arch/arm/Kconfig                       |  1 +
>   arch/arm/mach-dove/board-dt.c          |  2 ++
>   arch/arm/mach-dove/common.c            | 36 ++++++++++++++++++++++++++++++++++
>   arch/arm/mach-dove/common.h            |  1 +
>   arch/arm/mach-dove/include/mach/dove.h |  1 +
>   5 files changed, 41 insertions(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 1ad6fb6..7744415 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -495,6 +495,7 @@ config ARCH_IXP4XX
>
>   config ARCH_DOVE
>   	bool "Marvell Dove"
> +	select ARCH_HAS_CPUFREQ
>   	select ARCH_REQUIRE_GPIOLIB
>   	select CPU_PJ4
>   	select GENERIC_CLOCKEVENTS
> diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
> index 49f72a8..98202de 100644
> --- a/arch/arm/mach-dove/board-dt.c
> +++ b/arch/arm/mach-dove/board-dt.c
> @@ -70,6 +70,8 @@ static void __init dove_dt_init(void)
>   	/* Setup clocks for legacy devices */
>   	dove_legacy_clk_init();
>
> +	dove_cpufreq_init();
> +

What ever the outcome of "DT: blessing or curse" discussion at ELCE will
be, are there any plans to probe the cpufreq/cpuidle drivers directly
from DT? Someday, we want to get rid of .machine_init.

>   	/* Internal devices not ported to DT yet */
>   	dove_pcie_init(1, 1);
>
> diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
> index c122bcf..9e648a8 100644
> --- a/arch/arm/mach-dove/common.c
> +++ b/arch/arm/mach-dove/common.c
> @@ -344,6 +344,42 @@ void __init dove_sdio1_init(void)
>   	platform_device_register(&dove_sdio1);
>   }
>
> +/*****************************************************************************
> + * CPU Frequency
> + ****************************************************************************/
> +static struct resource dove_cpufreq_resources[] = {
> +	[0] = {
> +		.start  = DOVE_PMU_PHYS_BASE,
> +		.end    = DOVE_PMU_PHYS_BASE + 0x7,
> +		.flags  = IORESOURCE_MEM,
> +		.name   = "cpufreq: DFS"
> +	},
> +	[1] = {
> +		.start  = DOVE_PMU_PHYS_BASE + 0x8000,
> +		.end    = DOVE_PMU_PHYS_BASE + 0x8004,

BASE + 0x8004 - 1 ?

> +		.flags  = IORESOURCE_MEM,
> +		.name   = "cpufreq PMU CR"
> +	},
> +	[2] = {
> +		.start  = DOVE_PMU_PHYS_BASE + 0x0044,
> +		.end    = DOVE_PMU_PHYS_BASE + 0x0048,

ditto.

Sebastian

> +		.flags  = IORESOURCE_MEM,
> +		.name   = "cpufreq: PMU Clk Div"
> +	},
> +};
> +
> +static struct platform_device dove_cpufreq_device = {
> +	.name		= "dove-cpufreq",
> +	.id		= -1,
> +	.num_resources	= ARRAY_SIZE(dove_cpufreq_resources),
> +	.resource	= dove_cpufreq_resources,
> +};
> +
> +void __init dove_cpufreq_init(void)
> +{
> +	platform_device_register(&dove_cpufreq_device);
> +}
> +
>   void __init dove_setup_cpu_wins(void)
>   {
>   	/*
> diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h
> index 1d72522..5c9a77b 100644
> --- a/arch/arm/mach-dove/common.h
> +++ b/arch/arm/mach-dove/common.h
> @@ -44,6 +44,7 @@ void dove_spi1_init(void);
>   void dove_i2c_init(void);
>   void dove_sdio0_init(void);
>   void dove_sdio1_init(void);
> +void dove_cpufreq_init(void);
>   void dove_restart(enum reboot_mode, const char *);
>
>   #endif
> diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h
> index 0c4b35f..48db186 100644
> --- a/arch/arm/mach-dove/include/mach/dove.h
> +++ b/arch/arm/mach-dove/include/mach/dove.h
> @@ -144,6 +144,7 @@
>   #define  DOVE_SD0_GPIO_SEL		(1 << 0)
>
>   /* Power Management */
> +#define DOVE_PMU_PHYS_BASE	(DOVE_SB_REGS_PHYS_BASE + 0xd0000)
>   #define DOVE_PMU_VIRT_BASE	(DOVE_SB_REGS_VIRT_BASE + 0xd0000)
>   #define DOVE_PMU_SIG_CTRL	(DOVE_PMU_VIRT_BASE + 0x802c)
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Lunn Oct. 21, 2013, 3:26 p.m. UTC | #2
On Mon, Oct 21, 2013 at 11:47:32AM +0100, Sebastian Hesselbarth wrote:
> On 10/19/2013 01:37 PM, Andrew Lunn wrote:
> >Add a platform driver definition to instantiate the dove cpufreq
> >driver. Also indicate the ARCH has cpufreq support, so allowing the
> >cpufreq framework to be enabled.
> >
> >Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> >---
> >  arch/arm/Kconfig                       |  1 +
> >  arch/arm/mach-dove/board-dt.c          |  2 ++
> >  arch/arm/mach-dove/common.c            | 36 ++++++++++++++++++++++++++++++++++
> >  arch/arm/mach-dove/common.h            |  1 +
> >  arch/arm/mach-dove/include/mach/dove.h |  1 +
> >  5 files changed, 41 insertions(+)
> >
> >diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >index 1ad6fb6..7744415 100644
> >--- a/arch/arm/Kconfig
> >+++ b/arch/arm/Kconfig
> >@@ -495,6 +495,7 @@ config ARCH_IXP4XX
> >
> >  config ARCH_DOVE
> >  	bool "Marvell Dove"
> >+	select ARCH_HAS_CPUFREQ
> >  	select ARCH_REQUIRE_GPIOLIB
> >  	select CPU_PJ4
> >  	select GENERIC_CLOCKEVENTS
> >diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
> >index 49f72a8..98202de 100644
> >--- a/arch/arm/mach-dove/board-dt.c
> >+++ b/arch/arm/mach-dove/board-dt.c
> >@@ -70,6 +70,8 @@ static void __init dove_dt_init(void)
> >  	/* Setup clocks for legacy devices */
> >  	dove_legacy_clk_init();
> >
> >+	dove_cpufreq_init();
> >+
> 
> What ever the outcome of "DT: blessing or curse" discussion at ELCE will
> be, are there any plans to probe the cpufreq/cpuidle drivers directly
> from DT? Someday, we want to get rid of .machine_init.

Hi Sebastian

This has already been discussed once for cpufreq drivers. I triggered
it with the kirkwood cpufreq driver. The outcome was that not
everything needs to the DT, platform drivers are still OK for things
which are not really devices. But as you say, the outcome from
Edinburgh might repeal that decision.

> >+	[1] = {
> >+		.start  = DOVE_PMU_PHYS_BASE + 0x8000,
> >+		.end    = DOVE_PMU_PHYS_BASE + 0x8004,
> 
> BASE + 0x8004 - 1 ?

Ah, yes, was thinking DT.

See you soon,

    Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1ad6fb6..7744415 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -495,6 +495,7 @@  config ARCH_IXP4XX
 
 config ARCH_DOVE
 	bool "Marvell Dove"
+	select ARCH_HAS_CPUFREQ
 	select ARCH_REQUIRE_GPIOLIB
 	select CPU_PJ4
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index 49f72a8..98202de 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -70,6 +70,8 @@  static void __init dove_dt_init(void)
 	/* Setup clocks for legacy devices */
 	dove_legacy_clk_init();
 
+	dove_cpufreq_init();
+
 	/* Internal devices not ported to DT yet */
 	dove_pcie_init(1, 1);
 
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index c122bcf..9e648a8 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -344,6 +344,42 @@  void __init dove_sdio1_init(void)
 	platform_device_register(&dove_sdio1);
 }
 
+/*****************************************************************************
+ * CPU Frequency
+ ****************************************************************************/
+static struct resource dove_cpufreq_resources[] = {
+	[0] = {
+		.start  = DOVE_PMU_PHYS_BASE,
+		.end    = DOVE_PMU_PHYS_BASE + 0x7,
+		.flags  = IORESOURCE_MEM,
+		.name   = "cpufreq: DFS"
+	},
+	[1] = {
+		.start  = DOVE_PMU_PHYS_BASE + 0x8000,
+		.end    = DOVE_PMU_PHYS_BASE + 0x8004,
+		.flags  = IORESOURCE_MEM,
+		.name   = "cpufreq PMU CR"
+	},
+	[2] = {
+		.start  = DOVE_PMU_PHYS_BASE + 0x0044,
+		.end    = DOVE_PMU_PHYS_BASE + 0x0048,
+		.flags  = IORESOURCE_MEM,
+		.name   = "cpufreq: PMU Clk Div"
+	},
+};
+
+static struct platform_device dove_cpufreq_device = {
+	.name		= "dove-cpufreq",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(dove_cpufreq_resources),
+	.resource	= dove_cpufreq_resources,
+};
+
+void __init dove_cpufreq_init(void)
+{
+	platform_device_register(&dove_cpufreq_device);
+}
+
 void __init dove_setup_cpu_wins(void)
 {
 	/*
diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h
index 1d72522..5c9a77b 100644
--- a/arch/arm/mach-dove/common.h
+++ b/arch/arm/mach-dove/common.h
@@ -44,6 +44,7 @@  void dove_spi1_init(void);
 void dove_i2c_init(void);
 void dove_sdio0_init(void);
 void dove_sdio1_init(void);
+void dove_cpufreq_init(void);
 void dove_restart(enum reboot_mode, const char *);
 
 #endif
diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h
index 0c4b35f..48db186 100644
--- a/arch/arm/mach-dove/include/mach/dove.h
+++ b/arch/arm/mach-dove/include/mach/dove.h
@@ -144,6 +144,7 @@ 
 #define  DOVE_SD0_GPIO_SEL		(1 << 0)
 
 /* Power Management */
+#define DOVE_PMU_PHYS_BASE	(DOVE_SB_REGS_PHYS_BASE + 0xd0000)
 #define DOVE_PMU_VIRT_BASE	(DOVE_SB_REGS_VIRT_BASE + 0xd0000)
 #define DOVE_PMU_SIG_CTRL	(DOVE_PMU_VIRT_BASE + 0x802c)