--- zzzz-none-000/linux-4.19.183/drivers/mtd/nand/raw/brcmnand/brcmnand.h 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/drivers/mtd/nand/raw/brcmnand/brcmnand.h 2023-06-28 08:54:19.000000000 +0000 @@ -16,6 +16,13 @@ #include #include +#if defined(CONFIG_BCM_KF_MTD_BCMNAND) +#include +#include + +extern int setup_mtd_parts(struct mtd_info* mtd); +#endif + struct platform_device; struct dev_pm_ops; @@ -25,6 +32,12 @@ void (*ctlrdy_set_enabled)(struct brcmnand_soc *soc, bool en); void (*prepare_data_bus)(struct brcmnand_soc *soc, bool prepare, bool is_param); +#if defined(CONFIG_BCM_KF_MTD_BCMNAND) + struct platform_device *pdev; + void *priv; + int (*check_dying_gasp)(struct brcmnand_soc *soc); +#endif + }; static inline void brcmnand_soc_data_bus_prepare(struct brcmnand_soc *soc, @@ -41,6 +54,21 @@ soc->prepare_data_bus(soc, false, is_param); } +#if defined(CONFIG_BCM_KF_MTD_BCMNAND) +/* Check if system is losing power. Abort any write or erase request if system + * is shutting down to avoid any partial write or erase to the NAND media. Otherwise + * the impacted block or page may be unstable + */ +static inline int brcmnand_check_dying_gasp(struct brcmnand_soc *soc) +{ + int ret = 0; + if (soc && soc->check_dying_gasp) + ret = soc->check_dying_gasp(soc); + return ret; +} +#endif + + static inline u32 brcmnand_readl(void __iomem *addr) { /*