linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* ARM: mx28: cpufreq-cpu0 support?
@ 2014-08-24  9:47 Stefan Wahren
  2014-08-25  8:01 ` Shawn Guo
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Wahren @ 2014-08-24  9:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

could you please tell me, is i.MX28 supported by cpufreq-cpu0?

Do we need only the necessary DT entries like operating points or is it 
more?

Thanks in advance

Stefan

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-08-24  9:47 ARM: mx28: cpufreq-cpu0 support? Stefan Wahren
@ 2014-08-25  8:01 ` Shawn Guo
  2014-08-25 10:30   ` Stefan Wahren
  0 siblings, 1 reply; 14+ messages in thread
From: Shawn Guo @ 2014-08-25  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Aug 24, 2014 at 11:47:43AM +0200, Stefan Wahren wrote:
> Hi,
> 
> could you please tell me, is i.MX28 supported by cpufreq-cpu0?
> 
> Do we need only the necessary DT entries like operating points or is
> it more?

Clock might as simple as adding DT entries, but I'm not sure we have
voltage scaling support for i.MX28 in kernel.

Shawn

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-08-25  8:01 ` Shawn Guo
@ 2014-08-25 10:30   ` Stefan Wahren
  2014-08-30 17:05     ` Fabio Estevam
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Wahren @ 2014-08-25 10:30 UTC (permalink / raw)
  To: linux-arm-kernel

Am 25.08.2014 10:01, schrieb Shawn Guo:
> On Sun, Aug 24, 2014 at 11:47:43AM +0200, Stefan Wahren wrote:
>> Hi,
>>
>> could you please tell me, is i.MX28 supported by cpufreq-cpu0?
>>
>> Do we need only the necessary DT entries like operating points or is
>> it more?
>
> Clock might as simple as adding DT entries, but I'm not sure we have
> voltage scaling support for i.MX28 in kernel.
>
> Shawn
>

As far as i know, the old Freescale BSP (2.6.35) contains a cpufreq 
driver for mxs, which never goes to mainline. So i'm not sure what would 
be the best way: porting the old driver or using cpufreq-cpu0.

Stefan

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-08-25 10:30   ` Stefan Wahren
@ 2014-08-30 17:05     ` Fabio Estevam
  2014-08-30 17:07       ` Fabio Estevam
  0 siblings, 1 reply; 14+ messages in thread
From: Fabio Estevam @ 2014-08-30 17:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stefan,

On Mon, Aug 25, 2014 at 7:30 AM, Stefan Wahren <info@lategoodbye.de> wrote:

> As far as i know, the old Freescale BSP (2.6.35) contains a cpufreq driver
> for mxs, which never goes to mainline. So i'm not sure what would be the
> best way: porting the old driver or using cpufreq-cpu0.

First step would be to port the PMU driver into mainline.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-08-30 17:05     ` Fabio Estevam
@ 2014-08-30 17:07       ` Fabio Estevam
  2014-09-01  6:31         ` Stefan Wahren
  0 siblings, 1 reply; 14+ messages in thread
From: Fabio Estevam @ 2014-08-30 17:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Aug 30, 2014 at 2:05 PM, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Stefan,
>
> On Mon, Aug 25, 2014 at 7:30 AM, Stefan Wahren <info@lategoodbye.de> wrote:
>
>> As far as i know, the old Freescale BSP (2.6.35) contains a cpufreq driver
>> for mxs, which never goes to mainline. So i'm not sure what would be the
>> best way: porting the old driver or using cpufreq-cpu0.
>
> First step would be to port the PMU driver into mainline.

I mean this regulator driver:
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/regulator/mxs-regulator.c?h=imx_2.6.35_maintain

