X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=qemu%2Froms%2Fu-boot%2Fcommon%2Fcros_ec.c;fp=qemu%2Froms%2Fu-boot%2Fcommon%2Fcros_ec.c;h=b8ce1b581aab463f65330e4dcc769f3fc00b1f19;hb=e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb;hp=0000000000000000000000000000000000000000;hpb=9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00;p=kvmfornfv.git diff --git a/qemu/roms/u-boot/common/cros_ec.c b/qemu/roms/u-boot/common/cros_ec.c new file mode 100644 index 000000000..b8ce1b581 --- /dev/null +++ b/qemu/roms/u-boot/common/cros_ec.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + */ + +#include +#include +DECLARE_GLOBAL_DATA_PTR; + +struct local_info { + struct cros_ec_dev *cros_ec_dev; /* Pointer to cros_ec device */ + int cros_ec_err; /* Error for cros_ec, 0 if ok */ +}; + +static struct local_info local; + +struct cros_ec_dev *board_get_cros_ec_dev(void) +{ + return local.cros_ec_dev; +} + +static int board_init_cros_ec_devices(const void *blob) +{ + local.cros_ec_err = cros_ec_init(blob, &local.cros_ec_dev); + if (local.cros_ec_err) + return -1; /* Will report in board_late_init() */ + + return 0; +} + +int cros_ec_board_init(void) +{ + return board_init_cros_ec_devices(gd->fdt_blob); +} + +int cros_ec_get_error(void) +{ + return local.cros_ec_err; +}