Lines Matching +full:no +full:- +full:ether +full:- +full:link

26  *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
47 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
76 * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
86 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
107 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
125 #include "xgbe-common.h"
154 while (wait--) { in xgbe_i2c_abort()
161 return -EBUSY; in xgbe_i2c_abort()
169 while (wait--) { in xgbe_i2c_set_enable()
177 return -EBUSY; in xgbe_i2c_set_enable()
220 struct xgbe_i2c_op_state *state = &pdata->i2c.op_state; in xgbe_i2c_write()
225 tx_slots = pdata->i2c.tx_fifo_size - XI2C_IOREAD(pdata, IC_TXFLR); in xgbe_i2c_write()
226 while (tx_slots && state->tx_len) { in xgbe_i2c_write()
227 if (state->op->cmd == XGBE_I2C_CMD_READ) in xgbe_i2c_write()
230 cmd = *state->tx_buf++; in xgbe_i2c_write()
232 if (state->tx_len == 1) in xgbe_i2c_write()
237 tx_slots--; in xgbe_i2c_write()
238 state->tx_len--; in xgbe_i2c_write()
241 /* No more Tx operations, so ignore TX_EMPTY and return */ in xgbe_i2c_write()
242 if (!state->tx_len) in xgbe_i2c_write()
248 struct xgbe_i2c_op_state *state = &pdata->i2c.op_state; in xgbe_i2c_read()
252 if (state->op->cmd != XGBE_I2C_CMD_READ) in xgbe_i2c_read()
256 while (rx_slots && state->rx_len) { in xgbe_i2c_read()
257 *state->rx_buf++ = XI2C_IOREAD(pdata, IC_DATA_CMD); in xgbe_i2c_read()
258 state->rx_len--; in xgbe_i2c_read()
259 rx_slots--; in xgbe_i2c_read()
266 struct xgbe_i2c_op_state *state = &pdata->i2c.op_state; in xgbe_i2c_clear_isr_interrupts()
269 state->tx_abort_source = XI2C_IOREAD(pdata, IC_TX_ABRT_SOURCE); in xgbe_i2c_clear_isr_interrupts()
280 struct xgbe_i2c_op_state *state = &pdata->i2c.op_state; in xgbe_i2c_isr_task()
287 netif_dbg(pdata, intr, pdata->netdev, in xgbe_i2c_isr_task()
293 netif_dbg(pdata, link, pdata->netdev, in xgbe_i2c_isr_task()
295 state->tx_abort_source, state->op->target); in xgbe_i2c_isr_task()
299 state->ret = -EIO; in xgbe_i2c_isr_task()
311 if (state->ret || XI2C_GET_BITS(isr, IC_RAW_INTR_STAT, STOP_DET)) in xgbe_i2c_isr_task()
312 complete(&pdata->i2c_complete); in xgbe_i2c_isr_task()
316 if (pdata->vdata->irq_reissue_support) in xgbe_i2c_isr_task()
324 if (pdata->isr_as_tasklet) in xgbe_i2c_isr()
325 tasklet_schedule(&pdata->tasklet_i2c); in xgbe_i2c_isr()
327 xgbe_i2c_isr_task(&pdata->tasklet_i2c); in xgbe_i2c_isr()
347 struct xgbe_i2c *i2c = &pdata->i2c; in xgbe_i2c_get_features()
351 i2c->max_speed_mode = XI2C_GET_BITS(reg, IC_COMP_PARAM_1, in xgbe_i2c_get_features()
353 i2c->rx_fifo_size = XI2C_GET_BITS(reg, IC_COMP_PARAM_1, in xgbe_i2c_get_features()
355 i2c->tx_fifo_size = XI2C_GET_BITS(reg, IC_COMP_PARAM_1, in xgbe_i2c_get_features()
359 dev_dbg(pdata->dev, "I2C features: %s=%u, %s=%u, %s=%u\n", in xgbe_i2c_get_features()
360 "MAX_SPEED_MODE", i2c->max_speed_mode, in xgbe_i2c_get_features()
361 "RX_BUFFER_DEPTH", i2c->rx_fifo_size, in xgbe_i2c_get_features()
362 "TX_BUFFER_DEPTH", i2c->tx_fifo_size); in xgbe_i2c_get_features()
372 xgbe_i2c_isr_task(&pdata->tasklet_i2c); in xgbe_i2c_combined_isr()
379 struct xgbe_i2c_op_state *state = &pdata->i2c.op_state; in xgbe_i2c_xfer()
382 mutex_lock(&pdata->i2c_mutex); in xgbe_i2c_xfer()
384 reinit_completion(&pdata->i2c_complete); in xgbe_i2c_xfer()
388 netdev_err(pdata->netdev, "failed to disable i2c master\n"); in xgbe_i2c_xfer()
392 xgbe_i2c_set_target(pdata, op->target); in xgbe_i2c_xfer()
395 state->op = op; in xgbe_i2c_xfer()
396 state->tx_len = op->len; in xgbe_i2c_xfer()
397 state->tx_buf = op->buf; in xgbe_i2c_xfer()
398 state->rx_len = op->len; in xgbe_i2c_xfer()
399 state->rx_buf = op->buf; in xgbe_i2c_xfer()
404 netdev_err(pdata->netdev, "failed to enable i2c master\n"); in xgbe_i2c_xfer()
413 if (!wait_for_completion_timeout(&pdata->i2c_complete, HZ)) { in xgbe_i2c_xfer()
414 netdev_err(pdata->netdev, "i2c operation timed out\n"); in xgbe_i2c_xfer()
415 ret = -ETIMEDOUT; in xgbe_i2c_xfer()
419 ret = state->ret; in xgbe_i2c_xfer()
421 if (state->tx_abort_source & IC_TX_ABRT_7B_ADDR_NOACK) in xgbe_i2c_xfer()
422 ret = -ENOTCONN; in xgbe_i2c_xfer()
423 else if (state->tx_abort_source & IC_TX_ABRT_ARB_LOST) in xgbe_i2c_xfer()
424 ret = -EAGAIN; in xgbe_i2c_xfer()
432 mutex_unlock(&pdata->i2c_mutex); in xgbe_i2c_xfer()
439 if (!pdata->i2c.started) in xgbe_i2c_stop()
442 netif_dbg(pdata, link, pdata->netdev, "stopping I2C\n"); in xgbe_i2c_stop()
444 pdata->i2c.started = 0; in xgbe_i2c_stop()
450 if (pdata->dev_irq != pdata->i2c_irq) { in xgbe_i2c_stop()
451 devm_free_irq(pdata->dev, pdata->i2c_irq, pdata); in xgbe_i2c_stop()
452 tasklet_kill(&pdata->tasklet_i2c); in xgbe_i2c_stop()
460 if (pdata->i2c.started) in xgbe_i2c_start()
463 netif_dbg(pdata, link, pdata->netdev, "starting I2C\n"); in xgbe_i2c_start()
466 if (pdata->dev_irq != pdata->i2c_irq) { in xgbe_i2c_start()
467 tasklet_setup(&pdata->tasklet_i2c, xgbe_i2c_isr_task); in xgbe_i2c_start()
469 ret = devm_request_irq(pdata->dev, pdata->i2c_irq, in xgbe_i2c_start()
470 xgbe_i2c_isr, 0, pdata->i2c_name, in xgbe_i2c_start()
473 netdev_err(pdata->netdev, "i2c irq request failed\n"); in xgbe_i2c_start()
478 pdata->i2c.started = 1; in xgbe_i2c_start()
491 dev_err(pdata->dev, "failed to disable i2c master\n"); in xgbe_i2c_init()
506 i2c_if->i2c_init = xgbe_i2c_init; in xgbe_init_function_ptrs_i2c()
508 i2c_if->i2c_start = xgbe_i2c_start; in xgbe_init_function_ptrs_i2c()
509 i2c_if->i2c_stop = xgbe_i2c_stop; in xgbe_init_function_ptrs_i2c()
511 i2c_if->i2c_xfer = xgbe_i2c_xfer; in xgbe_init_function_ptrs_i2c()
513 i2c_if->i2c_isr = xgbe_i2c_combined_isr; in xgbe_init_function_ptrs_i2c()