blob: 4b7d61e0fe8e98f0a8c752407d1ab1e5a034714c [file] [log] [blame]
TsiChungLiew25ebc302008-01-14 15:30:15 -06001/*
2 * MCF5227x Internal Memory Map
3 *
4 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
5 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
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 as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25
26#ifndef __DSPI_H__
27#define __DSPI_H__
28
29/*********************************************************************
30* DMA Serial Peripheral Interface (DSPI)
31*********************************************************************/
32
33typedef struct dspi {
34 u32 dmcr;
35 u8 resv0[0x4];
36 u32 dtcr;
37 u32 dctar0;
38 u32 dctar1;
39 u32 dctar2;
40 u32 dctar3;
41 u32 dctar4;
42 u32 dctar5;
43 u32 dctar6;
44 u32 dctar7;
45 u32 dsr;
46 u32 dirsr;
47 u32 dtfr;
48 u32 drfr;
TsiChung Liew7f1a0462008-10-21 10:03:07 +000049#ifdef CONFIG_MCF547x_8x
50 u32 dtfdr[4];
TsiChungLiew25ebc302008-01-14 15:30:15 -060051 u8 resv1[0x30];
TsiChung Liew7f1a0462008-10-21 10:03:07 +000052 u32 drfdr[4];
53#else
54 u32 dtfdr[16];
55 u32 drfdr[16];
56#endif
TsiChungLiew25ebc302008-01-14 15:30:15 -060057} dspi_t;
58
59/* Bit definitions and macros for DMCR */
60#define DSPI_DMCR_HALT (0x00000001)
61#define DSPI_DMCR_SMPL_PT(x) (((x)&0x00000003)<<8)
62#define DSPI_DMCR_CRXF (0x00000400)
63#define DSPI_DMCR_CTXF (0x00000800)
64#define DSPI_DMCR_DRXF (0x00001000)
65#define DSPI_DMCR_DTXF (0x00002000)
TsiChung Liew523d9632008-03-25 15:41:15 -050066#define DSPI_DMCR_MDIS (0x00004000)
TsiChungLiew25ebc302008-01-14 15:30:15 -060067#define DSPI_DMCR_CSIS0 (0x00010000)
TsiChung Liew523d9632008-03-25 15:41:15 -050068#define DSPI_DMCR_CSIS1 (0x00020000)
TsiChungLiew25ebc302008-01-14 15:30:15 -060069#define DSPI_DMCR_CSIS2 (0x00040000)
70#define DSPI_DMCR_CSIS3 (0x00080000)
TsiChung Liew523d9632008-03-25 15:41:15 -050071#define DSPI_DMCR_CSIS4 (0x00100000)
TsiChungLiew25ebc302008-01-14 15:30:15 -060072#define DSPI_DMCR_CSIS5 (0x00200000)
TsiChung Liew523d9632008-03-25 15:41:15 -050073#define DSPI_DMCR_CSIS6 (0x00400000)
74#define DSPI_DMCR_CSIS7 (0x00800000)
TsiChungLiew25ebc302008-01-14 15:30:15 -060075#define DSPI_DMCR_ROOE (0x01000000)
76#define DSPI_DMCR_PCSSE (0x02000000)
77#define DSPI_DMCR_MTFE (0x04000000)
78#define DSPI_DMCR_FRZ (0x08000000)
79#define DSPI_DMCR_DCONF(x) (((x)&0x00000003)<<28)
80#define DSPI_DMCR_CSCK (0x40000000)
81#define DSPI_DMCR_MSTR (0x80000000)
82
83/* Bit definitions and macros for DTCR */
84#define DSPI_DTCR_SPI_TCNT(x) (((x)&0x0000FFFF)<<16)
85
86/* Bit definitions and macros for DCTAR group */
87#define DSPI_DCTAR_BR(x) (((x)&0x0000000F))
88#define DSPI_DCTAR_DT(x) (((x)&0x0000000F)<<4)
89#define DSPI_DCTAR_ASC(x) (((x)&0x0000000F)<<8)
90#define DSPI_DCTAR_CSSCK(x) (((x)&0x0000000F)<<12)
91#define DSPI_DCTAR_PBR(x) (((x)&0x00000003)<<16)
92#define DSPI_DCTAR_PDT(x) (((x)&0x00000003)<<18)
93#define DSPI_DCTAR_PASC(x) (((x)&0x00000003)<<20)
94#define DSPI_DCTAR_PCSSCK(x) (((x)&0x00000003)<<22)
95#define DSPI_DCTAR_LSBFE (0x01000000)
96#define DSPI_DCTAR_CPHA (0x02000000)
97#define DSPI_DCTAR_CPOL (0x04000000)
98#define DSPI_DCTAR_TRSZ(x) (((x)&0x0000000F)<<27)
TsiChung Liew523d9632008-03-25 15:41:15 -050099#define DSPI_DCTAR_DBR (0x80000000)
TsiChungLiew25ebc302008-01-14 15:30:15 -0600100#define DSPI_DCTAR_PCSSCK_1CLK (0x00000000)
101#define DSPI_DCTAR_PCSSCK_3CLK (0x00400000)
102#define DSPI_DCTAR_PCSSCK_5CLK (0x00800000)
103#define DSPI_DCTAR_PCSSCK_7CLK (0x00A00000)
104#define DSPI_DCTAR_PASC_1CLK (0x00000000)
105#define DSPI_DCTAR_PASC_3CLK (0x00100000)
106#define DSPI_DCTAR_PASC_5CLK (0x00200000)
107#define DSPI_DCTAR_PASC_7CLK (0x00300000)
108#define DSPI_DCTAR_PDT_1CLK (0x00000000)
109#define DSPI_DCTAR_PDT_3CLK (0x00040000)
110#define DSPI_DCTAR_PDT_5CLK (0x00080000)
111#define DSPI_DCTAR_PDT_7CLK (0x000A0000)
112#define DSPI_DCTAR_PBR_1CLK (0x00000000)
113#define DSPI_DCTAR_PBR_3CLK (0x00010000)
114#define DSPI_DCTAR_PBR_5CLK (0x00020000)
115#define DSPI_DCTAR_PBR_7CLK (0x00030000)
116
117/* Bit definitions and macros for DSR */
118#define DSPI_DSR_RXPTR(x) (((x)&0x0000000F))
119#define DSPI_DSR_RXCTR(x) (((x)&0x0000000F)<<4)
120#define DSPI_DSR_TXPTR(x) (((x)&0x0000000F)<<8)
121#define DSPI_DSR_TXCTR(x) (((x)&0x0000000F)<<12)
122#define DSPI_DSR_RFDF (0x00020000)
123#define DSPI_DSR_RFOF (0x00080000)
124#define DSPI_DSR_TFFF (0x02000000)
125#define DSPI_DSR_TFUF (0x08000000)
126#define DSPI_DSR_EOQF (0x10000000)
127#define DSPI_DSR_TXRXS (0x40000000)
128#define DSPI_DSR_TCF (0x80000000)
129
130/* Bit definitions and macros for DIRSR */
131#define DSPI_DIRSR_RFDFS (0x00010000)
132#define DSPI_DIRSR_RFDFE (0x00020000)
133#define DSPI_DIRSR_RFOFE (0x00080000)
134#define DSPI_DIRSR_TFFFS (0x01000000)
135#define DSPI_DIRSR_TFFFE (0x02000000)
136#define DSPI_DIRSR_TFUFE (0x08000000)
137#define DSPI_DIRSR_EOQFE (0x10000000)
138#define DSPI_DIRSR_TCFE (0x80000000)
139
140/* Bit definitions and macros for DTFR */
141#define DSPI_DTFR_TXDATA(x) (((x)&0x0000FFFF))
142#define DSPI_DTFR_CS0 (0x00010000)
143#define DSPI_DTFR_CS2 (0x00040000)
144#define DSPI_DTFR_CS3 (0x00080000)
145#define DSPI_DTFR_CS5 (0x00200000)
146#define DSPI_DTFR_CTCNT (0x04000000)
147#define DSPI_DTFR_EOQ (0x08000000)
148#define DSPI_DTFR_CTAS(x) (((x)&0x00000007)<<28)
149#define DSPI_DTFR_CONT (0x80000000)
150
151/* Bit definitions and macros for DRFR */
152#define DSPI_DRFR_RXDATA(x) (((x)&0x0000FFFF))
153
154/* Bit definitions and macros for DTFDR group */
155#define DSPI_DTFDR_TXDATA(x) (((x)&0x0000FFFF))
156#define DSPI_DTFDR_TXCMD(x) (((x)&0x0000FFFF)<<16)
157
158/* Bit definitions and macros for DRFDR group */
159#define DSPI_DRFDR_RXDATA(x) (((x)&0x0000FFFF))
160
TsiChung Liew523d9632008-03-25 15:41:15 -0500161void dspi_init(void);
162void dspi_tx(int chipsel, u8 attrib, u16 data);
163u16 dspi_rx(void);
164
TsiChungLiew25ebc302008-01-14 15:30:15 -0600165#endif /* __DSPI_H__ */