Skip to contentSkip to conversation

Flexcan RT driver registration failed

Xenomai Wolfgang Netbal 2 participants 6 messages May 5, 2015 – May 6, 2015

lore
Share & tools
lore
#0 lore raw

Dear All,

I have a custom board with an imx6dl using freescale yocto 3.10.53 with Xenomai 2.6.4. The probe function works fine while booting the kernel

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team
rtcan: registered rtcan0
flexcan 2090000.can: RTCAN device registered (reg_base=d0c00000, irq=142, clock=66000000)
rtcan: registered rtcan1
flexcan 2094000.can: RTCAN device registered (reg_base=d0c08000, irq=143, clock=66000000)

After Linux started I call the function flexcan_mode_start() and get the following message and CAN connections doesn't work.

rtcan0: Failed to softreset can module (mcr=0x5b80000f)

I have a working configuration for this board using Kernel 3.0.43 and Xenomai 2.6.2.1

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team
flexcan netdevice driver
rtcan: registered rtcan0
flexcan imx6q-flexcan.0: RTCAN device registered (reg_base=e0968000, irq=142, clock=30000000)
rtcan: registered rtcan1
flexcan imx6q-flexcan.1: RTCAN device registered (reg_base=e0970000, irq=143, clock=30000000)
...
rtcan0: writing ctrl=0x03292005

It seems that the clock is the difference so I checked the values of register CCM_CCGR0 3.0.43 address 0x20C4068 is set to 0x7fc03f
3.10.53 address 0x20C4068 is set to 0x4cc00f

so on kernel 3.10.53 are the serial clocks for can disabled.

If anyone has a hint for me how to activate the serial clock in register CCM_CCGR0 and change the clock to 30000000 that would be great.

Here is the part of the devicetree used to configure flexcan.

#include "imx6dl.dtsi"

/ {

};

/*
* PAD settings
*/

&iomuxc {
    flexcan1 {
        pinctrl_flexcan1_sigmatek: flexcan1grp-sigmatek {
            fsl,pins = <
                MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX NO_PAD_CTRL
                MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX NO_PAD_CTRL
            >;
        };
    };

    flexcan2 {
        pinctrl_flexcan2_sigmatek: flexcan2grp-sigmatek {
            fsl,pins = <
                MX6QDL_PAD_SD3_DAT1__FLEXCAN2_RX NO_PAD_CTRL
                MX6QDL_PAD_SD3_DAT0__FLEXCAN2_TX NO_PAD_CTRL
            >;
        };
    };
};

/*
* CAN
*/

&flexcan1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_flexcan1_sigmatek>;
    status = "okay";
};
&flexcan2 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_flexcan2_sigmatek>;
    status = "okay";
};

Kind regards

Wolfgang Netbal

#1 lore raw
Quoted 39 lines · Wolfgang Netbal

Dear All,

I have a custom board with an imx6dl using freescale yocto 3.10.53 with Xenomai 2.6.4.
The probe function works fine while booting the kernel

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team
rtcan: registered rtcan0
flexcan 2090000.can: RTCAN device registered (reg_base=d0c00000, irq=142, clock=66000000)
rtcan: registered rtcan1
flexcan 2094000.can: RTCAN device registered (reg_base=d0c08000, irq=143, clock=66000000)

After Linux started I call the function flexcan_mode_start() and get the

following message and CAN connections doesn't work.

rtcan0: Failed to softreset can module (mcr=0x5b80000f)

I have a working configuration for this board using Kernel 3.0.43 and Xenomai 2.6.2.1

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team flexcan netdevice driver
rtcan: registered rtcan0
flexcan imx6q-flexcan.0: RTCAN device registered (reg_base=e0968000, irq=142, clock=30000000)
rtcan: registered rtcan1
flexcan imx6q-flexcan.1: RTCAN device registered (reg_base=e0970000, irq=143, clock=30000000)
...
rtcan0: writing ctrl=0x03292005

