Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Chromium OS cros_ec driver |
| 4 | * |
| 5 | * Copyright (c) 2012 The Chromium OS Authors. |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _CROS_EC_H |
| 9 | #define _CROS_EC_H |
| 10 | |
| 11 | #include <linux/compiler.h> |
| 12 | #include <ec_commands.h> |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 13 | #include <cros_ec_message.h> |
Simon Glass | 32f8a19 | 2015-01-05 20:05:32 -0700 | [diff] [blame] | 14 | #include <asm/gpio.h> |
Simon Glass | b7e0d73 | 2017-05-18 20:09:02 -0600 | [diff] [blame] | 15 | #include <dm/of_extra.h> |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 16 | |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 17 | /* Our configuration information */ |
| 18 | struct cros_ec_dev { |
Simon Glass | 84d6cbd | 2014-10-13 23:42:14 -0600 | [diff] [blame] | 19 | struct udevice *dev; /* Transport device */ |
Simon Glass | 32f8a19 | 2015-01-05 20:05:32 -0700 | [diff] [blame] | 20 | struct gpio_desc ec_int; /* GPIO used as EC interrupt line */ |
Randall Spangler | e8c1266 | 2014-02-27 13:26:08 -0700 | [diff] [blame] | 21 | int protocol_version; /* Protocol version to use */ |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 22 | int optimise_flash_write; /* Don't write erased flash blocks */ |
| 23 | |
| 24 | /* |
| 25 | * These two buffers will always be dword-aligned and include enough |
| 26 | * space for up to 7 word-alignment bytes also, so we can ensure that |
| 27 | * the body of the message is always dword-aligned (64-bit). |
| 28 | * |
| 29 | * We use this alignment to keep ARM and x86 happy. Probably word |
| 30 | * alignment would be OK, there might be a small performance advantage |
| 31 | * to using dword. |
| 32 | */ |
| 33 | uint8_t din[ALIGN(MSG_BYTES + sizeof(int64_t), sizeof(int64_t))] |
| 34 | __aligned(sizeof(int64_t)); |
| 35 | uint8_t dout[ALIGN(MSG_BYTES + sizeof(int64_t), sizeof(int64_t))] |
| 36 | __aligned(sizeof(int64_t)); |
| 37 | }; |
| 38 | |
| 39 | /* |
| 40 | * Hard-code the number of columns we happen to know we have right now. It |
| 41 | * would be more correct to call cros_ec_info() at startup and determine the |
| 42 | * actual number of keyboard cols from there. |
| 43 | */ |
| 44 | #define CROS_EC_KEYSCAN_COLS 13 |
| 45 | |
| 46 | /* Information returned by a key scan */ |
| 47 | struct mbkp_keyscan { |
| 48 | uint8_t data[CROS_EC_KEYSCAN_COLS]; |
| 49 | }; |
| 50 | |
Simon Glass | d7f25f3 | 2014-02-27 13:26:03 -0700 | [diff] [blame] | 51 | /* Holds information about the Chrome EC */ |
| 52 | struct fdt_cros_ec { |
| 53 | struct fmap_entry flash; /* Address and size of EC flash */ |
| 54 | /* |
| 55 | * Byte value of erased flash, or -1 if not known. It is normally |
| 56 | * 0xff but some flash devices use 0 (e.g. STM32Lxxx) |
| 57 | */ |
| 58 | int flash_erase_value; |
| 59 | struct fmap_entry region[EC_FLASH_REGION_COUNT]; |
| 60 | }; |
| 61 | |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 62 | /** |
| 63 | * Read the ID of the CROS-EC device |
| 64 | * |
| 65 | * The ID is a string identifying the CROS-EC device. |
| 66 | * |
| 67 | * @param dev CROS-EC device |
| 68 | * @param id Place to put the ID |
| 69 | * @param maxlen Maximum length of the ID field |
| 70 | * @return 0 if ok, -1 on error |
| 71 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 72 | int cros_ec_read_id(struct udevice *dev, char *id, int maxlen); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 73 | |
| 74 | /** |
| 75 | * Read a keyboard scan from the CROS-EC device |
| 76 | * |
| 77 | * Send a message requesting a keyboard scan and return the result |
| 78 | * |
| 79 | * @param dev CROS-EC device |
| 80 | * @param scan Place to put the scan results |
| 81 | * @return 0 if ok, -1 on error |
| 82 | */ |
Simon Glass | 745009c | 2015-10-18 21:17:14 -0600 | [diff] [blame] | 83 | int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Read which image is currently running on the CROS-EC device. |
| 87 | * |
| 88 | * @param dev CROS-EC device |
| 89 | * @param image Destination for image identifier |
| 90 | * @return 0 if ok, <0 on error |
| 91 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 92 | int cros_ec_read_current_image(struct udevice *dev, |
| 93 | enum ec_current_image *image); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 94 | |
| 95 | /** |
| 96 | * Read the hash of the CROS-EC device firmware. |
| 97 | * |
| 98 | * @param dev CROS-EC device |
Simon Glass | a12ef7e | 2018-10-01 12:22:38 -0600 | [diff] [blame] | 99 | * @param hash_offset Offset in flash to read from |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 100 | * @param hash Destination for hash information |
| 101 | * @return 0 if ok, <0 on error |
| 102 | */ |
Simon Glass | a12ef7e | 2018-10-01 12:22:38 -0600 | [diff] [blame] | 103 | int cros_ec_read_hash(struct udevice *dev, uint hash_offset, |
| 104 | struct ec_response_vboot_hash *hash); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 105 | |
| 106 | /** |
| 107 | * Send a reboot command to the CROS-EC device. |
| 108 | * |
| 109 | * Note that some reboot commands (such as EC_REBOOT_COLD) also reboot the AP. |
| 110 | * |
| 111 | * @param dev CROS-EC device |
| 112 | * @param cmd Reboot command |
| 113 | * @param flags Flags for reboot command (EC_REBOOT_FLAG_*) |
| 114 | * @return 0 if ok, <0 on error |
| 115 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 116 | int cros_ec_reboot(struct udevice *dev, enum ec_reboot_cmd cmd, uint8_t flags); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 117 | |
| 118 | /** |
| 119 | * Check if the CROS-EC device has an interrupt pending. |
| 120 | * |
| 121 | * Read the status of the external interrupt connected to the CROS-EC device. |
| 122 | * If no external interrupt is configured, this always returns 1. |
| 123 | * |
| 124 | * @param dev CROS-EC device |
| 125 | * @return 0 if no interrupt is pending |
| 126 | */ |
Simon Glass | 745009c | 2015-10-18 21:17:14 -0600 | [diff] [blame] | 127 | int cros_ec_interrupt_pending(struct udevice *dev); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 128 | |
| 129 | enum { |
| 130 | CROS_EC_OK, |
| 131 | CROS_EC_ERR = 1, |
| 132 | CROS_EC_ERR_FDT_DECODE, |
| 133 | CROS_EC_ERR_CHECK_VERSION, |
| 134 | CROS_EC_ERR_READ_ID, |
| 135 | CROS_EC_ERR_DEV_INIT, |
| 136 | }; |
| 137 | |
| 138 | /** |
Simon Glass | 836bb6e | 2014-02-27 13:26:07 -0700 | [diff] [blame] | 139 | * Initialise the Chromium OS EC driver |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 140 | * |
| 141 | * @param blob Device tree blob containing setup information |
| 142 | * @param cros_ecp Returns pointer to the cros_ec device, or NULL if none |
| 143 | * @return 0 if we got an cros_ec device and all is well (or no cros_ec is |
| 144 | * expected), -ve if we should have an cros_ec device but failed to find |
| 145 | * one, or init failed (-CROS_EC_ERR_...). |
| 146 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 147 | int cros_ec_init(const void *blob, struct udevice**cros_ecp); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 148 | |
| 149 | /** |
| 150 | * Read information about the keyboard matrix |
| 151 | * |
| 152 | * @param dev CROS-EC device |
| 153 | * @param info Place to put the info structure |
| 154 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 155 | int cros_ec_info(struct udevice *dev, struct ec_response_mkbp_info *info); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 156 | |
| 157 | /** |
| 158 | * Read the host event flags |
| 159 | * |
| 160 | * @param dev CROS-EC device |
| 161 | * @param events_ptr Destination for event flags. Not changed on error. |
| 162 | * @return 0 if ok, <0 on error |
| 163 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 164 | int cros_ec_get_host_events(struct udevice *dev, uint32_t *events_ptr); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 165 | |
| 166 | /** |
| 167 | * Clear the specified host event flags |
| 168 | * |
| 169 | * @param dev CROS-EC device |
| 170 | * @param events Event flags to clear |
| 171 | * @return 0 if ok, <0 on error |
| 172 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 173 | int cros_ec_clear_host_events(struct udevice *dev, uint32_t events); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 174 | |
| 175 | /** |
| 176 | * Get/set flash protection |
| 177 | * |
| 178 | * @param dev CROS-EC device |
| 179 | * @param set_mask Mask of flags to set; if 0, just retrieves existing |
| 180 | * protection state without changing it. |
| 181 | * @param set_flags New flag values; only bits in set_mask are applied; |
| 182 | * ignored if set_mask=0. |
| 183 | * @param prot Destination for updated protection state from EC. |
| 184 | * @return 0 if ok, <0 on error |
| 185 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 186 | int cros_ec_flash_protect(struct udevice *dev, uint32_t set_mask, |
| 187 | uint32_t set_flags, |
| 188 | struct ec_response_flash_protect *resp); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 189 | |
| 190 | |
| 191 | /** |
| 192 | * Run internal tests on the cros_ec interface. |
| 193 | * |
| 194 | * @param dev CROS-EC device |
| 195 | * @return 0 if ok, <0 if the test failed |
| 196 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 197 | int cros_ec_test(struct udevice *dev); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 198 | |
| 199 | /** |
| 200 | * Update the EC RW copy. |
| 201 | * |
| 202 | * @param dev CROS-EC device |
| 203 | * @param image the content to write |
| 204 | * @param imafge_size content length |
| 205 | * @return 0 if ok, <0 if the test failed |
| 206 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 207 | int cros_ec_flash_update_rw(struct udevice *dev, const uint8_t *image, |
| 208 | int image_size); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 209 | |
| 210 | /** |
| 211 | * Return a pointer to the board's CROS-EC device |
| 212 | * |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 213 | * @return pointer to CROS-EC device, or NULL if none is available |
| 214 | */ |
Simon Glass | 42116f6 | 2018-10-01 12:22:23 -0600 | [diff] [blame] | 215 | struct udevice *board_get_cros_ec_dev(void); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 216 | |
Simon Glass | 84d6cbd | 2014-10-13 23:42:14 -0600 | [diff] [blame] | 217 | struct dm_cros_ec_ops { |
| 218 | int (*check_version)(struct udevice *dev); |
| 219 | int (*command)(struct udevice *dev, uint8_t cmd, int cmd_version, |
| 220 | const uint8_t *dout, int dout_len, |
| 221 | uint8_t **dinp, int din_len); |
| 222 | int (*packet)(struct udevice *dev, int out_bytes, int in_bytes); |
| 223 | }; |
| 224 | |
| 225 | #define dm_cros_ec_get_ops(dev) \ |
| 226 | ((struct dm_cros_ec_ops *)(dev)->driver->ops) |
| 227 | |
| 228 | int cros_ec_register(struct udevice *dev); |
| 229 | |
Randall Spangler | a607028 | 2014-02-27 13:26:10 -0700 | [diff] [blame] | 230 | /** |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 231 | * Dump a block of data for a command. |
| 232 | * |
| 233 | * @param name Name for data (e.g. 'in', 'out') |
| 234 | * @param cmd Command number associated with data, or -1 for none |
| 235 | * @param data Data block to dump |
| 236 | * @param len Length of data block to dump |
| 237 | */ |
| 238 | void cros_ec_dump_data(const char *name, int cmd, const uint8_t *data, int len); |
| 239 | |
| 240 | /** |
| 241 | * Calculate a simple 8-bit checksum of a data block |
| 242 | * |
| 243 | * @param data Data block to checksum |
| 244 | * @param size Size of data block in bytes |
| 245 | * @return checksum value (0 to 255) |
| 246 | */ |
| 247 | int cros_ec_calc_checksum(const uint8_t *data, int size); |
| 248 | |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 249 | int cros_ec_flash_erase(struct udevice *dev, uint32_t offset, uint32_t size); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 250 | |
| 251 | /** |
| 252 | * Read data from the flash |
| 253 | * |
| 254 | * Read an arbitrary amount of data from the EC flash, by repeatedly reading |
| 255 | * small blocks. |
| 256 | * |
| 257 | * The offset starts at 0. You can obtain the region information from |
| 258 | * cros_ec_flash_offset() to find out where to read for a particular region. |
| 259 | * |
| 260 | * @param dev CROS-EC device |
| 261 | * @param data Pointer to data buffer to read into |
| 262 | * @param offset Offset within flash to read from |
| 263 | * @param size Number of bytes to read |
| 264 | * @return 0 if ok, -1 on error |
| 265 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 266 | int cros_ec_flash_read(struct udevice *dev, uint8_t *data, uint32_t offset, |
| 267 | uint32_t size); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 268 | |
| 269 | /** |
Moritz Fischer | bfeba01 | 2016-10-04 17:08:08 -0700 | [diff] [blame] | 270 | * Read back flash parameters |
| 271 | * |
| 272 | * This function reads back parameters of the flash as reported by the EC |
| 273 | * |
| 274 | * @param dev Pointer to device |
| 275 | * @param info Pointer to output flash info struct |
| 276 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 277 | int cros_ec_read_flashinfo(struct udevice *dev, |
| 278 | struct ec_response_flash_info *info); |
Moritz Fischer | bfeba01 | 2016-10-04 17:08:08 -0700 | [diff] [blame] | 279 | |
| 280 | /** |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 281 | * Write data to the flash |
| 282 | * |
| 283 | * Write an arbitrary amount of data to the EC flash, by repeatedly writing |
| 284 | * small blocks. |
| 285 | * |
| 286 | * The offset starts at 0. You can obtain the region information from |
| 287 | * cros_ec_flash_offset() to find out where to write for a particular region. |
| 288 | * |
| 289 | * Attempting to write to the region where the EC is currently running from |
| 290 | * will result in an error. |
| 291 | * |
| 292 | * @param dev CROS-EC device |
| 293 | * @param data Pointer to data buffer to write |
| 294 | * @param offset Offset within flash to write to. |
| 295 | * @param size Number of bytes to write |
| 296 | * @return 0 if ok, -1 on error |
| 297 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 298 | int cros_ec_flash_write(struct udevice *dev, const uint8_t *data, |
| 299 | uint32_t offset, uint32_t size); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 300 | |
| 301 | /** |
| 302 | * Obtain position and size of a flash region |
| 303 | * |
| 304 | * @param dev CROS-EC device |
| 305 | * @param region Flash region to query |
| 306 | * @param offset Returns offset of flash region in EC flash |
| 307 | * @param size Returns size of flash region |
| 308 | * @return 0 if ok, -1 on error |
| 309 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 310 | int cros_ec_flash_offset(struct udevice *dev, enum ec_flash_region region, |
| 311 | uint32_t *offset, uint32_t *size); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 312 | |
| 313 | /** |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 314 | * Read/write non-volatile data from/to a CROS-EC device. |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 315 | * |
| 316 | * @param dev CROS-EC device |
| 317 | * @param block Buffer of VbNvContext to be read/write |
| 318 | * @return 0 if ok, -1 on error |
| 319 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 320 | int cros_ec_read_nvdata(struct udevice *dev, uint8_t *block, int size); |
| 321 | int cros_ec_write_nvdata(struct udevice *dev, const uint8_t *block, int size); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 322 | |
| 323 | /** |
| 324 | * Read the version information for the EC images |
| 325 | * |
| 326 | * @param dev CROS-EC device |
| 327 | * @param versionp This is set to point to the version information |
| 328 | * @return 0 if ok, -1 on error |
| 329 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 330 | int cros_ec_read_version(struct udevice *dev, |
| 331 | struct ec_response_get_version **versionp); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 332 | |
| 333 | /** |
| 334 | * Read the build information for the EC |
| 335 | * |
| 336 | * @param dev CROS-EC device |
| 337 | * @param versionp This is set to point to the build string |
| 338 | * @return 0 if ok, -1 on error |
| 339 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 340 | int cros_ec_read_build_info(struct udevice *dev, char **strp); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 341 | |
| 342 | /** |
| 343 | * Switch on/off a LDO / FET. |
| 344 | * |
| 345 | * @param dev CROS-EC device |
| 346 | * @param index index of the LDO/FET to switch |
| 347 | * @param state new state of the LDO/FET : EC_LDO_STATE_ON|OFF |
| 348 | * @return 0 if ok, -1 on error |
| 349 | */ |
Simon Glass | f48eaf0 | 2015-08-03 08:19:24 -0600 | [diff] [blame] | 350 | int cros_ec_set_ldo(struct udevice *dev, uint8_t index, uint8_t state); |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 351 | |
| 352 | /** |
| 353 | * Read back a LDO / FET current state. |
| 354 | * |
| 355 | * @param dev CROS-EC device |
| 356 | * @param index index of the LDO/FET to switch |
| 357 | * @param state current state of the LDO/FET : EC_LDO_STATE_ON|OFF |
| 358 | * @return 0 if ok, -1 on error |
| 359 | */ |
Simon Glass | f48eaf0 | 2015-08-03 08:19:24 -0600 | [diff] [blame] | 360 | int cros_ec_get_ldo(struct udevice *dev, uint8_t index, uint8_t *state); |
Vadim Bendebury | 41364f0 | 2014-02-27 13:26:02 -0700 | [diff] [blame] | 361 | |
| 362 | /** |
Vadim Bendebury | 41364f0 | 2014-02-27 13:26:02 -0700 | [diff] [blame] | 363 | * Get access to the error reported when cros_ec_board_init() was called |
| 364 | * |
| 365 | * This permits delayed reporting of the EC error if it failed during |
| 366 | * early init. |
| 367 | * |
| 368 | * @return error (0 if there was no error, -ve if there was an error) |
| 369 | */ |
| 370 | int cros_ec_get_error(void); |
| 371 | |
Simon Glass | d7f25f3 | 2014-02-27 13:26:03 -0700 | [diff] [blame] | 372 | /** |
| 373 | * Returns information from the FDT about the Chrome EC flash |
| 374 | * |
Simon Glass | 2ec9d17 | 2017-05-18 20:09:23 -0600 | [diff] [blame] | 375 | * @param dev Device to read from |
Simon Glass | d7f25f3 | 2014-02-27 13:26:03 -0700 | [diff] [blame] | 376 | * @param config Structure to use to return information |
| 377 | */ |
Simon Glass | 2ec9d17 | 2017-05-18 20:09:23 -0600 | [diff] [blame] | 378 | int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config); |
Simon Glass | d7f25f3 | 2014-02-27 13:26:03 -0700 | [diff] [blame] | 379 | |
Simon Glass | df93d90 | 2014-02-27 13:26:12 -0700 | [diff] [blame] | 380 | /** |
| 381 | * Check the current keyboard state, in case recovery mode is requested. |
| 382 | * This function is for sandbox only. |
| 383 | * |
| 384 | * @param ec CROS-EC device |
| 385 | */ |
Simon Glass | 6322a7b | 2018-10-01 12:22:22 -0600 | [diff] [blame] | 386 | void cros_ec_check_keyboard(struct udevice *dev); |
Simon Glass | df93d90 | 2014-02-27 13:26:12 -0700 | [diff] [blame] | 387 | |
Simon Glass | cc456bd | 2015-08-03 08:19:23 -0600 | [diff] [blame] | 388 | struct i2c_msg; |
| 389 | /* |
| 390 | * Tunnel an I2C transfer to the EC |
| 391 | * |
| 392 | * @param dev CROS-EC device |
Moritz Fischer | 6d1a718 | 2016-09-27 15:42:07 -0700 | [diff] [blame] | 393 | * @param port The remote port on EC to use |
Simon Glass | cc456bd | 2015-08-03 08:19:23 -0600 | [diff] [blame] | 394 | * @param msg List of messages to transfer |
| 395 | * @param nmsgs Number of messages to transfer |
| 396 | */ |
Moritz Fischer | 6d1a718 | 2016-09-27 15:42:07 -0700 | [diff] [blame] | 397 | int cros_ec_i2c_tunnel(struct udevice *dev, int port, struct i2c_msg *msg, |
| 398 | int nmsgs); |
Simon Glass | cc456bd | 2015-08-03 08:19:23 -0600 | [diff] [blame] | 399 | |
Hung-ying Tyan | 8836438 | 2013-05-15 18:27:28 +0800 | [diff] [blame] | 400 | #endif |