Commit | Line | Data |
---|---|---|
494a43bb AO |
1 | /* |
2 | * NAND Flash Controller Device Driver | |
3 | * Copyright (c) 2009, Intel Corporation and its suppliers. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms and conditions of the GNU General Public License, | |
7 | * version 2, as published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along with | |
15 | * this program; if not, write to the Free Software Foundation, Inc., | |
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | * | |
18 | */ | |
19 | ||
20 | /* header for LLD_CDMA.c module */ | |
21 | ||
22 | #ifndef _LLD_CDMA_ | |
23 | #define _LLD_CDMA_ | |
24 | ||
25 | #include "flash.h" | |
26 | ||
27 | #define DEBUG_SYNC 1 | |
28 | ||
29 | /*/////////// CDMA specific MACRO definition */ | |
30 | #define MAX_DESCS (255) | |
31 | #define MAX_CHANS (4) | |
32 | #define MAX_SYNC_POINTS (16) | |
33 | #define MAX_DESC_PER_CHAN (MAX_DESCS * 3 + MAX_SYNC_POINTS + 2) | |
34 | ||
35 | #define CHANNEL_SYNC_MASK (0x000F) | |
36 | #define CHANNEL_DMA_MASK (0x00F0) | |
37 | #define CHANNEL_ID_MASK (0x0300) | |
38 | #define CHANNEL_CONT_MASK (0x4000) | |
39 | #define CHANNEL_INTR_MASK (0x8000) | |
40 | ||
41 | #define CHANNEL_SYNC_OFFSET (0) | |
42 | #define CHANNEL_DMA_OFFSET (4) | |
43 | #define CHANNEL_ID_OFFSET (8) | |
44 | #define CHANNEL_CONT_OFFSET (14) | |
45 | #define CHANNEL_INTR_OFFSET (15) | |
46 | ||
47 | u16 CDMA_Data_CMD(u8 cmd, u8 *data, u32 block, u16 page, u16 num, u16 flags); | |
48 | u16 CDMA_MemCopy_CMD(u8 *dest, u8 *src, u32 byte_cnt, u16 flags); | |
49 | u16 CDMA_Execute_CMDs(void); | |
50 | void print_pending_cmds(void); | |
51 | void print_cdma_descriptors(void); | |
52 | ||
53 | extern u8 g_SBDCmdIndex; | |
54 | extern struct mrst_nand_info info; | |
55 | ||
56 | ||
57 | /*/////////// prototypes: APIs for LLD_CDMA */ | |
58 | int is_cdma_interrupt(void); | |
59 | u16 CDMA_Event_Status(void); | |
60 | ||
61 | /* CMD-DMA Descriptor Struct. These are defined by the CMD_DMA HW */ | |
62 | struct cdma_descriptor { | |
63 | u32 NxtPointerHi; | |
64 | u32 NxtPointerLo; | |
65 | u32 FlashPointerHi; | |
66 | u32 FlashPointerLo; | |
67 | u32 CommandType; | |
68 | u32 MemAddrHi; | |
69 | u32 MemAddrLo; | |
70 | u32 CommandFlags; | |
71 | u32 Channel; | |
72 | u32 Status; | |
73 | u32 MemCopyPointerHi; | |
74 | u32 MemCopyPointerLo; | |
75 | u32 Reserved12; | |
76 | u32 Reserved13; | |
77 | u32 Reserved14; | |
78 | u32 pcmd; /* pending cmd num related to this descriptor */ | |
79 | }; | |
80 | ||
81 | /* This struct holds one MemCopy descriptor as defined by the HW */ | |
82 | struct memcpy_descriptor { | |
83 | u32 NxtPointerHi; | |
84 | u32 NxtPointerLo; | |
85 | u32 SrcAddrHi; | |
86 | u32 SrcAddrLo; | |
87 | u32 DestAddrHi; | |
88 | u32 DestAddrLo; | |
89 | u32 XferSize; | |
90 | u32 MemCopyFlags; | |
91 | u32 MemCopyStatus; | |
92 | u32 reserved9; | |
93 | u32 reserved10; | |
94 | u32 reserved11; | |
95 | u32 reserved12; | |
96 | u32 reserved13; | |
97 | u32 reserved14; | |
98 | u32 reserved15; | |
99 | }; | |
100 | ||
101 | /* Pending CMD table entries (includes MemCopy parameters */ | |
102 | struct pending_cmd { | |
103 | u8 CMD; | |
104 | u8 *DataAddr; | |
105 | u32 Block; | |
106 | u16 Page; | |
107 | u16 PageCount; | |
108 | u8 *DataDestAddr; | |
109 | u8 *DataSrcAddr; | |
110 | u32 MemCopyByteCnt; | |
111 | u16 Flags; | |
112 | u16 Status; | |
113 | }; | |
114 | ||
115 | #if DEBUG_SYNC | |
116 | extern u32 debug_sync_cnt; | |
117 | #endif | |
118 | ||
119 | /* Definitions for CMD DMA descriptor chain fields */ | |
120 | #define CMD_DMA_DESC_COMP 0x8000 | |
121 | #define CMD_DMA_DESC_FAIL 0x4000 | |
122 | ||
123 | #endif /*_LLD_CDMA_*/ |