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