Lines Matching refs:iproc_i2c

220 static void bcm_iproc_i2c_enable_disable(struct bcm_iproc_i2c_dev *iproc_i2c,
223 static inline u32 iproc_i2c_rd_reg(struct bcm_iproc_i2c_dev *iproc_i2c, in iproc_i2c_rd_reg() argument
228 if (iproc_i2c->idm_base) { in iproc_i2c_rd_reg()
229 spin_lock(&iproc_i2c->idm_lock); in iproc_i2c_rd_reg()
230 writel(iproc_i2c->ape_addr_mask, in iproc_i2c_rd_reg()
231 iproc_i2c->idm_base + IDM_CTRL_DIRECT_OFFSET); in iproc_i2c_rd_reg()
232 val = readl(iproc_i2c->base + offset); in iproc_i2c_rd_reg()
233 spin_unlock(&iproc_i2c->idm_lock); in iproc_i2c_rd_reg()
235 val = readl(iproc_i2c->base + offset); in iproc_i2c_rd_reg()
241 static inline void iproc_i2c_wr_reg(struct bcm_iproc_i2c_dev *iproc_i2c, in iproc_i2c_wr_reg() argument
244 if (iproc_i2c->idm_base) { in iproc_i2c_wr_reg()
245 spin_lock(&iproc_i2c->idm_lock); in iproc_i2c_wr_reg()
246 writel(iproc_i2c->ape_addr_mask, in iproc_i2c_wr_reg()
247 iproc_i2c->idm_base + IDM_CTRL_DIRECT_OFFSET); in iproc_i2c_wr_reg()
248 writel(val, iproc_i2c->base + offset); in iproc_i2c_wr_reg()
249 spin_unlock(&iproc_i2c->idm_lock); in iproc_i2c_wr_reg()
251 writel(val, iproc_i2c->base + offset); in iproc_i2c_wr_reg()
256 struct bcm_iproc_i2c_dev *iproc_i2c, bool need_reset) in bcm_iproc_i2c_slave_init() argument
262 val = iproc_i2c_rd_reg(iproc_i2c, CFG_OFFSET); in bcm_iproc_i2c_slave_init()
264 iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); in bcm_iproc_i2c_slave_init()
271 iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); in bcm_iproc_i2c_slave_init()
276 iproc_i2c_wr_reg(iproc_i2c, S_FIFO_CTRL_OFFSET, val); in bcm_iproc_i2c_slave_init()
279 val = iproc_i2c_rd_reg(iproc_i2c, TIM_CFG_OFFSET); in bcm_iproc_i2c_slave_init()
282 iproc_i2c_wr_reg(iproc_i2c, TIM_CFG_OFFSET, val); in bcm_iproc_i2c_slave_init()
285 val = iproc_i2c_rd_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET); in bcm_iproc_i2c_slave_init()
288 val |= (iproc_i2c->slave->addr << S_CFG_NIC_SMB_ADDR3_SHIFT); in bcm_iproc_i2c_slave_init()
289 iproc_i2c_wr_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET, val); in bcm_iproc_i2c_slave_init()
292 iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, ISR_MASK_SLAVE); in bcm_iproc_i2c_slave_init()
298 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); in bcm_iproc_i2c_slave_init()
302 struct bcm_iproc_i2c_dev *iproc_i2c) in bcm_iproc_i2c_check_slave_status() argument
306 val = iproc_i2c_rd_reg(iproc_i2c, S_CMD_OFFSET); in bcm_iproc_i2c_check_slave_status()
313 dev_err(iproc_i2c->device, "slave random stretch time timeout\n"); in bcm_iproc_i2c_check_slave_status()
316 bcm_iproc_i2c_enable_disable(iproc_i2c, false); in bcm_iproc_i2c_check_slave_status()
317 bcm_iproc_i2c_slave_init(iproc_i2c, true); in bcm_iproc_i2c_check_slave_status()
318 bcm_iproc_i2c_enable_disable(iproc_i2c, true); in bcm_iproc_i2c_check_slave_status()
322 static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, in bcm_iproc_i2c_slave_isr() argument
330 val = iproc_i2c_rd_reg(iproc_i2c, S_RX_OFFSET); in bcm_iproc_i2c_slave_isr()
334 i2c_slave_event(iproc_i2c->slave, in bcm_iproc_i2c_slave_isr()
337 val = iproc_i2c_rd_reg(iproc_i2c, S_RX_OFFSET); in bcm_iproc_i2c_slave_isr()
339 i2c_slave_event(iproc_i2c->slave, in bcm_iproc_i2c_slave_isr()
343 i2c_slave_event(iproc_i2c->slave, in bcm_iproc_i2c_slave_isr()
345 iproc_i2c_wr_reg(iproc_i2c, S_TX_OFFSET, value); in bcm_iproc_i2c_slave_isr()
348 iproc_i2c_wr_reg(iproc_i2c, S_CMD_OFFSET, val); in bcm_iproc_i2c_slave_isr()
354 val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_slave_isr()
356 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); in bcm_iproc_i2c_slave_isr()
360 i2c_slave_event(iproc_i2c->slave, in bcm_iproc_i2c_slave_isr()
365 i2c_slave_event(iproc_i2c->slave, in bcm_iproc_i2c_slave_isr()
368 iproc_i2c_wr_reg(iproc_i2c, S_TX_OFFSET, value); in bcm_iproc_i2c_slave_isr()
370 iproc_i2c_wr_reg(iproc_i2c, S_CMD_OFFSET, val); in bcm_iproc_i2c_slave_isr()
375 i2c_slave_event(iproc_i2c->slave, I2C_SLAVE_STOP, &value); in bcm_iproc_i2c_slave_isr()
380 val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_slave_isr()
382 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); in bcm_iproc_i2c_slave_isr()
386 iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, status); in bcm_iproc_i2c_slave_isr()
388 bcm_iproc_i2c_check_slave_status(iproc_i2c); in bcm_iproc_i2c_slave_isr()
392 static void bcm_iproc_i2c_read_valid_bytes(struct bcm_iproc_i2c_dev *iproc_i2c) in bcm_iproc_i2c_read_valid_bytes() argument
394 struct i2c_msg *msg = iproc_i2c->msg; in bcm_iproc_i2c_read_valid_bytes()
398 while (iproc_i2c->rx_bytes < msg->len) { in bcm_iproc_i2c_read_valid_bytes()
399 val = iproc_i2c_rd_reg(iproc_i2c, M_RX_OFFSET); in bcm_iproc_i2c_read_valid_bytes()
405 msg->buf[iproc_i2c->rx_bytes] = in bcm_iproc_i2c_read_valid_bytes()
407 iproc_i2c->rx_bytes++; in bcm_iproc_i2c_read_valid_bytes()
411 static void bcm_iproc_i2c_send(struct bcm_iproc_i2c_dev *iproc_i2c) in bcm_iproc_i2c_send() argument
413 struct i2c_msg *msg = iproc_i2c->msg; in bcm_iproc_i2c_send()
414 unsigned int tx_bytes = msg->len - iproc_i2c->tx_bytes; in bcm_iproc_i2c_send()
422 unsigned int idx = iproc_i2c->tx_bytes + i; in bcm_iproc_i2c_send()
430 if (iproc_i2c->irq) { in bcm_iproc_i2c_send()
437 tmp = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_send()
439 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, in bcm_iproc_i2c_send()
445 iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val); in bcm_iproc_i2c_send()
449 iproc_i2c->tx_bytes += tx_bytes; in bcm_iproc_i2c_send()
452 static void bcm_iproc_i2c_read(struct bcm_iproc_i2c_dev *iproc_i2c) in bcm_iproc_i2c_read() argument
454 struct i2c_msg *msg = iproc_i2c->msg; in bcm_iproc_i2c_read()
457 bcm_iproc_i2c_read_valid_bytes(iproc_i2c); in bcm_iproc_i2c_read()
458 bytes_left = msg->len - iproc_i2c->rx_bytes; in bcm_iproc_i2c_read()
460 if (iproc_i2c->irq) { in bcm_iproc_i2c_read()
462 val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_read()
464 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); in bcm_iproc_i2c_read()
466 } else if (bytes_left < iproc_i2c->thld_bytes) { in bcm_iproc_i2c_read()
468 val = iproc_i2c_rd_reg(iproc_i2c, M_FIFO_CTRL_OFFSET); in bcm_iproc_i2c_read()
471 iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val); in bcm_iproc_i2c_read()
472 iproc_i2c->thld_bytes = bytes_left; in bcm_iproc_i2c_read()
481 static void bcm_iproc_i2c_process_m_event(struct bcm_iproc_i2c_dev *iproc_i2c, in bcm_iproc_i2c_process_m_event() argument
486 bcm_iproc_i2c_send(iproc_i2c); in bcm_iproc_i2c_process_m_event()
490 bcm_iproc_i2c_read(iproc_i2c); in bcm_iproc_i2c_process_m_event()
494 iproc_i2c->xfer_is_done = 1; in bcm_iproc_i2c_process_m_event()
495 if (iproc_i2c->irq) in bcm_iproc_i2c_process_m_event()
496 complete(&iproc_i2c->done); in bcm_iproc_i2c_process_m_event()
502 struct bcm_iproc_i2c_dev *iproc_i2c = data; in bcm_iproc_i2c_isr() local
503 u32 status = iproc_i2c_rd_reg(iproc_i2c, IS_OFFSET); in bcm_iproc_i2c_isr()
508 ret = bcm_iproc_i2c_slave_isr(iproc_i2c, sl_status); in bcm_iproc_i2c_isr()
520 bcm_iproc_i2c_process_m_event(iproc_i2c, status); in bcm_iproc_i2c_isr()
521 iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, status); in bcm_iproc_i2c_isr()
526 static int bcm_iproc_i2c_init(struct bcm_iproc_i2c_dev *iproc_i2c) in bcm_iproc_i2c_init() argument
531 val = iproc_i2c_rd_reg(iproc_i2c, CFG_OFFSET); in bcm_iproc_i2c_init()
534 iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); in bcm_iproc_i2c_init()
541 iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); in bcm_iproc_i2c_init()
545 iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val); in bcm_iproc_i2c_init()
547 val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_init()
550 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); in bcm_iproc_i2c_init()
553 iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, 0xffffffff); in bcm_iproc_i2c_init()
558 static void bcm_iproc_i2c_enable_disable(struct bcm_iproc_i2c_dev *iproc_i2c, in bcm_iproc_i2c_enable_disable() argument
563 val = iproc_i2c_rd_reg(iproc_i2c, CFG_OFFSET); in bcm_iproc_i2c_enable_disable()
568 iproc_i2c_wr_reg(iproc_i2c, CFG_OFFSET, val); in bcm_iproc_i2c_enable_disable()
571 static int bcm_iproc_i2c_check_status(struct bcm_iproc_i2c_dev *iproc_i2c, in bcm_iproc_i2c_check_status() argument
576 val = iproc_i2c_rd_reg(iproc_i2c, M_CMD_OFFSET); in bcm_iproc_i2c_check_status()
584 dev_dbg(iproc_i2c->device, "lost bus arbitration\n"); in bcm_iproc_i2c_check_status()
588 dev_dbg(iproc_i2c->device, "NAK addr:0x%02x\n", msg->addr); in bcm_iproc_i2c_check_status()
592 dev_dbg(iproc_i2c->device, "NAK data\n"); in bcm_iproc_i2c_check_status()
596 dev_dbg(iproc_i2c->device, "bus timeout\n"); in bcm_iproc_i2c_check_status()
600 dev_dbg(iproc_i2c->device, "FIFO under-run\n"); in bcm_iproc_i2c_check_status()
604 dev_dbg(iproc_i2c->device, "RX FIFO full\n"); in bcm_iproc_i2c_check_status()
608 dev_dbg(iproc_i2c->device, "unknown error code=%d\n", val); in bcm_iproc_i2c_check_status()
611 bcm_iproc_i2c_enable_disable(iproc_i2c, false); in bcm_iproc_i2c_check_status()
612 bcm_iproc_i2c_init(iproc_i2c); in bcm_iproc_i2c_check_status()
613 bcm_iproc_i2c_enable_disable(iproc_i2c, true); in bcm_iproc_i2c_check_status()
619 static int bcm_iproc_i2c_xfer_wait(struct bcm_iproc_i2c_dev *iproc_i2c, in bcm_iproc_i2c_xfer_wait() argument
627 iproc_i2c_wr_reg(iproc_i2c, M_CMD_OFFSET, cmd); in bcm_iproc_i2c_xfer_wait()
629 if (iproc_i2c->irq) { in bcm_iproc_i2c_xfer_wait()
630 time_left = wait_for_completion_timeout(&iproc_i2c->done, in bcm_iproc_i2c_xfer_wait()
633 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, 0); in bcm_iproc_i2c_xfer_wait()
635 iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_xfer_wait()
637 synchronize_irq(iproc_i2c->irq); in bcm_iproc_i2c_xfer_wait()
643 status = iproc_i2c_rd_reg(iproc_i2c, in bcm_iproc_i2c_xfer_wait()
645 bcm_iproc_i2c_process_m_event(iproc_i2c, status); in bcm_iproc_i2c_xfer_wait()
646 iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, status); in bcm_iproc_i2c_xfer_wait()
655 } while (!iproc_i2c->xfer_is_done); in bcm_iproc_i2c_xfer_wait()
658 if (!time_left && !iproc_i2c->xfer_is_done) { in bcm_iproc_i2c_xfer_wait()
659 dev_err(iproc_i2c->device, "transaction timed out\n"); in bcm_iproc_i2c_xfer_wait()
663 iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val); in bcm_iproc_i2c_xfer_wait()
667 ret = bcm_iproc_i2c_check_status(iproc_i2c, msg); in bcm_iproc_i2c_xfer_wait()
671 iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val); in bcm_iproc_i2c_xfer_wait()
678 static int bcm_iproc_i2c_xfer_single_msg(struct bcm_iproc_i2c_dev *iproc_i2c, in bcm_iproc_i2c_xfer_single_msg() argument
687 if (!!(iproc_i2c_rd_reg(iproc_i2c, in bcm_iproc_i2c_xfer_single_msg()
689 dev_warn(iproc_i2c->device, "bus is busy\n"); in bcm_iproc_i2c_xfer_single_msg()
693 iproc_i2c->msg = msg; in bcm_iproc_i2c_xfer_single_msg()
697 iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, addr); in bcm_iproc_i2c_xfer_single_msg()
713 iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val); in bcm_iproc_i2c_xfer_single_msg()
715 iproc_i2c->tx_bytes = tx_bytes; in bcm_iproc_i2c_xfer_single_msg()
719 if (iproc_i2c->irq) in bcm_iproc_i2c_xfer_single_msg()
720 reinit_completion(&iproc_i2c->done); in bcm_iproc_i2c_xfer_single_msg()
722 iproc_i2c->xfer_is_done = 0; in bcm_iproc_i2c_xfer_single_msg()
737 msg->len > iproc_i2c->tx_bytes) in bcm_iproc_i2c_xfer_single_msg()
746 iproc_i2c->rx_bytes = 0; in bcm_iproc_i2c_xfer_single_msg()
748 iproc_i2c->thld_bytes = M_RX_FIFO_THLD_VALUE; in bcm_iproc_i2c_xfer_single_msg()
750 iproc_i2c->thld_bytes = msg->len; in bcm_iproc_i2c_xfer_single_msg()
753 tmp = iproc_i2c_rd_reg(iproc_i2c, M_FIFO_CTRL_OFFSET); in bcm_iproc_i2c_xfer_single_msg()
755 tmp |= iproc_i2c->thld_bytes << M_FIFO_RX_THLD_SHIFT; in bcm_iproc_i2c_xfer_single_msg()
756 iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, tmp); in bcm_iproc_i2c_xfer_single_msg()
767 if (iproc_i2c->irq) in bcm_iproc_i2c_xfer_single_msg()
768 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val_intr_en); in bcm_iproc_i2c_xfer_single_msg()
770 return bcm_iproc_i2c_xfer_wait(iproc_i2c, msg, val); in bcm_iproc_i2c_xfer_single_msg()
776 struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(adapter); in bcm_iproc_i2c_xfer() local
781 ret = bcm_iproc_i2c_xfer_single_msg(iproc_i2c, &msgs[i]); in bcm_iproc_i2c_xfer()
783 dev_dbg(iproc_i2c->device, "xfer failed\n"); in bcm_iproc_i2c_xfer()
815 static int bcm_iproc_i2c_cfg_speed(struct bcm_iproc_i2c_dev *iproc_i2c) in bcm_iproc_i2c_cfg_speed() argument
819 int ret = of_property_read_u32(iproc_i2c->device->of_node, in bcm_iproc_i2c_cfg_speed()
822 dev_info(iproc_i2c->device, in bcm_iproc_i2c_cfg_speed()
828 dev_err(iproc_i2c->device, "%d Hz bus speed not supported\n", in bcm_iproc_i2c_cfg_speed()
830 dev_err(iproc_i2c->device, in bcm_iproc_i2c_cfg_speed()
839 iproc_i2c->bus_speed = bus_speed; in bcm_iproc_i2c_cfg_speed()
840 val = iproc_i2c_rd_reg(iproc_i2c, TIM_CFG_OFFSET); in bcm_iproc_i2c_cfg_speed()
843 iproc_i2c_wr_reg(iproc_i2c, TIM_CFG_OFFSET, val); in bcm_iproc_i2c_cfg_speed()
845 dev_info(iproc_i2c->device, "bus set to %u Hz\n", bus_speed); in bcm_iproc_i2c_cfg_speed()
853 struct bcm_iproc_i2c_dev *iproc_i2c; in bcm_iproc_i2c_probe() local
857 iproc_i2c = devm_kzalloc(&pdev->dev, sizeof(*iproc_i2c), in bcm_iproc_i2c_probe()
859 if (!iproc_i2c) in bcm_iproc_i2c_probe()
862 platform_set_drvdata(pdev, iproc_i2c); in bcm_iproc_i2c_probe()
863 iproc_i2c->device = &pdev->dev; in bcm_iproc_i2c_probe()
864 iproc_i2c->type = in bcm_iproc_i2c_probe()
866 init_completion(&iproc_i2c->done); in bcm_iproc_i2c_probe()
869 iproc_i2c->base = devm_ioremap_resource(iproc_i2c->device, res); in bcm_iproc_i2c_probe()
870 if (IS_ERR(iproc_i2c->base)) in bcm_iproc_i2c_probe()
871 return PTR_ERR(iproc_i2c->base); in bcm_iproc_i2c_probe()
873 if (iproc_i2c->type == IPROC_I2C_NIC) { in bcm_iproc_i2c_probe()
875 iproc_i2c->idm_base = devm_ioremap_resource(iproc_i2c->device, in bcm_iproc_i2c_probe()
877 if (IS_ERR(iproc_i2c->idm_base)) in bcm_iproc_i2c_probe()
878 return PTR_ERR(iproc_i2c->idm_base); in bcm_iproc_i2c_probe()
880 ret = of_property_read_u32(iproc_i2c->device->of_node, in bcm_iproc_i2c_probe()
882 &iproc_i2c->ape_addr_mask); in bcm_iproc_i2c_probe()
884 dev_err(iproc_i2c->device, in bcm_iproc_i2c_probe()
889 spin_lock_init(&iproc_i2c->idm_lock); in bcm_iproc_i2c_probe()
896 ret = bcm_iproc_i2c_init(iproc_i2c); in bcm_iproc_i2c_probe()
900 ret = bcm_iproc_i2c_cfg_speed(iproc_i2c); in bcm_iproc_i2c_probe()
906 ret = devm_request_irq(iproc_i2c->device, irq, in bcm_iproc_i2c_probe()
908 iproc_i2c); in bcm_iproc_i2c_probe()
910 dev_err(iproc_i2c->device, in bcm_iproc_i2c_probe()
915 iproc_i2c->irq = irq; in bcm_iproc_i2c_probe()
917 dev_warn(iproc_i2c->device, in bcm_iproc_i2c_probe()
921 bcm_iproc_i2c_enable_disable(iproc_i2c, true); in bcm_iproc_i2c_probe()
923 adap = &iproc_i2c->adapter; in bcm_iproc_i2c_probe()
924 i2c_set_adapdata(adap, iproc_i2c); in bcm_iproc_i2c_probe()
927 of_node_full_name(iproc_i2c->device->of_node)); in bcm_iproc_i2c_probe()
938 struct bcm_iproc_i2c_dev *iproc_i2c = platform_get_drvdata(pdev); in bcm_iproc_i2c_remove() local
940 if (iproc_i2c->irq) { in bcm_iproc_i2c_remove()
945 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, 0); in bcm_iproc_i2c_remove()
946 iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_remove()
947 synchronize_irq(iproc_i2c->irq); in bcm_iproc_i2c_remove()
950 i2c_del_adapter(&iproc_i2c->adapter); in bcm_iproc_i2c_remove()
951 bcm_iproc_i2c_enable_disable(iproc_i2c, false); in bcm_iproc_i2c_remove()
960 struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev); in bcm_iproc_i2c_suspend() local
962 if (iproc_i2c->irq) { in bcm_iproc_i2c_suspend()
967 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, 0); in bcm_iproc_i2c_suspend()
968 iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_suspend()
969 synchronize_irq(iproc_i2c->irq); in bcm_iproc_i2c_suspend()
973 bcm_iproc_i2c_enable_disable(iproc_i2c, false); in bcm_iproc_i2c_suspend()
980 struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev); in bcm_iproc_i2c_resume() local
988 ret = bcm_iproc_i2c_init(iproc_i2c); in bcm_iproc_i2c_resume()
993 val = iproc_i2c_rd_reg(iproc_i2c, TIM_CFG_OFFSET); in bcm_iproc_i2c_resume()
995 val |= (iproc_i2c->bus_speed == 400000) << TIM_CFG_MODE_400_SHIFT; in bcm_iproc_i2c_resume()
996 iproc_i2c_wr_reg(iproc_i2c, TIM_CFG_OFFSET, val); in bcm_iproc_i2c_resume()
998 bcm_iproc_i2c_enable_disable(iproc_i2c, true); in bcm_iproc_i2c_resume()
1016 struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter); in bcm_iproc_i2c_reg_slave() local
1018 if (iproc_i2c->slave) in bcm_iproc_i2c_reg_slave()
1024 iproc_i2c->slave = slave; in bcm_iproc_i2c_reg_slave()
1025 bcm_iproc_i2c_slave_init(iproc_i2c, false); in bcm_iproc_i2c_reg_slave()
1032 struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter); in bcm_iproc_i2c_unreg_slave() local
1034 if (!iproc_i2c->slave) in bcm_iproc_i2c_unreg_slave()
1037 iproc_i2c->slave = NULL; in bcm_iproc_i2c_unreg_slave()
1040 tmp = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); in bcm_iproc_i2c_unreg_slave()
1043 iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, tmp); in bcm_iproc_i2c_unreg_slave()
1046 tmp = iproc_i2c_rd_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET); in bcm_iproc_i2c_unreg_slave()
1048 iproc_i2c_wr_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET, tmp); in bcm_iproc_i2c_unreg_slave()