Lines Matching refs:priv
62 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_read_hirq() local
94 priv->hirq = hirq; in max3421e_read_hirq()
172 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_hien_disable() local
174 priv->hien &= ~hint; in max3421e_hien_disable()
176 return max3421e_write_byte(dev, MAX3421E_REG_HIEN, priv->hien); in max3421e_hien_disable()
183 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_peraddr() local
186 if (priv->addr != addr) { in max3421e_peraddr()
194 priv->addr = addr; in max3421e_peraddr()
204 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_tgl_update() local
205 uint8_t ep_idx = MAX3421E_EP(priv->hxfr); in max3421e_tgl_update()
207 if (priv->hxfr & MAX3421E_OUTNIN) { in max3421e_tgl_update()
208 if (priv->hrsl & MAX3421E_SNDTOGRD) { in max3421e_tgl_update()
209 priv->tog_out |= BIT(ep_idx); in max3421e_tgl_update()
211 priv->tog_out &= ~BIT(ep_idx); in max3421e_tgl_update()
214 if (priv->hrsl & MAX3421E_RCVTOGRD) { in max3421e_tgl_update()
215 priv->tog_in |= BIT(ep_idx); in max3421e_tgl_update()
217 priv->tog_in &= ~BIT(ep_idx); in max3421e_tgl_update()
222 priv->tog_in, priv->tog_out, priv->hxfr, priv->hrsl); in max3421e_tgl_update()
229 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_tgl_next() local
235 priv->tog_in |= BIT(0); in max3421e_tgl_next()
236 priv->tog_out |= BIT(0); in max3421e_tgl_next()
240 hctl = (priv->tog_out & BIT(ep_idx)) ? MAX3421E_SNDTOG1 : in max3421e_tgl_next()
243 hctl = (priv->tog_in & BIT(ep_idx)) ? MAX3421E_RCVTOG1 : in max3421e_tgl_next()
253 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_hxfr_start() local
255 if (priv->hxfr != hxfr) { in max3421e_hxfr_start()
261 priv->hxfr = hxfr; in max3421e_hxfr_start()
268 return max3421e_write_byte(dev, MAX3421E_REG_HXFR, priv->hxfr); in max3421e_hxfr_start()
312 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_xfer_control() local
318 return max3421e_hxfr_start(dev, priv->hxfr); in max3421e_xfer_control()
361 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_xfer_bulk() local
366 return max3421e_hxfr_start(dev, priv->hxfr); in max3421e_xfer_bulk()
379 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_schedule_xfer() local
380 const uint8_t hirq = priv->hirq; in max3421e_schedule_xfer()
381 const uint8_t hrsl = priv->hrsl; in max3421e_schedule_xfer()
383 if (priv->last_xfer == NULL) { in max3421e_schedule_xfer()
386 priv->last_xfer = uhc_xfer_get_next(dev); in max3421e_schedule_xfer()
387 if (priv->last_xfer == NULL) { in max3421e_schedule_xfer()
392 LOG_DBG("Next transfer %p", priv->last_xfer); in max3421e_schedule_xfer()
393 ret = max3421e_peraddr(dev, priv->last_xfer->addr); in max3421e_schedule_xfer()
400 if (priv->last_xfer->timeout) { in max3421e_schedule_xfer()
401 priv->last_xfer->timeout--; in max3421e_schedule_xfer()
411 if (USB_EP_GET_IDX(priv->last_xfer->ep) == 0) { in max3421e_schedule_xfer()
412 return max3421e_xfer_control(dev, priv->last_xfer, hrsl); in max3421e_schedule_xfer()
415 return max3421e_xfer_bulk(dev, priv->last_xfer, hrsl); in max3421e_schedule_xfer()
420 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_xfer_drop_active() local
422 if (priv->last_xfer) { in max3421e_xfer_drop_active()
423 uhc_xfer_return(dev, priv->last_xfer, err); in max3421e_xfer_drop_active()
424 priv->last_xfer = NULL; in max3421e_xfer_drop_active()
430 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_hrslt_success() local
431 struct uhc_transfer *const xfer = priv->last_xfer; in max3421e_hrslt_success()
438 switch (MAX3421E_HXFR_TYPE(priv->hxfr)) { in max3421e_hrslt_success()
506 priv->last_xfer = NULL; in max3421e_hrslt_success()
518 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_handle_hxfrdn() local
519 struct uhc_transfer *const xfer = priv->last_xfer; in max3421e_handle_hxfrdn()
520 const uint8_t hrsl = priv->hrsl; in max3421e_handle_hxfrdn()
563 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_handle_condet() local
564 const uint8_t jk = priv->hrsl & MAX3421E_JKSTATUS_MASK; in max3421e_handle_condet()
592 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_bus_event() local
594 if (atomic_test_and_clear_bit(&priv->state, in max3421e_bus_event()
600 if (atomic_test_and_clear_bit(&priv->state, in max3421e_bus_event()
609 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_update_hrsl_hirq() local
612 err = max3421e_read_hirq(dev, MAX3421E_REG_HRSL, &priv->hrsl, 1, true); in max3421e_update_hrsl_hirq()
614 priv->hirq &= priv->hien | MAX3421E_RCVDAV; in max3421e_update_hrsl_hirq()
615 LOG_DBG("HIRQ 0x%02x HRSLT %d", priv->hirq, MAX3421E_HRSLT(priv->hrsl)); in max3421e_update_hrsl_hirq()
627 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_handle_bus_irq() local
628 const uint8_t hirq = priv->hirq; in max3421e_handle_bus_irq()
661 struct max3421e_data *priv = uhc_get_private(dev); in uhc_max3421e_thread() local
669 k_sem_take(&priv->irq_sem, K_FOREVER); in uhc_max3421e_thread()
683 if (priv->hirq & MAX3421E_HXFRDN) { in uhc_max3421e_thread()
689 if (priv->hirq & MAX3421E_FRAME) { in uhc_max3421e_thread()
690 schedule = HRSLT_IS_BUSY(priv->hrsl) ? false : true; in uhc_max3421e_thread()
694 if (priv->hirq & ~(MAX3421E_FRAME | MAX3421E_HXFRDN)) { in uhc_max3421e_thread()
702 err = max3421e_clear_hirq(dev, priv->hirq); in uhc_max3421e_thread()
722 struct max3421e_data *priv = in max3421e_gpio_cb() local
725 k_sem_give(&priv->irq_sem); in max3421e_gpio_cb()
731 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_sof_enable() local
733 if (priv->mode & MAX3421E_SOFKAENAB) { in max3421e_sof_enable()
737 priv->mode |= MAX3421E_SOFKAENAB; in max3421e_sof_enable()
739 return max3421e_write_byte(dev, MAX3421E_REG_MODE, priv->mode); in max3421e_sof_enable()
745 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_bus_suspend() local
747 if (!(priv->mode & MAX3421E_SOFKAENAB)) { in max3421e_bus_suspend()
751 priv->hien |= MAX3421E_SUSDN; in max3421e_bus_suspend()
752 priv->mode &= ~MAX3421E_SOFKAENAB; in max3421e_bus_suspend()
754 uint8_t tmp[3] = {MAX3421E_SUSDN, priv->hien, priv->mode}; in max3421e_bus_suspend()
762 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_bus_reset() local
765 if (atomic_test_bit(&priv->state, MAX3421E_STATE_BUS_RESUME)) { in max3421e_bus_reset()
770 atomic_set_bit(&priv->state, MAX3421E_STATE_BUS_RESET); in max3421e_bus_reset()
778 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_bus_resume() local
781 if (atomic_test_bit(&priv->state, MAX3421E_STATE_BUS_RESET)) { in max3421e_bus_resume()
786 atomic_set_bit(&priv->state, MAX3421E_STATE_BUS_RESUME); in max3421e_bus_resume()
877 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_mode_setup() local
897 priv->mode = mode; in max3421e_mode_setup()
908 struct max3421e_data *priv = uhc_get_private(dev); in max3421e_hien_setup() local
928 priv->hien = hien; in max3421e_hien_setup()
961 struct max3421e_data *priv = uhc_get_private(dev); in uhc_max3421e_init() local
1002 rev, priv->mode, priv->hien); in uhc_max3421e_init()
1004 priv->addr = 0; in uhc_max3421e_init()
1032 struct max3421e_data *priv = data->priv; in max3421e_driver_init() local
1067 gpio_init_callback(&priv->gpio_cb, max3421e_gpio_cb, in max3421e_driver_init()
1069 ret = gpio_add_callback(config->dt_int.port, &priv->gpio_cb); in max3421e_driver_init()
1115 .priv = &max3421e_data,