It seems that the clock is the difference so I checked the values of register CCM_CCGR0
3.0.43 address 0x20C4068 is set to 0x7fc03f
3.10.53 address 0x20C4068 is set to 0x4cc00f

Quoted 5 lines

so on kernel 3.10.53 are the serial clocks for can disabled.

If anyone has a hint for me how to activate the serial clock in register

CCM_CCGR0 and change the clock to 30000000 that would be great.

Have a look into the directory "arch/arm/boot/dts" of a recent kernel tree and execute therein "grep LEXCAN[12] *.dts*". There are various boards setting the pins you mention below. Maybe you find some matching hardware.

Quoted 41 lines

Here is the part of the devicetree used to configure flexcan.

#include "imx6dl.dtsi"

/ {

};

/*
* PAD settings
*/

&iomuxc {
     flexcan1 {
         pinctrl_flexcan1_sigmatek: flexcan1grp-sigmatek {
             fsl,pins = <
                 MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX NO_PAD_CTRL
                 MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX NO_PAD_CTRL
             >;
         };
     };

     flexcan2 {
         pinctrl_flexcan2_sigmatek: flexcan2grp-sigmatek {
             fsl,pins = <
                 MX6QDL_PAD_SD3_DAT1__FLEXCAN2_RX NO_PAD_CTRL
                 MX6QDL_PAD_SD3_DAT0__FLEXCAN2_TX NO_PAD_CTRL
             >;
         };
     };
};

/*
* CAN
*/

&flexcan1 {
     pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_flexcan1_sigmatek>;
     status = "okay";
};
Quoted 5 lines
&flexcan2 {
     pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_flexcan2_sigmatek>;
     status = "okay";
};

Hope that already helps.

Wolfgang.

#2 lore raw

Dear Wolfgang,

thank you for your fast replay.

I'm sure my problems are not from setting the pin configuration, because I tested configuration also with the default settings.

My issue is that the clock rate is set to 66000000 instead of 30000000 and that can_serial_clock in register CCM_CCG0 is disabled.

Do you hava any idea how to activate the serial_clock for can. I cant find anything in other devicetree files.

Kind regards
Wolfgang

Am 2015-05-05 um 15:32 schrieb Wolfgang Grandegger:

Quoted 98 lines
Quoted 38 lines · Wolfgang Netbal

Dear All,

I have a custom board with an imx6dl using freescale yocto 3.10.53 with Xenomai 2.6.4.
The probe function works fine while booting the kernel

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team
rtcan: registered rtcan0
flexcan 2090000.can: RTCAN device registered (reg_base=d0c00000, irq=142, clock=66000000)
rtcan: registered rtcan1
flexcan 2094000.can: RTCAN device registered (reg_base=d0c08000, irq=143, clock=66000000)

After Linux started I call the function flexcan_mode_start() and get the following message and CAN connections doesn't work.

rtcan0: Failed to softreset can module (mcr=0x5b80000f)

I have a working configuration for this board using Kernel 3.0.43 and Xenomai 2.6.2.1

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team flexcan netdevice driver
rtcan: registered rtcan0
flexcan imx6q-flexcan.0: RTCAN device registered (reg_base=e0968000, irq=142, clock=30000000)
rtcan: registered rtcan1
flexcan imx6q-flexcan.1: RTCAN device registered (reg_base=e0970000, irq=143, clock=30000000)
...
rtcan0: writing ctrl=0x03292005

It seems that the clock is the difference so I checked the values of register CCM_CCGR0
3.0.43 address 0x20C4068 is set to 0x7fc03f
3.10.53 address 0x20C4068 is set to 0x4cc00f

Quoted 4 lines

so on kernel 3.10.53 are the serial clocks for can disabled.

If anyone has a hint for me how to activate the serial clock in register CCM_CCGR0 and change the clock to 30000000 that would be great.

