]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - include/asm-arm/arch-mx23/ssp.h
merged current version of git://git.denx.de/u-boot
[karo-tx-uboot.git] / include / asm-arm / arch-mx23 / ssp.h
1 /*
2  * Copyright (C) 2008 Embedded Alley Solutions Inc.
3  *
4  * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
5  *
6  * SSP register definitions
7  *
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.
12  *
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.
17  *
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
21  */
22 #ifndef SSP_H
23 #define SSP_H
24
25 #include <asm/arch/mx23.h>
26
27 #define SSP1_BASE       (MX23_REGS_BASE + 0x10000)
28 #define SSP2_BASE       (MX23_REGS_BASE + 0x34000)
29
30 #define SSP_CTRL0       0x000
31 #define SSP_CMD0        0x010
32 #define SSP_CMD1        0x020
33 #define SSP_COMPREF     0x030
34 #define SSP_COMPMASK    0x040
35 #define SSP_TIMING      0x050
36 #define SSP_CTRL1       0x060
37 #define SSP_DATA        0x070
38 #define SSP_SDRESP0     0x080
39 #define SSP_SDRESP1     0x090
40 #define SSP_SDRESP2     0x0a0
41 #define SSP_SDRESP3     0x0b0
42 #define SSP_STATUS      0x0c0
43 #define SSP_DEBUG       0x100
44 #define SSP_VERSION     0x110
45
46 /* CTRL0 bits, bit fields and values */
47 #define CTRL0_SFTRST            (0x1 << 31)
48 #define CTRL0_CLKGATE           (0x1 << 30)
49 #define CTRL0_RUN               (0x1 << 29)
50 #define CTRL0_LOCK_CS           (0x1 << 27)
51 #define CTRL0_IGNORE_CRC        (0x1 << 26)
52 #define CTRL0_DATA_XFER         (0x1 << 24)
53 #define CTRL0_READ              (0x1 << 25)
54 #define CTRL0_BUS_WIDTH         22
55 #define CTRL0_WAIT_FOR_IRQ      (0x1 << 21)
56 #define CTRL0_WAIT_FOR_CMD      (0x1 << 20)
57 #define CTRL0_XFER_COUNT        0
58
59 #define BUS_WIDTH_SPI1  (0x0 << CTRL0_BUS_WIDTH)
60 #define BUS_WIDTH_SPI4  (0x1 << CTRL0_BUS_WIDTH)
61 #define BUS_WIDTH_SPI8  (0x2 << CTRL0_BUS_WIDTH)
62
63 #define SPI_CS0         0x0
64 #define SPI_CS1         CTRL0_WAIT_FOR_CMD
65 #define SPI_CS2         CTRL0_WAIT_FOR_IRQ
66 #define SPI_CS_CLR_MASK (CTRL0_WAIT_FOR_CMD | CTRL0_WAIT_FOR_IRQ)
67
68 /* CMD0 bits, bit fields and values */
69 #define CMD0_BLOCK_SIZE         16
70 #define CMD0_BLOCK_COUNT        12
71 #define CMD0_CMD                0
72
73 /* TIMING bits, bit fields and values */
74 #define TIMING_TIMEOUT          16
75 #define TIMING_CLOCK_DIVIDE     8
76 #define TIMING_CLOCK_RATE       0
77
78 /* CTRL1 bits, bit fields and values */
79 #define CTRL1_DMA_ENABLE        (0x1 << 13)
80 #define CTRL1_PHASE             (0x1 << 10)
81 #define CTRL1_POLARITY          (0x1 << 9)
82 #define CTRL1_SLAVE_MODE        (0x1 << 8)
83 #define CTRL1_WORD_LENGTH       4
84 #define CTRL1_SSP_MODE          0
85
86 #define WORD_LENGTH4    (0x3 << CTRL1_WORD_LENGTH)
87 #define WORD_LENGTH8    (0x7 << CTRL1_WORD_LENGTH)
88 #define WORD_LENGTH16   (0xF << CTRL1_WORD_LENGTH)
89
90 #define SSP_MODE_SPI    (0x0 << CTRL1_SSP_MODE)
91 #define SSP_MODE_SSI    (0x1 << CTRL1_SSP_MODE)
92 #define SSP_MODE_SD_MMC (0x3 << CTRL1_SSP_MODE)
93 #define SSP_MODE_MS     (0x4 << CTRL1_SSP_MODE)
94 #define SSP_MODE_ATA    (0x7 << CTRL1_SSP_MODE)
95
96 /* CTRL1 bits, bit fields and values */
97 #define STATUS_FIFO_EMPTY       (1 << 5)
98 #define STATUS_FIFO_FULL        (1 << 8)
99
100 #endif /* SSP_H */