]>
git.proxmox.com Git - mirror_edk2.git/blob - Omap35xxPkg/Flash/Flash.h
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Library/BaseLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/MemoryAllocationLib.h>
23 #include <Library/DebugLib.h>
24 #include <Library/IoLib.h>
25 #include <Library/PcdLib.h>
26 #include <Library/UefiBootServicesTableLib.h>
27 #include <Library/IoLib.h>
29 #include <Protocol/BlockIo.h>
30 #include <Protocol/Cpu.h>
31 #include <Omap3530/Omap3530.h>
33 #define PAGE_SIZE(x) ((x) & 0x01)
34 #define PAGE_SIZE_2K_VAL (0x01UL)
36 #define SPARE_AREA_SIZE(x) (((x) >> 2) & 0x01)
37 #define SPARE_AREA_SIZE_64B_VAL (0x1UL)
39 #define BLOCK_SIZE(x) (((x) >> 4) & 0x01)
40 #define BLOCK_SIZE_128K_VAL (0x01UL)
42 #define ORGANIZATION(x) (((x) >> 6) & 0x01)
43 #define ORGANIZATION_X8 (0x0UL)
44 #define ORGANIZATION_X16 (0x1UL)
46 #define PAGE_SIZE_512B (512)
47 #define PAGE_SIZE_2K (2048)
48 #define PAGE_SIZE_4K (4096)
49 #define SPARE_AREA_SIZE_16B (16)
50 #define SPARE_AREA_SIZE_64B (64)
52 #define BLOCK_SIZE_16K (16*1024)
53 #define BLOCK_SIZE_128K (128*1024)
55 #define BLOCK_COUNT (2048)
56 #define LAST_BLOCK (BLOCK_COUNT - 1)
58 #define ECC_POSITION 2
61 #define RESET_CMD 0xFF
62 #define READ_ID_CMD 0x90
64 #define READ_STATUS_CMD 0x70
66 #define PAGE_READ_CMD 0x00
67 #define PAGE_READ_CONFIRM_CMD 0x30
69 #define BLOCK_ERASE_CMD 0x60
70 #define BLOCK_ERASE_CONFIRM_CMD 0xD0
72 #define PROGRAM_PAGE_CMD 0x80
73 #define PROGRAM_PAGE_CONFIRM_CMD 0x10
75 //Nand status register bit definition
76 #define NAND_SUCCESS (0x0UL << 0)
77 #define NAND_FAILURE BIT0
79 #define NAND_BUSY (0x0UL << 6)
80 #define NAND_READY BIT6
82 #define NAND_RESET_STATUS (0x60UL << 0)
84 #define MAX_RETRY_COUNT 1500
90 UINT8 BlockAddressStart
; //Start of the Block address in actual NAND
91 UINT8 PageAddressStart
; //Start of the Page address in actual NAND
92 } NAND_PART_INFO_TABLE
;
97 UINT8 Organization
; //x8 or x16
101 UINT32 NumPagesPerBlock
;
102 UINT8 BlockAddressStart
; //Start of the Block address in actual NAND
103 UINT8 PageAddressStart
; //Start of the Page address in actual NAND