Have a look into the directory "arch/arm/boot/dts" of a recent kernel tree and execute therein "grep LEXCAN[12] *.dts*". There are various boards setting the pins you mention below. Maybe you find some matching hardware.

Quoted 41 lines

Here is the part of the devicetree used to configure flexcan.

#include "imx6dl.dtsi"

/ {

};

/*
* PAD settings
*/

&iomuxc {
      flexcan1 {
          pinctrl_flexcan1_sigmatek: flexcan1grp-sigmatek {
              fsl,pins = <
                  MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX NO_PAD_CTRL
                  MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX NO_PAD_CTRL
              >;
          };
      };

      flexcan2 {
          pinctrl_flexcan2_sigmatek: flexcan2grp-sigmatek {
              fsl,pins = <
                  MX6QDL_PAD_SD3_DAT1__FLEXCAN2_RX NO_PAD_CTRL
                  MX6QDL_PAD_SD3_DAT0__FLEXCAN2_TX NO_PAD_CTRL
              >;
          };
      };
};

/*
* CAN
*/

&flexcan1 {
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_flexcan1_sigmatek>;
      status = "okay";
};
Quoted 5 lines
&flexcan2 {
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_flexcan2_sigmatek>;
      status = "okay";
};

Hope that already helps.

Wolfgang

#3 lore raw
Quoted 6 lines · Wolfgang Netbal

Dear Wolfgang,

thank you for your fast replay.

I'm sure my problems are not from setting the pin configuration, because

Quoted 7 lines

I tested configuration also with the default settings.

My issue is that the clock rate is set to 66000000 instead of 30000000 and that can_serial_clock in register CCM_CCG0 is disabled.

Do you hava any idea how to activate the serial_clock for can. I cant find anything in other devicetree files.

Looking to the Flexcan function "register_flexcandev()" of the 3.10 mainline kernel here:

http://lxr.free-electrons.com/source/drivers/net/can/flexcan.c#L1083

I realize that the Xenomai kernel support of that driver is not correct. Could you please replace *all* "KERNEL_VERSION(3,11,0)" with "KERNEL_VERSION(3,10,0)" in your "rtcan_flexcan.c".

Hope it helps.

Wolfgang.

Quoted 9 lines

Kind regards
Wolfgang

Am 2015-05-05 um 15:32 schrieb Wolfgang Grandegger:

Quoted 5 lines
Quoted 3 lines · Wolfgang Netbal

Dear All,

I have a custom board with an imx6dl using freescale yocto 3.10.53

with

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Xenomai 2.6.4.
The probe function works fine while booting the kernel

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team
rtcan: registered rtcan0
flexcan 2090000.can: RTCAN device registered (reg_base=d0c00000, irq=142, clock=66000000)
rtcan: registered rtcan1
flexcan 2094000.can: RTCAN device registered (reg_base=d0c08000, irq=143, clock=66000000)

Quoted 1 line
Quoted 1 line
Quoted 1 line

After Linux started I call the function flexcan_mode_start() and get

the

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

following message and CAN connections doesn't work.

rtcan0: Failed to softreset can module (mcr=0x5b80000f)

I have a working configuration for this board using Kernel 3.0.43 and Xenomai 2.6.2.1

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team flexcan netdevice driver
rtcan: registered rtcan0
flexcan imx6q-flexcan.0: RTCAN device registered (reg_base=e0968000, irq=142, clock=30000000)
rtcan: registered rtcan1
flexcan imx6q-flexcan.1: RTCAN device registered (reg_base=e0970000, irq=143, clock=30000000)
...
rtcan0: writing ctrl=0x03292005

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

It seems that the clock is the difference so I checked the values of register CCM_CCGR0
3.0.43 address 0x20C4068 is set to 0x7fc03f
3.10.53 address 0x20C4068 is set to 0x4cc00f

so on kernel 3.10.53 are the serial clocks for can disabled.

If anyone has a hint for me how to activate the serial clock in

register

Quoted 57 lines
Quoted 57 lines
Quoted 1 line

