arm: vf610: fix double iomux configuration for vf610twr board
[u-boot/qq2440-u-boot.git] / drivers / spi / sh_spi.h
blob96b4b6850185a3bb8983d7331919bc4e8a994db7
1 /*
2 * SH SPI driver
4 * Copyright (C) 2011 Renesas Solutions Corp.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef __SH_SPI_H__
22 #define __SH_SPI_H__
24 #include <spi.h>
26 struct sh_spi_regs {
27 unsigned long tbr_rbr;
28 unsigned long resv1;
29 unsigned long cr1;
30 unsigned long resv2;
31 unsigned long cr2;
32 unsigned long resv3;
33 unsigned long cr3;
34 unsigned long resv4;
35 unsigned long cr4;
38 /* CR1 */
39 #define SH_SPI_TBE 0x80
40 #define SH_SPI_TBF 0x40
41 #define SH_SPI_RBE 0x20
42 #define SH_SPI_RBF 0x10
43 #define SH_SPI_PFONRD 0x08
44 #define SH_SPI_SSDB 0x04
45 #define SH_SPI_SSD 0x02
46 #define SH_SPI_SSA 0x01
48 /* CR2 */
49 #define SH_SPI_RSTF 0x80
50 #define SH_SPI_LOOPBK 0x40
51 #define SH_SPI_CPOL 0x20
52 #define SH_SPI_CPHA 0x10
53 #define SH_SPI_L1M0 0x08
55 /* CR3 */
56 #define SH_SPI_MAX_BYTE 0xFF
58 /* CR4 */
59 #define SH_SPI_TBEI 0x80
60 #define SH_SPI_TBFI 0x40
61 #define SH_SPI_RBEI 0x20
62 #define SH_SPI_RBFI 0x10
63 #define SH_SPI_SSS1 0x08
64 #define SH_SPI_WPABRT 0x04
65 #define SH_SPI_SSS0 0x01
67 #define SH_SPI_FIFO_SIZE 32
68 #define SH_SPI_NUM_CS 4
70 struct sh_spi {
71 struct spi_slave slave;
72 struct sh_spi_regs *regs;
75 static inline struct sh_spi *to_sh_spi(struct spi_slave *slave)
77 return container_of(slave, struct sh_spi, slave);
80 #endif