,so that you can do the voltage scaling.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-08-30 17:07       ` Fabio Estevam
@ 2014-09-01  6:31         ` Stefan Wahren
  2014-09-01 13:33           ` Fabio Estevam
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Wahren @ 2014-09-01  6:31 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

Am 30.08.2014 19:07, schrieb Fabio Estevam:
> On Sat, Aug 30, 2014 at 2:05 PM, Fabio Estevam <festevam@gmail.com> wrote:
>> Hi Stefan,
>>
>> On Mon, Aug 25, 2014 at 7:30 AM, Stefan Wahren <info@lategoodbye.de> wrote:
>>
>>> As far as i know, the old Freescale BSP (2.6.35) contains a cpufreq driver
>>> for mxs, which never goes to mainline. So i'm not sure what would be the
>>> best way: porting the old driver or using cpufreq-cpu0.
>>
>> First step would be to port the PMU driver into mainline.
>
> I mean this regulator driver:
> http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/regulator/mxs-regulator.c?h=imx_2.6.35_maintain
>
> ,so that you can do the voltage scaling.
>

thanks. Okay, that leads to more questions:

How can i test a ported mxs-regulator driver, that it's really working? 
Is there any userspace interface?

Is there a good DT implementation of a similiar regulator driver, so i 
can orientate on?

What are the recommend mailing lists for this porting (linux-pm and 
linux-arm-kernel)?

BR Stefan

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-01  6:31         ` Stefan Wahren
@ 2014-09-01 13:33           ` Fabio Estevam
  2014-09-02  5:09             ` Stefan Wahren
  2014-09-22 21:25             ` Stefan Wahren
  0 siblings, 2 replies; 14+ messages in thread
From: Fabio Estevam @ 2014-09-01 13:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stefan,

On Mon, Sep 1, 2014 at 3:31 AM, Stefan Wahren <info@lategoodbye.de> wrote:

> thanks. Okay, that leads to more questions:
>
> How can i test a ported mxs-regulator driver, that it's really working? Is
> there any userspace interface?

After you ported the mxs regulator you can check whether it probed
correctly and if the reported voltages in the kernel log match the
register settings. You can also check if the voltages are really in
the correct reported value with a scope.

On mx6q we have the following:

[    0.070554] vdd1p1: 800 <--> 1375 mV at 1100 mV
[    0.071521] vdd3p0: 2800 <--> 3150 mV at 3000 mV
[    0.072397] vdd2p5: 2000 <--> 2750 mV at 2400 mV
[    0.073369] vddarm: 725 <--> 1450 mV at 1150 mV
[    0.074282] vddpu: 725 <--> 1450 mV at 1150 mV
[    0.075247] vddsoc: 725 <--> 1450 mV at 1200 mV

and you should get something like that in your kernel log after you
ported the mxs regulator driver.

> Is there a good DT implementation of a similiar regulator driver, so i can
> orientate on?

You could take a look at the drivers/regulator/anatop-regulator.c
driver, which handles the internal regulators on mx6.

The dts is arch/arm/boot/dts/imx6qdl.dtsi . Search for "anatop-regulator"

>
> What are the recommend mailing lists for this porting (linux-pm and
> linux-arm-kernel)?

After you generate a patch, just run '/scripts/get_maintainer.pl' on
your patch and it will give you some hints. Mark Brown is the
regulator drivers maintainer.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-01 13:33           ` Fabio Estevam
@ 2014-09-02  5:09             ` Stefan Wahren
  2014-09-02 13:13               ` Fabio Estevam
  2014-09-22 21:25             ` Stefan Wahren
  1 sibling, 1 reply; 14+ messages in thread
From: Stefan Wahren @ 2014-09-02  5:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Fabio,

Am 01.09.2014 15:33, schrieb Fabio Estevam:
> Hi Stefan,
>
> On Mon, Sep 1, 2014 at 3:31 AM, Stefan Wahren <info@lategoodbye.de> wrote:
>
>> thanks. Okay, that leads to more questions:
>>
>> How can i test a ported mxs-regulator driver, that it's really working? Is
>> there any userspace interface?
>
> After you ported the mxs regulator you can check whether it probed
> correctly and if the reported voltages in the kernel log match the
> register settings. You can also check if the voltages are really in
> the correct reported value with a scope.
>
> On mx6q we have the following:
>
> [    0.070554] vdd1p1: 800 <--> 1375 mV at 1100 mV
> [    0.071521] vdd3p0: 2800 <--> 3150 mV at 3000 mV
> [    0.072397] vdd2p5: 2000 <--> 2750 mV at 2400 mV
> [    0.073369] vddarm: 725 <--> 1450 mV at 1150 mV
> [    0.074282] vddpu: 725 <--> 1450 mV at 1150 mV
> [    0.075247] vddsoc: 725 <--> 1450 mV at 1200 mV
>
> and you should get something like that in your kernel log after you
> ported the mxs regulator driver.
>
>> Is there a good DT implementation of a similiar regulator driver, so i can
>> orientate on?
>
> You could take a look at the drivers/regulator/anatop-regulator.c
> driver, which handles the internal regulators on mx6.
>
> The dts is arch/arm/boot/dts/imx6qdl.dtsi . Search for "anatop-regulator"
>

thanks again. Now i unterstand much more, but otherwise the portation 
won't be straight forward. The old source in 
drivers/regulator/mxs-regulator.c needs a low level part located in 
arch/arm/plat-mx28/power.c . As far as i know, the low level part needs 
to move into the devicetree binding and into the mxs-regulator.c . Am i 
right?

Yesterday i had looked into the mx28 reference manual and into the low 
level part of the mxs regulator. The reference manual defines four 
voltage regulators: vddd, vdda, vddio and vddmem plus a overall current 
regulator. But the low level part make use of vddd, vdda, vddio, 
vddio_bo and the overall current.

Do i need the brown out regulator (vddio_bo) and the vddmem?

Stefan

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-02  5:09             ` Stefan Wahren
@ 2014-09-02 13:13               ` Fabio Estevam
  0 siblings, 0 replies; 14+ messages in thread
From: Fabio Estevam @ 2014-09-02 13:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 2, 2014 at 2:09 AM, Stefan Wahren <info@lategoodbye.de> wrote:

> thanks again. Now i unterstand much more, but otherwise the portation won't
> be straight forward. The old source in drivers/regulator/mxs-regulator.c
> needs a low level part located in arch/arm/plat-mx28/power.c . As far as i
> know, the low level part needs to move into the devicetree binding and into
> the mxs-regulator.c . Am i right?

Yes, I think you are right.

> Yesterday i had looked into the mx28 reference manual and into the low level
> part of the mxs regulator. The reference manual defines four voltage
> regulators: vddd, vdda, vddio and vddmem plus a overall current regulator.
> But the low level part make use of vddd, vdda, vddio, vddio_bo and the
> overall current.
>
> Do i need the brown out regulator (vddio_bo) and the vddmem?

As far as I understand vddmem is not used on mx28evk. From the mx28
reference manual;

"11.12.8 VDDMEM Supply Targets Control Register
(HW_POWER_VDDMEMCTRL)
This register controls the voltage target for a memory supply
generated from VDDA. This
supply is intended for use with external memories such as LV-DDR that
have unique voltage
requirements not compatible with VDDIO, VDDA , or VDDD."

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-01 13:33           ` Fabio Estevam
  2014-09-02  5:09             ` Stefan Wahren
@ 2014-09-22 21:25             ` Stefan Wahren
  2014-09-22 22:18               ` Fabio Estevam
  1 sibling, 1 reply; 14+ messages in thread
From: Stefan Wahren @ 2014-09-22 21:25 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Am 01.09.2014 15:33, schrieb Fabio Estevam:
> Hi Stefan,
>
> On Mon, Sep 1, 2014 at 3:31 AM, Stefan Wahren <info@lategoodbye.de> wrote:
>
>> thanks. Okay, that leads to more questions:
>>
>> How can i test a ported mxs-regulator driver, that it's really working? Is
>> there any userspace interface?
>
> After you ported the mxs regulator you can check whether it probed
> correctly and if the reported voltages in the kernel log match the
> register settings. You can also check if the voltages are really in
> the correct reported value with a scope.
>
> On mx6q we have the following:
>
> [    0.070554] vdd1p1: 800 <--> 1375 mV at 1100 mV
> [    0.071521] vdd3p0: 2800 <--> 3150 mV at 3000 mV
> [    0.072397] vdd2p5: 2000 <--> 2750 mV at 2400 mV
> [    0.073369] vddarm: 725 <--> 1450 mV at 1150 mV
> [    0.074282] vddpu: 725 <--> 1450 mV at 1150 mV
> [    0.075247] vddsoc: 725 <--> 1450 mV at 1200 mV
>
> and you should get something like that in your kernel log after you
> ported the mxs regulator driver.
>
>

i've ported the mxs-regulator driver and now i'm getting an probing 
output like above with Linux 3.17-rc4.

Now i want to test the mxs-regulator driver with the cpufreq-cpu0 as 
consumer. So i defined cpu at 0 according to cpufreq-cpu0 binding in 
imx28.dtsi and enabled cpufreq-cpu0 driver and userspace gov in Kernel 
config.

But if i modprobe cpufreq-cpu0 i don't get any output and the entry 
/sys/devices/system/cpu/cpu0/cpufreq is also missing.

Any ideas, what's wrong or missing?

Best regards
Stefan

PS: Here the relevant config:

# .config
#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
CONFIG_GENERIC_CPUFREQ_CPU0=m

# imx28.dtsi

[...]

cpus {
	#address-cells = <1>;
	#size-cells = <0>;

	cpu: cpu at 0 {
		compatible = "arm,arm926ej-s";
		device_type = "cpu";
		operating-points = <
			/* kHz	uV */
			454736	1550000
			392727	1475000
			360000	1375000
			261818	1275000
			64000	1050000
		>;
		clock-latency = <61036>; /* two CLK32 periods */
		cpu0-supply = <&reg_vddd>;
	};
};

[...]

power: power at 80044000 {
	compatible = "simple-bus";
	#address-cells = <1>;
	#size-cells = <1>;
	reg = <0x80044000 0x2000>;
	ranges;

	reg_vddd: regulator at 80044040 {
		reg = <0x80044040 0x10>;
		compatible = "fsl,mxs-regulator";
		regulator-name = "vddd";
		regulator-min-microvolt = <800000>;
		regulator-max-microvolt = <1575000>;
		regulator-boot-on;
		vddd-supply = <&reg_vdda>;
	};

	reg_vdda: regulator at 80044050 {
		reg = <0x80044050 0x10>;
		compatible = "fsl,mxs-regulator";
		regulator-name = "vdda";
		regulator-min-microvolt = <1500000>;
		regulator-max-microvolt = <2275000>;
		regulator-boot-on;
		vdda-supply = <&reg_vddio>;
	};

	reg_vddio: regulator at 80044060 {
		reg = <0x80044060 0x10>;
		compatible = "fsl,mxs-regulator";
		regulator-name = "vddio";
		regulator-min-microvolt = <2800000>;
		regulator-max-microvolt = <3600000>;
		regulator-microvolt-offset = <80000>;
		regulator-boot-on;
	};

	power_sts: power_sts at 800440c0 {
		reg = <0x800440c0 0x10>;
		status = "disabled";
	};
};

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-22 21:25             ` Stefan Wahren
@ 2014-09-22 22:18               ` Fabio Estevam
  2014-09-24 20:46                 ` Stefan Wahren
  0 siblings, 1 reply; 14+ messages in thread
