xref: /freebsd/sys/dev/spibus/spi.h (revision 64b507e5fe1d27bdbad831ba9249e68fdffc759a)
146b39c90SWarner Losh /*-
246b39c90SWarner Losh  * Copyright (c) 2006 M. Warner Losh
346b39c90SWarner Losh  * All rights reserved.
446b39c90SWarner Losh  *
546b39c90SWarner Losh  * Redistribution and use in source and binary forms, with or without
646b39c90SWarner Losh  * modification, are permitted provided that the following conditions
746b39c90SWarner Losh  * are met:
846b39c90SWarner Losh  * 1. Redistributions of source code must retain the above copyright
946b39c90SWarner Losh  *    notice, this list of conditions and the following disclaimer.
1046b39c90SWarner Losh  * 2. Redistributions in binary form must reproduce the above copyright
1146b39c90SWarner Losh  *    notice, this list of conditions and the following disclaimer in the
1246b39c90SWarner Losh  *    documentation and/or other materials provided with the distribution.
1346b39c90SWarner Losh  *
1446b39c90SWarner Losh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1546b39c90SWarner Losh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1646b39c90SWarner Losh  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1746b39c90SWarner Losh  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1846b39c90SWarner Losh  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1946b39c90SWarner Losh  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2046b39c90SWarner Losh  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2146b39c90SWarner Losh  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2246b39c90SWarner Losh  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2346b39c90SWarner Losh  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2446b39c90SWarner Losh  * SUCH DAMAGE.
2546b39c90SWarner Losh  *
2646b39c90SWarner Losh  * $FreeBSD$
2746b39c90SWarner Losh  */
289a795dfaSWarner Losh 
299a795dfaSWarner Losh struct spi_command {
309a795dfaSWarner Losh 	void	*tx_cmd;
319a795dfaSWarner Losh 	uint32_t tx_cmd_sz;
329a795dfaSWarner Losh 	void	*rx_cmd;
339a795dfaSWarner Losh 	uint32_t rx_cmd_sz;
349a795dfaSWarner Losh 	void	*tx_data;
359a795dfaSWarner Losh 	uint32_t tx_data_sz;
369a795dfaSWarner Losh 	void	*rx_data;
379a795dfaSWarner Losh 	uint32_t rx_data_sz;
389a795dfaSWarner Losh };
39cc906398SWarner Losh 
40d67fe28bSAdrian Chadd #define	SPI_COMMAND_INITIALIZER	{ 0 }
41d67fe28bSAdrian Chadd 
42cc906398SWarner Losh #define	SPI_CHIP_SELECT_HIGH	0x1		/* Chip select high (else low) */
43*64b507e5SEmmanuel Vadot 
44*64b507e5SEmmanuel Vadot #define SPIBUS_PNP_DESCR "Z:compat;P:#;"
45*64b507e5SEmmanuel Vadot #define SPIBUS_PNP_INFO(t) \
46*64b507e5SEmmanuel Vadot 	MODULE_PNP_INFO(SPIBUS_PNP_DESCR, spibus, t, t, sizeof(t[0]), sizeof(t) / sizeof(t[0]));
47