Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
tle927x.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2026 Deere & Company
3 * SPDX-FileCopyrightText: Copyright (c) 2026 Linumiz
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
13
14#ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_TLE927X_H_
15#define ZEPHYR_INCLUDE_DRIVERS_MFD_TLE927X_H_
16
17#include <stdint.h>
18
19#include <zephyr/device.h>
20#include <zephyr/sys/util.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
31
36#define TLE927X_REG_MS_CTRL 0x01U
37#define TLE927X_REG_HW_CTRL 0x02U
38#define TLE927X_REG_WD_CTRL 0x03U
39#define TLE927X_REG_BUS_CTRL_1 0x04U
40#define TLE927X_REG_BUS_CTRL_2 0x05U
41#define TLE927X_REG_WK_CTRL_1 0x06U
42#define TLE927X_REG_WK_CTRL_2 0x07U
44
49#define TLE927X_REG_SUP_STAT 0x41U
50#define TLE927X_REG_THERM_STAT 0x42U
51#define TLE927X_REG_DEV_STAT 0x43U
52#define TLE927X_REG_BUS_STAT_1 0x44U
53#define TLE927X_REG_BUS_STAT_2 0x45U
54#define TLE927X_REG_WK_STAT_1 0x46U
55#define TLE927X_REG_WK_STAT_2 0x47U
56#define TLE927X_REG_SMPS_STAT 0x4CU
58
63#define TLE927X_MS_CTRL_MODE_MASK GENMASK(7, 6)
64#define TLE927X_MS_CTRL_VCC2_ON_MASK GENMASK(4, 3)
65#define TLE927X_MS_CTRL_VCC1_OV_RST_MASK BIT(2)
66#define TLE927X_MS_CTRL_VCC1_RT_MASK GENMASK(1, 0)
68
73#define TLE927X_VCC2_ON_OFF 0x0U
74#define TLE927X_VCC2_ON_NORMAL 0x1U
75#define TLE927X_VCC2_ON_NORMAL_STOP 0x2U
76#define TLE927X_VCC2_ON_ALL_MODES 0x3U
78
83#define TLE927X_VCC1_RT_VRT1 0x0U
84#define TLE927X_VCC1_RT_VRT2 0x1U
85#define TLE927X_VCC1_RT_VRT3 0x2U
86#define TLE927X_VCC1_RT_DISABLED 0x3U
88
93#define TLE927X_HW_CTRL_FSI_FO2_MASK BIT(7)
94#define TLE927X_HW_CTRL_FO_ON BIT(5)
96
101#define TLE927X_WD_CTRL_CHECKSUM BIT(7)
102#define TLE927X_WD_CTRL_WD_STM_EN_0 BIT(6)
103#define TLE927X_WD_CTRL_WD_WIN BIT(5)
104#define TLE927X_WD_CTRL_WD_EN_WK_BUS BIT(4)
105#define TLE927X_WD_CTRL_MAX_3_RST BIT(3)
106#define TLE927X_WD_CTRL_WD_TIMER GENMASK(2, 0)
108
113#define TLE927X_BUS_CTRL_1_LIN1 GENMASK(4, 3)
114#define TLE927X_BUS_CTRL_1_CAN_MASK GENMASK(1, 0)
116
121#define TLE927X_CAN_OFF 0x0U
122#define TLE927X_CAN_WAKE_CAPABLE 0x1U
123#define TLE927X_CAN_RECEIVE_ONLY 0x2U
124#define TLE927X_CAN_NORMAL 0x3U
126
131#define TLE927X_WK_CTRL_2_WK_EN BIT(0)
133
138#define TLE927X_SUP_STAT_POR BIT(7)
139#define TLE927X_SUP_STAT_VLIN_UV BIT(6)
140#define TLE927X_SUP_STAT_VCC1_OV BIT(5)
141#define TLE927X_SUP_STAT_VCC2_OT BIT(4)
142#define TLE927X_SUP_STAT_VCC2_UV BIT(3)
143#define TLE927X_SUP_STAT_VCC1_SC BIT(2)
144#define TLE927X_SUP_STAT_VCC1_UV BIT(0)
146
151#define TLE927X_THERM_STAT_TSD2 BIT(2)
152#define TLE927X_THERM_STAT_TSD1 BIT(1)
153#define TLE927X_THERM_STAT_TPW BIT(0)
155
160#define TLE927X_DEV_STAT_PREV GENMASK(7, 6)
161#define TLE927X_DEV_STAT_RO_CL_HIGH BIT(5)
162#define TLE927X_DEV_STAT_FSI_FAIL BIT(4)
163#define TLE927X_DEV_STAT_WD_FAIL GENMASK(3, 2)
164#define TLE927X_DEV_STAT_SPI_FAIL BIT(1)
165#define TLE927X_DEV_STAT_FO_ON_STATE BIT(0)
167
172#define TLE927X_PREV_CLEARED 0x0U
173#define TLE927X_PREV_RESTART_FAILURE 0x1U
174#define TLE927X_PREV_WAKE_FROM_SLEEP 0x2U
176
181#define TLE927X_BUS_STAT_1_CAN_FAIL GENMASK(2, 1)
182#define TLE927X_BUS_STAT_1_VCAN_UV BIT(0)
184
189#define TLE927X_WK_STAT_1_PFM_PWM BIT(7)
190#define TLE927X_WK_STAT_1_CAN_WU BIT(5)
191#define TLE927X_WK_STAT_1_TIMER_WU BIT(4)
192#define TLE927X_WK_STAT_1_WK_WU BIT(0)
194
199#define TLE927X_WK_STAT_2_LIN2_WU BIT(1)
200#define TLE927X_WK_STAT_2_LIN1_WU BIT(0)
202
216
228int mfd_tle927x_read_reg(const struct device *dev, uint8_t reg, uint8_t *val);
229
247int mfd_tle927x_write_reg(const struct device *dev, uint8_t reg, uint8_t val);
248
262int mfd_tle927x_update_reg(const struct device *dev, uint8_t reg, uint8_t mask, uint8_t val);
263
279int mfd_tle927x_set_mode(const struct device *dev, enum tle927x_mode mode);
280
290int mfd_tle927x_get_mode(const struct device *dev, enum tle927x_mode *mode);
291
303int mfd_tle927x_read_faults(const struct device *dev, uint8_t *sup, uint8_t *therm,
304 uint8_t *dev_stat);
305
307
308#ifdef __cplusplus
309}
310#endif
311
312#endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_TLE927X_H_ */
APIs and macros for the Zephyr device model.
int mfd_tle927x_get_mode(const struct device *dev, enum tle927x_mode *mode)
Get the current SBC mode.
int mfd_tle927x_update_reg(const struct device *dev, uint8_t reg, uint8_t mask, uint8_t val)
Read-modify-write a TLE927x control register, atomically.
int mfd_tle927x_read_faults(const struct device *dev, uint8_t *sup, uint8_t *therm, uint8_t *dev_stat)
Read the global fault status, leaving the registers latched.
tle927x_mode
SBC operating modes selectable over SPI.
Definition tle927x.h:208
int mfd_tle927x_write_reg(const struct device *dev, uint8_t reg, uint8_t val)
Write a TLE927x register, writing a status register clears it.
int mfd_tle927x_set_mode(const struct device *dev, enum tle927x_mode mode)
Request an SBC mode transition.
int mfd_tle927x_read_reg(const struct device *dev, uint8_t reg, uint8_t *val)
Read a TLE927x register.
@ TLE927X_MODE_NORMAL
All functions available, watchdog running.
Definition tle927x.h:210
@ TLE927X_MODE_SLEEP
VCC1 off, wake through CAN, LIN or WK only.
Definition tle927x.h:212
@ TLE927X_MODE_STOP
VCC1 on, configuration frozen, restricted SPI command set.
Definition tle927x.h:214
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:543
Misc utilities.