From: Fabio Estevam @ 2014-09-22 22:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stefan,

On Mon, Sep 22, 2014 at 6:25 PM, Stefan Wahren <info@lategoodbye.de> wrote:

> i've ported the mxs-regulator driver and now i'm getting an probing output
> like above with Linux 3.17-rc4.

Great, it looks like you are making good progress :-)

>
> Now i want to test the mxs-regulator driver with the cpufreq-cpu0 as
> consumer. So i defined cpu at 0 according to cpufreq-cpu0 binding in imx28.dtsi
> and enabled cpufreq-cpu0 driver and userspace gov in Kernel config.
>
> But if i modprobe cpufreq-cpu0 i don't get any output and the entry
> /sys/devices/system/cpu/cpu0/cpufreq is also missing.
>
> Any ideas, what's wrong or missing?

Have you registered cpufreq-cpu0 inside arch/arm/mach-mxs/mach-mxs.c?

Take a look at this patch for an example:
http://www.spinics.net/lists/arm-kernel/msg363761.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-22 22:18               ` Fabio Estevam
@ 2014-09-24 20:46                 ` Stefan Wahren
  2014-09-24 21:47                   ` Fabio Estevam
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Wahren @ 2014-09-24 20:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Am 23.09.2014 00:18, schrieb Fabio Estevam:
> Hi Stefan,
>
>> Now i want to test the mxs-regulator driver with the cpufreq-cpu0 as
>> consumer. So i defined cpu at 0 according to cpufreq-cpu0 binding in imx28.dtsi
>> and enabled cpufreq-cpu0 driver and userspace gov in Kernel config.
>>
>> But if i modprobe cpufreq-cpu0 i don't get any output and the entry
>> /sys/devices/system/cpu/cpu0/cpufreq is also missing.
>>
>> Any ideas, what's wrong or missing?
>
> Have you registered cpufreq-cpu0 inside arch/arm/mach-mxs/mach-mxs.c?
>
> Take a look at this patch for an example:
> http://www.spinics.net/lists/arm-kernel/msg363761.html
>

