openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

soc_flash.h (1234B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * Purpose:     Header for QSPI Flash Driver
      8  */
      9 #ifndef _SOC_FLASH_H_
     10 #define _SOC_FLASH_H_
     11 
     12 #define SOC_FLASH_SECTOR_TYPE_UNIFORM (0)
     13 #define SOC_FLASH_SECTOR_TYPE_HYBRID  (1)
     14 typedef struct soc_flash_conf_s {
     15     uint8      id;
     16     size_t     page_size;
     17     size_t     sector_size;
     18     uint32     sector_type;
     19     uint32     nr_sectors;
     20     size_t     size;
     21 } soc_flash_conf_t;
     22 
     23 extern int
     24 soc_flash_init(int unit,
     25                uint32 max_hz,
     26                uint32 mode,
     27                soc_flash_conf_t *spi_flash);
     28 
     29 extern int
     30 soc_flash_cleanup(int unit);
     31 
     32 extern int
     33 soc_flash_read(int unit,
     34                uint32 offset,
     35                size_t len,
     36                void *buf);
     37 
     38 extern int
     39 soc_flash_write(int unit,
     40                 uint32 offset,
     41                 size_t len,
     42                 const void *buf);
     43 
     44 extern int
     45 soc_flash_erase(int unit,
     46                 uint32 offset,
     47                 size_t len);
     48 
     49 extern int
     50 soc_flash_cmd_write_status(int unit,
     51                            uint8 sr);
     52 
     53 #endif /* _SOC_FLASH_H_ */