Tom Warren | ee554f8 | 2011-11-05 09:48:11 +0000 | [diff] [blame] | 1 | /* |
Allen Martin | 55d98a1 | 2012-08-31 08:30:00 +0000 | [diff] [blame] | 2 | * NVIDIA Tegra20 SPI-FLASH controller |
Tom Warren | ee554f8 | 2011-11-05 09:48:11 +0000 | [diff] [blame] | 3 | * |
Tom Warren | e8aebc2 | 2012-05-22 07:33:47 +0000 | [diff] [blame] | 4 | * Copyright 2010-2012 NVIDIA Corporation |
Tom Warren | ee554f8 | 2011-11-05 09:48:11 +0000 | [diff] [blame] | 5 | * |
| 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 Warren | e8aebc2 | 2012-05-22 07:33:47 +0000 | [diff] [blame] | 25 | #ifndef _TEGRA_SPI_H_ |
| 26 | #define _TEGRA_SPI_H_ |
Tom Warren | ee554f8 | 2011-11-05 09:48:11 +0000 | [diff] [blame] | 27 | |
| 28 | #include <asm/types.h> |
| 29 | |
| 30 | struct 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 |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 73 | #define TEGRA_SPI_MAX_FREQ 52000000 |
Tom Warren | ee554f8 | 2011-11-05 09:48:11 +0000 | [diff] [blame] | 74 | |
Tom Warren | e8aebc2 | 2012-05-22 07:33:47 +0000 | [diff] [blame] | 75 | #endif /* _TEGRA_SPI_H_ */ |