1161197Simp/*******************************************************************************
2161197Simp *
3161197Simp * Filename: spi_flash.h
4161197Simp *
5161197Simp * Definition of flash control routines supporting AT45DB161B
6161197Simp *
7161197Simp * Revision information:
8161197Simp *
9161197Simp * 17JAN2005	kb_admin	initial creation
10161197Simp *
11161197Simp * BEGIN_KBDD_BLOCK
12161197Simp * No warranty, expressed or implied, is included with this software.  It is
13161197Simp * provided "AS IS" and no warranty of any kind including statutory or aspects
14161197Simp * relating to merchantability or fitness for any purpose is provided.  All
15161197Simp * intellectual property rights of others is maintained with the respective
16161197Simp * owners.  This software is not copyrighted and is intended for reference
17161197Simp * only.
18161197Simp * END_BLOCK
19161197Simp *
20161197Simp * $FreeBSD$
21161197Simp ******************************************************************************/
22161197Simp
23161197Simp#ifndef _SPI_FLASH_H_
24161197Simp#define _SPI_FLASH_H_
25161197Simp
26161197Simptypedef struct {
27161197Simp	char		*tx_cmd;
28161197Simp	unsigned	tx_cmd_size;
29161197Simp	char		*rx_cmd;
30161197Simp	unsigned	rx_cmd_size;
31161197Simp	char		*tx_data;
32161197Simp	unsigned	tx_data_size;
33161197Simp	char		*rx_data;
34161197Simp	unsigned	rx_data_size;
35161197Simp} spiCommand_t;
36161197Simp
37161197Simpvoid SPI_ReadFlash(unsigned flash_addr, char *dest_addr, unsigned size);
38161197Simpvoid SPI_WriteFlash(unsigned flash_addr, char *dest_addr, unsigned size);
39161197Simpvoid SPI_InitFlash(void);
40161197Simp
41161197Simpvoid SPI_GetId(unsigned *id);
42161197Simp
43165400Simp#ifdef BOOT_BWCT
44165400Simp#define FLASH_PAGE_SIZE	528
45165400Simp#else
46161197Simp#define FLASH_PAGE_SIZE	1056
47165400Simp#endif
48161197Simp
49161197Simp// Flash commands
50161197Simp
51161197Simp#define CONTINUOUS_ARRAY_READ		0xE8
52161197Simp#define CONTINUOUS_ARRAY_READ_HF	0x0B
53161197Simp#define CONTINUOUS_ARRAY_READ_LF	0x03
54161197Simp#define STATUS_REGISTER_READ		0xD7
55161197Simp#define PROGRAM_THROUGH_BUFFER		0x82
56161197Simp#define MANUFACTURER_ID			0x9F
57161197Simp
58161197Simp#endif
59