1 /* Copyright (C) 2007-2008 The Android Open Source Project 2 ** 3 ** This software is licensed under the terms of the GNU General Public 4 ** License version 2, as published by the Free Software Foundation, and 5 ** may be copied, distributed, and modified under those terms. 6 ** 7 ** This program is distributed in the hope that it will be useful, 8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 ** GNU General Public License for more details. 11 */ 12 #ifndef NAND_DEVICE_REG_H 13 #define NAND_DEVICE_REG_H 14 15 enum nand_cmd { 16 NAND_CMD_GET_DEV_NAME, // Write device name for NAND_DEV to NAND_DATA (vaddr) 17 NAND_CMD_READ, 18 NAND_CMD_WRITE, 19 NAND_CMD_ERASE, 20 NAND_CMD_BLOCK_BAD_GET, // NAND_RESULT is 1 if block is bad, 0 if it is not 21 NAND_CMD_BLOCK_BAD_SET, 22 NAND_CMD_READ_BATCH, // BATCH OP extensions. 23 NAND_CMD_WRITE_BATCH, 24 NAND_CMD_ERASE_BATCH 25 }; 26 27 struct batch_data{ 28 uint32_t dev; 29 uint32_t addr_low; 30 uint32_t addr_high; 31 uint32_t transfer_size; 32 uint32_t data; 33 uint32_t result; 34 }; 35 36 struct batch_data_64 { 37 uint32_t dev; 38 uint32_t addr_low; 39 uint32_t addr_high; 40 uint32_t transfer_size; 41 uint64_t data; 42 uint32_t result; 43 }; 44 45 enum nand_dev_flags { 46 NAND_DEV_FLAG_READ_ONLY = 0x00000001, 47 NAND_DEV_FLAG_BATCH_CAP = 0x00000002 48 }; 49 50 #define NAND_VERSION_CURRENT (1) 51 52 enum nand_reg { 53 // Global 54 NAND_VERSION = 0x000, 55 NAND_NUM_DEV = 0x004, 56 NAND_DEV = 0x008, 57 58 // Dev info 59 NAND_DEV_FLAGS = 0x010, 60 NAND_DEV_NAME_LEN = 0x014, 61 NAND_DEV_PAGE_SIZE = 0x018, 62 NAND_DEV_EXTRA_SIZE = 0x01c, 63 NAND_DEV_ERASE_SIZE = 0x020, 64 NAND_DEV_SIZE_LOW = 0x028, 65 NAND_DEV_SIZE_HIGH = 0x02c, 66 67 // Command 68 NAND_RESULT = 0x040, 69 NAND_COMMAND = 0x044, 70 NAND_DATA = 0x048, 71 NAND_TRANSFER_SIZE = 0x04c, 72 NAND_ADDR_LOW = 0x050, 73 NAND_ADDR_HIGH = 0x054, 74 NAND_BATCH_ADDR_LOW = 0x058, 75 NAND_BATCH_ADDR_HIGH= 0x05c, 76 77 NAND_DATA_HIGH = 0x100, // For 64-bit guest CPUs. 78 }; 79 80 #endif 81