Lines Matching +full:precondition +full:- +full:timeout

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2012-2017 ASPEED Technology Inc.
163 /* Multi-master */
179 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_recover_bus()
180 command = readl(bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_recover_bus()
186 dev_dbg(bus->dev, "SCL hung (state %x), attempting recovery\n", in aspeed_i2c_recover_bus()
189 reinit_completion(&bus->cmd_complete); in aspeed_i2c_recover_bus()
190 writel(ASPEED_I2CD_M_STOP_CMD, bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_recover_bus()
191 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_recover_bus()
194 &bus->cmd_complete, bus->adap.timeout); in aspeed_i2c_recover_bus()
196 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_recover_bus()
199 else if (bus->cmd_err) in aspeed_i2c_recover_bus()
202 else if (!(readl(bus->base + ASPEED_I2C_CMD_REG) & in aspeed_i2c_recover_bus()
207 dev_dbg(bus->dev, "SDA hung (state %x), attempting recovery\n", in aspeed_i2c_recover_bus()
210 reinit_completion(&bus->cmd_complete); in aspeed_i2c_recover_bus()
213 bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_recover_bus()
214 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_recover_bus()
217 &bus->cmd_complete, bus->adap.timeout); in aspeed_i2c_recover_bus()
219 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_recover_bus()
222 else if (bus->cmd_err) in aspeed_i2c_recover_bus()
225 else if (!(readl(bus->base + ASPEED_I2C_CMD_REG) & in aspeed_i2c_recover_bus()
231 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_recover_bus()
236 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_recover_bus()
245 struct i2c_client *slave = bus->slave; in aspeed_i2c_slave_irq()
252 command = readl(bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_slave_irq()
257 bus->slave_state = ASPEED_I2C_SLAVE_START; in aspeed_i2c_slave_irq()
261 if (bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE) in aspeed_i2c_slave_irq()
264 dev_dbg(bus->dev, "slave irq status 0x%08x, cmd 0x%08x\n", in aspeed_i2c_slave_irq()
269 value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; in aspeed_i2c_slave_irq()
271 if (bus->slave_state == ASPEED_I2C_SLAVE_START) { in aspeed_i2c_slave_irq()
273 bus->slave_state = in aspeed_i2c_slave_irq()
276 bus->slave_state = in aspeed_i2c_slave_irq()
285 bus->slave_state = ASPEED_I2C_SLAVE_STOP; in aspeed_i2c_slave_irq()
288 bus->slave_state == ASPEED_I2C_SLAVE_READ_PROCESSED) { in aspeed_i2c_slave_irq()
290 bus->slave_state = ASPEED_I2C_SLAVE_STOP; in aspeed_i2c_slave_irq()
293 switch (bus->slave_state) { in aspeed_i2c_slave_irq()
296 dev_err(bus->dev, "Unexpected ACK on read request.\n"); in aspeed_i2c_slave_irq()
297 bus->slave_state = ASPEED_I2C_SLAVE_READ_PROCESSED; in aspeed_i2c_slave_irq()
299 writel(value, bus->base + ASPEED_I2C_BYTE_BUF_REG); in aspeed_i2c_slave_irq()
300 writel(ASPEED_I2CD_S_TX_CMD, bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_slave_irq()
304 dev_err(bus->dev, in aspeed_i2c_slave_irq()
310 writel(value, bus->base + ASPEED_I2C_BYTE_BUF_REG); in aspeed_i2c_slave_irq()
311 writel(ASPEED_I2CD_S_TX_CMD, bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_slave_irq()
314 bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; in aspeed_i2c_slave_irq()
321 writel(ASPEED_I2CD_M_S_RX_CMD_LAST, bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_slave_irq()
328 bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; in aspeed_i2c_slave_irq()
334 dev_err(bus->dev, "unknown slave_state: %d\n", in aspeed_i2c_slave_irq()
335 bus->slave_state); in aspeed_i2c_slave_irq()
336 bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; in aspeed_i2c_slave_irq()
344 /* precondition: bus.lock has been acquired. */
348 struct i2c_msg *msg = &bus->msgs[bus->msgs_index]; in aspeed_i2c_do_start()
357 if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) { in aspeed_i2c_do_start()
358 bus->master_state = ASPEED_I2C_MASTER_PENDING; in aspeed_i2c_do_start()
363 bus->master_state = ASPEED_I2C_MASTER_START; in aspeed_i2c_do_start()
364 bus->buf_index = 0; in aspeed_i2c_do_start()
366 if (msg->flags & I2C_M_RD) { in aspeed_i2c_do_start()
369 if (msg->len == 1 && !(msg->flags & I2C_M_RECV_LEN)) in aspeed_i2c_do_start()
373 writel(slave_addr, bus->base + ASPEED_I2C_BYTE_BUF_REG); in aspeed_i2c_do_start()
374 writel(command, bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_do_start()
377 /* precondition: bus.lock has been acquired. */
380 bus->master_state = ASPEED_I2C_MASTER_STOP; in aspeed_i2c_do_stop()
381 writel(ASPEED_I2CD_M_STOP_CMD, bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_do_stop()
384 /* precondition: bus.lock has been acquired. */
387 if (bus->msgs_index + 1 < bus->msgs_count) { in aspeed_i2c_next_msg_or_stop()
388 bus->msgs_index++; in aspeed_i2c_next_msg_or_stop()
398 return -EAGAIN; in aspeed_i2c_is_irq_error()
401 return -EBUSY; in aspeed_i2c_is_irq_error()
403 return -EPROTO; in aspeed_i2c_is_irq_error()
416 bus->master_state = ASPEED_I2C_MASTER_INACTIVE; in aspeed_i2c_master_irq()
428 dev_dbg(bus->dev, "received error interrupt: 0x%08x\n", in aspeed_i2c_master_irq()
431 if (bus->master_state != ASPEED_I2C_MASTER_INACTIVE) { in aspeed_i2c_master_irq()
432 bus->cmd_err = ret; in aspeed_i2c_master_irq()
433 bus->master_state = ASPEED_I2C_MASTER_INACTIVE; in aspeed_i2c_master_irq()
439 if (bus->master_state == ASPEED_I2C_MASTER_INACTIVE || in aspeed_i2c_master_irq()
440 bus->master_state == ASPEED_I2C_MASTER_PENDING) in aspeed_i2c_master_irq()
444 if (!bus->msgs) { in aspeed_i2c_master_irq()
445 dev_err(bus->dev, "bus in unknown state. irq_status: 0x%x\n", in aspeed_i2c_master_irq()
447 bus->cmd_err = -EIO; in aspeed_i2c_master_irq()
448 if (bus->master_state != ASPEED_I2C_MASTER_STOP && in aspeed_i2c_master_irq()
449 bus->master_state != ASPEED_I2C_MASTER_INACTIVE) in aspeed_i2c_master_irq()
453 msg = &bus->msgs[bus->msgs_index]; in aspeed_i2c_master_irq()
460 if (bus->master_state == ASPEED_I2C_MASTER_START) { in aspeed_i2c_master_irq()
470 writel(readl(bus->base + ASPEED_I2C_CMD_REG) & in aspeed_i2c_master_irq()
472 bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_master_irq()
473 bus->master_state = ASPEED_I2C_MASTER_PENDING; in aspeed_i2c_master_irq()
474 dev_dbg(bus->dev, in aspeed_i2c_master_irq()
481 bus->cmd_err = -ENXIO; in aspeed_i2c_master_irq()
482 bus->master_state = ASPEED_I2C_MASTER_INACTIVE; in aspeed_i2c_master_irq()
485 pr_devel("no slave present at %02x\n", msg->addr); in aspeed_i2c_master_irq()
487 bus->cmd_err = -ENXIO; in aspeed_i2c_master_irq()
492 if (msg->len == 0) { /* SMBUS_QUICK */ in aspeed_i2c_master_irq()
496 if (msg->flags & I2C_M_RD) in aspeed_i2c_master_irq()
497 bus->master_state = ASPEED_I2C_MASTER_RX_FIRST; in aspeed_i2c_master_irq()
499 bus->master_state = ASPEED_I2C_MASTER_TX_FIRST; in aspeed_i2c_master_irq()
502 switch (bus->master_state) { in aspeed_i2c_master_irq()
505 dev_dbg(bus->dev, "slave NACKed TX\n"); in aspeed_i2c_master_irq()
509 dev_err(bus->dev, "slave failed to ACK TX\n"); in aspeed_i2c_master_irq()
515 if (bus->buf_index < msg->len) { in aspeed_i2c_master_irq()
516 bus->master_state = ASPEED_I2C_MASTER_TX; in aspeed_i2c_master_irq()
517 writel(msg->buf[bus->buf_index++], in aspeed_i2c_master_irq()
518 bus->base + ASPEED_I2C_BYTE_BUF_REG); in aspeed_i2c_master_irq()
520 bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_master_irq()
532 dev_err(bus->dev, "master failed to RX\n"); in aspeed_i2c_master_irq()
537 recv_byte = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; in aspeed_i2c_master_irq()
538 msg->buf[bus->buf_index++] = recv_byte; in aspeed_i2c_master_irq()
540 if (msg->flags & I2C_M_RECV_LEN) { in aspeed_i2c_master_irq()
542 bus->cmd_err = -EPROTO; in aspeed_i2c_master_irq()
546 msg->len = recv_byte + in aspeed_i2c_master_irq()
547 ((msg->flags & I2C_CLIENT_PEC) ? 2 : 1); in aspeed_i2c_master_irq()
548 msg->flags &= ~I2C_M_RECV_LEN; in aspeed_i2c_master_irq()
551 if (bus->buf_index < msg->len) { in aspeed_i2c_master_irq()
552 bus->master_state = ASPEED_I2C_MASTER_RX; in aspeed_i2c_master_irq()
554 if (bus->buf_index + 1 == msg->len) in aspeed_i2c_master_irq()
556 writel(command, bus->base + ASPEED_I2C_CMD_REG); in aspeed_i2c_master_irq()
563 dev_err(bus->dev, in aspeed_i2c_master_irq()
566 bus->cmd_err = -EIO; in aspeed_i2c_master_irq()
572 bus->master_state = ASPEED_I2C_MASTER_INACTIVE; in aspeed_i2c_master_irq()
575 dev_err(bus->dev, in aspeed_i2c_master_irq()
578 bus->cmd_err = -EIO; in aspeed_i2c_master_irq()
583 bus->master_state = ASPEED_I2C_MASTER_INACTIVE; in aspeed_i2c_master_irq()
584 bus->cmd_err = -EINVAL; in aspeed_i2c_master_irq()
588 bus->cmd_err = -EIO; in aspeed_i2c_master_irq()
592 bus->msgs = NULL; in aspeed_i2c_master_irq()
593 if (bus->cmd_err) in aspeed_i2c_master_irq()
594 bus->master_xfer_result = bus->cmd_err; in aspeed_i2c_master_irq()
596 bus->master_xfer_result = bus->msgs_index + 1; in aspeed_i2c_master_irq()
597 complete(&bus->cmd_complete); in aspeed_i2c_master_irq()
607 spin_lock(&bus->lock); in aspeed_i2c_bus_irq()
608 irq_received = readl(bus->base + ASPEED_I2C_INTR_STS_REG); in aspeed_i2c_bus_irq()
611 bus->base + ASPEED_I2C_INTR_STS_REG); in aspeed_i2c_bus_irq()
612 readl(bus->base + ASPEED_I2C_INTR_STS_REG); in aspeed_i2c_bus_irq()
624 if (bus->master_state != ASPEED_I2C_MASTER_INACTIVE && in aspeed_i2c_bus_irq()
625 bus->master_state != ASPEED_I2C_MASTER_PENDING) { in aspeed_i2c_bus_irq()
642 if (bus->master_state == ASPEED_I2C_MASTER_PENDING && in aspeed_i2c_bus_irq()
643 bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE) in aspeed_i2c_bus_irq()
651 dev_err(bus->dev, in aspeed_i2c_bus_irq()
658 bus->base + ASPEED_I2C_INTR_STS_REG); in aspeed_i2c_bus_irq()
659 readl(bus->base + ASPEED_I2C_INTR_STS_REG); in aspeed_i2c_bus_irq()
661 spin_unlock(&bus->lock); in aspeed_i2c_bus_irq()
671 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_master_xfer()
672 bus->cmd_err = 0; in aspeed_i2c_master_xfer()
675 if (!bus->multi_master && in aspeed_i2c_master_xfer()
676 (readl(bus->base + ASPEED_I2C_CMD_REG) & in aspeed_i2c_master_xfer()
680 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_master_xfer()
684 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_master_xfer()
687 bus->cmd_err = 0; in aspeed_i2c_master_xfer()
688 bus->msgs = msgs; in aspeed_i2c_master_xfer()
689 bus->msgs_index = 0; in aspeed_i2c_master_xfer()
690 bus->msgs_count = num; in aspeed_i2c_master_xfer()
692 reinit_completion(&bus->cmd_complete); in aspeed_i2c_master_xfer()
694 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_master_xfer()
696 time_left = wait_for_completion_timeout(&bus->cmd_complete, in aspeed_i2c_master_xfer()
697 bus->adap.timeout); in aspeed_i2c_master_xfer()
704 if (bus->multi_master && in aspeed_i2c_master_xfer()
705 (readl(bus->base + ASPEED_I2C_CMD_REG) & in aspeed_i2c_master_xfer()
713 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_master_xfer()
714 if (bus->master_state == ASPEED_I2C_MASTER_PENDING) in aspeed_i2c_master_xfer()
715 bus->master_state = ASPEED_I2C_MASTER_INACTIVE; in aspeed_i2c_master_xfer()
716 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_master_xfer()
718 return -ETIMEDOUT; in aspeed_i2c_master_xfer()
721 return bus->master_xfer_result; in aspeed_i2c_master_xfer()
730 /* precondition: bus.lock has been acquired. */
743 writel(addr_reg_val, bus->base + ASPEED_I2C_DEV_ADDR_REG); in __aspeed_i2c_reg_slave()
746 func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); in __aspeed_i2c_reg_slave()
748 writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); in __aspeed_i2c_reg_slave()
753 struct aspeed_i2c_bus *bus = i2c_get_adapdata(client->adapter); in aspeed_i2c_reg_slave()
756 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_reg_slave()
757 if (bus->slave) { in aspeed_i2c_reg_slave()
758 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_reg_slave()
759 return -EINVAL; in aspeed_i2c_reg_slave()
762 __aspeed_i2c_reg_slave(bus, client->addr); in aspeed_i2c_reg_slave()
764 bus->slave = client; in aspeed_i2c_reg_slave()
765 bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; in aspeed_i2c_reg_slave()
766 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_reg_slave()
773 struct aspeed_i2c_bus *bus = i2c_get_adapdata(client->adapter); in aspeed_i2c_unreg_slave()
777 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_unreg_slave()
778 if (!bus->slave) { in aspeed_i2c_unreg_slave()
779 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_unreg_slave()
780 return -EINVAL; in aspeed_i2c_unreg_slave()
784 func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); in aspeed_i2c_unreg_slave()
786 writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); in aspeed_i2c_unreg_slave()
788 bus->slave = NULL; in aspeed_i2c_unreg_slave()
789 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_unreg_slave()
836 * clk_low >= clk_low_max / 2 - 1 when possible; this last constraint in aspeed_i2c_get_clk_reg_val()
840 ilog2((divisor - 1) / clk_high_low_max) + 1 : 0; in aspeed_i2c_get_clk_reg_val()
850 tmp = (divisor + (1 << base_clk_divisor) - 1) in aspeed_i2c_get_clk_reg_val()
853 clk_high = tmp - clk_low; in aspeed_i2c_get_clk_reg_val()
856 clk_high--; in aspeed_i2c_get_clk_reg_val()
859 clk_low--; in aspeed_i2c_get_clk_reg_val()
889 /* precondition: bus.lock has been acquired. */
894 divisor = DIV_ROUND_UP(bus->parent_clk_frequency, bus->bus_frequency); in aspeed_i2c_init_clk()
895 clk_reg_val = readl(bus->base + ASPEED_I2C_AC_TIMING_REG1); in aspeed_i2c_init_clk()
899 clk_reg_val |= bus->get_clk_reg_val(bus->dev, divisor); in aspeed_i2c_init_clk()
900 writel(clk_reg_val, bus->base + ASPEED_I2C_AC_TIMING_REG1); in aspeed_i2c_init_clk()
901 writel(ASPEED_NO_TIMEOUT_CTRL, bus->base + ASPEED_I2C_AC_TIMING_REG2); in aspeed_i2c_init_clk()
906 /* precondition: bus.lock has been acquired. */
914 writel(0, bus->base + ASPEED_I2C_FUN_CTRL_REG); in aspeed_i2c_init()
920 if (of_property_read_bool(pdev->dev.of_node, "multi-master")) in aspeed_i2c_init()
921 bus->multi_master = true; in aspeed_i2c_init()
926 writel(readl(bus->base + ASPEED_I2C_FUN_CTRL_REG) | fun_ctrl_reg, in aspeed_i2c_init()
927 bus->base + ASPEED_I2C_FUN_CTRL_REG); in aspeed_i2c_init()
930 /* If slave has already been registered, re-enable it. */ in aspeed_i2c_init()
931 if (bus->slave) in aspeed_i2c_init()
932 __aspeed_i2c_reg_slave(bus, bus->slave->addr); in aspeed_i2c_init()
936 writel(ASPEED_I2CD_INTR_ALL, bus->base + ASPEED_I2C_INTR_CTRL_REG); in aspeed_i2c_init()
943 struct platform_device *pdev = to_platform_device(bus->dev); in aspeed_i2c_reset()
947 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_reset()
950 writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); in aspeed_i2c_reset()
951 writel(0xffffffff, bus->base + ASPEED_I2C_INTR_STS_REG); in aspeed_i2c_reset()
955 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_reset()
962 .compatible = "aspeed,ast2400-i2c-bus",
966 .compatible = "aspeed,ast2500-i2c-bus",
970 .compatible = "aspeed,ast2600-i2c-bus",
985 bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); in aspeed_i2c_probe_bus()
987 return -ENOMEM; in aspeed_i2c_probe_bus()
990 bus->base = devm_ioremap_resource(&pdev->dev, res); in aspeed_i2c_probe_bus()
991 if (IS_ERR(bus->base)) in aspeed_i2c_probe_bus()
992 return PTR_ERR(bus->base); in aspeed_i2c_probe_bus()
994 parent_clk = devm_clk_get(&pdev->dev, NULL); in aspeed_i2c_probe_bus()
997 bus->parent_clk_frequency = clk_get_rate(parent_clk); in aspeed_i2c_probe_bus()
999 devm_clk_put(&pdev->dev, parent_clk); in aspeed_i2c_probe_bus()
1001 bus->rst = devm_reset_control_get_shared(&pdev->dev, NULL); in aspeed_i2c_probe_bus()
1002 if (IS_ERR(bus->rst)) { in aspeed_i2c_probe_bus()
1003 dev_err(&pdev->dev, in aspeed_i2c_probe_bus()
1005 return PTR_ERR(bus->rst); in aspeed_i2c_probe_bus()
1007 reset_control_deassert(bus->rst); in aspeed_i2c_probe_bus()
1009 ret = of_property_read_u32(pdev->dev.of_node, in aspeed_i2c_probe_bus()
1010 "bus-frequency", &bus->bus_frequency); in aspeed_i2c_probe_bus()
1012 dev_err(&pdev->dev, in aspeed_i2c_probe_bus()
1013 "Could not read bus-frequency property\n"); in aspeed_i2c_probe_bus()
1014 bus->bus_frequency = I2C_MAX_STANDARD_MODE_FREQ; in aspeed_i2c_probe_bus()
1017 match = of_match_node(aspeed_i2c_bus_of_table, pdev->dev.of_node); in aspeed_i2c_probe_bus()
1019 bus->get_clk_reg_val = aspeed_i2c_24xx_get_clk_reg_val; in aspeed_i2c_probe_bus()
1021 bus->get_clk_reg_val = (u32 (*)(struct device *, u32)) in aspeed_i2c_probe_bus()
1022 match->data; in aspeed_i2c_probe_bus()
1025 spin_lock_init(&bus->lock); in aspeed_i2c_probe_bus()
1026 init_completion(&bus->cmd_complete); in aspeed_i2c_probe_bus()
1027 bus->adap.owner = THIS_MODULE; in aspeed_i2c_probe_bus()
1028 bus->adap.retries = 0; in aspeed_i2c_probe_bus()
1029 bus->adap.algo = &aspeed_i2c_algo; in aspeed_i2c_probe_bus()
1030 bus->adap.dev.parent = &pdev->dev; in aspeed_i2c_probe_bus()
1031 bus->adap.dev.of_node = pdev->dev.of_node; in aspeed_i2c_probe_bus()
1032 strscpy(bus->adap.name, pdev->name, sizeof(bus->adap.name)); in aspeed_i2c_probe_bus()
1033 i2c_set_adapdata(&bus->adap, bus); in aspeed_i2c_probe_bus()
1035 bus->dev = &pdev->dev; in aspeed_i2c_probe_bus()
1038 writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); in aspeed_i2c_probe_bus()
1039 writel(0xffffffff, bus->base + ASPEED_I2C_INTR_STS_REG); in aspeed_i2c_probe_bus()
1048 irq = irq_of_parse_and_map(pdev->dev.of_node, 0); in aspeed_i2c_probe_bus()
1049 ret = devm_request_irq(&pdev->dev, irq, aspeed_i2c_bus_irq, in aspeed_i2c_probe_bus()
1050 0, dev_name(&pdev->dev), bus); in aspeed_i2c_probe_bus()
1054 ret = i2c_add_adapter(&bus->adap); in aspeed_i2c_probe_bus()
1060 dev_info(bus->dev, "i2c bus %d registered, irq %d\n", in aspeed_i2c_probe_bus()
1061 bus->adap.nr, irq); in aspeed_i2c_probe_bus()
1071 spin_lock_irqsave(&bus->lock, flags); in aspeed_i2c_remove_bus()
1074 writel(0, bus->base + ASPEED_I2C_FUN_CTRL_REG); in aspeed_i2c_remove_bus()
1075 writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); in aspeed_i2c_remove_bus()
1077 spin_unlock_irqrestore(&bus->lock, flags); in aspeed_i2c_remove_bus()
1079 reset_control_assert(bus->rst); in aspeed_i2c_remove_bus()
1081 i2c_del_adapter(&bus->adap); in aspeed_i2c_remove_bus()
1090 .name = "aspeed-i2c-bus",