2 * NVIDIA Tegra2 SPI-FLASH controller
4 * Copyright 2010-2011 NVIDIA Corporation
6 * This software may be used and distributed according to the
7 * terms of the GNU Public License, Version 2, incorporated
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * Version 2 as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #ifndef _TEGRA2_SPI_H_
26 #define _TEGRA2_SPI_H_
28 #include <asm/types.h>
31 u32 command; /* SPI_COMMAND_0 register */
32 u32 status; /* SPI_STATUS_0 register */
33 u32 rx_cmp; /* SPI_RX_CMP_0 register */
34 u32 dma_ctl; /* SPI_DMA_CTL_0 register */
35 u32 tx_fifo; /* SPI_TX_FIFO_0 register */
36 u32 rsvd[3]; /* offsets 0x14 to 0x1F reserved */
37 u32 rx_fifo; /* SPI_RX_FIFO_0 register */
40 #define SPI_CMD_GO (1 << 30)
41 #define SPI_CMD_ACTIVE_SCLK_SHIFT 26
42 #define SPI_CMD_ACTIVE_SCLK_MASK (3 << SPI_CMD_ACTIVE_SCLK_SHIFT)
43 #define SPI_CMD_CK_SDA (1 << 21)
44 #define SPI_CMD_ACTIVE_SDA_SHIFT 18
45 #define SPI_CMD_ACTIVE_SDA_MASK (3 << SPI_CMD_ACTIVE_SDA_SHIFT)
46 #define SPI_CMD_CS_POL (1 << 16)
47 #define SPI_CMD_TXEN (1 << 15)
48 #define SPI_CMD_RXEN (1 << 14)
49 #define SPI_CMD_CS_VAL (1 << 13)
50 #define SPI_CMD_CS_SOFT (1 << 12)
51 #define SPI_CMD_CS_DELAY (1 << 9)
52 #define SPI_CMD_CS3_EN (1 << 8)
53 #define SPI_CMD_CS2_EN (1 << 7)
54 #define SPI_CMD_CS1_EN (1 << 6)
55 #define SPI_CMD_CS0_EN (1 << 5)
56 #define SPI_CMD_BIT_LENGTH (1 << 4)
57 #define SPI_CMD_BIT_LENGTH_MASK 0x0000001F
59 #define SPI_STAT_BSY (1 << 31)
60 #define SPI_STAT_RDY (1 << 30)
61 #define SPI_STAT_RXF_FLUSH (1 << 29)
62 #define SPI_STAT_TXF_FLUSH (1 << 28)
63 #define SPI_STAT_RXF_UNR (1 << 27)
64 #define SPI_STAT_TXF_OVF (1 << 26)
65 #define SPI_STAT_RXF_EMPTY (1 << 25)
66 #define SPI_STAT_RXF_FULL (1 << 24)
67 #define SPI_STAT_TXF_EMPTY (1 << 23)
68 #define SPI_STAT_TXF_FULL (1 << 22)
69 #define SPI_STAT_SEL_TXRX_N (1 << 16)
70 #define SPI_STAT_CUR_BLKCNT (1 << 15)
72 #define SPI_TIMEOUT 1000
73 #define TEGRA2_SPI_MAX_FREQ 52000000
76 #endif /* _TEGRA2_SPI_H_ */