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 
21 
22 #ifndef _LLD_
23 #define _LLD_
24 
25 #include "ffsport.h"
26 #include "spectraswconfig.h"
27 #include "flash.h"
28 
29 #define GOOD_BLOCK 0
30 #define DEFECTIVE_BLOCK 1
31 #define READ_ERROR 2
32 
33 #define CLK_X  5
34 #define CLK_MULTI 4
35 
36 /* Typedefs */
37 
38 /*  prototypes: API for LLD */
39 /* Currently, Write_Page_Main
40  * 			  MemCopy
41  * 			  Read_Page_Main_Spare
42  * do not have flag because they were not implemented prior to this
43  * They are not being added to keep changes to a minimum for now.
44  * Currently, they are not required (only reqd for Wr_P_M_S.)
45  * Later on, these NEED to be changed.
46  */
47 
48 extern void GLOB_LLD_ECC_Control(int enable);
49 
50 extern u16 GLOB_LLD_Flash_Reset(void);
51 
52 extern u16 GLOB_LLD_Read_Device_ID(void);
53 
54 extern u16 GLOB_LLD_UnlockArrayAll(void);
55 
56 extern u16 GLOB_LLD_Flash_Init(void);
57 
58 extern int GLOB_LLD_Flash_Release(void);
59 
60 extern u16 GLOB_LLD_Erase_Block(u32 block_add);
61 
62 extern u16 GLOB_LLD_Write_Page_Main(u8 *write_data,
63 	u32 block, u16 Page, u16 PageCount);
64 
65 extern u16 GLOB_LLD_Read_Page_Main(u8 *read_data,
66 	u32 block, u16 page, u16 page_count);
67 
68 extern u16 GLOB_LLD_Read_Page_Main_Polling(u8 *read_data,
69 	u32 block, u16 page, u16 page_count);
70 
71 extern u16 GLOB_LLD_Write_Page_Main_Spare(u8 *write_data,
72 	u32 block, u16 Page, u16 PageCount);
73 
74 extern u16 GLOB_LLD_Write_Page_Spare(u8 *write_data,
75 	u32 block, u16 Page, u16 PageCount);
76 
77 extern u16 GLOB_LLD_Read_Page_Main_Spare(u8 *read_data,
78 	u32 block, u16 page, u16 page_count);
79 
80 extern u16 GLOB_LLD_Read_Page_Spare(u8 *read_data,
81 	u32 block, u16 Page, u16 PageCount);
82 
83 extern u16  GLOB_LLD_Get_Bad_Block(u32 block);
84 
85 extern u16 GLOB_LLD_Event_Status(void);
86 
87 extern u16 GLOB_LLD_MemCopy_CMD(u8 *dest, u8 *src, u32 ByteCount, u16 flag);
88 
89 extern u16 glob_lld_execute_cmds(void);
90 
91 extern u16 GLOB_LLD_Erase_Block_cdma(u32 block, u16 flags);
92 
93 extern u16 GLOB_LLD_Write_Page_Main_cdma(u8 *data,
94 	u32 block, u16 page, u16 count);
95 
96 extern u16 GLOB_LLD_Read_Page_Main_cdma(u8 *data,
97 	u32 block, u16 page, u16 count, u16 flags);
98 
99 extern u16 GLOB_LLD_Write_Page_Main_Spare_cdma(u8 *data,
100 	u32 block, u16 page, u16 count, u16 flags);
101 
102 extern u16 GLOB_LLD_Read_Page_Main_Spare_cdma(u8 *data,
103 	u32 block, u16 page, u16 count);
104 
105 #define LLD_CMD_FLAG_ORDER_BEFORE_REST		(0x1)
106 #define LLD_CMD_FLAG_MODE_CDMA			(0x8)
107 
108 
109 #endif /*_LLD_ */
110 
111 
112