diff -drupN a/drivers/mtd/aw-spinand/sunxi-spinand.h b/drivers/mtd/aw-spinand/sunxi-spinand.h --- a/drivers/mtd/aw-spinand/sunxi-spinand.h 1970-01-01 03:00:00.000000000 +0300 +++ b/drivers/mtd/aw-spinand/sunxi-spinand.h 2022-06-12 05:28:14.000000000 +0300 @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __SUNXI_SPINAND_H +#define __SUNXI_SPINAND_H + +#include +#include +#include + +#define SECTOR_SHIFT 9 + +#define AW_MTD_SPINAND_VER_MAIN 0x01 +#define AW_MTD_SPINAND_VER_SUB 0x05 +#define AW_MTD_SPINAND_VER_DATE 0x20190702 + +#define UBOOT_START_BLOCK_BIGNAND 4 +#define UBOOT_START_BLOCK_SMALLNAND 8 +#define PHY_BLKS_FOR_BOOT0 8 +#define PHY_BLKS_FOR_SECURE_STORAGE 8 +#define PSTORE_SIZE_KB 512 +#define NAND_BOOT0_BLK_START 0 +#define VALID_PAGESIZE_FOR_BOOT0 2048 + +struct aw_spinand { + struct mutex lock; + struct aw_spinand_chip chip; + struct mtd_info mtd; + int sector_shift; + int page_shift; + int block_shift; +#if IS_ENABLED(CONFIG_AW_SPINAND_SECURE_STORAGE) + struct aw_spinand_sec_sto sec_sto; +#endif +}; + +extern struct aw_spinand *get_aw_spinand(void); + +#define spinand_to_mtd(spinand) (&spinand->mtd) +#define spinand_to_chip(spinand) (&spinand->chip) +#define mtd_to_spinand(mtd) container_of(mtd, struct aw_spinand, mtd) +#define spi_to_spinand(spi) spi_get_drvdata(spi) + +#endif