2bdd5fc13c1fd905a508382e64870715448a92ac
[openwrt.git] / target / linux / brcm-2.4 / files / arch / mips / bcm947xx / include / sflash.h
1 /*
2  * Broadcom SiliconBackplane chipcommon serial flash interface
3  *
4  * Copyright 2007, Broadcom Corporation
5  * All Rights Reserved.
6  * 
7  * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8  * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9  * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10  * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11  *
12  * $Id$
13  */
14
15 #ifndef _sflash_h_
16 #define _sflash_h_
17
18 #include <typedefs.h>
19 #include <sbchipc.h>
20 #include <sbutils.h>
21
22 struct sflash {
23         uint blocksize;         /* Block size */
24         uint numblocks;         /* Number of blocks */
25         uint32 type;            /* Type */
26         uint size;              /* Total size in bytes */
27 };
28
29 /* Utility functions */
30 extern int sflash_poll(sb_t *sbh, chipcregs_t *cc, uint offset);
31 extern int sflash_read(sb_t *sbh, chipcregs_t *cc,
32                        uint offset, uint len, uchar *buf);
33 extern int sflash_write(sb_t *sbh, chipcregs_t *cc,
34                         uint offset, uint len, const uchar *buf);
35 extern int sflash_erase(sb_t *sbh, chipcregs_t *cc, uint offset);
36 extern int sflash_commit(sb_t *sbh, chipcregs_t *cc,
37                          uint offset, uint len, const uchar *buf);
38 extern struct sflash *sflash_init(sb_t *sbh, chipcregs_t *cc);
39
40 #endif /* _sflash_h_ */