How to configure the Socket CAN br_clksrc from bus to clk ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure the Socket CAN br_clksrc from bus to clk ?

Jump to solution
1,365 Views
gurumoorthirasi
Contributor IV

Dear All,

How to configure the Socket CAN br_clksrc from bus to clk ?

i tried the below command

ifconfig can0 down

echo 0 > /sys/devices/platform/Flex.can0/br_clksrc

cat /sys/devices/platform/Flex.can0/br_clksrc

bus

it is in bus mode only. how to change it to clk.

This is high priority !!!

Regards,

Guru

Labels (2)
1 Solution
1,119 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi Juan ,

I think Guru already has the answer to this.

We had to change the default value of br_clksrc to 0 in the dev.c file found in linux/drivers/net/can/flexcan/ function flexca_device_default.

And take the "osc24m" instead of "ckih" in the flexcan_update_bitrate fucntion.

After that we could change the br_propseg, br_pseg1 and br_pseg2 to get the 1Mbps.

Best Regards,

Alejandro

View solution in original post

6 Replies
1,119 Views
juangutierrez
NXP Employee
NXP Employee

Which BSP or kernel are you using. I can not found sucha a clck br_clksrc.

If this is a custom change?

0 Kudos
1,119 Views
gurumoorthirasi
Contributor IV

hi,

I am using the linux kernel 2.6.31 downloaded from freescale imx25 products downloads page.

you can found that only flexcan driver has been loaded .

Regards,

Guru

1,119 Views
juangutierrez
NXP Employee
NXP Employee

Can you try

echo "osc" > /sys/devices/platform/Flex.can0/br_clksrc

0 Kudos
1,119 Views
gurumoorthirasi
Contributor IV

Hi i tried that also it wont work.

Is anything specially need to change in FLEXCAN driver file for OSC clock?

0 Kudos
1,119 Views
juangutierrez
NXP Employee
NXP Employee

Well if you check the flexcan_set_attr function at drivers/net/can/flexcan/dev.c

if (attr_id == FLEXCAN_ATTR_BR_CLKSRC) {

                if (!strncasecmp(buf, "bus", 3))

                        flexcan->br_clksrc = 1;

                else if (!strncasecmp(buf, "osc", 3))

                        flexcan->br_clksrc = 0;

                goto set_finish;

        }

This function should be called when writing in the br_clksrc device (echo "osc" > /sys/devices/platform/Flex.can0/br_clksrc)

In case writing "osc" then flexcan->br_clksrc = 0

I think you can add some logs/traces (with pr_err or pr_info) to see if really reaching this part of the code

The default/initial value for br_clksrc is set to 1 at arch/arm/mach-mx25/mx25_3stack.c in

struct flexcan_platform_data flexcan_data[] = {

...

.br_clksrc = 1,

..

You can try forcing this to 0

1,120 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi Juan ,

I think Guru already has the answer to this.

We had to change the default value of br_clksrc to 0 in the dev.c file found in linux/drivers/net/can/flexcan/ function flexca_device_default.

And take the "osc24m" instead of "ckih" in the flexcan_update_bitrate fucntion.

After that we could change the br_propseg, br_pseg1 and br_pseg2 to get the 1Mbps.

Best Regards,

Alejandro