X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fcros_ec.h;h=771a176eeabb4df247eed5ced0c9ce59b99b3da4;hb=23a12cb3d05ee2caa860bee7b6f0ebcb40afacce;hp=3b2be2c2fa642dc91c8511f07b9960624f10f5b3;hpb=b939689c7b87773c44275a578ffc8674a867e39d;p=u-boot diff --git a/include/cros_ec.h b/include/cros_ec.h index 3b2be2c2fa..771a176eea 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -11,9 +11,9 @@ #include #include -#include #include #include +#include /* Our configuration information */ struct cros_ec_dev { @@ -81,7 +81,7 @@ int cros_ec_read_id(struct cros_ec_dev *dev, char *id, int maxlen); * @param scan Place to put the scan results * @return 0 if ok, -1 on error */ -int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan); +int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan); /** * Read which image is currently running on the CROS-EC device. @@ -125,7 +125,7 @@ int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd, * @param dev CROS-EC device * @return 0 if no interrupt is pending */ -int cros_ec_interrupt_pending(struct cros_ec_dev *dev); +int cros_ec_interrupt_pending(struct udevice *dev); enum { CROS_EC_OK, @@ -250,15 +250,6 @@ void cros_ec_dump_data(const char *name, int cmd, const uint8_t *data, int len); */ int cros_ec_calc_checksum(const uint8_t *data, int size); -/** - * Decode a flash region parameter - * - * @param argc Number of params remaining - * @param argv List of remaining parameters - * @return flash region (EC_FLASH_REGION_...) or -1 on error - */ -int cros_ec_decode_region(int argc, char * const argv[]); - int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset, uint32_t size); @@ -280,6 +271,17 @@ int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset, int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset, uint32_t size); +/** + * Read back flash parameters + * + * This function reads back parameters of the flash as reported by the EC + * + * @param dev Pointer to device + * @param info Pointer to output flash info struct + */ +int cros_ec_read_flashinfo(struct cros_ec_dev *dev, + struct ec_response_flash_info *info); + /** * Write data to the flash * @@ -350,7 +352,7 @@ int cros_ec_read_build_info(struct cros_ec_dev *dev, char **strp); * @param state new state of the LDO/FET : EC_LDO_STATE_ON|OFF * @return 0 if ok, -1 on error */ -int cros_ec_set_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t state); +int cros_ec_set_ldo(struct udevice *dev, uint8_t index, uint8_t state); /** * Read back a LDO / FET current state. @@ -360,7 +362,7 @@ int cros_ec_set_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t state); * @param state current state of the LDO/FET : EC_LDO_STATE_ON|OFF * @return 0 if ok, -1 on error */ -int cros_ec_get_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t *state); +int cros_ec_get_ldo(struct udevice *dev, uint8_t index, uint8_t *state); /** * Get access to the error reported when cros_ec_board_init() was called @@ -375,12 +377,10 @@ int cros_ec_get_error(void); /** * Returns information from the FDT about the Chrome EC flash * - * @param blob FDT blob to use - * @param node Node offset to read from + * @param dev Device to read from * @param config Structure to use to return information */ -int cros_ec_decode_ec_flash(const void *blob, int node, - struct fdt_cros_ec *config); +int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config); /** * Check the current keyboard state, in case recovery mode is requested. @@ -390,18 +390,16 @@ int cros_ec_decode_ec_flash(const void *blob, int node, */ void cros_ec_check_keyboard(struct cros_ec_dev *dev); +struct i2c_msg; /* * Tunnel an I2C transfer to the EC * * @param dev CROS-EC device - * @param chip Chip address (7-bit I2C address) - * @param addr Register address to read/write - * @param alen Length of register address in bytes - * @param buffer Buffer containing data to read/write - * @param len Length of buffer - * @param is_read 1 if this is a read, 0 if this is a write + * @param port The remote port on EC to use + * @param msg List of messages to transfer + * @param nmsgs Number of messages to transfer */ -int cros_ec_i2c_xfer(struct cros_ec_dev *dev, uchar chip, uint addr, - int alen, uchar *buffer, int len, int is_read); +int cros_ec_i2c_tunnel(struct udevice *dev, int port, struct i2c_msg *msg, + int nmsgs); #endif