Lines Matching +full:on +full:- +full:chip
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
38 * An I2C chip is a device on the I2C bus. It sits at a particular address
39 * and normally supports 7-bit or 10-bit addressing.
42 * the chip to examine.
44 * @chip_addr: Chip address on bus
48 * @flags: Flags for this chip (dm_i2c_chip_flags)
49 * @emul: Emulator for this chip address (only used for emulation)
62 * struct dm_i2c_bus- information about an i2c bus
64 * An I2C bus contains 0 or more chips on it, each at its own address. The
78 * Not all of these flags are implemented in the U-Boot API
81 I2C_M_TEN = 0x0010, /* ten-bit chip address */
87 I2C_M_NO_RD_ACK = 0x0800, /* skip the Ack bit on reads */
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
123 * To obtain an I2C device (called a 'chip') given the I2C bus address you
130 * @dev: Chip to read from
131 * @offset: Offset within chip to start reading
135 * @return 0 on success, -ve on failure
140 * dm_i2c_write() - write bytes to an I2C chip
144 * @dev: Chip to write to
145 * @offset: Offset within chip to start writing
149 * @return 0 on success, -ve on failure
155 * dm_i2c_probe() - probe a particular chip address
157 * This can be useful to check for the existence of a chip on the bus.
158 * It is typically implemented by writing the chip address to the bus
159 * and checking that the chip replies with an ACK.
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
173 * This reads a single value from the given address in an I2C chip
177 * @return value read, or -ve on error
182 * dm_i2c_reg_write() - Write a value to an I2C register
184 * This writes a single value to the given address in an I2C chip
189 * @return 0 on success, -ve on error
194 * dm_i2c_reg_clrset() - Apply bitmask to an I2C register
197 * given address in an I2C chip
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
225 * @return 0 if OK, -EINVAL for invalid values
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.
243 * @dev: Chip to adjust
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
252 * @dev: Chip to check
254 * @return 0 if OK, other -ve value on error
259 * i2c_set_offset_len() - set the offset length for a chip
261 * The offset used to access a chip may be up to 4 bytes long. Typically it
271 * i2c_get_offset_len() - get the offset length for a chip
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
305 * i2c_write() - Compatibility function for driver model
314 * i2c_get_bus_num_fdt() - Compatibility function for driver model
321 * i2c_get_bus_num() - Compatibility function for driver model
328 * i2c_set_bus_num() - Compatibility function for driver model
345 * i2c_init() - Compatibility function for driver model
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
394 * @chip_addr: Chip address to probe
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)
405 * does not return an error. This method is optional - if it is not
407 * dev_get_uclass_priv(bus)->speed_hz
411 * @return 0 if OK, -EINVAL for invalid values
416 * get_bus_speed() - get the speed of a bus (optional)
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)
436 * @dev: Chip to adjust
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
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
503 * This returns the device for the given chip address. The device can then
507 * @chip_addr: Chip address for the new device
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
519 * This returns the device for the given chip address on a particular bus
523 * @chip_addr: Chip address for the new device
525 * @devp: Returns pointer to new device if found or -ENODEV if not
532 * i2c_chip_ofdata_to_platdata() - Decode standard I2C platform data
534 * This decodes the chip address from a device tree node and puts it into
542 int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip);
545 * i2c_dump_msgs() - Dump a list of I2C messages
562 * use of stack-based variables are OK (the initial stack size is
594 int (*probe)(struct i2c_adapter *adap, uint8_t chip);
595 int (*read)(struct i2c_adapter *adap, uint8_t chip,
598 int (*write)(struct i2c_adapter *adap, uint8_t chip,
642 uint8_t chip; member
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)
697 * Initialization, must be called once on start up, may be called
710 * Returns index of currently active I2C bus. Zero-based.
720 * bus - bus index, zero based
722 * Returns: 0 on success, not 0 on failure
732 * speed and slaveaddr. Returns 0 on success, non-0 on failure.
737 * Probe the given I2C chip address. Returns 0 if a chip responded,
738 * not 0 on failure.
740 int i2c_probe(uint8_t chip);
744 * chip: I2C chip address, range 0..127
745 * addr: Memory (register) address within the chip
752 * Returns: 0 on success, not 0 on failure
754 int i2c_read(uint8_t chip, unsigned int addr, int alen,
757 int i2c_write(uint8_t chip, unsigned int addr, int alen,
772 * speed - bus speed in Hz
790 * Probe the given I2C chip address. Returns 0 if a chip responded,
791 * not 0 on failure.
793 int i2c_probe(uchar chip);
797 * chip: I2C chip address, range 0..127
798 * addr: Memory (register) address within the chip
805 * Returns: 0 on success, not 0 on failure
807 int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
808 int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
846 * bus - bus index, zero based
848 * Returns: 0 on success, not 0 on failure
856 * Returns index of currently active I2C bus. Zero-based.
866 * speed - bus speed in Hz
868 * Returns: 0 on success, not 0 on failure
929 * @return the number of I2C bus (zero based), or -1 on error
938 * @return 0 if port was reset, -1 if not found