Lines Matching +full:current +full:- +full:speed
1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Copyright (C) 2009 - 2013 Heiko Schocher <hs@denx.de>
12 * AIRVENT SAM s.p.a - RIMINI(ITALY)
20 * For now there are essentially two parts to this file - driver model
28 DM_I2C_CHIP_10BIT = 1 << 0, /* Use 10-bit addressing */
35 * struct dm_i2c_chip - information about an i2c chip
38 * and normally supports 7-bit or 10-bit addressing.
75 * struct dm_i2c_bus- information about an i2c bus
84 * @speed_hz: Bus speed in hertz (typically 100000)
91 * Not all of these flags are implemented in the U-Boot API
94 I2C_M_TEN = 0x0010, /* ten-bit chip address */
105 * struct i2c_msg - an I2C message
120 * struct i2c_msg_list - a list of I2C messages
123 * appropriate in U-Boot.
134 * dm_i2c_read() - read bytes from an I2C chip
148 * @return 0 on success, -ve on failure
153 * dm_i2c_write() - write bytes to an I2C chip
162 * @return 0 on success, -ve on failure
168 * dm_i2c_probe() - probe a particular chip address
175 * @chip_addr: 7-bit address to probe (10-bit and others are not supported)
178 * @return 0 if a chip was found at that address, -ve if not
184 * dm_i2c_reg_read() - Read a value from an I2C register
190 * @return value read, or -ve on error
195 * dm_i2c_reg_write() - Write a value to an I2C register
202 * @return 0 on success, -ve on error
207 * dm_i2c_xfer() - Transfer messages over I2C
215 * @return 0 on success, -ve on error
220 * dm_i2c_set_bus_speed() - set the speed of a bus
223 * @speed: Requested speed in Hz
224 * @return 0 if OK, -EINVAL for invalid values
226 int dm_i2c_set_bus_speed(struct udevice *bus, unsigned int speed);
229 * dm_i2c_get_bus_speed() - get the speed of a bus
232 * @return speed of selected I2C bus in Hz, -ve on error
237 * i2c_set_chip_flags() - set flags for a chip
239 * Typically addresses are 7 bits, but for 10-bit addresses you should set
240 * flags to DM_I2C_CHIP_10BIT. All accesses will then use 10-bit addressing.
244 * @return 0 if OK, -EINVAL if value is unsupported, other -ve value on error
249 * i2c_get_chip_flags() - get flags for a chip
253 * @return 0 if OK, other -ve value on error
258 * i2c_set_offset_len() - set the offset length for a chip
270 * i2c_get_offset_len() - get the offset length for a chip
272 * @return: Current offset length value (typically 1 or 2)
277 * i2c_set_chip_addr_offset_mask() - set mask of address bits usable by offset
284 * @return 0 if OK, other -ve value on error
289 * i2c_get_chip_addr_offset_mask() - get mask of address bits usable by offset
291 * @return current chip addr offset mask
296 * i2c_deblock() - recover a bus that is in an unknown state
301 * @return 0 if OK, -ve on error
307 * i2c_probe() - Compatibility function for driver model
309 * Calls dm_i2c_probe() on the current bus
314 * i2c_read() - Compatibility function for driver model
317 * set to @addr. @alen must match the current setting for the device.
323 * i2c_write() - Compatibility function for driver model
326 * set to @addr. @alen must match the current setting for the device.
332 * i2c_get_bus_num_fdt() - Compatibility function for driver model
339 * i2c_get_bus_num() - Compatibility function for driver model
341 * @return the 'current' bus number
346 * i2c_set_bus_num() - Compatibility function for driver model
348 * Sets the 'current' bus
363 * i2c_init() - Compatibility function for driver model
367 void i2c_init(int speed, int slaveaddr);
370 * board_i2c_init() - Compatibility function for driver model
386 * struct dm_i2c_ops - driver operations for I2C uclass
394 * xfer() - transfer a list of I2C messages
399 * @return 0 if OK, -EREMOTEIO if the slave did not ACK a byte,
400 * -ECOMM if the speed cannot be supported, -EPROTO if the chip
401 * flags cannot be supported, other -ve value on some other error
406 * probe_chip() - probe for the presense of a chip address
414 * @return 0 if chip was found, -EREMOTEIO if not, -ENOSYS to fall back
415 * to default probem other -ve value on error
420 * set_bus_speed() - set the speed of a bus (optional)
422 * The bus speed value will be updated by the uclass if this function
423 * does not return an error. This method is optional - if it is not
424 * provided then the driver can read the speed from
425 * dev_get_uclass_priv(bus)->speed_hz
428 * @speed: Requested speed in Hz
429 * @return 0 if OK, -EINVAL for invalid values
431 int (*set_bus_speed)(struct udevice *bus, unsigned int speed);
434 * get_bus_speed() - get the speed of a bus (optional)
437 * driver to check the bus speed by looking at the hardware, you can
439 * normally be expected to return dev_get_uclass_priv(bus)->speed_hz.
442 * @return speed of selected I2C bus in Hz, -ve on error
447 * set_flags() - set the flags for a chip (optional)
456 * @return 0 if OK, -EINVAL if value is unsupported
461 * deblock() - recover a bus that is in an unknown state
477 #define i2c_get_ops(dev) ((struct dm_i2c_ops *)(dev)->driver->ops)
480 * struct i2c_mux_ops - operations for an I2C mux
482 * The current mux state is expected to be stored in the mux itself since
484 * record the current state and then avoid switching unless it is necessary.
490 * select() - select one of of I2C buses attached to a mux
499 * @return 0 if OK, -ve on error
504 * deselect() - select one of of I2C buses attached to a mux
511 * @return 0 if OK, -ve on error
516 #define i2c_mux_get_ops(dev) ((struct i2c_mux_ops *)(dev)->driver->ops)
519 * i2c_get_chip() - get a device to use to access a chip on a bus
527 * @devp: Returns pointer to new device if found or -ENODEV if not
534 * i2c_get_chip_for_busnum() - get a device to use to access a chip on
543 * @devp: Returns pointer to new device if found or -ENODEV if not
550 * i2c_chip_ofdata_to_platdata() - Decode standard I2C platform data
563 * i2c_dump_msgs() - Dump a list of I2C messages
573 * i2c_emul_find() - Find an emulator for an i2c sandbox device
579 * @return 0 if OK, -ENOENT or -ENODEV if not found
584 * i2c_emul_get_device() - Find the device being emulated
601 * use of stack-based variables are OK (the initial stack size is
631 void (*init)(struct i2c_adapter *adap, int speed,
641 uint speed);
642 int speed; member
658 .speed = _speed, \
689 #define I2C_NULL_HOP {{-1, ""}, 0, 0}
696 #define I2C_BUS gd->cur_i2c_bus
699 #define I2C_ADAP I2C_ADAP_NR(gd->cur_i2c_bus)
700 #define I2C_ADAP_HWNR (I2C_ADAP->hwadapnr)
737 * repeatedly to change the speed and slave addresses.
742 void i2c_init(int speed, int slaveaddr);
749 * Returns index of currently active I2C bus. Zero-based.
759 * bus - bus index, zero based
771 * speed and slaveaddr. Returns 0 on success, non-0 on failure.
809 * Change the speed of the active I2C bus
811 * speed - bus speed in Hz
813 * Returns: new bus speed
816 unsigned int i2c_set_bus_speed(unsigned int speed);
821 * Returns speed of currently active I2C bus in Hz
876 * Functions for setting the current I2C bus and its speed
885 * bus - bus index, zero based
895 * Returns index of currently active I2C bus. Zero-based.
903 * Change the speed of the active I2C bus
905 * speed - bus speed in Hz
915 * Returns speed of currently active I2C bus in Hz
968 * @return the number of I2C bus (zero based), or -1 on error
977 * @return 0 if port was reset, -1 if not found