Lines Matching +full:bitrate +full:- +full:data
4 * SPDX-License-Identifier: Apache-2.0
28 * This driver is single-instance. If the devicetree contains multiple
34 /* The following constants describes the bitrate of it8xxx2 PECI,
41 /* The following masks are designed for the PECI bitrate settings,
103 uint32_t bitrate; member
121 reg_base->PADCTLR = (reg_base->PADCTLR & PECI_DVIE) | vol_opt; in peci_it8xxx2_init_vtts()
126 reg_base->HOSTAR = HOSTAR_RST_ANYBIT; in peci_it8xxx2_rst_status()
131 return (reg_base->HOSTAR & HOBY) ? (-EBUSY) : 0; in peci_it8xxx2_check_host_busy()
136 struct peci_it8xxx2_data *data = dev->data; in peci_it8xxx2_check_host_finish() local
137 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_check_host_finish()
139 (struct peci_it8xxx2_regs *)config->base_addr; in peci_it8xxx2_check_host_finish()
141 int ret = k_sem_take(&data->device_sync_sem, K_MSEC(PECI_TIMEOUT_MS)); in peci_it8xxx2_check_host_finish()
143 if (ret == -EAGAIN) { in peci_it8xxx2_check_host_finish()
145 return -ETIMEDOUT; in peci_it8xxx2_check_host_finish()
148 if (peci_regs->HOSTAR != FINISH) { in peci_it8xxx2_check_host_finish()
149 LOG_ERR("[PECI] Error: HOSTAR=0x%02X\r\n", peci_regs->HOSTAR); in peci_it8xxx2_check_host_finish()
150 return -EIO; in peci_it8xxx2_check_host_finish()
156 static int peci_it8xxx2_configure(const struct device *dev, uint32_t bitrate) in peci_it8xxx2_configure() argument
158 struct peci_it8xxx2_data *data = dev->data; in peci_it8xxx2_configure() local
159 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_configure()
161 (struct peci_it8xxx2_regs *)config->base_addr; in peci_it8xxx2_configure()
165 data->bitrate = bitrate; in peci_it8xxx2_configure()
168 (peci_regs->HOCTL2R) & (~(PECI_IT8XXX2_BITRATE_BITS_MASK)); in peci_it8xxx2_configure()
170 switch (bitrate) { in peci_it8xxx2_configure()
183 LOG_ERR("[PECI] Error: Specified Bitrate Not Supported\r\n"); in peci_it8xxx2_configure()
185 data->bitrate = PECI_IT8XXX2_BITRATE_1MHZ; in peci_it8xxx2_configure()
186 peci_regs->HOCTL2R = hoctl2r_to_write; in peci_it8xxx2_configure()
187 return -ENOTSUP; in peci_it8xxx2_configure()
190 peci_regs->HOCTL2R = hoctl2r_to_write; in peci_it8xxx2_configure()
197 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_enable()
199 (struct peci_it8xxx2_regs *)config->base_addr; in peci_it8xxx2_enable()
201 peci_regs->HOCTLR |= (FIFOCLR|FCSERR_ABT|PECIHEN|CONTROL); in peci_it8xxx2_enable()
208 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_disable()
210 (struct peci_it8xxx2_regs *)config->base_addr; in peci_it8xxx2_disable()
212 peci_regs->HOCTLR &= ~(PECIHEN); in peci_it8xxx2_disable()
218 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_rst_module()
220 (struct peci_it8xxx2_regs *)config->base_addr; in peci_it8xxx2_rst_module()
225 gctrl_regs->GCTRL_RSTC4 |= IT8XXX2_GCTRL_RPECI; in peci_it8xxx2_rst_module()
233 peci_regs->PADCTLR |= PECI_DVIE; in peci_it8xxx2_rst_module()
242 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_transfer()
244 (struct peci_it8xxx2_regs *)config->base_addr; in peci_it8xxx2_transfer()
246 struct peci_buf *peci_rx_buf = &msg->rx_buffer; in peci_it8xxx2_transfer()
247 struct peci_buf *peci_tx_buf = &msg->tx_buffer; in peci_it8xxx2_transfer()
253 if (!(peci_regs->HOCTLR & PECIHEN)) { in peci_it8xxx2_transfer()
255 return -ECONNREFUSED; in peci_it8xxx2_transfer()
259 return -EBUSY; in peci_it8xxx2_transfer()
262 peci_regs->HOTRADDR = msg->addr; in peci_it8xxx2_transfer()
263 peci_regs->HOWRLR = peci_tx_buf->len; in peci_it8xxx2_transfer()
264 peci_regs->HORDLR = peci_rx_buf->len; in peci_it8xxx2_transfer()
265 peci_regs->HOCMDR = msg->cmd_code; in peci_it8xxx2_transfer()
267 if (msg->cmd_code != PECI_CMD_PING) { in peci_it8xxx2_transfer()
268 for (cnt = 0; cnt < (peci_tx_buf->len - 1); cnt++) { in peci_it8xxx2_transfer()
269 peci_regs->HOWRDR = peci_tx_buf->buf[cnt]; in peci_it8xxx2_transfer()
274 irq_enable(config->irq_no); in peci_it8xxx2_transfer()
275 peci_regs->HOCTLR |= START; in peci_it8xxx2_transfer()
279 /* Host Transactions Finished, Fetch Data from the regs */ in peci_it8xxx2_transfer()
280 if (peci_rx_buf->len) { in peci_it8xxx2_transfer()
281 for (cnt = 0; cnt < (peci_rx_buf->len); cnt++) { in peci_it8xxx2_transfer()
282 peci_rx_buf->buf[cnt] = peci_regs->HORDDR; in peci_it8xxx2_transfer()
297 struct peci_it8xxx2_data *data = dev->data; in peci_it8xxx2_isr() local
298 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_isr()
300 irq_disable(config->irq_no); in peci_it8xxx2_isr()
301 k_sem_give(&data->device_sync_sem); in peci_it8xxx2_isr()
313 struct peci_it8xxx2_data *data = dev->data; in peci_it8xxx2_init() local
314 const struct peci_it8xxx2_config *config = dev->config; in peci_it8xxx2_init()
316 (struct peci_it8xxx2_regs *)config->base_addr; in peci_it8xxx2_init()
320 k_sem_init(&data->device_sync_sem, 0, 1); in peci_it8xxx2_init()
323 status = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); in peci_it8xxx2_init()
329 peci_regs->PADCTLR |= PECI_DVIE; in peci_it8xxx2_init()