aboutsummaryrefslogtreecommitdiffstats
path: root/hw/goldfish_nand_reg.h
blob: 34d7c44d118a9e56158280d1b3c30f06f6d86ad4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* Copyright (C) 2007-2008 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
*/
#ifndef NAND_DEVICE_REG_H
#define NAND_DEVICE_REG_H

enum nand_cmd {
	NAND_CMD_GET_DEV_NAME,  // Write device name for NAND_DEV to NAND_DATA (vaddr)
	NAND_CMD_READ,
	NAND_CMD_WRITE,
	NAND_CMD_ERASE,
	NAND_CMD_BLOCK_BAD_GET, // NAND_RESULT is 1 if block is bad, 0 if it is not
	NAND_CMD_BLOCK_BAD_SET,
	NAND_CMD_READ_BATCH,	// BATCH OP extensions.
	NAND_CMD_WRITE_BATCH,
	NAND_CMD_ERASE_BATCH
};

struct batch_data{
	uint32_t dev;
	uint32_t addr_low;
	uint32_t addr_high;
	uint32_t transfer_size;
	uint32_t data;
	uint32_t result;
};

enum nand_dev_flags {
	NAND_DEV_FLAG_READ_ONLY = 0x00000001,
	NAND_DEV_FLAG_BATCH_CAP = 0x00000002
};

#define NAND_VERSION_CURRENT (1)

enum nand_reg {
	// Global
	NAND_VERSION        = 0x000,
	NAND_NUM_DEV        = 0x004,
	NAND_DEV            = 0x008,

	// Dev info
	NAND_DEV_FLAGS      = 0x010,
	NAND_DEV_NAME_LEN   = 0x014,
	NAND_DEV_PAGE_SIZE  = 0x018,
	NAND_DEV_EXTRA_SIZE = 0x01c,
	NAND_DEV_ERASE_SIZE = 0x020,
	NAND_DEV_SIZE_LOW   = 0x028,
	NAND_DEV_SIZE_HIGH  = 0x02c,

	// Command
	NAND_RESULT         = 0x040,
	NAND_COMMAND        = 0x044,
	NAND_DATA           = 0x048,
	NAND_TRANSFER_SIZE  = 0x04c,
	NAND_ADDR_LOW       = 0x050,
	NAND_ADDR_HIGH      = 0x054,
	NAND_BATCH_ADDR_LOW = 0x058,
	NAND_BATCH_ADDR_HIGH= 0x05c,
};

#endif