linux/drivers/platform/chrome/cros_ec_lpc_mec.c

// SPDX-License-Identifier: GPL-2.0
// LPC variant I/O for Microchip EC
//
// Copyright (C) 2016 Google, Inc

#include <linux/delay.h>
#include <linux/io.h>
#include <linux/mutex.h>
#include <linux/types.h>

#include "cros_ec_lpc_mec.h"

#define ACPI_LOCK_DELAY_MS

/*
 * This mutex must be held while accessing the EMI unit. We can't rely on the
 * EC mutex because memmap data may be accessed without it being held.
 */
static DEFINE_MUTEX(io_mutex);
/*
 * An alternative mutex to be used when the ACPI AML code may also
 * access memmap data.  When set, this mutex is used in preference to
 * io_mutex.
 */
static acpi_handle aml_mutex;

static u16 mec_emi_base, mec_emi_end;

/**
 * cros_ec_lpc_mec_lock() - Acquire mutex for EMI
 *
 * @return: Negative error code, or zero for success
 */
static int cros_ec_lpc_mec_lock(void)
{}

/**
 * cros_ec_lpc_mec_unlock() - Release mutex for EMI
 *
 * @return: Negative error code, or zero for success
 */
static int cros_ec_lpc_mec_unlock(void)
{}

/**
 * cros_ec_lpc_mec_emi_write_address() - Initialize EMI at a given address.
 *
 * @addr: Starting read / write address
 * @access_type: Type of access, typically 32-bit auto-increment
 */
static void cros_ec_lpc_mec_emi_write_address(u16 addr,
			enum cros_ec_lpc_mec_emi_access_mode access_type)
{}

/**
 * cros_ec_lpc_mec_in_range() - Determine if addresses are in MEC EMI range.
 *
 * @offset: Address offset
 * @length: Number of bytes to check
 *
 * Return: 1 if in range, 0 if not, and -EINVAL on failure
 *         such as the mec range not being initialized
 */
int cros_ec_lpc_mec_in_range(unsigned int offset, unsigned int length)
{}

/**
 * cros_ec_lpc_io_bytes_mec() - Read / write bytes to MEC EMI port.
 *
 * @io_type: MEC_IO_READ or MEC_IO_WRITE, depending on request
 * @offset:  Base read / write address
 * @length:  Number of bytes to read / write
 * @buf:     Destination / source buffer
 *
 * @return:  A negative error code on error, or 8-bit checksum of all
 *           bytes read / written
 */
int cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
			     unsigned int offset, unsigned int length,
			     u8 *buf)
{}
EXPORT_SYMBOL();

void cros_ec_lpc_mec_init(unsigned int base, unsigned int end)
{}
EXPORT_SYMBOL();

int cros_ec_lpc_mec_acpi_mutex(struct acpi_device *adev, const char *pathname)
{}
EXPORT_SYMBOL();