thanks, registering cpufreq-cpu0 and adding missing properties reg & 
clocks did the trick.

Now the sys interface of cpufreq is available and the mxs-regulator 
seems to handle frequency change. But the frequency selection do not 
work as expected. If i set cpu frequency to 454736, 392727 or 261818 
kHz, the cpufreq driver change it silently to 240000 kHz.

Why? Is it the wrong clock ( 21 should be cpu )?

Thanks in advance
Stefan

PS: Here my DT and the debug output

####################### imx28.dtsi

[...]

cpus {
	#address-cells = <1>;
	#size-cells = <0>;

	cpu at 0 {
		compatible = "arm,arm926ej-s";
		device_type = "cpu";
		reg = <0x0>;
		operating-points = <
			/* kHz	uV */
			454736	1550000
			392727	1475000
			360000	1375000
			261818	1275000
			64000	1050000
		>;
		clocks = <&clks 21>;
		clock-latency = <61036>; /* two CLK32 periods */
		cpu0-supply = <&reg_vddd>;
	};
};

[...]

power: power at 80044000 {
	compatible = "simple-bus";
	#address-cells = <1>;
	#size-cells = <1>;
	reg = <0x80044000 0x2000>;
	ranges;

	reg_vddd: regulator at 80044040 {
		reg = <0x80044040 0x10>;
		compatible = "fsl,mxs-regulator";
		regulator-name = "vddd";
		regulator-min-microvolt = <800000>;
		regulator-max-microvolt = <1575000>;
		regulator-boot-on;
		vddd-supply = <&reg_vdda>;
	};

	reg_vdda: regulator at 80044050 {
		reg = <0x80044050 0x10>;
		compatible = "fsl,mxs-regulator";
		regulator-name = "vdda";
		regulator-min-microvolt = <1500000>;
		regulator-max-microvolt = <2275000>;
		regulator-boot-on;
		vdda-supply = <&reg_vddio>;
	};

	reg_vddio: regulator at 80044060 {
		reg = <0x80044060 0x10>;
		compatible = "fsl,mxs-regulator";
		regulator-name = "vddio";
		regulator-min-microvolt = <2800000>;
		regulator-max-microvolt = <3600000>;
		regulator-microvolt-offset = <80000>;
		regulator-boot-on;
	};

	power_sts: power_sts at 800440c0 {
		reg = <0x800440c0 0x10>;
		status = "disabled";
	};
};

