drivers: can: Implement stm32fd driver

This driver is the SoC specific implementation of the
Bosch M_CAN IP.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
This commit is contained in:
Alexander Wachter 2021-02-07 15:47:52 +01:00 committed by Kumar Gala
commit f1754b19eb
6 changed files with 357 additions and 34 deletions

View file

@ -1,9 +1,17 @@
# STM32 CAN configuration options
if CAN_MCAN && SOC_SERIES_STM32G4X
# Copyright (c) 2020 Alexander Wachter
# SPDX-License-Identifier: Apache-2.0
DT_COMPAT_STM32_FDCAN := st,stm32-fdcan
config CAN_STM32FD
bool
default y
bool "STM32 FDCAN driver"
default $(dt_compat_enabled,$(DT_COMPAT_STM32_FDCAN))
select CAN_MCAN
select USE_STM32_LL_RCC
if CAN_STM32FD
config CAN_MAX_STD_ID_FILTER
int "Maximum number of std ID filters"
@ -21,15 +29,14 @@ config CAN_MAX_EXT_ID_FILTER
Defines the maximum number of filters with extended ID (29-bit)
that can be attached.
config CAN_CKDIV
int "CKDIV register value"
range 0 15
default 0
config CAN_STM32_CLOCK_DIVISOR
int "CAN clock divisor"
range 1 30
default 1
help
This value is written to the CKDIV register.
The APB clock is divided according to this value before it is feed to
CAN core. Note that the the divider affects all CAN controllers.
The values of the register are multiplied by two and zero corresponds
to one. The value six, for example results in a clock divided by 12.
The APB clock is divided by this value (stored in CKDIV register)
before it is fed to the CAN core.
Note that the the divisor affects all CAN controllers.
Allowed values: 1 or 2 * n, where n <= 15.
endif #CAN_MCAN
endif #CAN_STM32FD