Select Git revision
Forked from
Reform / reform-boundary-uboot
Source project has a limited visibility.
-
Olav Morken authored
This patch removes volatile from: volatile IP_t *ip = (IP_t *)xip; Due to a bug, avr32-gcc will assume that ip is aligned on a word boundary when using volatile, which causes an exception since xip isn't aligned on a word boundary. Signed-off-by:
Gunnar Rangoy <gunnar@rangoy.com> Signed-off-by:
Paul Driveklepp <pauldriveklepp@gmail.com> Signed-off-by:
Olav Morken <olavmrk@gmail.com> Signed-off-by:
Ben Warren <biggerbadderben@gmail.com>
Olav Morken authoredThis patch removes volatile from: volatile IP_t *ip = (IP_t *)xip; Due to a bug, avr32-gcc will assume that ip is aligned on a word boundary when using volatile, which causes an exception since xip isn't aligned on a word boundary. Signed-off-by:
Gunnar Rangoy <gunnar@rangoy.com> Signed-off-by:
Paul Driveklepp <pauldriveklepp@gmail.com> Signed-off-by:
Olav Morken <olavmrk@gmail.com> Signed-off-by:
Ben Warren <biggerbadderben@gmail.com>
cros_ec_spi.c 5.93 KiB
/*
* Chromium OS cros_ec driver - SPI interface
*
* Copyright (c) 2012 The Chromium OS Authors.
*
* SPDX-License-Identifier: GPL-2.0+
*/
/*
* The Matrix Keyboard Protocol driver handles talking to the keyboard
* controller chip. Mostly this is for keyboard functions, but some other
* things have slipped in, so we provide generic services to talk to the
* KBC.
*/
#include <common.h>
#include <cros_ec.h>
#include <dm.h>
#include <errno.h>
#include <spi.h>
DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_DM_CROS_EC
int cros_ec_spi_packet(struct udevice *udev, int out_bytes, int in_bytes)
{
struct cros_ec_dev *dev = udev->uclass_priv;
#else
int cros_ec_spi_packet(struct cros_ec_dev *dev, int out_bytes, int in_bytes)
{
#endif
struct spi_slave *slave = dev_get_parentdata(dev->dev);
int rv;
/* Do the transfer */
if (spi_claim_bus(slave)) {
debug("%s: Cannot claim SPI bus\n", __func__);
return -1;
}
rv = spi_xfer(slave, max(out_bytes, in_bytes) * 8,
dev->dout, dev->din,
SPI_XFER_BEGIN | SPI_XFER_END);
spi_release_bus(slave);
if (rv) {
debug("%s: Cannot complete SPI transfer\n", __func__);
return -1;
}
return in_bytes;
}
/**
* Send a command to a LPC CROS_EC device and return the reply.
*
* The device's internal input/output buffers are used.
*
* @param dev CROS_EC device
* @param cmd Command to send (EC_CMD_...)
* @param cmd_version Version of command to send (EC_VER_...)
* @param dout Output data (may be NULL If dout_len=0)
* @param dout_len Size of output data in bytes
* @param dinp Returns pointer to response data. This will be
* untouched unless we return a value > 0.
* @param din_len Maximum size of response in bytes
* @return number of bytes in response, or -1 on error
*/
#ifdef CONFIG_DM_CROS_EC