####################### dmesg

[ 3845.602210] cpu cpu0: Looking up cpu0-supply from device tree
[ 3845.604389] freq_table: table entry 0: 64000 kHz
[ 3845.604448] freq_table: table entry 1: 261818 kHz
[ 3845.604482] freq_table: table entry 2: 360000 kHz
[ 3845.604512] freq_table: table entry 3: 392727 kHz
[ 3845.604541] freq_table: table entry 4: 454736 kHz
[ 3845.608402] freq_table: request for verificatiorequest for 
verification of policy (64000 - 454736 kHz) for cpu 0
[ 3845.608571] freq_table: verification lead to (64000 - 454736 kHz) for 
cpu 0
[ 4049.590886] freq_table: request for target 392727 kHz (relation: 0) 
for cpu 0
[ 4049.590957] freq_table: target index is 3, freq is:392727 kHz
[ 4049.597120] mxs_get_voltage: vddd register val 28
[ 4049.597202] cpufreq_cpu0: 454 MHz, 1500 mV --> 240 MHz, 1275 mV
[ 4049.597686] mxs_is_enabled: vddd register val 0
[ 4049.597783] mxs_get_voltage: vddd register val 28
[ 4049.597864] mxs_set_voltage: min_uV 1275000, max_uV 1275000, min 
800000, max 1575000
[ 4049.597928] mxs_set_voltage: vddd calculated val 19
[ 4049.598384] mxs_get_voltage: vddd register val 19
[ 4464.831192] freq_table: request for target 360000 kHz (relation: 0) 
for cpu 0
[ 4464.831609] freq_table: target index is 2, freq is:360000 kHz
[ 4464.831871] mxs_get_voltage: vddd register val 19
[ 4464.831965] cpufreq_cpu0: 240 MHz, 1275 mV --> 360 MHz, 1375 mV
[ 4464.832063] mxs_is_enabled: vddd register val 0
[ 4464.832137] mxs_get_voltage: vddd register val 19
[ 4464.832213] mxs_set_voltage: min_uV 1375000, max_uV 1375000, min 
800000, max 1575000
[ 4464.832274] mxs_set_voltage: vddd calculated val 23
[ 4464.832488] mxs_get_voltage: vddd register val 23
[ 4603.949470] freq_table: request for target 261818 kHz (relation: 0) 
for cpu 0
[ 4603.949548] freq_table: target index is 1, freq is:261818 kHz
[ 4603.949747] mxs_get_voltage: vddd register val 23
[ 4603.949815] cpufreq_cpu0: 360 MHz, 1375 mV --> 240 MHz, 1275 mV
[ 4603.950088] mxs_is_enabled: vddd register val 0
[ 4603.950165] mxs_get_voltage: vddd register val 23
[ 4603.950244] mxs_set_voltage: min_uV 1275000, max_uV 1275000, min 
800000, max 1575000
[ 4603.950306] mxs_set_voltage: vddd calculated val 19
[ 4603.950473] mxs_get_voltage: vddd register val 19
[ 4757.663161] freq_table: request for target 454736 kHz (relation: 0) 
for cpu 0
[ 4757.663267] freq_table: target index is 4, freq is:454736 kHz
[ 4757.663518] mxs_get_voltage: vddd register val 19
[ 4757.663614] cpufreq_cpu0: 240 MHz, 1275 mV --> 240 MHz, 1275 mV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-24 20:46                 ` Stefan Wahren
@ 2014-09-24 21:47                   ` Fabio Estevam
  2014-09-25 18:24                     ` Stefan Wahren
  0 siblings, 1 reply; 14+ messages in thread
From: Fabio Estevam @ 2014-09-24 21:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 24, 2014 at 5:46 PM, Stefan Wahren <info@lategoodbye.de> wrote:

> thanks, registering cpufreq-cpu0 and adding missing properties reg & clocks
> did the trick.
>
> Now the sys interface of cpufreq is available and the mxs-regulator seems to
> handle frequency change. But the frequency selection do not work as
> expected. If i set cpu frequency to 454736, 392727 or 261818 kHz, the

Why 454736 instead of 454MHz? Same for the other values.

> cpufreq driver change it silently to 240000 kHz.

24MHz is the osc clock. It seems you did not turn on the PLL0.

Check the POWER bit of HW_CLKCTRL_PLL0CTRL0 register.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ARM: mx28: cpufreq-cpu0 support?
  2014-09-24 21:47                   ` Fabio Estevam
