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 enum nand_dev_flags { 37 NAND_DEV_FLAG_READ_ONLY = 0x00000001, 38 NAND_DEV_FLAG_BATCH_CAP = 0x00000002 39 }; 40 41 #define NAND_VERSION_CURRENT (1) 42 43 enum nand_reg { 44 // Global 45 NAND_VERSION = 0x000, 46 NAND_NUM_DEV = 0x004, 47 NAND_DEV = 0x008, 48 49 // Dev info 50 NAND_DEV_FLAGS = 0x010, 51 NAND_DEV_NAME_LEN = 0x014, 52 NAND_DEV_PAGE_SIZE = 0x018, 53 NAND_DEV_EXTRA_SIZE = 0x01c, 54 NAND_DEV_ERASE_SIZE = 0x020, 55 NAND_DEV_SIZE_LOW = 0x028, 56 NAND_DEV_SIZE_HIGH = 0x02c, 57 58 // Command 59 NAND_RESULT = 0x040, 60 NAND_COMMAND = 0x044, 61 NAND_DATA = 0x048, 62 NAND_TRANSFER_SIZE = 0x04c, 63 NAND_ADDR_LOW = 0x050, 64 NAND_ADDR_HIGH = 0x054, 65 NAND_BATCH_ADDR_LOW = 0x058, 66 NAND_BATCH_ADDR_HIGH= 0x05c, 67 }; 68 69 #endif 70