All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <info@lategoodbye.de>
To: Fabio Estevam <festevam@gmail.com>
Cc: Shawn Guo <shawn.guo@linaro.org>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Otavio Salvador <otavio@ossystems.com.br>
Subject: Re: ARM: mx28: cpufreq-cpu0 support?
Date: Wed, 24 Sep 2014 22:46:20 +0200	[thread overview]
Message-ID: <54232D9C.5070404@lategoodbye.de> (raw)
In-Reply-To: <CAOMZO5A0of3_arOx2z0_t7xN37jQjJ5uU4gwcsgCuSdpBJJVzw@mail.gmail.com>

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@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@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@80044000 {
	compatible = "simple-bus";
	#address-cells = <1>;
	#size-cells = <1>;
	reg = <0x80044000 0x2000>;
	ranges;

	reg_vddd: regulator@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@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@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@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


WARNING: multiple messages have this Message-ID (diff)
From: info@lategoodbye.de (Stefan Wahren)
To: linux-arm-kernel@lists.infradead.org
Subject: ARM: mx28: cpufreq-cpu0 support?
Date: Wed, 24 Sep 2014 22:46:20 +0200	[thread overview]
Message-ID: <54232D9C.5070404@lategoodbye.de> (raw)
In-Reply-To: <CAOMZO5A0of3_arOx2z0_t7xN37jQjJ5uU4gwcsgCuSdpBJJVzw@mail.gmail.com>

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

  reply	other threads:[~2014-09-24 20:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-24  9:47 ARM: mx28: cpufreq-cpu0 support? Stefan Wahren
2014-08-24  9:47 ` Stefan Wahren
2014-08-25  8:01 ` Shawn Guo
2014-08-25  8:01   ` Shawn Guo
2014-08-25 10:30   ` Stefan Wahren
2014-08-25 10:30     ` Stefan Wahren
2014-08-30 17:05     ` Fabio Estevam
2014-08-30 17:05       ` Fabio Estevam
2014-08-30 17:07       ` Fabio Estevam
2014-08-30 17:07         ` Fabio Estevam
2014-09-01  6:31         ` Stefan Wahren
2014-09-01  6:31           ` Stefan Wahren
2014-09-01 13:33           ` Fabio Estevam
2014-09-01 13:33             ` Fabio Estevam
2014-09-02  5:09             ` Stefan Wahren
2014-09-02  5:09               ` Stefan Wahren
2014-09-02 13:13               ` Fabio Estevam
2014-09-02 13:13                 ` Fabio Estevam
2014-09-22 21:25             ` Stefan Wahren
2014-09-22 21:25               ` Stefan Wahren
2014-09-22 22:18               ` Fabio Estevam
2014-09-22 22:18                 ` Fabio Estevam
2014-09-24 20:46                 ` Stefan Wahren [this message]
2014-09-24 20:46                   ` Stefan Wahren
2014-09-24 21:47                   ` Fabio Estevam
2014-09-24 21:47                     ` Fabio Estevam
2014-09-25 18:24                     ` Stefan Wahren
2014-09-25 18:24                       ` Stefan Wahren

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=54232D9C.5070404@lategoodbye.de \
    --to=info@lategoodbye.de \
    --cc=cpufreq@vger.kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=festevam@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=otavio@ossystems.com.br \
    --cc=shawn.guo@linaro.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.