1192355Sgonzo/*-
2192355Sgonzo * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3192355Sgonzo * All rights reserved.
4192355Sgonzo *
5192355Sgonzo * Redistribution and use in source and binary forms, with or without
6192355Sgonzo * modification, are permitted provided that the following conditions
7192355Sgonzo * are met:
8192355Sgonzo * 1. Redistributions of source code must retain the above copyright
9192355Sgonzo *    notice unmodified, this list of conditions, and the following
10192355Sgonzo *    disclaimer.
11192355Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
12192355Sgonzo *    notice, this list of conditions and the following disclaimer in the
13192355Sgonzo *    documentation and/or other materials provided with the distribution.
14192355Sgonzo *
15192355Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16192355Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17192355Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18192355Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19192355Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20192355Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21192355Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22192355Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23192355Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24192355Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25192355Sgonzo * SUCH DAMAGE.
26210238Sadrian *
27210238Sadrian * $FreeBSD$
28192355Sgonzo */
29192355Sgonzo
30192355Sgonzo#ifndef __MX25LREG_H__
31192355Sgonzo#define __MX25LREG_H__
32192355Sgonzo
33192355Sgonzo/*
34192355Sgonzo * Commands
35192355Sgonzo */
36192355Sgonzo#define CMD_WRITE_ENABLE	0x06
37192355Sgonzo#define CMD_WRITE_DISABLE	0x04
38192355Sgonzo#define CMD_READ_IDENT		0x9F
39192355Sgonzo#define CMD_READ_STATUS		0x05
40192355Sgonzo#define CMD_WRITE_STATUS	0x01
41192355Sgonzo#define CMD_READ		0x03
42192355Sgonzo#define CMD_FAST_READ		0x0B
43192355Sgonzo#define CMD_PAGE_PROGRAM	0x02
44192355Sgonzo#define CMD_SECTOR_ERASE	0xD8
45192355Sgonzo#define CMD_BULK_ERASE		0xC7
46210238Sadrian#define	CMD_BLOCK_4K_ERASE	0x20
47210238Sadrian#define	CMD_BLOCK_32K_ERASE	0x52
48192355Sgonzo
49192355Sgonzo/*
50192355Sgonzo * Status register flags
51192355Sgonzo */
52192355Sgonzo#define	STATUS_SRWD	(1 << 7)
53192355Sgonzo#define	STATUS_BP2	(1 << 4)
54192355Sgonzo#define	STATUS_BP1	(1 << 3)
55192355Sgonzo#define	STATUS_BP0	(1 << 2)
56192355Sgonzo#define	STATUS_WEL	(1 << 1)
57192355Sgonzo#define	STATUS_WIP	(1 << 0)
58192355Sgonzo
59198465Sgonzo#define	FLASH_PAGE_SIZE	256
60198465Sgonzo
61192355Sgonzo#endif /* __MX25LREG_H__ */
62192355Sgonzo
63