summaryrefslogtreecommitdiff
path: root/board/st/u8500/flash.c
blob: e44f9ef322923828b970b5663e661261ad4a8d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * Copyright (C) ST-Ericsson SA 2009
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

/* Support for ST NOR flash M30L0R7KB02AQ  and M30L0R7KT02AQ */

#include <common.h>
#include <linux/byteorder/swab.h>

#undef DEBUG_FLASH 
flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips  */

/* Board support for 1 or 2 flash devices */
#undef FLASH_PORT_WIDTH32
#define FLASH_PORT_WIDTH16

#ifdef FLASH_PORT_WIDTH16
#define FLASH_PORT_WIDTH		ushort
#define FLASH_PORT_WIDTHV		vu_short
#define SWAP(x)			__swab16(x)
#else
#define FLASH_PORT_WIDTH		ulong
#define FLASH_PORT_WIDTHV		vu_long
#define SWAP(x)			__swab32(x)
#endif

#define FPW	FLASH_PORT_WIDTH
#define FPWV	FLASH_PORT_WIDTHV

/*-----------------------------------------------------------------------
 * Functions
 */
unsigned long flash_init(void);
/*static ulong flash_get_size(FPW * addr, flash_info_t * info);
static int write_data(flash_info_t * info, ulong dest, FPW data);
static void flash_get_offsets(ulong base, flash_info_t * info);*/
void inline spin_wheel(void);
void flash_print_info(flash_info_t * info);
void flash_unprotect_sectors(FPWV * addr);
int flash_erase(flash_info_t * info, int s_first, int s_last);
int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt);

/*-----------------------------------------------------------------------
 */

unsigned long flash_init(void)
{
	ulong size = 0;
	return size;
}

/*-----------------------------------------------------------------------
 */
void flash_print_info(flash_info_t * info)
{
}

/* unprotects a sector for write and erase
 * on some intel parts, this unprotects the entire chip, but it
 * wont hurt to call this additional times per sector...
 */
void flash_unprotect_sectors(FPWV * addr)
{
	return;
}

/*-----------------------------------------------------------------------
 */

int flash_erase(flash_info_t * info, int s_first, int s_last)
{
	return 0;
}

/*-----------------------------------------------------------------------
 * Copy memory to flash, returns:
 * 0 - OK
 * 1 - write timeout
 * 2 - Flash not erased
 * 4 - Flash not identified
 */

int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
{
	return 0;
}

void inline spin_wheel(void)
{
}