Skip to content

Commit

Permalink
drivers: can_mcp251xfd: Add XSTBY option
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Maškarinec <marek.maskarinec@hardwario.com>
  • Loading branch information
marekmaskarinec committed Jan 10, 2025
1 parent c7998cd commit 52fc80b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/can/can_mcp251xfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,12 @@ static inline int mcp251xfd_init_iocon_reg(const struct device *dev)
tmp |= MCP251XFD_REG_IOCON_SOF;
}

if (dev_cfg->xstby_enable) {
tmp &= ~MCP251XFD_REG_IOCON_TRIS0;
tmp &= ~MCP251XFD_REG_IOCON_PM0;
tmp |= MCP251XFD_REG_IOCON_XSTBYEN;
}

*reg = sys_cpu_to_le32(tmp);

return mcp251xfd_write(dev, MCP251XFD_REG_IOCON, MCP251XFD_REG_SIZE);
Expand Down Expand Up @@ -1749,6 +1755,7 @@ static const struct can_driver_api mcp251xfd_api_funcs = {
.int_gpio_dt = GPIO_DT_SPEC_INST_GET(inst, int_gpios), \
\
.sof_on_clko = DT_INST_PROP(inst, sof_on_clko), \
.xstby_enable = DT_INST_PROP(inst, xstby_enable), \
.clko_div = DT_INST_ENUM_IDX(inst, clko_div), \
.pll_enable = DT_INST_PROP(inst, pll_enable), \
.timestamp_prescaler = DT_INST_PROP(inst, timestamp_prescaler), \
Expand Down
1 change: 1 addition & 0 deletions drivers/can/can_mcp251xfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ struct mcp251xfd_config {

/* IO Config */
bool sof_on_clko;
bool xstby_enable;
bool pll_enable;
uint8_t clko_div;

Expand Down
4 changes: 4 additions & 0 deletions dts/bindings/can/microchip,mcp251xfd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ properties:
is not set, then an internal clock (typically 40MHz or 20MHz) will be
output on CLKO pin instead.
xstby-enable:
type: boolean
description: Enables standby pin control on GPIO0.

clko-div:
type: int
description: The factor to divide the system clock for CLKO pin.
Expand Down

0 comments on commit 52fc80b

Please sign in to comment.