1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef __CFIFLASH_H__ 16 #define __CFIFLASH_H__ 17 18 #include "fs/driver.h" 19 #include "mtd_dev.h" 20 21 #define CFI_DRIVER "/dev/cfiflash" 22 #define CFI_BLK_DRIVER "/dev/cfiblk" 23 #define FLASH_TYPE "cfi-flash" 24 25 #define CFIFLASH_CAPACITY (64 * 1024 * 1024) 26 #define CFIFLASH_ERASEBLK_SIZE (128 * 1024 * 2) /* fit QEMU of 2 banks */ 27 #define CFIFLASH_ERASEBLK_WORDS (CFIFLASH_ERASEBLK_SIZE / sizeof(uint32_t)) 28 #define CFIFLASH_ERASEBLK_WORDMASK (~(CFIFLASH_ERASEBLK_WORDS - 1)) 29 30 #define CFIFLASH_ROOT_ADDR (10 * 1024 * 1024) 31 #define CFIFLASH_BOOTARGS_ADDR (CFIFLASH_ROOT_ADDR - CFIFLASH_ERASEBLK_SIZE) 32 33 struct block_operations *GetCfiBlkOps(void); 34 struct MtdDev *GetCfiMtdDev(void); 35 36 #endif 37