cros_ec_tunnel.c 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2015 Google, Inc
  3. * Written by Simon Glass <sjg@chromium.org>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <dm.h>
  9. #include <cros_ec.h>
  10. #include <errno.h>
  11. #include <i2c.h>
  12. static int cros_ec_i2c_set_bus_speed(struct udevice *dev, unsigned int speed)
  13. {
  14. return 0;
  15. }
  16. static int cros_ec_i2c_xfer(struct udevice *dev, struct i2c_msg *msg,
  17. int nmsgs)
  18. {
  19. return cros_ec_i2c_tunnel(dev->parent, msg, nmsgs);
  20. }
  21. static const struct dm_i2c_ops cros_ec_i2c_ops = {
  22. .xfer = cros_ec_i2c_xfer,
  23. .set_bus_speed = cros_ec_i2c_set_bus_speed,
  24. };
  25. static const struct udevice_id cros_ec_i2c_ids[] = {
  26. { .compatible = "google,cros-ec-i2c-tunnel" },
  27. { }
  28. };
  29. U_BOOT_DRIVER(cros_ec_tunnel) = {
  30. .name = "cros_ec_tunnel",
  31. .id = UCLASS_I2C,
  32. .of_match = cros_ec_i2c_ids,
  33. .per_child_auto_alloc_size = sizeof(struct dm_i2c_chip),
  34. .ops = &cros_ec_i2c_ops,
  35. };