Problems modifying device tree to blink an LED

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problems modifying device tree to blink an LED

ソリューションへジャンプ
10,607件の閲覧回数
rathben
Contributor III

Hello All -

I've had a surprising amount of difficulty trying to figure out how to use dts to configure the hardware to heartbeat-blink the debug led on the i.MX6SL EVK. I'm running kernel 3.10.17, building core-image-minimal, and tried adding the following code in the appropriate places in imx6sl-evk.dts (as well as enabling the appropriate items in the kernel menuconfig):

  leds {

  compatible = "gpio-leds";

  debug-led {

  label = "Heartbeat";

  gpios = <&gpio3 20 0>; //HSIC_STROBE -> GPIO3_20

  linux,default-trigger = "heartbeat";

  };

  };

and

  MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x110b0

After much trial and error, I was able to get this to work after modifying the init function register_init_complete (in .../git/drivers/regulator/core.c) to return early without doing anything.

I'm looking into this further, but in the meantime, does anyone have any ideas about what is going on here?

Thanks! -Ben

ラベル(2)
タグ(3)
0 件の賞賛
1 解決策
4,757件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

Ben,

Please try this patch that I have just submitted:

'[PATCH] ARM: dts: imx6sl-evk: Keep VGEN1 regulator always enabled' - MARC

Regards,

Fabio Estevam

元の投稿で解決策を見る

0 件の賞賛
20 返答(返信)
4,757件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

Ben,

I have just tested with this changes and it works here:

--- a/arch/arm/boot/dts/imx6sl-evk.dts

+++ b/arch/arm/boot/dts/imx6sl-evk.dts

@@ -19,6 +19,18 @@

                reg = <0x80000000 0x40000000>;

        };

+       leds {

+               compatible = "gpio-leds";

+               pinctrl-names = "default";

+               pinctrl-0 = <&pinctrl_led>;

+

+               user {

+                       label = "Heartbeat";

+                       gpios = <&gpio3 20 0>;

+                       linux,default-trigger = "heartbeat";

+               };

+       };

+

        regulators {

                compatible = "simple-bus";

                #address-cells = <1>;

@@ -108,6 +120,12 @@

                        >;

                };

+               pinctrl_led: ledgrp {

+                       fsl,pins = <

+                               MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x17059

+                       >;

+               };