CCM_CCGR0 and change the clock to 30000000 that would be great.

Have a look into the directory "arch/arm/boot/dts" of a recent kernel tree
and execute therein "grep LEXCAN[12] *.dts*". There are various boards setting the pins you mention below. Maybe you find some matching hardware.

Quoted 41 lines

Here is the part of the devicetree used to configure flexcan.

#include "imx6dl.dtsi"

/ {

};

/*
* PAD settings
*/

&iomuxc {
      flexcan1 {
          pinctrl_flexcan1_sigmatek: flexcan1grp-sigmatek {
              fsl,pins = <
                  MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX NO_PAD_CTRL
                  MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX NO_PAD_CTRL
              >;
          };
      };

      flexcan2 {
          pinctrl_flexcan2_sigmatek: flexcan2grp-sigmatek {
              fsl,pins = <
                  MX6QDL_PAD_SD3_DAT1__FLEXCAN2_RX NO_PAD_CTRL
                  MX6QDL_PAD_SD3_DAT0__FLEXCAN2_TX NO_PAD_CTRL
              >;
          };
      };
};

/*
* CAN
*/

&flexcan1 {
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_flexcan1_sigmatek>;
      status = "okay";
};
Quoted 5 lines
&flexcan2 {
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_flexcan2_sigmatek>;
      status = "okay";
};

Hope that already helps.

Wolfgang

#4 lore raw

Am 2015-05-06 um 10:51 schrieb Wolfgang Grandegger:

Quoted 14 lines
Quoted 4 lines · Wolfgang Netbal

Dear Wolfgang,

thank you for your fast replay.

Quoted 8 lines

I'm sure my problems are not from setting the pin configuration, because I tested configuration also with the default settings.

My issue is that the clock rate is set to 66000000 instead of 30000000 and that can_serial_clock in register CCM_CCG0 is disabled.

Do you hava any idea how to activate the serial_clock for can. I cant find anything in other devicetree files.

Quoted 8 lines

Looking to the Flexcan function "register_flexcandev()" of the 3.10 mainline kernel here:

http://lxr.free-electrons.com/source/drivers/net/can/flexcan.c#L1083

I realize that the Xenomai kernel support of that driver is not correct. Could you please replace *all* "KERNEL_VERSION(3,11,0)" with "KERNEL_VERSION(3,10,0)" in your "rtcan_flexcan.c".

