• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* drivers/mtd/devices/goldfish_nand_reg.h
2 **
3 ** Copyright (C) 2007 Google, Inc.
4 **
5 ** This software is licensed under the terms of the GNU General Public
6 ** License version 2, as published by the Free Software Foundation, and
7 ** may be copied, distributed, and modified under those terms.
8 **
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ** GNU General Public License for more details.
13 **
14 */
15 
16 #ifndef GOLDFISH_NAND_REG_H
17 #define GOLDFISH_NAND_REG_H
18 
19 enum nand_cmd {
20 	NAND_CMD_INVALID = -1,
21 	NAND_CMD_GET_DEV_NAME,  // Write device name for NAND_DEV to NAND_DATA (vaddr)
22 	NAND_CMD_READ,
23 	NAND_CMD_WRITE,
24 	NAND_CMD_ERASE,
25 	NAND_CMD_BLOCK_BAD_GET, // NAND_RESULT is 1 if block is bad, 0 if it is not
26 	NAND_CMD_BLOCK_BAD_SET,
27 	NAND_CMD_READ_WITH_PARAMS,
28 	NAND_CMD_WRITE_WITH_PARAMS,
29 	NAND_CMD_ERASE_WITH_PARAMS
30 };
31 
32 enum nand_dev_flags {
33     NAND_DEV_FLAG_READ_ONLY = 0x00000001,
34     NAND_DEV_FLAG_CMD_PARAMS_CAP = 0x00000002,
35 };
36 
37 #define NAND_VERSION_CURRENT (1)
38 
39 enum nand_reg {
40 	// Global
41 	NAND_VERSION        = 0x000,
42 	NAND_NUM_DEV        = 0x004,
43 	NAND_DEV            = 0x008,
44 
45 	// Dev info
46 	NAND_DEV_FLAGS      = 0x010,
47 	NAND_DEV_NAME_LEN   = 0x014,
48 	NAND_DEV_PAGE_SIZE  = 0x018,
49 	NAND_DEV_EXTRA_SIZE = 0x01c,
50 	NAND_DEV_ERASE_SIZE = 0x020,
51 	NAND_DEV_SIZE_LOW   = 0x028,
52 	NAND_DEV_SIZE_HIGH  = 0x02c,
53 
54 	// Command
55 	NAND_RESULT         = 0x040,
56 	NAND_COMMAND        = 0x044,
57 	NAND_DATA           = 0x048,
58 	NAND_TRANSFER_SIZE  = 0x04c,
59 	NAND_ADDR_LOW       = 0x050,
60 	NAND_ADDR_HIGH      = 0x054,
61 	NAND_CMD_PARAMS_ADDR_LOW = 0x058,
62 	NAND_CMD_PARAMS_ADDR_HIGH = 0x05c,
63 };
64 
65 struct cmd_params{
66 	uint32_t dev;
67 	uint32_t addr_low;
68 	uint32_t addr_high;
69 	uint32_t transfer_size;
70 	uint32_t data;
71 	uint32_t result;
72 };
73 #endif
74