11f40866fSVal Packett /*- 21f40866fSVal Packett * SPDX-License-Identifier: BSD-2-Clause 31f40866fSVal Packett * 41f40866fSVal Packett * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org> 51f40866fSVal Packett * All rights reserved. 61f40866fSVal Packett * 71f40866fSVal Packett * Redistribution and use in source and binary forms, with or without 81f40866fSVal Packett * modification, are permitted provided that the following conditions 91f40866fSVal Packett * are met: 101f40866fSVal Packett * 1. Redistributions of source code must retain the above copyright 111f40866fSVal Packett * notice, this list of conditions and the following disclaimer. 121f40866fSVal Packett * 2. Redistributions in binary form must reproduce the above copyright 131f40866fSVal Packett * notice, this list of conditions and the following disclaimer in the 141f40866fSVal Packett * documentation and/or other materials provided with the distribution. 151f40866fSVal Packett * 161f40866fSVal Packett * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 171f40866fSVal Packett * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 181f40866fSVal Packett * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 191f40866fSVal Packett * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 201f40866fSVal Packett * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 211f40866fSVal Packett * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 221f40866fSVal Packett * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 231f40866fSVal Packett * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 241f40866fSVal Packett * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 251f40866fSVal Packett * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 261f40866fSVal Packett * SUCH DAMAGE. 271f40866fSVal Packett */ 281f40866fSVal Packett 291f40866fSVal Packett #ifndef _DEV_INTEL_SPI_H_ 301f40866fSVal Packett #define _DEV_INTEL_SPI_H_ 311f40866fSVal Packett 321f40866fSVal Packett #include <contrib/dev/acpica/include/acpi.h> 331f40866fSVal Packett #include <contrib/dev/acpica/include/accommon.h> 341f40866fSVal Packett 351f40866fSVal Packett #include <dev/acpica/acpivar.h> 361f40866fSVal Packett 371f40866fSVal Packett enum intelspi_vers { 381f40866fSVal Packett SPI_BAYTRAIL, 391f40866fSVal Packett SPI_BRASWELL, 401f40866fSVal Packett SPI_LYNXPOINT, 411f40866fSVal Packett SPI_SUNRISEPOINT, 421f40866fSVal Packett }; 431f40866fSVal Packett 441f40866fSVal Packett struct intelspi_softc { 451f40866fSVal Packett ACPI_HANDLE sc_handle; 461f40866fSVal Packett device_t sc_dev; 471f40866fSVal Packett enum intelspi_vers sc_vers; 481f40866fSVal Packett struct mtx sc_mtx; 491f40866fSVal Packett int sc_mem_rid; 501f40866fSVal Packett struct resource *sc_mem_res; 511f40866fSVal Packett int sc_irq_rid; 521f40866fSVal Packett struct resource *sc_irq_res; 531f40866fSVal Packett void *sc_irq_ih; 541f40866fSVal Packett struct spi_command *sc_cmd; 551f40866fSVal Packett uint32_t sc_len; 561f40866fSVal Packett uint32_t sc_read; 57*5adcec04SVladimir Kondratyev volatile uint32_t sc_flags; 581f40866fSVal Packett uint32_t sc_written; 591f40866fSVal Packett uint32_t sc_clock; 601f40866fSVal Packett uint32_t sc_mode; 611f40866fSVal Packett /* LPSS private register storage for suspend-resume */ 621f40866fSVal Packett uint32_t sc_regs[9]; 631f40866fSVal Packett }; 641f40866fSVal Packett 651f40866fSVal Packett int intelspi_attach(device_t dev); 661f40866fSVal Packett int intelspi_detach(device_t dev); 671f40866fSVal Packett int intelspi_transfer(device_t dev, device_t child, struct spi_command *cmd); 681f40866fSVal Packett int intelspi_suspend(device_t dev); 691f40866fSVal Packett int intelspi_resume(device_t dev); 701f40866fSVal Packett 711f40866fSVal Packett #endif 72