Lines Matching full:chip

43  * i2c_setup_offset() - Set up a new message with a chip offset
45 * @chip: Chip to use
46 * @offset: Byte offset within chip
52 static int i2c_setup_offset(struct dm_i2c_chip *chip, uint offset, in i2c_setup_offset() argument
55 int offset_len = chip->offset_len; in i2c_setup_offset()
57 msg->addr = chip->chip_addr; in i2c_setup_offset()
58 if (chip->chip_addr_offset_mask) in i2c_setup_offset()
60 chip->chip_addr_offset_mask; in i2c_setup_offset()
61 msg->flags = chip->flags & DM_I2C_CHIP_10BIT ? I2C_M_TEN : 0; in i2c_setup_offset()
62 msg->len = chip->offset_len; in i2c_setup_offset()
77 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_read_bytewise() local
86 if (i2c_setup_offset(chip, offset + i, offset_buf, msg)) in i2c_read_bytewise()
106 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_write_bytewise() local
115 if (i2c_setup_offset(chip, offset + i, buf, msg)) in i2c_write_bytewise()
129 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in dm_i2c_read() local
138 if (chip->flags & DM_I2C_CHIP_RD_ADDRESS) in dm_i2c_read()
141 if (!i2c_setup_offset(chip, offset, offset_buf, ptr)) in dm_i2c_read()
146 ptr->flags = chip->flags & DM_I2C_CHIP_10BIT ? I2C_M_TEN : 0; in dm_i2c_read()
160 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in dm_i2c_write() local
168 if (chip->flags & DM_I2C_CHIP_WR_ADDRESS) in dm_i2c_write()
191 i2c_setup_offset(chip, offset, buf, msg); in dm_i2c_write()
193 memcpy(buf + chip->offset_len, buffer, len); in dm_i2c_write()
203 i2c_setup_offset(chip, offset, buf, msg); in dm_i2c_write()
205 memcpy(buf + chip->offset_len, buffer, len); in dm_i2c_write()
244 * i2c_probe_chip() - probe for a chip on a bus
247 * @chip_addr: Chip address to probe
248 * @flags: Flags for the chip
249 * @return 0 if found, -ENOSYS if the driver is invalid, -EREMOTEIO if the chip
280 struct dm_i2c_chip *chip; in i2c_bind_driver() local
295 chip = dev_get_parent_platdata(dev); in i2c_bind_driver()
296 chip->chip_addr = chip_addr; in i2c_bind_driver()
297 chip->offset_len = offset_len; in i2c_bind_driver()
326 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_get_chip() local
329 if (chip->chip_addr == (chip_addr & in i2c_get_chip()
330 ~chip->chip_addr_offset_mask)) { in i2c_get_chip()
355 /* detect the presence of the chip on the bus */ in i2c_get_chip_for_busnum()
360 debug("Cannot detect I2C chip %02x on bus %d\n", chip_addr, in i2c_get_chip_for_busnum()
367 debug("Cannot find I2C chip %02x on bus %d\n", chip_addr, in i2c_get_chip_for_busnum()
382 /* First probe that chip */ in dm_i2c_probe()
389 /* The chip was found, see if we have a driver, and probe it */ in dm_i2c_probe()
431 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_set_chip_flags() local
440 chip->flags = flags; in i2c_set_chip_flags()
447 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_get_chip_flags() local
449 *flagsp = chip->flags; in i2c_get_chip_flags()
456 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_set_chip_offset_len() local
460 chip->offset_len = offset_len; in i2c_set_chip_offset_len()
467 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_get_chip_offset_len() local
469 return chip->offset_len; in i2c_get_chip_offset_len()
474 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_set_chip_addr_offset_mask() local
476 chip->chip_addr_offset_mask = mask; in i2c_set_chip_addr_offset_mask()
483 struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); in i2c_get_chip_addr_offset_mask() local
485 return chip->chip_addr_offset_mask; in i2c_get_chip_addr_offset_mask()
597 int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip) in i2c_chip_ofdata_to_platdata() argument
601 chip->offset_len = dev_read_u32_default(dev, "u-boot,i2c-offset-len", in i2c_chip_ofdata_to_platdata()
603 chip->flags = 0; in i2c_chip_ofdata_to_platdata()
610 chip->chip_addr = addr; in i2c_chip_ofdata_to_platdata()