]> git.proxmox.com Git - mirror_edk2.git/blame - Omap35xxPkg/Flash/Flash.h
Omap35xxPkg: Replace BSD License with BSD+Patent License
[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
538311f7 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
1e57a462 6\r
7**/\r
8\r
9#ifndef FLASH_H\r
10#define FLASH_H\r
11\r
12#include <Uefi.h>\r
13\r
14#include <Library/BaseLib.h>\r
15#include <Library/BaseMemoryLib.h>\r
16#include <Library/MemoryAllocationLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/IoLib.h>\r
19#include <Library/PcdLib.h>\r
20#include <Library/UefiBootServicesTableLib.h>\r
21#include <Library/IoLib.h>\r
22\r
23#include <Protocol/BlockIo.h>\r
24#include <Protocol/Cpu.h>\r
25#include <Omap3530/Omap3530.h>\r
26\r
27#define PAGE_SIZE(x) ((x) & 0x01)\r
28#define PAGE_SIZE_2K_VAL (0x01UL)\r
29\r
30#define SPARE_AREA_SIZE(x) (((x) >> 2) & 0x01)\r
31#define SPARE_AREA_SIZE_64B_VAL (0x1UL)\r
32\r
33#define BLOCK_SIZE(x) (((x) >> 4) & 0x01)\r
34#define BLOCK_SIZE_128K_VAL (0x01UL)\r
35\r
36#define ORGANIZATION(x) (((x) >> 6) & 0x01)\r
37#define ORGANIZATION_X8 (0x0UL)\r
38#define ORGANIZATION_X16 (0x1UL)\r
39\r
40#define PAGE_SIZE_512B (512)\r
41#define PAGE_SIZE_2K (2048)\r
42#define PAGE_SIZE_4K (4096)\r
43#define SPARE_AREA_SIZE_16B (16)\r
44#define SPARE_AREA_SIZE_64B (64)\r
45\r
46#define BLOCK_SIZE_16K (16*1024)\r
47#define BLOCK_SIZE_128K (128*1024)\r
48\r
49#define BLOCK_COUNT (2048)\r
50#define LAST_BLOCK (BLOCK_COUNT - 1)\r
51\r
52#define ECC_POSITION 2\r
53\r
54//List of commands.\r
55#define RESET_CMD 0xFF\r
56#define READ_ID_CMD 0x90\r
57\r
58#define READ_STATUS_CMD 0x70\r
59\r
60#define PAGE_READ_CMD 0x00\r
61#define PAGE_READ_CONFIRM_CMD 0x30\r
62\r
63#define BLOCK_ERASE_CMD 0x60\r
64#define BLOCK_ERASE_CONFIRM_CMD 0xD0\r
65\r
66#define PROGRAM_PAGE_CMD 0x80\r
67#define PROGRAM_PAGE_CONFIRM_CMD 0x10\r
68\r
69//Nand status register bit definition\r
70#define NAND_SUCCESS (0x0UL << 0)\r
71#define NAND_FAILURE BIT0\r
72\r
73#define NAND_BUSY (0x0UL << 6)\r
74#define NAND_READY BIT6\r
75\r
76#define NAND_RESET_STATUS (0x60UL << 0)\r
77\r
78#define MAX_RETRY_COUNT 1500\r
79\r
80\r
81typedef struct {\r
82 UINT8 ManufactureId;\r
83 UINT8 DeviceId;\r
84 UINT8 BlockAddressStart; //Start of the Block address in actual NAND\r
85 UINT8 PageAddressStart; //Start of the Page address in actual NAND\r
86} NAND_PART_INFO_TABLE;\r
87\r
88typedef struct {\r
89 UINT8 ManufactureId;\r
90 UINT8 DeviceId;\r
91 UINT8 Organization; //x8 or x16\r
92 UINT32 PageSize;\r
93 UINT32 SparePageSize;\r
94 UINT32 BlockSize;\r
95 UINT32 NumPagesPerBlock;\r
96 UINT8 BlockAddressStart; //Start of the Block address in actual NAND\r
97 UINT8 PageAddressStart; //Start of the Page address in actual NAND\r
98} NAND_FLASH_INFO;\r
99\r
100#endif //FLASH_H\r