project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
106 lines
1.9 KiB
C
106 lines
1.9 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/* Copyright (c) 2018 Rockchip Electronics Co. Ltd. */
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include "sfc_nand.h"
|
|
#include "rkflash_api.h"
|
|
#include "rk_sftl.h"
|
|
|
|
struct SFNAND_DEV *sfnand_dev;
|
|
|
|
static int snand_init(void __iomem *reg_addr)
|
|
{
|
|
int ret;
|
|
|
|
sfc_init(reg_addr);
|
|
ret = sfc_nand_init();
|
|
if (ret == 0) {
|
|
sfnand_dev = sfc_nand_get_private_dev();
|
|
#if IS_REACHABLE(CONFIG_RK_SFTL)
|
|
sfc_nand_ftl_ops_init();
|
|
ret = sftl_init();
|
|
#elif !IS_REACHABLE(CONFIG_RK_SFC_NAND_MTD)
|
|
#error "When CONFIG_RK_SFC_NAND_MTD is not used, CONFIG_RK_SFTL is required!"
|
|
#endif
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
static unsigned int snand_get_capacity(void)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
return sftl_get_density();
|
|
return 0;
|
|
}
|
|
|
|
static int snand_write(u32 sec, u32 n_sec, void *p_data)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
return sftl_write(sec, n_sec, p_data);
|
|
return 0;
|
|
}
|
|
|
|
static int snand_read(u32 sec, u32 n_sec, void *p_data)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
return sftl_read(sec, n_sec, p_data);
|
|
return 0;
|
|
}
|
|
|
|
static int snand_vendor_read(u32 sec, u32 n_sec, void *p_data)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
return sftl_vendor_read(sec, n_sec, p_data);
|
|
return 0;
|
|
}
|
|
|
|
static int snand_vendor_write(u32 sec, u32 n_sec, void *p_data)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
return sftl_vendor_write(sec, n_sec, p_data);
|
|
return 0;
|
|
}
|
|
|
|
static int snand_gc(void)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
return sftl_gc();
|
|
return 0;
|
|
}
|
|
|
|
static int snand_discard(u32 sec, u32 n_sec)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
return sftl_discard(sec, n_sec);
|
|
return 0;
|
|
}
|
|
|
|
static void snand_deinit(void)
|
|
{
|
|
if (IS_ENABLED(CONFIG_RK_SFTL))
|
|
sftl_deinit();
|
|
sfc_nand_deinit();
|
|
}
|
|
|
|
static int snand_resume(void __iomem *reg_addr)
|
|
{
|
|
sfc_init(reg_addr);
|
|
return sfc_nand_init();
|
|
}
|
|
|
|
const struct flash_boot_ops sfc_nand_ops = {
|
|
snand_init,
|
|
snand_read,
|
|
snand_write,
|
|
snand_get_capacity,
|
|
snand_deinit,
|
|
snand_resume,
|
|
snand_vendor_read,
|
|
snand_vendor_write,
|
|
snand_gc,
|
|
snand_discard,
|
|
};
|