1/* 2 * Broadcom SiliconBackplane chipcommon serial flash interface 3 * 4 * Copyright (C) 2015, 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. 17 * 18 * $Id: sflash.h 345826 2012-07-19 06:34:55Z $ 19 */ 20 21#ifndef _sflash_h_ 22#define _sflash_h_ 23 24#include <typedefs.h> 25#include <sbchipc.h> 26 27struct sflash { 28 uint blocksize; /* Block size */ 29 uint numblocks; /* Number of blocks */ 30 uint32 type; /* Type */ 31 uint size; /* Total size in bytes */ 32 uint32 phybase; 33}; 34 35/* Utility functions */ 36extern int sflash_poll(si_t *sih, chipcregs_t *cc, uint offset); 37extern int sflash_read(si_t *sih, chipcregs_t *cc, 38 uint offset, uint len, uchar *buf); 39extern int sflash_write(si_t *sih, chipcregs_t *cc, 40 uint offset, uint len, const uchar *buf); 41extern int sflash_erase(si_t *sih, chipcregs_t *cc, uint offset); 42extern int sflash_commit(si_t *sih, chipcregs_t *cc, 43 uint offset, uint len, const uchar *buf); 44extern struct sflash *sflash_init(si_t *sih, chipcregs_t *cc); 45 46#endif /* _sflash_h_ */ 47