Bosch M_CAN Linux Driver
Go to file
Mario Huettel 16cd0aaa5a can: m_can: Enable M_CAN version dependent initialization
This patch adapts the initialization of the M_CAN. So it can be used with
all versions >= 3.0.x.

Changes:
* Added version element to m_can_priv structure to hold M_CAN version.
* Renamed bittiming structs for version 3.0.x
* Added new bittiming structs for version >= 3.1.x
* Function alloc_m_can_dev takes 2 new arguments. The TX FIFO size and the
  base address of the module.
* Chip configuration for CAN_CTRLMODE_LOOPBACK is changed: Enabled
  CCCR_MON bit. In combination with TEST_LBCK it activates the internal
  loopback mode. Leaving CCCR_MON '0' results in external loopback mode.
* Clocks are temporarily enabled by platform_propbe function in order to
  allow read access to the Core Release register and the Control Register.
  Registers are used to detect M_CAN version and optional Non-ISO Feature.

Initialization of M_CAN for version >= 3.1.x:
* TX FIFO of M_CAN is used to transmit frames. The driver does not need to
  stop the tx queue after each frame sent.
* Initialization of TX Event FIFO is added.
* NON-ISO is fixed for all M_CAN versions < 3.2.x. Version 3.2.x _can_ have
  the NISO (Non-ISO) bit which can switch the mode of the M_CAN to Non-ISO
  mode. This bit does not have to be writeable. Therefore it is checked.
  If it is writable Non-ISO support is added to the controllers supported
  CAN modes.

New Functions:
* Function to check the Core Release version. The read value determines the
  behaviour of the driver.
* Function to check if the NISO bit for version >= 3.2.x is implemented.

Signed-off-by: Mario Huettel <mario.huettel@gmx.net>
2017-04-26 13:13:25 +02:00
drivers/net/can/m_can can: m_can: Enable M_CAN version dependent initialization 2017-04-26 13:13:25 +02:00
README.md added Readme 2016-08-11 15:47:30 +02:00

Bosch M_CAN (CAN Controller) Device Driver

Files

  • *.c : Driver C-Source Files
  • Kconfig : Config file for menuconfig etc.
  • Makefile : Makefile for Kernel Build

Compile

compile as normal Kernel Driver.

  • Driver can be compiled as an externel module.
  • Driver can be compiled statically into the kernel.

Device Tree

The following code shows a basic device tree for an M_CAN node:

/* M_CAN Device Tree Nodes */
hclk: hclk {
	compatible = "fixed-clock";
	#clock-cells = < 0 >;
	clock-frequency = <50000000>;
};
cclk: cclk {
	compatible = "fixed-clock";
	#clock-cells = < 0 >;
	clock-frequency = <40000000>;
};	
mcan0: can@0xff240000 {
	compatible = "bosch,m_can-3.2.1";
	reg = <0xff240000 0x200>,<0xff260000 0x4000>;
	reg-names = "m_can", "message_ram";
	interrupt-parent = <&intc>;
	/* Shared Interrupt for every M_CAN */
	interrupts = <0x0 40 0x4>;
	interrupt-names = "int0";
	clocks = <&hclk>, <&cclk>;
	clock-names = "hclk", "cclk";
	bosch,mram-cfg = <0x0 128 64 64 32 64 32 32>;
};