Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / sflash.h
blob39d281e91d29c8bef62578856db00e5670fd0eec
1 /*
2 * Broadcom SiliconBackplane chipcommon serial flash interface
4 * Copyright (C) 2010, Broadcom Corporation. All Rights Reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * $Id: sflash.h,v 13.10 2008-03-04 22:17:11 Exp $
21 #ifndef _sflash_h_
22 #define _sflash_h_
24 #include <typedefs.h>
25 #include <sbchipc.h>
27 struct sflash {
28 uint blocksize; /* Block size */
29 uint numblocks; /* Number of blocks */
30 uint32 type; /* Type */
31 uint size; /* Total size in bytes */
34 /* Utility functions */
35 extern int sflash_poll(si_t *sih, chipcregs_t *cc, uint offset);
36 extern int sflash_read(si_t *sih, chipcregs_t *cc,
37 uint offset, uint len, uchar *buf);
38 extern int sflash_write(si_t *sih, chipcregs_t *cc,
39 uint offset, uint len, const uchar *buf);
40 extern int sflash_erase(si_t *sih, chipcregs_t *cc, uint offset);
41 extern int sflash_commit(si_t *sih, chipcregs_t *cc,
42 uint offset, uint len, const uchar *buf);
43 extern struct sflash *sflash_init(si_t *sih, chipcregs_t *cc);
45 #endif /* _sflash_h_ */