]> git.proxmox.com Git - mirror_edk2.git/blame - Omap35xxPkg/Flash/Flash.h
BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / Omap35xxPkg / Flash / Flash.h
CommitLineData
1e57a462 1/** @file\r
2\r
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
4\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef FLASH_H\r
16#define FLASH_H\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Library/BaseLib.h>\r
21#include <Library/BaseMemoryLib.h>\r
22#include <Library/MemoryAllocationLib.h>\r
23#include <Library/DebugLib.h>\r
24#include <Library/IoLib.h>\r
25#include <Library/PcdLib.h>\r
26#include <Library/UefiBootServicesTableLib.h>\r
27#include <Library/IoLib.h>\r
28\r
29#include <Protocol/BlockIo.h>\r
30#include <Protocol/Cpu.h>\r
31#include <Omap3530/Omap3530.h>\r
32\r
33#define PAGE_SIZE(x) ((x) & 0x01)\r
34#define PAGE_SIZE_2K_VAL (0x01UL)\r
35\r
36#define SPARE_AREA_SIZE(x) (((x) >> 2) & 0x01)\r
37#define SPARE_AREA_SIZE_64B_VAL (0x1UL)\r
38\r
39#define BLOCK_SIZE(x) (((x) >> 4) & 0x01)\r
40#define BLOCK_SIZE_128K_VAL (0x01UL)\r
41\r
42#define ORGANIZATION(x) (((x) >> 6) & 0x01)\r
43#define ORGANIZATION_X8 (0x0UL)\r
44#define ORGANIZATION_X16 (0x1UL)\r
45\r
46#define PAGE_SIZE_512B (512)\r
47#define PAGE_SIZE_2K (2048)\r
48#define PAGE_SIZE_4K (4096)\r
49#define SPARE_AREA_SIZE_16B (16)\r
50#define SPARE_AREA_SIZE_64B (64)\r
51\r
52#define BLOCK_SIZE_16K (16*1024)\r
53#define BLOCK_SIZE_128K (128*1024)\r
54\r
55#define BLOCK_COUNT (2048)\r
56#define LAST_BLOCK (BLOCK_COUNT - 1)\r
57\r
58#define ECC_POSITION 2\r
59\r
60//List of commands.\r
61#define RESET_CMD 0xFF\r
62#define READ_ID_CMD 0x90\r
63\r
64#define READ_STATUS_CMD 0x70\r
65\r
66#define PAGE_READ_CMD 0x00\r
67#define PAGE_READ_CONFIRM_CMD 0x30\r
68\r
69#define BLOCK_ERASE_CMD 0x60\r
70#define BLOCK_ERASE_CONFIRM_CMD 0xD0\r
71\r
72#define PROGRAM_PAGE_CMD 0x80\r
73#define PROGRAM_PAGE_CONFIRM_CMD 0x10\r
74\r
75//Nand status register bit definition\r
76#define NAND_SUCCESS (0x0UL << 0)\r
77#define NAND_FAILURE BIT0\r
78\r
79#define NAND_BUSY (0x0UL << 6)\r
80#define NAND_READY BIT6\r
81\r
82#define NAND_RESET_STATUS (0x60UL << 0)\r
83\r
84#define MAX_RETRY_COUNT 1500\r
85\r
86\r
87typedef struct {\r
88 UINT8 ManufactureId;\r
89 UINT8 DeviceId;\r
90 UINT8 BlockAddressStart; //Start of the Block address in actual NAND\r
91 UINT8 PageAddressStart; //Start of the Page address in actual NAND\r
92} NAND_PART_INFO_TABLE;\r
93\r
94typedef struct {\r
95 UINT8 ManufactureId;\r
96 UINT8 DeviceId;\r
97 UINT8 Organization; //x8 or x16\r
98 UINT32 PageSize;\r
99 UINT32 SparePageSize;\r
100 UINT32 BlockSize;\r
101 UINT32 NumPagesPerBlock;\r
102 UINT8 BlockAddressStart; //Start of the Block address in actual NAND\r
103 UINT8 PageAddressStart; //Start of the Page address in actual NAND\r
104} NAND_FLASH_INFO;\r
105\r
106#endif //FLASH_H\r