Lines Matching +full:device +full:- +full:id
4 * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/device.h>
15 #define NXP_RSTCTL_OFFSET(id) ((id >> 16) * sizeof(uint32_t)) argument
16 #define NXP_RSTCTL_BIT(id) (BIT(id & 0xFFFF)) argument
17 #define NXP_RSTCTL_CTL(id) (NXP_RSTCTL_OFFSET(id) + 0x10) argument
18 #define NXP_RSTCTL_SET(id) (NXP_RSTCTL_OFFSET(id) + 0x40) argument
19 #define NXP_RSTCTL_CLR(id) (NXP_RSTCTL_OFFSET(id) + 0x70) argument
21 static int reset_nxp_rstctl_status(const struct device *dev, uint32_t id, uint8_t *status) in reset_nxp_rstctl_status() argument
23 const uint32_t *base = dev->config; in reset_nxp_rstctl_status()
24 volatile const uint32_t *ctl_reg = base+(NXP_RSTCTL_CTL(id)/sizeof(uint32_t)); in reset_nxp_rstctl_status()
27 *status = (uint8_t)FIELD_GET(NXP_RSTCTL_BIT(id), val); in reset_nxp_rstctl_status()
32 static int reset_nxp_rstctl_line_assert(const struct device *dev, uint32_t id) in reset_nxp_rstctl_line_assert() argument
34 const uint32_t *base = dev->config; in reset_nxp_rstctl_line_assert()
35 volatile uint32_t *set_reg = (uint32_t *)base+(NXP_RSTCTL_SET(id)/sizeof(uint32_t)); in reset_nxp_rstctl_line_assert()
37 *set_reg = FIELD_PREP(NXP_RSTCTL_BIT(id), 0b1); in reset_nxp_rstctl_line_assert()
42 static int reset_nxp_rstctl_line_deassert(const struct device *dev, uint32_t id) in reset_nxp_rstctl_line_deassert() argument
44 const uint32_t *base = dev->config; in reset_nxp_rstctl_line_deassert()
45 volatile uint32_t *clr_reg = (uint32_t *)base+(NXP_RSTCTL_CLR(id)/sizeof(uint32_t)); in reset_nxp_rstctl_line_deassert()
47 *clr_reg = FIELD_PREP(NXP_RSTCTL_BIT(id), 0b1); in reset_nxp_rstctl_line_deassert()
52 static int reset_nxp_rstctl_line_toggle(const struct device *dev, uint32_t id) in reset_nxp_rstctl_line_toggle() argument
56 reset_nxp_rstctl_line_assert(dev, id); in reset_nxp_rstctl_line_toggle()
59 reset_nxp_rstctl_status(dev, id, &status); in reset_nxp_rstctl_line_toggle()
62 reset_nxp_rstctl_line_deassert(dev, id); in reset_nxp_rstctl_line_toggle()