Lines Matching +full:i2c +full:- +full:arb +full:- +full:gpio +full:- +full:challenge

1 // SPDX-License-Identifier: GPL-2.0+
10 #include <i2c.h>
11 #include <asm/gpio.h>
29 debug("%s: %s\n", __func__, mux->name); in i2c_arbitrator_deselect()
30 ret = dm_gpio_set_value(&priv->ap_claim, 0); in i2c_arbitrator_deselect()
31 udelay(priv->slew_delay_us); in i2c_arbitrator_deselect()
43 debug("%s: %s\n", __func__, mux->name); in i2c_arbitrator_select()
51 ret = dm_gpio_set_value(&priv->ap_claim, 1); in i2c_arbitrator_select()
54 udelay(priv->slew_delay_us); in i2c_arbitrator_select()
58 while (get_timer(start_retry) < priv->wait_retry_ms) { in i2c_arbitrator_select()
59 ret = dm_gpio_get_value(&priv->ec_claim); in i2c_arbitrator_select()
72 ret = dm_gpio_set_value(&priv->ap_claim, 0); in i2c_arbitrator_select()
76 mdelay(priv->wait_retry_ms); in i2c_arbitrator_select()
77 } while (get_timer(start) < priv->wait_free_ms); in i2c_arbitrator_select()
80 printf("I2C: Could not claim bus, timeout %lu\n", get_timer(start)); in i2c_arbitrator_select()
81 ret = -ETIMEDOUT; in i2c_arbitrator_select()
90 const void *blob = gd->fdt_blob; in i2c_arbitrator_probe()
94 debug("%s: %s\n", __func__, dev->name); in i2c_arbitrator_probe()
95 priv->slew_delay_us = fdtdec_get_int(blob, node, "slew-delay-us", 0); in i2c_arbitrator_probe()
96 priv->wait_retry_ms = fdtdec_get_int(blob, node, "wait-retry-us", 0) / in i2c_arbitrator_probe()
98 priv->wait_free_ms = fdtdec_get_int(blob, node, "wait-free-us", 0) / in i2c_arbitrator_probe()
100 ret = gpio_request_by_name(dev, "our-claim-gpio", 0, &priv->ap_claim, in i2c_arbitrator_probe()
104 ret = gpio_request_by_name(dev, "their-claim-gpios", 0, &priv->ec_claim, in i2c_arbitrator_probe()
112 dm_gpio_free(dev, &priv->ap_claim); in i2c_arbitrator_probe()
122 dm_gpio_free(dev, &priv->ap_claim); in i2c_arbitrator_remove()
123 dm_gpio_free(dev, &priv->ec_claim); in i2c_arbitrator_remove()
134 { .compatible = "i2c-arb-gpio-challenge" },