arch/arm/src/lpc43: Fix lpc43 CAN configuration. Configuration settings were used and documented in README.txt files, but never in any Kconfig file. Also fix the scoping name of CAN variable naming. CONFIG_CANx_BAUD->CONFIG_LPC43_CANx_BAUD.

This commit is contained in:
Gregory Nutt 2018-06-28 15:11:23 -06:00
parent 45cdc3a3d0
commit 2552bfd2ef
7 changed files with 98 additions and 33 deletions

View File

@ -790,6 +790,61 @@ config LPC43_I2C0_SUPERFAST
endmenu # I2C Configution
endif # LPC43_I2C0
menu "CAN driver options"
depends on LPC43_CAN0 || LPC43_CAN1
config LPC43_CAN0_BAUD
int "CAN0 BAUD"
depends on LPC43_CAN0
default 1000000
---help---
CAN0 BAUD rate.
config LPC43_CAN1_BAUD
int "CAN1 BAUD"
depends on LPC43_CAN1
default 1000000
---help---
CAN1 BAUD rate.
config LPC43_CAN0_DIVISOR
int "CAN0 CCLK divisor"
depends on LPC43_CAN0
default 4
---help---
CAN0 is clocked at CCLK divided by this number. (the CCLK frequency is divided
by this number to get the CAN clock). Options = {1,2,4,6}. Default: 4.
config LPC43_CAN1_DIVISOR
int "CAN2 CCLK divisor"
depends on LPC43_CAN1
default 4
---help---
CAN1 is clocked at CCLK divided by this number. (the CCLK frequency is divided
by this number to get the CAN clock). Options = {1,2,4,6}. Default: 4.
config CAN_TSEG1
int "TSEG1 quanta"
default 12
---help---
The number of CAN time quanta in segment 1. Default: 6
config CAN_TSEG2
int "TSEG2 quanta"
default 4
---help---
The number of CAN time quanta in segment 2. Default: 7
config LPC43_CAN_REGDEBUG
bool "Register level debug"
depends on DEBUG_CAN_INFO
default n
---help---
Output detailed register-level CAN debug information. Requires also
CONFIG_DEBUG_CAN_INFO.
endmenu # CAN driver options
if LPC43_USBOTG && USBHOST
menu "USB host controller driver (HCD) options"

View File

