drivers: can: mcp2515: Rework for DTS SPI bindings
Adjusted the MCP2515 driver to switch from KConfig SPI configuration to DTS based configuration. Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
This commit is contained in:
parent
35b9308488
commit
4f7761047b
4 changed files with 34 additions and 80 deletions
|
@ -14,10 +14,6 @@ config CAN_MCP2515
|
|||
|
||||
if CAN_MCP2515
|
||||
|
||||
config CAN_MCP2515_NAME
|
||||
string "Driver name"
|
||||
default "MCP2515"
|
||||
|
||||
config CAN_MCP2515_OSC_FREQ
|
||||
int "Oscillator frequency"
|
||||
default 8000000
|
||||
|
@ -52,38 +48,6 @@ config CAN_SJW
|
|||
help
|
||||
Resynchronization jump width (ISO 11898-1)
|
||||
|
||||
config CAN_MCP2515_SPI_PORT_NAME
|
||||
string "SPI device where MCP2515 is connected"
|
||||
default "SPI_1"
|
||||
help
|
||||
Specify the device name of the SPI device to which MCP2515 is
|
||||
connected.
|
||||
|
||||
config CAN_MCP2515_SPI_SLAVE
|
||||
int "SPI Slave Select where MCP2515 is connected"
|
||||
default 1
|
||||
help
|
||||
Specify the slave select pin of the SPI to which MCP2515 is
|
||||
connected.
|
||||
|
||||
config CAN_MCP2515_SPI_FREQ
|
||||
int "SPI frequency to use with MCP2515"
|
||||
default 1000000
|
||||
help
|
||||
SPI frequency to use with MCP2515
|
||||
|
||||
config CAN_MCP2515_INT_PORT_NAME
|
||||
string "INT GPIO controller port name"
|
||||
default "GPIO_0"
|
||||
help
|
||||
GPIO port where INT is connected.
|
||||
|
||||
config CAN_MCP2515_INT_PIN
|
||||
int "INT GPIO pin"
|
||||
default 19
|
||||
help
|
||||
GPIO pin where INT is connected.
|
||||
|
||||
config CAN_MCP2515_INT_THREAD_STACK_SIZE
|
||||
int "Stack size for interrupt handler"
|
||||
default 512
|
||||
|
@ -104,22 +68,6 @@ config CAN_MCP2515_GPIO_SPI_CS
|
|||
This option is useful if one needs to manage SPI CS through a GPIO
|
||||
pin to by-pass the SPI controller's CS logic.
|
||||
|
||||
if CAN_MCP2515_GPIO_SPI_CS
|
||||
config CAN_MCP2515_SPI_CS_PORT_NAME
|
||||
string "GPIO driver's name to use to drive SPI CS through"
|
||||
help
|
||||
This option is mandatory to set which GPIO controller to use in
|
||||
order to actually emulate the SPI CS.
|
||||
|
||||
config CAN_MCP2515_SPI_CS_PIN
|
||||
int "GPIO PIN to use to drive SPI CS through"
|
||||
default 0
|
||||
help
|
||||
This option is mandatory to set which GPIO pin to use in order
|
||||
to actually emulate the SPI CS.
|
||||
|
||||
endif #CAN_MCP2515_GPIO_SPI_CS
|
||||
|
||||
config CAN_MCP2515_MAX_FILTER
|
||||
int "Maximum number of concurrent active filters"
|
||||
default 5
|
||||
|
|
|
@ -615,16 +615,16 @@ static struct mcp2515_data mcp2515_data_1 = {
|
|||
};
|
||||
|
||||
static const struct mcp2515_config mcp2515_config_1 = {
|
||||
.spi_port = CONFIG_CAN_MCP2515_SPI_PORT_NAME,
|
||||
.spi_freq = CONFIG_CAN_MCP2515_SPI_FREQ,
|
||||
.spi_slave = CONFIG_CAN_MCP2515_SPI_SLAVE,
|
||||
.int_pin = CONFIG_CAN_MCP2515_INT_PIN,
|
||||
.int_port = CONFIG_CAN_MCP2515_INT_PORT_NAME,
|
||||
.spi_port = DT_MICROCHIP_MCP2515_0_BUS_NAME,
|
||||
.spi_freq = DT_MICROCHIP_MCP2515_0_SPI_MAX_FREQUENCY,
|
||||
.spi_slave = DT_MICROCHIP_MCP2515_0_BASE_ADDRESS,
|
||||
.int_pin = DT_MICROCHIP_MCP2515_0_INT_GPIOS_PIN,
|
||||
.int_port = DT_MICROCHIP_MCP2515_0_INT_GPIOS_CONTROLLER,
|
||||
.int_thread_stack_size = CONFIG_CAN_MCP2515_INT_THREAD_STACK_SIZE,
|
||||
.int_thread_priority = CONFIG_CAN_MCP2515_INT_THREAD_PRIO,
|
||||
#ifdef CONFIG_CAN_MCP2515_GPIO_SPI_CS
|
||||
.spi_cs_pin = CONFIG_CAN_MCP2515_SPI_CS_PIN,
|
||||
.spi_cs_port = CONFIG_CAN_MCP2515_SPI_CS_PORT_NAME,
|
||||
.spi_cs_pin = DT_MICROCHIP_MCP2515_0_CS_GPIOS_PIN,
|
||||
.spi_cs_port = DT_MICROCHIP_MCP2515_0_CS_GPIOS_CONTROLLER,
|
||||
#endif /* CAN_MCP2515_GPIO_SPI_CS */
|
||||
.tq_sjw = CONFIG_CAN_SJW,
|
||||
.tq_prop = CONFIG_CAN_PROP_SEG,
|
||||
|
@ -632,7 +632,7 @@ static const struct mcp2515_config mcp2515_config_1 = {
|
|||
.tq_bs2 = CONFIG_CAN_PHASE_SEG2,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(can_mcp2515_1, CONFIG_CAN_MCP2515_NAME, &mcp2515_init,
|
||||
DEVICE_AND_API_INIT(can_mcp2515_1, DT_MICROCHIP_MCP2515_0_LABEL, &mcp2515_init,
|
||||
&mcp2515_data_1, &mcp2515_config_1, POST_KERNEL,
|
||||
CONFIG_CAN_MCP2515_INIT_PRIORITY, &can_api_funcs);
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
title: MCP2515 CAN
|
||||
id: mcp,mcp2515-can
|
||||
version: 0.1
|
||||
|
||||
description: >
|
||||
This binding gives a base representation of the MCP2515 SPI CAN controller
|
||||
|
||||
inherits:
|
||||
!include can.yaml
|
||||
!include spi-device.yaml
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
type: string
|
||||
category: required
|
||||
description: compatible strings
|
||||
constraint: "mcp,mcp2515"
|
||||
|
||||
...
|
26
dts/bindings/can/microchip,mcp2515.yaml
Normal file
26
dts/bindings/can/microchip,mcp2515.yaml
Normal file
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Copyright (c) 2019 Karsten Koenig
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
---
|
||||
title: MCP2515 CAN
|
||||
version: 0.1
|
||||
|
||||
description: >
|
||||
This binding gives a base representation of the MCP2515 SPI CAN controller
|
||||
|
||||
inherits:
|
||||
!include [can.yaml, spi-device.yaml]
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
type: string
|
||||
category: required
|
||||
description: compatible strings
|
||||
constraint: "microchip,mcp2515"
|
||||
int-gpios:
|
||||
type: compound
|
||||
category: required
|
||||
generation: define, use-prop-name
|
||||
...
|
Loading…
Add table
Add a link
Reference in a new issue