@ 2014-09-25 18:24                     ` Stefan Wahren
  0 siblings, 0 replies; 14+ messages in thread
From: Stefan Wahren @ 2014-09-25 18:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

i added linux-pm list.

Am 24.09.2014 23:47, schrieb Fabio Estevam:
> On Wed, Sep 24, 2014 at 5:46 PM, Stefan Wahren <info@lategoodbye.de> wrote:
>
>> thanks, registering cpufreq-cpu0 and adding missing properties reg & clocks
>> did the trick.
>>
>> Now the sys interface of cpufreq is available and the mxs-regulator seems to
>> handle frequency change. But the frequency selection do not work as
>> expected. If i set cpu frequency to 454736, 392727 or 261818 kHz, the
>
> Why 454736 instead of 454MHz? Same for the other values.

I took these values from the cpufreq driver in the Freescale BSP and 
they are in the datasheet, too. If i take 454000 and so one, i will get 
this nice oops:

root at duckbill:~# modprobe cpufreq-cpu0
[   95.764654] cpufreq: __cpufreq_add_dev: CPU0: Running at unlisted 
freq: 454736 KHz
[   95.773146] cpufreq_cpu0: failed to find OPP for 454736842
[   95.778692] cpufreq: __target_index: Failed to change cpu frequency: -34
[   95.786235] ------------[ cut here ]------------
[   95.790913] kernel BUG at drivers/cpufreq/cpufreq.c:1249!
[   95.796342] Internal error: Oops - BUG: 0 [#1] ARM
[   95.801154] Modules linked in: cpufreq_cpu0(+)
[   95.805673] CPU: 0 PID: 446 Comm: modprobe Not tainted 
3.17.0-rc4-00268-ge789d1c-dirty #17
[   95.813965] task: c6fa8980 ti: c6c86000 task.ti: c6c86000
[   95.819409] PC is at cpufreq_add_dev+0x530/0x5b4
[   95.824069] LR is at mark_held_locks+0x74/0x9c
[...]

>
>> cpufreq driver change it silently to 240000 kHz.
>
> 24MHz is the osc clock. It seems you did not turn on the PLL0.
>
> Check the POWER bit of HW_CLKCTRL_PLL0CTRL0 register.
>

240000 kHz = 240 MHz

I fixed this specific problem by setting the clock reference in the DT 
to ref_cpu instead of cpu. After that i'm able to set 392727, 360000, 
261818 and 64000 kHz. Unfortunately the highest and default value 454736 
is not selectable:

[   38.901842] cpu cpu0: Looking up cpu0-supply from device tree
[   38.904082] freq_table: table entry 0: 64000 kHz
[   38.904141] freq_table: table entry 1: 261818 kHz
[   38.904176] freq_table: table entry 2: 360000 kHz
[   38.904206] freq_table: table entry 3: 392727 kHz
[   38.904235] freq_table: table entry 4: 454736 kHz
[   38.908050] freq_table: request for verification of policy (64000 - 
454736 kHz) for cpu 0
[   38.908116] freq_table: verification lead to (64000 - 454736 kHz) for 
cpu 0
[   38.908176] freq_table: request for verification of policy (64000 - 
454736 kHz) for cpu 0
[   38.908220] freq_table: verification lead to tage: vddd register val 30
root at duckbill:/sys/devices/system/cpu/cpu0/cpufreq# echo "454736" > 
scaling_setspeed
[  595.671708] cpufreq_cpu0: failed to find OPP for 454736842
[  595.677272] cpufreq: __target_index: Failed to change cpu frequency: -34

That looks like a bug in cpufreq.

Best regards
Stefan

PS: Here is my relevant DT:

############# imx28.dtsi

[...]

cpus {
	#address-cells = <1>;
	#size-cells = <0>;

	cpu at 0 {
		compatible = "arm,arm926ej-s";
		device_type = "cpu";
		reg = <0x0>;
		operating-points = <
			/* kHz	uV */
			454736  1550000
			392727  1475000
			360000  1375000
			261818  1275000
			64000   1050000
		>;
		clocks = <&clks 4>;
		clock-latency = <61036>; /* two CLK32 periods */
		cpu0-supply = <&reg_vddd>;
	};
};

[...]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-09-25 18:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-24  9:47 ARM: mx28: cpufreq-cpu0 support? Stefan Wahren
2014-08-25  8:01 ` Shawn Guo
2014-08-25 10:30   ` Stefan Wahren
2014-08-30 17:05     ` Fabio Estevam
2014-08-30 17:07       ` Fabio Estevam
2014-09-01  6:31         ` Stefan Wahren
2014-09-01 13:33           ` Fabio Estevam
2014-09-02  5:09             ` Stefan Wahren
2014-09-02 13:13               ` Fabio Estevam
2014-09-22 21:25             ` Stefan Wahren
2014-09-22 22:18               ` Fabio Estevam
2014-09-24 20:46                 ` Stefan Wahren
2014-09-24 21:47                   ` Fabio Estevam
2014-09-25 18:24                     ` Stefan Wahren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).