drivers: can: mcp2515: fix devicetree bindings

Adding required fields to the devicetree overlay of the CAN sample as
this is often used as a reference. Also use these fields instead of the
KConfig entries.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
This commit is contained in:
Karsten Koenig 2019-08-05 21:34:46 +02:00 committed by Ioannis Glaropoulos
commit 758c461252
4 changed files with 13 additions and 32 deletions

View file

@ -20,34 +20,6 @@ config CAN_MCP2515_OSC_FREQ
help
Specify the frequency of the oscillator connected to the MCP2515.
config CAN_PROP_SEG
int "Prop_Seg"
default 2
range 1 8
help
Time quanta of propagation segment (ISO 11898-1)
config CAN_PHASE_SEG1
int "Phase_Seg1"
default 7
range 1 8
help
Time quanta of phase buffer 1 segment (ISO 11898-1)
config CAN_PHASE_SEG2
int "Phase_Seg2"
default 6
range 2 8
help
Time quanta of phase buffer 2 segment (ISO 11898-1)
config CAN_SJW
int "SJW"
default 1
range 1 4
help
Resynchronization jump width (ISO 11898-1)
config CAN_MCP2515_INT_THREAD_STACK_SIZE
int "Stack size for interrupt handler"
default 512

View file

@ -618,10 +618,10 @@ static const struct mcp2515_config mcp2515_config_1 = {
.spi_cs_pin = DT_INST_0_MICROCHIP_MCP2515_CS_GPIOS_PIN,
.spi_cs_port = DT_INST_0_MICROCHIP_MCP2515_CS_GPIOS_CONTROLLER,
#endif /* DT_INST_0_MICROCHIP_MCP2515_CS_GPIOS_PIN */
.tq_sjw = CONFIG_CAN_SJW,
.tq_prop = CONFIG_CAN_PROP_SEG,
.tq_bs1 = CONFIG_CAN_PHASE_SEG1,
.tq_bs2 = CONFIG_CAN_PHASE_SEG2,
.tq_sjw = DT_INST_0_MICROCHIP_MCP2515_SJW,
.tq_prop = DT_INST_0_MICROCHIP_MCP2515_PROP_SEG,
.tq_bs1 = DT_INST_0_MICROCHIP_MCP2515_PHASE_SEG1,
.tq_bs2 = DT_INST_0_MICROCHIP_MCP2515_PHASE_SEG2,
.bus_speed = DT_INST_0_MICROCHIP_MCP2515_BUS_SPEED,
};

View file

@ -18,3 +18,6 @@ properties:
int-gpios:
type: compound
category: required
reg:
type: array
category: required

View file

@ -16,5 +16,11 @@
label = "CAN_1";
reg = <0>;
bus-speed = <250000>;
sjw = <1>;
prop-seg = <2>;
phase-seg1 = <7>;
phase-seg2 = <6>;
#address-cells = <1>;
#size-cells = <0>;
};
};