Lines Matching +full:i2c +full:- +full:scl +full:- +full:hz
4 * SPDX-License-Identifier: Apache-2.0
11 * @brief Driver for ARM's SBCon 2-wire serial bus interface
14 * hardware state of two-bit serial interfaces like I2C.
19 #include <zephyr/drivers/i2c.h>
24 #include "i2c-priv.h"
36 /* Bits values for SCL and SDA lines in struct sbcon registers */
37 #define SCL BIT(0) macro
43 uint32_t bitrate; /* I2C bus speed in Hz */
48 struct i2c_bitbang bitbang; /* Bit-bang library data */
56 sbcon->SB_CONTROLS = SCL; in i2c_sbcon_set_scl()
58 sbcon->SB_CONTROLC = SCL; in i2c_sbcon_set_scl()
67 sbcon->SB_CONTROLS = SDA; in i2c_sbcon_set_sda()
69 sbcon->SB_CONTROLC = SDA; in i2c_sbcon_set_sda()
77 return sbcon->SB_CONTROL & SDA; in i2c_sbcon_get_sda()
88 struct i2c_sbcon_context *context = dev->data; in i2c_sbcon_configure()
90 return i2c_bitbang_configure(&context->bitbang, dev_config); in i2c_sbcon_configure()
95 struct i2c_sbcon_context *context = dev->data; in i2c_sbcon_get_config()
97 return i2c_bitbang_get_config(&context->bitbang, config); in i2c_sbcon_get_config()
103 struct i2c_sbcon_context *context = dev->data; in i2c_sbcon_transfer()
105 return i2c_bitbang_transfer(&context->bitbang, msgs, num_msgs, in i2c_sbcon_transfer()
111 struct i2c_sbcon_context *context = dev->data; in i2c_sbcon_recover_bus()
113 return i2c_bitbang_recover_bus(&context->bitbang); in i2c_sbcon_recover_bus()
116 static DEVICE_API(i2c, api) = {
128 struct i2c_sbcon_context *context = dev->data; in i2c_sbcon_init()
129 const struct i2c_sbcon_config *config = dev->config; in i2c_sbcon_init()
132 i2c_bitbang_init(&context->bitbang, &io_fns, config->sbcon); in i2c_sbcon_init()
134 ret = i2c_bitbang_configure(&context->bitbang, in i2c_sbcon_init()
135 I2C_MODE_CONTROLLER | i2c_map_dt_bitrate(config->bitrate)); in i2c_sbcon_init()
137 LOG_ERR("failed to configure I2C bitbang: %d", ret); in i2c_sbcon_init()