flexcan controller register
/********************************************************************* * flexcan controller register * 说明: * 由于设备树没有正确注册CAN控制器设备,导致内核没有生产CAN设备。 * 另外就是在调试阶段可以make menuconfig加上can debug信息,如果需要 * 内核支持vcan,也需要通过make menuconfig来对其进行支持。 * * 2017-8-15 深圳 龙华樟坑村 曾剑锋 ********************************************************************/ 一、参考文档: 1. device tree can controller status setting https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/net/can/c_can.txt 2. fsl-flexcan.txt https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt 二、处理方法: 1. 设备树路径:arch/arm/boot/dts/imx6qdl.dtsi flexcan1: can@02090000 { compatible = "fsl,imx6q-flexcan"; reg = <0x02090000 0x4000>; interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6QDL_CLK_CAN1_IPG>, <&clks IMX6QDL_CLK_CAN1_SERIAL>; clock-names = "ipg", "per"; stop-mode = <&gpr 0x34 28 0x10 17>; status = "okay"; /* change disable to okay */ }; flexcan2: can@02094000 { compatible = "fsl,imx6q-flexcan"; reg = <0x02094000 0x4000>; interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6QDL_CLK_CAN2_IPG>, <&clks IMX6QDL_CLK_CAN2_SERIAL>; clock-names = "ipg", "per"; stop-mode = <&gpr 0x34 29 0x10 18>; status = "okay"; /* change disable to okay */ }; 2. 查看CAN设备: root@freescale ~$ ifconfig -a can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:142 can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:143 ... root@freescale ~$