Compare commits

..

8 Commits

Author SHA1 Message Date
09003224fd Modified Readme
* Added 'Patch Kernel' section
* Modified example device tree to fit newest driver
2017-04-26 13:18:19 +02:00
1f6deec3fb can: m_can: Enable TX FIFO Handling for M_CAN IP version >= v3.1.x
* Added defines for TX Event FIFO Element
* Adapted ndo_start_xmit function.
  For versions >= v3.1.x it uses the TX FIFO to optimize the data
  throughput. It stores the echo skb at the same index as in the
  M_CAN's TX FIFO. The frame's message marker is set to this index.
  This message marker is received in the TX Event FIFO after
  the message was successfully transmitted. It is used to echo the
  correct echo skb back to the network stack.
* Added m_can_echo_tx_event function. It reads all received
  message markers in the TX Event FIFO and loops back the
  corresponding echo skbs.
* ISR checks for new TX Event Entry interrupt for version >= 3.1.x.

Signed-off-by: Mario Huettel <mario.huettel@gmx.net>
2017-04-26 13:13:46 +02:00
ae8a5eb664 can: m_can: Configuration for TX and TX event FIFOs
* TX/TX Event FIFO sizes are configured for version >= v3.1.x

Signed-off-by: Mario Huettel <mario.huettel@gmx.net>
2017-04-26 13:13:34 +02:00
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
4d0ab5bc18 can: m_can: Updated register defines to newest version
* Updated register defines to newest M_CAN version (v3.2.1).
* Changed defines in the whole code.

Signed-off-by: Mario Huettel <mario.huettel@gmx.net>
2017-04-26 13:13:15 +02:00
1b2fbe42f9 can: m_can: Removed virtual address from print
The virtual address of the device was printed. I removed it
because it leaks internal information.

Signed-off-by: Mario Huettel <mario.huettel@gmx.net>
2017-04-26 13:13:02 +02:00
7d933b0569 can: m_can: Removed initialization of FIFO water marks
FIFO water marks disabled because the driver doesn't handle water mark events.

Signed-off-by: Mario Huettel <mario.huettel@gmx.net>
2017-04-26 13:12:40 +02:00
76dd032c7a can: m_can: Disabled Interrupt Line 1
* Disabled interrupt line 1. The driver didn't use it.

Signed-off-by: Mario Huettel <mario.huettel@gmx.net>
2017-04-26 13:11:58 +02:00
2 changed files with 597 additions and 171 deletions

View File

@ -7,11 +7,17 @@ Files
* Kconfig : Config file for menuconfig etc. * Kconfig : Config file for menuconfig etc.
* Makefile : Makefile for Kernel Build * Makefile : Makefile for Kernel Build
Patch Kernel
------------
* Apply the specific commits on your kernel source tree
* Or copy the newest m_can.c to your kernel source tree.
Compile Compile
------- -------
compile as normal Kernel Driver. compile as normal Kernel Driver.
* Driver can be compiled as an externel module. * Driver can be compiled as an externel module.
* Driver can be compiled statically into the kernel. * Driver can be compiled statically into the kernel.
* selectable with menuconfig
Device Tree Device Tree
@ -20,6 +26,7 @@ The following code shows a basic device tree for an M_CAN node:
``` ```
/* M_CAN Device Tree Nodes */ /* M_CAN Device Tree Nodes */
/* Example clocks */
hclk: hclk { hclk: hclk {
compatible = "fixed-clock"; compatible = "fixed-clock";
#clock-cells = < 0 >; #clock-cells = < 0 >;
@ -30,12 +37,13 @@ cclk: cclk {
#clock-cells = < 0 >; #clock-cells = < 0 >;
clock-frequency = <40000000>; clock-frequency = <40000000>;
}; };
/* M_CAN device */
mcan0: can@0xff240000 { mcan0: can@0xff240000 {
compatible = "bosch,m_can-3.2.1"; compatible = "bosch,m_can";
reg = <0xff240000 0x200>,<0xff260000 0x4000>; reg = <0xff240000 0x200>,<0xff260000 0x4000>;
reg-names = "m_can", "message_ram"; reg-names = "m_can", "message_ram";
interrupt-parent = <&intc>; interrupt-parent = <&intc>;
/* Shared Interrupt for every M_CAN */
interrupts = <0x0 40 0x4>; interrupts = <0x0 40 0x4>;
interrupt-names = "int0"; interrupt-names = "int0";
clocks = <&hclk>, <&cclk>; clocks = <&hclk>, <&cclk>;

File diff suppressed because it is too large Load Diff