blob: 8978beacc5d6e757183c220508d0a2018853c038 [file] [log] [blame]
Tom Warrenee554f82011-11-05 09:48:11 +00001/*
Allen Martin55d98a12012-08-31 08:30:00 +00002 * NVIDIA Tegra20 SPI-FLASH controller
Tom Warrenee554f82011-11-05 09:48:11 +00003 *
Tom Warrene8aebc22012-05-22 07:33:47 +00004 * Copyright 2010-2012 NVIDIA Corporation
Tom Warrenee554f82011-11-05 09:48:11 +00005 *
6 * This software may be used and distributed according to the
7 * terms of the GNU Public License, Version 2, incorporated
8 * herein by reference.
9 *
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.
13 *
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.
18 *
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,
22 * MA 02111-1307 USA
23 */
24
Tom Warrene8aebc22012-05-22 07:33:47 +000025#ifndef _TEGRA_SPI_H_
26#define _TEGRA_SPI_H_
Tom Warrenee554f82011-11-05 09:48:11 +000027
28#include <asm/types.h>
29
30struct spi_tegra {
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 */
38};
39
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
58
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)
71
72#define SPI_TIMEOUT 1000
Allen Martin55d98a12012-08-31 08:30:00 +000073#define TEGRA20_SPI_MAX_FREQ 52000000
Tom Warrenee554f82011-11-05 09:48:11 +000074
Tom Warrene8aebc22012-05-22 07:33:47 +000075#endif /* _TEGRA_SPI_H_ */