Lines Matching +full:current +full:- +full:speed
3 * Copyright (C) 2009 - 2013 Heiko Schocher <hs@denx.de>
9 * SPDX-License-Identifier: GPL-2.0+
13 * AIRVENT SAM s.p.a - RIMINI(ITALY)
21 * For now there are essentially two parts to this file - driver model
29 DM_I2C_CHIP_10BIT = 1 << 0, /* Use 10-bit addressing */
36 * struct dm_i2c_chip - information about an i2c chip
39 * and normally supports 7-bit or 10-bit addressing.
62 * struct dm_i2c_bus- information about an i2c bus
71 * @speed_hz: Bus speed in hertz (typically 100000)
78 * Not all of these flags are implemented in the U-Boot API
81 I2C_M_TEN = 0x0010, /* ten-bit chip address */
92 * struct i2c_msg - an I2C message
107 * struct i2c_msg_list - a list of I2C messages
110 * appropriate in U-Boot.
121 * dm_i2c_read() - read bytes from an I2C chip
135 * @return 0 on success, -ve on failure
140 * dm_i2c_write() - write bytes to an I2C chip
149 * @return 0 on success, -ve on failure
155 * dm_i2c_probe() - probe a particular chip address
162 * @chip_addr: 7-bit address to probe (10-bit and others are not supported)
165 * @return 0 if a chip was found at that address, -ve if not
171 * dm_i2c_reg_read() - Read a value from an I2C register
177 * @return value read, or -ve on error
182 * dm_i2c_reg_write() - Write a value to an I2C register
189 * @return 0 on success, -ve on error
194 * dm_i2c_reg_clrset() - Apply bitmask to an I2C register
203 * @return 0 on success, -ve on error
208 * dm_i2c_xfer() - Transfer messages over I2C
216 * @return 0 on success, -ve on error
221 * dm_i2c_set_bus_speed() - set the speed of a bus
224 * @speed: Requested speed in Hz
225 * @return 0 if OK, -EINVAL for invalid values
227 int dm_i2c_set_bus_speed(struct udevice *bus, unsigned int speed);
230 * dm_i2c_get_bus_speed() - get the speed of a bus
233 * @return speed of selected I2C bus in Hz, -ve on error
238 * i2c_set_chip_flags() - set flags for a chip
240 * Typically addresses are 7 bits, but for 10-bit addresses you should set
241 * flags to DM_I2C_CHIP_10BIT. All accesses will then use 10-bit addressing.
245 * @return 0 if OK, -EINVAL if value is unsupported, other -ve value on error
250 * i2c_get_chip_flags() - get flags for a chip
254 * @return 0 if OK, other -ve value on error
259 * i2c_set_offset_len() - set the offset length for a chip
271 * i2c_get_offset_len() - get the offset length for a chip
273 * @return: Current offset length value (typically 1 or 2)
278 * i2c_deblock() - recover a bus that is in an unknown state
283 * @return 0 if OK, -ve on error
289 * i2c_probe() - Compatibility function for driver model
291 * Calls dm_i2c_probe() on the current bus
296 * i2c_read() - Compatibility function for driver model
299 * set to @addr. @alen must match the current setting for the device.
305 * i2c_write() - Compatibility function for driver model
308 * set to @addr. @alen must match the current setting for the device.
314 * i2c_get_bus_num_fdt() - Compatibility function for driver model
321 * i2c_get_bus_num() - Compatibility function for driver model
323 * @return the 'current' bus number
328 * i2c_set_bus_num() - Compatibility function for driver model
330 * Sets the 'current' bus
345 * i2c_init() - Compatibility function for driver model
349 void i2c_init(int speed, int slaveaddr);
352 * board_i2c_init() - Compatibility function for driver model
368 * struct dm_i2c_ops - driver operations for I2C uclass
376 * xfer() - transfer a list of I2C messages
381 * @return 0 if OK, -EREMOTEIO if the slave did not ACK a byte,
382 * -ECOMM if the speed cannot be supported, -EPROTO if the chip
383 * flags cannot be supported, other -ve value on some other error
388 * probe_chip() - probe for the presense of a chip address
396 * @return 0 if chip was found, -EREMOTEIO if not, -ENOSYS to fall back
397 * to default probem other -ve value on error
402 * set_bus_speed() - set the speed of a bus (optional)
404 * The bus speed value will be updated by the uclass if this function
405 * does not return an error. This method is optional - if it is not
406 * provided then the driver can read the speed from
407 * dev_get_uclass_priv(bus)->speed_hz
410 * @speed: Requested speed in Hz
411 * @return 0 if OK, -EINVAL for invalid values
413 int (*set_bus_speed)(struct udevice *bus, unsigned int speed);
416 * get_bus_speed() - get the speed of a bus (optional)
419 * driver to check the bus speed by looking at the hardware, you can
421 * normally be expected to return dev_get_uclass_priv(bus)->speed_hz.
424 * @return speed of selected I2C bus in Hz, -ve on error
429 * set_flags() - set the flags for a chip (optional)
438 * @return 0 if OK, -EINVAL if value is unsupported
443 * deblock() - recover a bus that is in an unknown state
459 #define i2c_get_ops(dev) ((struct dm_i2c_ops *)(dev)->driver->ops)
462 * struct i2c_mux_ops - operations for an I2C mux
464 * The current mux state is expected to be stored in the mux itself since
466 * record the current state and then avoid switching unless it is necessary.
472 * select() - select one of of I2C buses attached to a mux
481 * @return 0 if OK, -ve on error
486 * deselect() - select one of of I2C buses attached to a mux
493 * @return 0 if OK, -ve on error
498 #define i2c_mux_get_ops(dev) ((struct i2c_mux_ops *)(dev)->driver->ops)
501 * i2c_get_chip() - get a device to use to access a chip on a bus
509 * @devp: Returns pointer to new device if found or -ENODEV if not
516 * i2c_get_chip_for_busnum() - get a device to use to access a chip on
525 * @devp: Returns pointer to new device if found or -ENODEV if not
532 * i2c_chip_ofdata_to_platdata() - Decode standard I2C platform data
545 * i2c_dump_msgs() - Dump a list of I2C messages
562 * use of stack-based variables are OK (the initial stack size is
592 void (*init)(struct i2c_adapter *adap, int speed,
602 uint speed);
603 int speed; member
619 .speed = _speed, \
650 #define I2C_NULL_HOP {{-1, ""}, 0, 0}
657 #define I2C_BUS gd->cur_i2c_bus
660 #define I2C_ADAP I2C_ADAP_NR(gd->cur_i2c_bus)
661 #define I2C_ADAP_HWNR (I2C_ADAP->hwadapnr)
698 * repeatedly to change the speed and slave addresses.
703 void i2c_init(int speed, int slaveaddr);
710 * Returns index of currently active I2C bus. Zero-based.
720 * bus - bus index, zero based
732 * speed and slaveaddr. Returns 0 on success, non-0 on failure.
770 * Change the speed of the active I2C bus
772 * speed - bus speed in Hz
774 * Returns: new bus speed
777 unsigned int i2c_set_bus_speed(unsigned int speed);
782 * Returns speed of currently active I2C bus in Hz
837 * Functions for setting the current I2C bus and its speed
846 * bus - bus index, zero based
856 * Returns index of currently active I2C bus. Zero-based.
864 * Change the speed of the active I2C bus
866 * speed - bus speed in Hz
876 * Returns speed of currently active I2C bus in Hz
929 * @return the number of I2C bus (zero based), or -1 on error
938 * @return 0 if port was reset, -1 if not found