LAN969x MCAN

1. SoC Resources

LAN969x SoC supports two instances of CAN-FD (Control Area Network with Flexible Data-Rate) which is compliant with CAN 2.0 Part A and 2.0 Part B.

2. Kernel configurations

Following kernel config options should be enabled to use LAN969x MCAN:

  • CONFIG_CAN - CAN driver config option.

  • CONFIG_CAN_M_CAN - Bosch MCAN config option.

  • CONFIG_CAN_M_CAN_PLATFORM - Bosch M_CAN support for io-mapped devices.

3. Devicetree Configuration

To enable MCAN interface, following configurations are required in device tree:

  • compatible string must be set to bosch,m_can.

  • reg property must be set to <0xe081c000 0xfc> and <0x00100000 0x4000> for mcan0, and <0xe0820000 0xfc> and <0x00100000 0x8000> for mcan1.

  • reg-names must be set to m_can and message_ram.

  • interrupts property must be set with interrupt details as show in the table:

MCAN ID Shared Peripheral Interrupt (int0) CPU INTR (int0) Shared Peripheral Interrupt (int1) CPU INTR (int1)

mcan0

102

70

103

71

mcan1

104

72

105

73

Note

Shared peripheral interrupt lines start at index ID32. So, CPU INTR must be calculated as [Shared peripheral interrupt number - 32].

  • interrupt-names must be set to int0 and int1.

  • clocks property must be set to <&clks GCK_ID_MCANx>, <&clks GCK_ID_MCANx>, where x is MCAN ID (0-1).

  • clock-names must be set to hclk and cclk.

  • bosch,mram-cfg property must be set to <0x0 0 0 64 0 0 32 32> for mcan0 and

  • standby-gpios property is optional and defines a regular GPIO line that is used to mute the transmitter and block the receiver if the line is high.

3.2. Example

Following example shows how a CAN controller should be defined in DT:

dtsi file:

can0: can@e081c000 {
	compatible = "bosch,m_can";
	reg = <0xe081c000 0xfc>, <0x00100000 0x4000>;
	reg-names = "m_can", "message_ram";
	interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>,
		     <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
	interrupt-names = "int0", "int1";
	clocks = <&clks GCK_ID_MCAN0>, <&clks GCK_ID_MCAN0>;
	clock-names = "hclk", "cclk";
	assigned-clocks = <&clks GCK_ID_MCAN0>;
	assigned-clock-rates = <40000000>;
	bosch,mram-cfg = <0x0 0 0 64 0 0 32 32>;
	status = "disabled";
};

dts file changes:

&can0 {
	pinctrl-0 = <&can0_b_pins>;
	pinctrl-names = "default";
	standby-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>;
	status = "okay";
};
The standby-gpios shown above is just an example and must match the actual board design.

The EVB-LAN9696-24port EVB does not have any CAN devices, so please refer to the LAN966x MCAN page for more details.