drivers: rkflash: add vendor ops api for nand devices

1.Add vendor ops api for nand devices;
2.Remove unused headfile.
3.Make rkflash block driver reachable by other devices

Change-Id: I26129cb94382b0714b9c35f4dc6113ddb752251c
Signed-off-by: Dingqiang Lin <jon.lin@rock-chips.com>
This commit is contained in:
Dingqiang Lin 2018-07-21 21:18:18 +08:00 committed by Kever Yang
parent 3872c3f472
commit cd67f373aa
12 changed files with 2054 additions and 83850 deletions

View File

@ -4,9 +4,10 @@
# SPDX-License-Identifier: GPL-2.0
#
obj-$(CONFIG_RKNANDC_NAND) += rksftl.o rkflash_blk.o rknandc_base.o rkflash_api.o rkflash_debug.o flash.o nandc.o
obj-$(CONFIG_RKSFC_NAND) += rksftl.o rkflash_blk.o rksfc_base.o rkflash_api.o rkflash_debug.o sfc_nand.o sfc.o
obj-$(CONFIG_RKSFC_NOR) += rkflash_blk.o rksfc_base.o rkflash_api.o rkflash_debug.o sfc_nor.o sfc.o
obj-y += rkflash_blk.o rkflash_debug.o
obj-$(CONFIG_RKNANDC_NAND) += rksftl.o rknandc_base.o rkflash_api.o flash.o nandc.o
obj-$(CONFIG_RKSFC_NAND) += rksftl.o rksfc_base.o rkflash_api.o sfc_nand.o sfc.o
obj-$(CONFIG_RKSFC_NOR) += rksfc_base.o rkflash_api.o sfc_nor.o sfc.o
ifneq (, $(CONFIG_RKNANDC_NAND)$(CONFIG_RKSFC_NAND))

View File

@ -10,7 +10,6 @@
#include "flash.h"
#include "flash_com.h"
#include "nandc.h"
#include "typedef.h"
#include "rkflash_debug.h"
#define FLASH_STRESS_TEST_EN 0

View File

@ -7,8 +7,6 @@
#ifndef __FLASH_H
#define __FLASH_H
#include "typedef.h"
#ifndef BIT
#define BIT(nr) (1 << (nr))
#endif

View File

@ -11,7 +11,7 @@
#include "flash.h"
#include "flash_com.h"
#include "nandc.h"
#include "typedef.h"
#include "rk_sftl.h"
#define CPU_DELAY_NS(n) ndelay(n)

View File

@ -14,5 +14,13 @@ int sftl_read(u32 index, u32 count, u8 *buf);
int sftl_write(u32 index, u32 count, u8 *buf);
u32 sftl_get_density(void);
s32 sftl_gc(void);
int sftl_vendor_read(u32 index, u32 count, u8 *buf);
int sftl_vendor_write(u32 index, u32 count, u8 *buf);
void *ftl_malloc(int n_size);
void ftl_free(void *p);
void *ftl_memset(void *s, int c, unsigned int n);
void *ftl_memcpy(void *pv_to,
const void *pv_from,
unsigned int size);
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
#include <dm.h>
#include <dm/device-internal.h>
#include <asm/arch/clock.h>
#include <rksfc.h>
#include "rkflash_blk.h"
#include "rkflash_api.h"

View File

@ -8,11 +8,11 @@
#include <linux/bug.h>
#include <linux/delay.h>
#include "flash.h"
#include "flash_com.h"
#include "rkflash_debug.h"
#include "rk_sftl.h"
#include "sfc.h"
#include "sfc_nand.h"
#include "rkflash_debug.h"
static struct nand_info spi_nand_tbl[] = {
/* TC58CVG0S0HxAIx */
@ -559,7 +559,7 @@ u32 sfc_nand_init(void)
PRINT_SFC_I("...%s enter...\n", __func__);
sfc_nand_read_id_raw(id_byte);
PRINT_SFC_E("sfc_nand id: %x %x %x\n",
PRINT_SFC_I("sfc_nand id: %x %x %x\n",
id_byte[0], id_byte[1], id_byte[2]);
if (id_byte[0] == 0xFF || id_byte[0] == 0x00)
return FTL_NO_FLASH;

4
drivers/rkflash/sfc_nand.h Executable file → Normal file
View File

@ -117,7 +117,11 @@ struct nand_info {
u32 (*ecc_status)(void);
};
extern struct nand_phy_info g_nand_phy_info;
extern struct nand_ops g_nand_ops;
u32 sfc_nand_init(void);
void sfc_nand_deinit(void);
int sfc_nand_read_id(u8 *buf);
u32 sfc_nand_ecc_status_sp1(void);
u32 sfc_nand_ecc_status_sp3(void);

View File

@ -526,7 +526,7 @@ int snor_init(struct SFNOR_DEV *p_dev)
memset(p_dev, 0, sizeof(struct SFNOR_DEV));
snor_read_id(id_byte);
PRINT_SFC_E("sfc nor id: %x %x %x\n",
PRINT_SFC_I("sfc nor id: %x %x %x\n",
id_byte[0], id_byte[1], id_byte[2]);
if (0xFF == id_byte[0] || 0x00 == id_byte[0]) {
err = SFC_ERROR;

View File

@ -29,15 +29,4 @@
#define INVALID_UINT16 ((u16)0xFFFF)
#define INVALID_UINT32 ((u32)0xFFFFFFFFL)
#define PRINT_E pr_info
#define PRINT_I pr_info
void *ftl_malloc(int n_size);
void *ftl_memset(void *s, int c, unsigned int n);
void *ftl_memcpy(void *pv_to,
const void *pv_from,
unsigned int size);
void ftl_free(void *p);
void rknand_print_hex(char *s, void *buf, int width, int len);
#endif /*__TYPEDEF_H */