146b39c90SWarner Losh /*- 2f86e6000SWarner Losh * Copyright (c) 2006 M. Warner Losh <imp@FreeBSD.org> 346b39c90SWarner Losh * 446b39c90SWarner Losh * Redistribution and use in source and binary forms, with or without 546b39c90SWarner Losh * modification, are permitted provided that the following conditions 646b39c90SWarner Losh * are met: 746b39c90SWarner Losh * 1. Redistributions of source code must retain the above copyright 846b39c90SWarner Losh * notice, this list of conditions and the following disclaimer. 946b39c90SWarner Losh * 2. Redistributions in binary form must reproduce the above copyright 1046b39c90SWarner Losh * notice, this list of conditions and the following disclaimer in the 1146b39c90SWarner Losh * documentation and/or other materials provided with the distribution. 1246b39c90SWarner Losh * 1346b39c90SWarner Losh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1446b39c90SWarner Losh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1546b39c90SWarner Losh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1646b39c90SWarner Losh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1746b39c90SWarner Losh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1846b39c90SWarner Losh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1946b39c90SWarner Losh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2046b39c90SWarner Losh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2146b39c90SWarner Losh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2246b39c90SWarner Losh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2346b39c90SWarner Losh * SUCH DAMAGE. 2446b39c90SWarner Losh * 2546b39c90SWarner Losh * $FreeBSD$ 2646b39c90SWarner Losh */ 279a795dfaSWarner Losh 289a795dfaSWarner Losh struct spi_command { 299a795dfaSWarner Losh void *tx_cmd; 309a795dfaSWarner Losh uint32_t tx_cmd_sz; 319a795dfaSWarner Losh void *rx_cmd; 329a795dfaSWarner Losh uint32_t rx_cmd_sz; 339a795dfaSWarner Losh void *tx_data; 349a795dfaSWarner Losh uint32_t tx_data_sz; 359a795dfaSWarner Losh void *rx_data; 369a795dfaSWarner Losh uint32_t rx_data_sz; 37*3c086734SVal Packett uint32_t flags; 389a795dfaSWarner Losh }; 39d67fe28bSAdrian Chadd #define SPI_COMMAND_INITIALIZER { 0 } 40d67fe28bSAdrian Chadd 41*3c086734SVal Packett #define SPI_FLAG_KEEP_CS 0x1 /* Keep chip select asserted */ 42*3c086734SVal Packett #define SPI_FLAG_NO_SLEEP 0x2 /* Prevent driver from sleeping (use polling) */ 43*3c086734SVal Packett 44cc906398SWarner Losh #define SPI_CHIP_SELECT_HIGH 0x1 /* Chip select high (else low) */ 4564b507e5SEmmanuel Vadot 46db63d251SIan Lepore #ifdef FDT 47db63d251SIan Lepore #define SPIBUS_FDT_PNP_INFO(t) FDTCOMPAT_PNP_INFO(t, spibus) 48db63d251SIan Lepore #else 49db63d251SIan Lepore #define SPIBUS_FDT_PNP_INFO(t) 50db63d251SIan Lepore #endif 51