| 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 | */ |
| 13 | |
| 14 | #ifndef _sflash_h_ |
| 15 | #define _sflash_h_ |
| 16 | |
| 17 | #include <typedefs.h> |
| 18 | #include <sbchipc.h> |
| 19 | #include <sbutils.h> |
| 20 | |
| 21 | struct sflash { |
| 22 | uint blocksize; /* Block size */ |
| 23 | uint numblocks; /* Number of blocks */ |
| 24 | uint32 type; /* Type */ |
| 25 | uint size; /* Total size in bytes */ |
| 26 | }; |
| 27 | |
| 28 | /* Utility functions */ |
| 29 | extern int sflash_poll(sb_t *sbh, chipcregs_t *cc, uint offset); |
| 30 | extern int sflash_read(sb_t *sbh, chipcregs_t *cc, |
| 31 | uint offset, uint len, uchar *buf); |
| 32 | extern int sflash_write(sb_t *sbh, chipcregs_t *cc, |
| 33 | uint offset, uint len, const uchar *buf); |
| 34 | extern int sflash_erase(sb_t *sbh, chipcregs_t *cc, uint offset); |
| 35 | extern int sflash_commit(sb_t *sbh, chipcregs_t *cc, |
| 36 | uint offset, uint len, const uchar *buf); |
| 37 | extern struct sflash *sflash_init(sb_t *sbh, chipcregs_t *cc); |
| 38 | |
| 39 | #endif /* _sflash_h_ */ |
| 40 | |