+

                pinctrl_kpp: kppgrp {

                        fsl,pins = <

                                MX6SL_PAD_KEY_ROW0__KEY_ROW0    0x1b010

Regards,

Fabio Estevam

4,757件の閲覧回数
rathben
Contributor III

same result as with Marek's suggestions. Side note, is there a significance to you placing the pinctrl_led node in regulators while Marek suggested iomuxc? Also I noticed that your patch is not based from the same version of imx6sl-evk.dts as mine. Is there something else in the file that I might be missing?

0 件の賞賛
4,757件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

I haven't put the pinctrl_led node into regulators. The patch I sent is against 3.14-rc1. Haven't tested 3.10 yet.

Regards,

Fabio Estevam

0 件の賞賛
4,757件の閲覧回数
rathben
Contributor III

ok. I've placed pinctrl_led in the &iomuxc node as follows, is this correct? (still doesn't work, but at least we'll be on the same page)

&iomuxc {

  pinctrl-names = "default", "sleep";

  pinctrl-0 = <&pinctrl_hog>;

  pinctrl-1 = <&pinctrl_hog_sleep>;

   pinctrl_led: ledgrp {

           fsl,pins = <

                   MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x17059

           >;

   };

  hog {

  pinctrl_hog: hoggrp {

  fsl,pins = <

  MX6SL_PAD_KEY_ROW7__GPIO4_IO07    0x17059

0 件の賞賛
4,757件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

Here is a patch against 3.10.17.

I won't have access to my mx6slevk until tomorrow to test it.

0 件の賞賛
4,756件の閲覧回数
rathben
Contributor III

thanks for the patch, but same non-working result

0 件の賞賛
4,756件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

Ben,

Today I tested 3.14-rc1 and got the LEDs blinking on my mx6slevk at the office.

Running the same 3.14-rc1 kernel and dtb on the mx6slevk I have at home I got no LED blinking.

I don't have a scope here at home to measure the signals. The evk I have at home is an old version (it is a red one).

Tomorrow I will try 3.10 with the evk from the office.

Regards,

Fabio Estevam

0 件の賞賛
4,756件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

Ok, so I tested on 3.10 and I see the same behavior as you reported: LED blinks once and then stops.

If I run 3.14-rc1 it works fine though.

Also tested 3.10.17 on a mx53qsb and the LED blinks fine.

I haven't had a chance to debug this.

Regards,

Fabio Estevam

0 件の賞賛
4,756件の閲覧回数
rathben
Contributor III

well... I guess that is "good" news, at least we're seeing the same behavior and I'm apparently not totally insane :smileyhappy:. You might try commenting out the call to regulator_init_complete (same as I did) to see that it works afterwards. Perhaps someone shedding some light on what this function does might help to debug the situation. Thanks!

0 件の賞賛
4,758件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

Ben,

Please try this patch that I have just submitted:

'[PATCH] ARM: dts: imx6sl-evk: Keep VGEN1 regulator always enabled' - MARC

Regards,

Fabio Estevam

0 件の賞賛
4,751件の閲覧回数
rathben
Contributor III

This works for me. Thanks!

0 件の賞賛
4,756件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

Some more hints:

Stop the heartbeat blinking:

$ echo none >  /sys/class/leds/Heartbeat/trigger

Turn on the LED:

$ echo 1 > /sys/class/leds/Heartbeat/brightness

Turn off the LED:

$ echo 0 > /sys/class/leds/Heartbeat/brightness

Regards,

Fabio Estevam

0 件の賞賛
4,756件の閲覧回数
MarekVasut
Senior Contributor I

Check if you have the necessary stuff enabled in your kernel config ...

$ grep LED_TRIGGERS .config

$ grep LEDS_TRIGGER_HEARTBEAT .config

$ grep LEDS_GPIO .config

Next, check if your pin is really configured as GPIO. I don't see

                pinctrl-names = "default";

                pinctrl-0 = <&led_pin_gpio>;

anywhere in your led {} DT node. You should have those two right under the 'compatible' prop AND the led_pin_gpio should be defined in the &iomuxc node like so:

                led_pin_gpio: led_gpio@0 {

                        fsl,pins = <

                                MX6SL_PAD_HSIC_STROBE__GPIO3_IO20            0x110b0

                        >;

                };

You can use /sys/class/leds/*/brightness to toggle the led when debugging this stuff.

4,756件の閲覧回数
rathben
Contributor III

this is helpful but doesn't work for me. I can see that during bootup the led blinks once and then stops around the time that regulator_init_complete runs

0 件の賞賛
4,756件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

It should be

MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x80000000

Regards,

Fabio Estevam

0 件の賞賛
4,756件の閲覧回数
rathben
Contributor III

Hi Fabio, thanks for your response. Please clarify. What is the significance of this value? The 31st bit isn't defined by any documentation I've seen. I will double-check tomorrow but I believe I did try this value before going on my frantic adventure commenting out initialization functions out until it worked.

0 件の賞賛
4,756件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

It is documented at:

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/Documentation/devicetree/bindings/p...

"Bits used for CONFIG:
NO_PAD_CTL(1 << 31): indicate this pin does not need config."

So the LED still does not work?

Regards,

Fabio Estevam

0 件の賞賛
4,756件の閲覧回数
rathben
Contributor III

changing the pad config to 0x80000000 did not get the led to work. I will go on to trying the other suggestions below

0 件の賞賛
4,756件の閲覧回数
MarekVasut
Senior Contributor I

That NO_PAD_CTL means 'don't touch the current configuration of the pin, it was configured by bootloader', right ?

0 件の賞賛
4,757件の閲覧回数
rathben
Contributor III

thank you for the documentation link, I'll try it tomorrow when I get back to the hardware. Thanks!

0 件の賞賛