Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: can_mcp251xfd: Add XSTBY option #86548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 DEVICE_API(can, 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
Loading