SAMV7 MCAN: Add some definitions for the PCK5 clock source and prescaler
This commit is contained in:
parent
70f6e1e8bb
commit
6c9e8b5092
@ -1309,6 +1309,32 @@ if SAMV7_MCAN
|
|||||||
|
|
||||||
menu "MCAN device driver options"
|
menu "MCAN device driver options"
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "MCAN clock source (PCK5)"
|
||||||
|
default SAMV7_MCAN_CLKSRC_MAIN
|
||||||
|
|
||||||
|
config SAMV7_MCAN_CLKSRC_SLOW
|
||||||
|
bool "Slow clock"
|
||||||
|
|
||||||
|
config SAMV7_MCAN_CLKSRC_MAIN
|
||||||
|
bool "Main clock"
|
||||||
|
|
||||||
|
config SAMV7_MCAN_CLKSRC_PLLA
|
||||||
|
bool "PLLA clock"
|
||||||
|
|
||||||
|
config SAMV7_MCAN_CLKSRC_UPLL
|
||||||
|
bool "UPLL clock"
|
||||||
|
|
||||||
|
config SAMV7_MCAN_CLKSRC_MCK
|
||||||
|
bool "Master clock"
|
||||||
|
|
||||||
|
endchoice # MCAN clock source
|
||||||
|
|
||||||
|
config SAMV7_MCAN_CLKSRC_PRESCALER
|
||||||
|
int "MCAN clock prescaler"
|
||||||
|
default 1
|
||||||
|
range 1 256
|
||||||
|
|
||||||
if SAMV7_MCAN0
|
if SAMV7_MCAN0
|
||||||
|
|
||||||
config SAMV7_MCAN0_BAUD
|
config SAMV7_MCAN0_BAUD
|
||||||
|
@ -76,6 +76,34 @@
|
|||||||
# define MAX(a,b) ((a > b) ? a : b)
|
# define MAX(a,b) ((a > b) ? a : b)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Clock source *************************************************************/
|
||||||
|
|
||||||
|
/* PCK5 is the programmable clock source, common to all MCAN controllers */
|
||||||
|
|
||||||
|
#if defined(CONFIG_SAMV7_MCAN_CLKSRC_SLOW)
|
||||||
|
# define SAMV7_MCAN_CLKSRC PMC_PCK_CSS_SLOW
|
||||||
|
# define SAMV7_MCAN_CLKSRC_FREQUENCY BOARD_SLOWCLK_FREQUENCY
|
||||||
|
#elif defined(CONFIG_SAMV7_MCAN_CLKSRC_PLLA)
|
||||||
|
# define SAMV7_MCAN_CLKSRC PMC_PCK_CSS_PLLA
|
||||||
|
# define SAMV7_MCAN_CLKSRC_FREQUENCY BOARD_PLLA_FREQUENCY
|
||||||
|
#elif defined(CONFIG_SAMV7_MCAN_CLKSRC_UPLL)
|
||||||
|
# define SAMV7_MCAN_CLKSRC PMC_PCK_CSS_UPLL
|
||||||
|
# define SAMV7_MCAN_CLKSRC_FREQUENCY BOARD_UPLL_FREQUENCY
|
||||||
|
#elif defined(CONFIG_SAMV7_MCAN_CLKSRC_MCK)
|
||||||
|
# define SAMV7_MCAN_CLKSRC PMC_PCK_CSS_MCK
|
||||||
|
# define SAMV7_MCAN_CLKSRC_FREQUENCY BOARD_MCK_FREQUENCY
|
||||||
|
#else /* if defined(CONFIG_SAMV7_MCAN_CLKSRC_MAIN */
|
||||||
|
# define SAMV7_MCAN_CLKSRC PMC_PCK_CSS_MAIN
|
||||||
|
# define SAMV7_MCAN_CLKSRC_FREQUENCY BOARD_MAINOSC_FREQUENCY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_SAMV7_MCAN_CLKSRC_PRESCALER
|
||||||
|
# define CONFIG_SAMV7_MCAN_CLKSRC_PRESCALER 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SAMV7_MCANCLK_FREQUENCY \
|
||||||
|
(SAMV7_MCAN_CLKSRC_FREQUENCY / CONFIG_SAMV7_MCAN_CLKSRC_PRESCALER)
|
||||||
|
|
||||||
/* Mailboxes ****************************************************************/
|
/* Mailboxes ****************************************************************/
|
||||||
|
|
||||||
#define SAMV7_MCAN_NRECVMB MAX(CONFIG_SAMV7_MCAN0_NRECVMB, CONFIG_SAMV7_MCAN1_NRECVMB)
|
#define SAMV7_MCAN_NRECVMB MAX(CONFIG_SAMV7_MCAN0_NRECVMB, CONFIG_SAMV7_MCAN1_NRECVMB)
|
||||||
|
Loading…
Reference in New Issue
Block a user