@ -83,8 +83,8 @@
/* A CAN bit rate must be provided */
# ifndef CONFIG_CAN0_BAUD
# define CONFIG_CAN0_BAUD 1000000
# ifndef CONFIG_LPC43_CAN0_BAUD
# define CONFIG_LPC43_CAN0_BAUD 1000000
# endif
#endif
@ -92,8 +92,8 @@
/* A CAN bit rate must be provided */
# ifndef CONFIG_CAN1_BAUD
# define CONFIG_CAN1_BAUD 1000000
# ifndef CONFIG_LPC43_CAN1_BAUD
# define CONFIG_LPC43_CAN1_BAUD 1000000
# endif
#endif
@ -142,14 +142,14 @@ struct up_dev_s
****************************************************************************/
/* CAN Register access */
#ifdef CONFIG_CAN_REGDEBUG
#ifdef CONFIG_LPC43_CAN_REGDEBUG
static void can_printreg(uint32_t addr, uint32_t value);
#endif
static uint32_t can_getreg(struct up_dev_s *priv, int offset);
static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value);
#ifdef CONFIG_CAN_REGDEBUG
#ifdef CONFIG_LPC43_CAN_REGDEBUG
static uint32_t can_getcommon(uint32_t addr);
static void can_putcommon(uint32_t addr, uint32_t value);
#else
@ -215,7 +215,7 @@ static struct up_dev_s g_can0priv =
{
.port = 0,
.clkdiv = CAN_CLKDIVVAL + 1,
.baud = CONFIG_CAN0_BAUD,
.baud = CONFIG_LPC43_CAN0_BAUD,
.base = LPC43_CAN0_BASE,
.irq = LPC43M4_IRQ_CAN0,
};
@ -232,7 +232,7 @@ static struct up_dev_s g_can1priv =
{
.port = 1,
.clkdiv = CAN_CLKDIVVAL + 1,
.baud = CONFIG_CAN1_BAUD,
.baud = CONFIG_LPC43_CAN1_BAUD,
.base = LPC43_CAN1_BASE,
.irq = LPC43M4_IRQ_CAN1,
};
@ -263,7 +263,7 @@ static struct can_dev_s g_can1dev =
*
****************************************************************************/
#ifdef CONFIG_CAN_REGDEBUG
#ifdef CONFIG_LPC43_CAN_REGDEBUG
static void can_printreg(uint32_t addr, uint32_t value)
{
static uint32_t prevaddr = 0;
@ -311,7 +311,7 @@ static void can_printreg(uint32_t addr, uint32_t value)
caninfo("%08x->%08x\n", addr, value);
}
#endif /* CONFIG_CAN_REGDEBUG */
#endif /* CONFIG_LPC43_CAN_REGDEBUG */
/****************************************************************************
* Name: can_getreg
@ -327,7 +327,7 @@ static void can_printreg(uint32_t addr, uint32_t value)
*
****************************************************************************/
#ifdef CONFIG_CAN_REGDEBUG
#ifdef CONFIG_LPC43_CAN_REGDEBUG
static uint32_t can_getreg(struct up_dev_s *priv, int offset)
{
uint32_t addr;
@ -345,7 +345,7 @@ static uint32_t can_getreg(struct up_dev_s *priv, int offset)
{
return getreg32(priv->base + offset);
}
#endif /* CONFIG_CAN_REGDEBUG */
#endif /* CONFIG_LPC43_CAN_REGDEBUG */
/****************************************************************************
* Name: can_putreg
@ -363,7 +363,7 @@ static uint32_t can_getreg(struct up_dev_s *priv, int offset)
*
****************************************************************************/
#ifdef CONFIG_CAN_REGDEBUG
#ifdef CONFIG_LPC43_CAN_REGDEBUG
static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value)
{
uint32_t addr = priv->base + offset;
@ -381,7 +381,7 @@ static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value)
{
putreg32(value, priv->base + offset);
}
#endif /* CONFIG_CAN_REGDEBUG */
#endif /* CONFIG_LPC43_CAN_REGDEBUG */
/****************************************************************************
* Name: can_getcommon
@ -397,7 +397,7 @@ static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value)
*
****************************************************************************/
#ifdef CONFIG_CAN_REGDEBUG
#ifdef CONFIG_LPC43_CAN_REGDEBUG
static uint32_t can_getcommon(uint32_t addr)
{
uint32_t value;
@ -408,7 +408,7 @@ static uint32_t can_getcommon(uint32_t addr)
can_printreg(addr, value);
return value;
}
#endif /* CONFIG_CAN_REGDEBUG */
#endif /* CONFIG_LPC43_CAN_REGDEBUG */
/****************************************************************************
* Name: can_putcommon
@ -425,7 +425,7 @@ static uint32_t can_getcommon(uint32_t addr)
*
****************************************************************************/
#ifdef CONFIG_CAN_REGDEBUG
#ifdef CONFIG_LPC43_CAN_REGDEBUG
static void can_putcommon(uint32_t addr, uint32_t value)
{
/* Show the register value being written */
@ -436,7 +436,7 @@ static void can_putcommon(uint32_t addr, uint32_t value)
putreg32(value, addr);
}
#endif /* CONFIG_CAN_REGDEBUG */
#endif /* CONFIG_LPC43_CAN_REGDEBUG */
/****************************************************************************
* Name: can_reset

View File

@ -241,8 +241,8 @@ Bambino-200e Configuration Options
CONFIG_LPC43_ADC0=y
CONFIG_LPC43_ADC1=y
CONFIG_LPC43_ATIMER=y
CONFIG_LPC43_CAN0=y
CONFIG_LPC43_CAN1=y
CONFIG_LPC43_CAN2=y
CONFIG_LPC43_DAC=y
CONFIG_LPC43_EMC=y
CONFIG_LPC43_ETHERNET=y
@ -298,8 +298,10 @@ Bambino-200e Configuration Options
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1 is defined.
CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN2 is defined.
CONFIG_LPC43_CAN0_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN0
is defined.
CONFIG_LPC43_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1
is defined.
CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7

View File

@ -493,8 +493,8 @@ LPC4330-Xplorer Configuration Options
CONFIG_LPC43_ADC0=y
CONFIG_LPC43_ADC1=y
CONFIG_LPC43_ATIMER=y
CONFIG_LPC43_CAN0=y
CONFIG_LPC43_CAN1=y
CONFIG_LPC43_CAN2=y
CONFIG_LPC43_DAC=y
CONFIG_LPC43_EMC=y
CONFIG_LPC43_ETHERNET=y
@ -550,8 +550,10 @@ LPC4330-Xplorer Configuration Options
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1 is defined.
CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN2 is defined.
CONFIG_LPC43_CAN0_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN0
is defined.
CONFIG_LPC43_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1
is defined.
CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7

View File

@ -532,8 +532,8 @@ LPC4337-ws Configuration Options
CONFIG_LPC43_ADC0=y
CONFIG_LPC43_ADC1=y
CONFIG_LPC43_ATIMER=y
CONFIG_LPC43_CAN0=y
CONFIG_LPC43_CAN1=y
CONFIG_LPC43_CAN2=y
CONFIG_LPC43_DAC=y
CONFIG_LPC43_EMC=y
CONFIG_LPC43_ETHERNET=y
@ -589,8 +589,10 @@ LPC4337-ws Configuration Options
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1 is defined.
CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN2 is defined.
CONFIG_LPC43_CAN0_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN0
is defined.
CONFIG_LPC43_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1
is defined.
CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7

View File

@ -529,8 +529,8 @@ LPC4357-EVB Configuration Options
CONFIG_LPC43_ADC0=y
CONFIG_LPC43_ADC1=y
CONFIG_LPC43_ATIMER=y
CONFIG_LPC43_CAN0=y
CONFIG_LPC43_CAN1=y
CONFIG_LPC43_CAN2=y
CONFIG_LPC43_DAC=y
CONFIG_LPC43_EMC=y
CONFIG_LPC43_ETHERNET=y
@ -586,8 +586,10 @@ LPC4357-EVB Configuration Options
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1 is defined.
CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN2 is defined.
CONFIG_LPC43_CAN0_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN0
is defined.
CONFIG_LPC43_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1
is defined.
CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7

View File

@ -532,8 +532,8 @@ LPC4370-Link2 Configuration Options
CONFIG_LPC43_ADC0=y
CONFIG_LPC43_ADC1=y
CONFIG_LPC43_ATIMER=y
CONFIG_LPC43_CAN0=y
CONFIG_LPC43_CAN1=y
CONFIG_LPC43_CAN2=y
CONFIG_LPC43_DAC=y
CONFIG_LPC43_EMC=y
CONFIG_LPC43_ETHERNET=y
@ -589,8 +589,10 @@ LPC4370-Link2 Configuration Options
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1 is defined.
CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN2 is defined.
CONFIG_LPC43_CAN0_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN0
is defined.
CONFIG_LPC43_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1
is defined.
CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7