2 * Copyright (C) 2008 Embedded Alley Solutions Inc.
4 * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <asm/arch/ssp.h>
30 * Flags to set SPI mode
32 #define SPI_PHASE 0x1 /* Set phase to 1 */
33 #define SPI_POLARITY 0x2 /* Set polarity to 1 */
35 /* Various flags to control SPI transfers */
36 #define SPI_START 0x1 /* Lock CS signal */
37 #define SPI_STOP 0x2 /* Unlock CS signal */
40 * Init SSPx interface, must be called first
45 * Set phase, polarity and CS number (SS0, SS1, SS2)
47 void spi_set_cfg(unsigned int bus, unsigned int cs, unsigned long mode);
51 * Send @rx_len bytes from @dout, then receive @rx_len bytes
54 void spi_txrx(const char *dout, unsigned int tx_len, char *din,
55 unsigned int rx_len, unsigned long flags);
58 /* Lock/unlock SPI bus */
59 static inline void spi_lock(void)
64 static inline void spi_unlock(void)