I made a cherry-pick of commit "can/flexcan: fixup for kernel release >= 3.11" (a7b7adec9123dc60587d160f0818322a9a547630 <http://git.xenomai.org/xenomai-2.6.git/commit/?id=a7b7adec9123dc60587d160f0818322a9a547630>) from xenomai-2.6.git <http://git.xenomai.org/xenomai-2.6.git/>
and replaced all "KERNEL_VERSION(3,11,0)" with "KERNEL_VERSION(3,10,0)" and it works.

Thanks a lot Wolfgang

Quoted 111 lines

Hope it helps.

Wolfgang.

Quoted 9 lines

Kind regards
Wolfgang

Am 2015-05-05 um 15:32 schrieb Wolfgang Grandegger:

Quoted 5 lines
Quoted 3 lines · Wolfgang Netbal

Dear All,

I have a custom board with an imx6dl using freescale yocto 3.10.53

with

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Xenomai 2.6.4.
The probe function works fine while booting the kernel

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team
rtcan: registered rtcan0
flexcan 2090000.can: RTCAN device registered (reg_base=d0c00000, irq=142, clock=66000000)
rtcan: registered rtcan1
flexcan 2094000.can: RTCAN device registered (reg_base=d0c08000, irq=143, clock=66000000)

Quoted 1 line
Quoted 1 line
Quoted 1 line

After Linux started I call the function flexcan_mode_start() and get

the

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

following message and CAN connections doesn't work.

rtcan0: Failed to softreset can module (mcr=0x5b80000f)

I have a working configuration for this board using Kernel 3.0.43 and Xenomai 2.6.2.1

RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team flexcan netdevice driver
rtcan: registered rtcan0
flexcan imx6q-flexcan.0: RTCAN device registered (reg_base=e0968000, irq=142, clock=30000000)
rtcan: registered rtcan1
flexcan imx6q-flexcan.1: RTCAN device registered (reg_base=e0970000, irq=143, clock=30000000)
...
rtcan0: writing ctrl=0x03292005

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

It seems that the clock is the difference so I checked the values of register CCM_CCGR0
3.0.43 address 0x20C4068 is set to 0x7fc03f
3.10.53 address 0x20C4068 is set to 0x4cc00f

so on kernel 3.10.53 are the serial clocks for can disabled.

If anyone has a hint for me how to activate the serial clock in

register

Quoted 57 lines
Quoted 57 lines
Quoted 1 line

CCM_CCGR0 and change the clock to 30000000 that would be great.

Have a look into the directory "arch/arm/boot/dts" of a recent kernel tree
and execute therein "grep LEXCAN[12] *.dts*". There are various boards setting the pins you mention below. Maybe you find some matching hardware.

Quoted 41 lines

Here is the part of the devicetree used to configure flexcan.

#include "imx6dl.dtsi"

/ {

};

/*
* PAD settings
*/

&iomuxc {
       flexcan1 {
           pinctrl_flexcan1_sigmatek: flexcan1grp-sigmatek {
               fsl,pins = <
                   MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX NO_PAD_CTRL
                   MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX NO_PAD_CTRL
               >;
           };
       };

       flexcan2 {
           pinctrl_flexcan2_sigmatek: flexcan2grp-sigmatek {
               fsl,pins = <
                   MX6QDL_PAD_SD3_DAT1__FLEXCAN2_RX NO_PAD_CTRL
                   MX6QDL_PAD_SD3_DAT0__FLEXCAN2_TX NO_PAD_CTRL
               >;
           };
       };
};

/*
* CAN
*/

&flexcan1 {
       pinctrl-names = "default";
       pinctrl-0 = <&pinctrl_flexcan1_sigmatek>;
       status = "okay";
};
Quoted 5 lines
&flexcan2 {
       pinctrl-names = "default";
       pinctrl-0 = <&pinctrl_flexcan2_sigmatek>;
       status = "okay";
};

Hope that already helps.

Wolfgang

#5 lore raw
Quoted 16 lines · Wolfgang Netbal

Am 2015-05-06 um 10:51 schrieb Wolfgang Grandegger:

On Wed, 06 May 2015 10:26:52 +0200, Wolfgang Netbal
[1] wrote:

Dear Wolfgang,

thank you for your fast replay.

I'm sure my problems are not from setting the pin configuration, because

I tested configuration also with the default settings.

My issue is that the clock rate is set to 66000000 instead of 30000000 and that can_serial_clock in register CCM_CCG0 is disabled.

Quoted 7 lines

Do you hava any idea how to activate the serial_clock for can. I cant find anything in other devicetree files.

Looking to the Flexcan function "register_flexcandev()" of the 3.10 mainline kernel here:

http://lxr.free-electrons.com/source/drivers/net/can/flexcan.c#L1083

[2]

Quoted 10 lines

I realize that the Xenomai kernel support of that driver is not correct. Could you please replace *all* "KERNEL_VERSION(3,11,0)" with "KERNEL_VERSION(3,10,0)" in your "rtcan_flexcan.c".

I made a cherry-pick of commit "can/flexcan: fixup for kernel release

Quoted 1 line

= 3.11" (a7b7adec9123dc60587d160f0818322a9a547630 [3]) from

xenomai-2.6.git [4]
and replaced all "KERNEL_VERSION(3,11,0)" with "KERNEL_VERSION(3,10,0)"
and it works.

I just checked... the proper kernel version switch should be >= 3.6. I'm going to prepare a patch later this week.

Wolfgang.