6b5bc77c9b
Stefan thinks they don't add value. Command used: sed -i -e '/file is part of /d' $(git grep "file is part of " |egrep ":( */\*.*\*/\$|#|;#|-- | *\* )" | cut -d: -f1 |grep -v crossgcc |grep -v gcov | grep -v /elf.h |grep -v nvramtool) The exceptions are for: - crossgcc (patch file) - gcov (imported from gcc) - elf.h (imported from GNU's libc) - nvramtool (more complicated header) The removed lines are: - fmt.Fprintln(f, "/* This file is part of the coreboot project. */") -# This file is part of a set of unofficial pre-commit hooks available -/* This file is part of coreboot */ -# This file is part of msrtool. -/* This file is part of msrtool. */ - * This file is part of ncurses, designed to be appended after curses.h.in -/* This file is part of pgtblgen. */ - * This file is part of the coreboot project. - /* This file is part of the coreboot project. */ -# This file is part of the coreboot project. -# This file is part of the coreboot project. -## This file is part of the coreboot project. --- This file is part of the coreboot project. -/* This file is part of the coreboot project */ -/* This file is part of the coreboot project. */ -;## This file is part of the coreboot project. -# This file is part of the coreboot project. It originated in the - * This file is part of the coreinfo project. -## This file is part of the coreinfo project. - * This file is part of the depthcharge project. -/* This file is part of the depthcharge project. */ -/* This file is part of the ectool project. */ - * This file is part of the GNU C Library. - * This file is part of the libpayload project. -## This file is part of the libpayload project. -/* This file is part of the Linux kernel. */ -## This file is part of the superiotool project. -/* This file is part of the superiotool project */ -/* This file is part of uio_usbdebug */ Change-Id: I82d872b3b337388c93d5f5bf704e9ee9e53ab3a9 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41194 Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
88 lines
2.3 KiB
C
88 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef _DEVICE_I2C_BUS_H_
|
|
#define _DEVICE_I2C_BUS_H_
|
|
|
|
#include <stdint.h>
|
|
#include <device/i2c.h>
|
|
#include <device/device.h>
|
|
|
|
/* I2C bus operation for ramstage drivers */
|
|
struct i2c_bus_operations {
|
|
int (*transfer)(struct device *, const struct i2c_msg *, size_t count);
|
|
};
|
|
|
|
/*
|
|
* Returns the first upstream facing link whose bus implements either
|
|
* `i2c_bus_operations` *or* `smbus_bus_operations`.
|
|
*
|
|
* If not NULL, guarantees that `->dev`, `->dev->ops` and either
|
|
* `->dev->ops->ops_i2c_bus` or `->dev->ops->ops_smbus_bus` are
|
|
* not NULL.
|
|
*/
|
|
struct bus *i2c_link(struct device *);
|
|
|
|
/*
|
|
* Shorthand for `i2c_link(dev)->dev`.
|
|
*
|
|
* Returns NULL if i2c_link(dev) returns NULL.
|
|
*/
|
|
static inline DEVTREE_CONST struct device *i2c_busdev(struct device *dev)
|
|
{
|
|
struct bus *const link = i2c_link(dev);
|
|
return link ? link->dev : NULL;
|
|
}
|
|
|
|
/*
|
|
* Slave driver interface functions. These will look for the next
|
|
* `i2c_bus_operations` *or* `smbus_bus_operations` and perform the
|
|
* respective transfers.
|
|
*
|
|
* The interface is limited to what current slave drivers demand.
|
|
* Extend as required.
|
|
*
|
|
* All functions return a negative `enum cb_err` value on error.
|
|
* Either CB_ERR, CB_ERR_ARG or any CB_I2C_* (cf. include/types.h).
|
|
*/
|
|
|
|
/*
|
|
* Reads one byte.
|
|
* Compatible to smbus_recv_byte().
|
|
*
|
|
* Returns the read byte on success, negative `enum cb_err` value on error.
|
|
*/
|
|
int i2c_dev_readb(struct device *);
|
|
|
|
/*
|
|
* Writes the byte `val`.
|
|
* Compatible to smbus_send_byte().
|
|
*
|
|
* Returns 0 on success, negative `enum cb_err` value on error.
|
|
*/
|
|
int i2c_dev_writeb(struct device *, uint8_t val);
|
|
|
|
/*
|
|
* Sends the register offset `off` and reads one byte.
|
|
* Compatible to smbus_read_byte().
|
|
*
|
|
* Returns the read byte on success, negative `enum cb_err` value on error.
|
|
*/
|
|
int i2c_dev_readb_at(struct device *, uint8_t off);
|
|
|
|
/*
|
|
* Sends the register offset `off` followed by the byte `val`.
|
|
* Compatible to smbus_write_byte().
|
|
*
|
|
* Returns 0 on success, negative `enum cb_err` value on error.
|
|
*/
|
|
int i2c_dev_writeb_at(struct device *, uint8_t off, uint8_t val);
|
|
|
|
/*
|
|
* Sends the 16-bit register offset `off` and reads `len` bytes into `buf`.
|
|
*
|
|
* Returns the number of bytes read on success, negative `enum cb_err`
|
|
* value on error.
|
|
*/
|
|
int i2c_dev_read_at16(struct device *, uint8_t *buf, size_t len, uint16_t off);
|
|
|
|
#endif /* _DEVICE_I2C_BUS_H_ */
|