Flexcan resources sharing between M4 and A35 in iMX8QXP

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

Flexcan resources sharing between M4 and A35 in iMX8QXP

2,604 Views
preethu
Contributor I

Hi,

 

I am trying to enable CAN on both m4 and A35 (linux) core, like CAN1 to M4 and CAN0 to linux or vice versa on imx8qxp.

I tried with changing board.c and assigned SC_R_CAN_0 and its pad SC_P_FLEXCAN0_RX, SC_P_FLEXCAN0_TX and updated device tree with status okay for respective CAN on Linux.

 

With this setting i can see only M4 CAN is up and Linux side when i tried to link up it says "Cannot find device can1"

and also observed error in dmesg "clk: couldn't get clock 0 for /bus@5a000000/can@5a8d0000"

Can please guide how to enable CAN for both core ?

Thanks in advanced.

 

0 Kudos
Reply
6 Replies

2,560 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

Please share your modifications.

Best Regards,
Zhiming

0 Kudos
Reply

2,541 Views
preethu
Contributor I

 

Hi, 

please find attched board.c and imx8x-mek.dtsi modifications which we are tried.

Thank you

0 Kudos
Reply

2,508 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

Checked the files you shared, the modification in board.c conforms to normal modification logic, but there is one problem about this way. All flexcan modules in linux share the same clock.

Zhiming_Liu_0-1730791591423.png

 

If you have already enable this clock in M4, the imx_clk_scu_alloc_dev function maybe return error, you can try to add the debug messages in this function and then try to add the relevant code, if the rsrc_id is CAN_0 clock, just return NULL directly to indicate success.



Best Regards,
Zhiming

0 Kudos
Reply

2,475 Views
preethu
Contributor I

Hi Zhiming,

M4 CAN0 is enbled i can run CAN example on M4 and Linux side as you suggested i added debug message in imx_clk_scu_alloc_dev function, observed that its already returnung NULL from below code.


if(rsrc_id == IMX_SC_R_CAN_0)
{

    if (!imx_clk_is_resource_owned(rsrc_id))
    {
        pr_warn("Entered !imx_clk_is_resource_owned------>\n");
        return NULL;
    }

}

[ 2.807928] Entered !imx_clk_is_resource_owned------>
[ 43.401376] clk: couldn't get clock 0 for /bus@5a000000/can@5a8e0000

What else i can try ?

Thank you. 


0 Kudos
Reply

2,463 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

If the rsrc_id == IMX_SC_R_CAN_0 and the rsrc not assign to A core, if you want to skip this error, you need to continue executing the following code at this point to add the clock. Even though this clock is false from the software level. This is a hack method. You can continue to try to skip this clock error.

pdev = platform_device_alloc(name, PLATFORM_DEVID_NONE);
	if (!pdev) {
		pr_err("%s: failed to allocate scu clk dev rsrc %d type %d\n",
		       name, rsrc_id, clk_type);
		return ERR_PTR(-ENOMEM);
	}

	ret = platform_device_add_data(pdev, &clk, sizeof(clk));
	if (ret) {
		platform_device_put(pdev);
		return ERR_PTR(ret);
	}

	ret = driver_set_override(&pdev->dev, &pdev->driver_override,
				  "imx-scu-clk", strlen("imx-scu-clk"));
	if (ret) {
		platform_device_put(pdev);
		return ERR_PTR(ret);
	}

	ret = imx_clk_scu_attach_pd(&pdev->dev, rsrc_id);
	if (ret)
		pr_warn("%s: failed to attached the power domain %d\n",
			name, ret);

	ret = platform_device_add(pdev);
	if (ret) {
		platform_device_put(pdev);
		return ERR_PTR(ret);
	}



Best Regards,
Zhiming

0 Kudos
Reply

2,582 Views
ksloat_cornersoft
Contributor I
Can you share the source code as well as the device tree modifications you made to attempt to enable these?
0 Kudos
Reply