1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Networks nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
49 * This file provides bootbus flash operations
51 * <hr>$Revision: 49448 $<hr>
57 #ifndef __CVMX_FLASH_H__
58 #define __CVMX_FLASH_H__
69 } cvmx_flash_region_t;
72 * Initialize the flash access library
74 void cvmx_flash_initialize(void);
77 * Return a pointer to the flash chip
79 * @param chip_id Chip ID to return
80 * @return NULL if the chip doesn't exist
82 void *cvmx_flash_get_base(int chip_id);
85 * Return the number of erasable regions on the chip
87 * @param chip_id Chip to return info for
88 * @return Number of regions
90 int cvmx_flash_get_num_regions(int chip_id);
93 * Return information about a flash chips region
95 * @param chip_id Chip to get info for
96 * @param region Region to get info for
97 * @return Region information
99 const cvmx_flash_region_t *cvmx_flash_get_region_info(int chip_id, int region);
102 * Erase a block on the flash chip
104 * @param chip_id Chip to erase a block on
105 * @param region Region to erase a block in
106 * @param block Block number to erase
107 * @return Zero on success. Negative on failure
109 int cvmx_flash_erase_block(int chip_id, int region, int block);
112 * Write a block on the flash chip
114 * @param chip_id Chip to write a block on
115 * @param region Region to write a block in
116 * @param block Block number to write
117 * @param data Data to write
118 * @return Zero on success. Negative on failure
120 int cvmx_flash_write_block(int chip_id, int region, int block, const void *data);
123 * Erase and write data to a flash
125 * @param address Memory address to write to
126 * @param data Data to write
127 * @param len Length of the data
128 * @return Zero on success. Negative on failure
130 int cvmx_flash_write(void *address, const void *data, int len);
136 #endif /* __CVMX_FLASH_H__ */