linux/drivers/mtd/nand/raw/omap_elm.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Error Location Module
 *
 * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com/
 */

#define DRIVER_NAME

#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/sched.h>
#include <linux/pm_runtime.h>
#include <linux/platform_data/elm.h>

#define ELM_SYSCONFIG
#define ELM_IRQSTATUS
#define ELM_IRQENABLE
#define ELM_LOCATION_CONFIG
#define ELM_PAGE_CTRL
#define ELM_SYNDROME_FRAGMENT_0
#define ELM_SYNDROME_FRAGMENT_1
#define ELM_SYNDROME_FRAGMENT_2
#define ELM_SYNDROME_FRAGMENT_3
#define ELM_SYNDROME_FRAGMENT_4
#define ELM_SYNDROME_FRAGMENT_5
#define ELM_SYNDROME_FRAGMENT_6
#define ELM_LOCATION_STATUS
#define ELM_ERROR_LOCATION_0

/* ELM Interrupt Status Register */
#define INTR_STATUS_PAGE_VALID

/* ELM Interrupt Enable Register */
#define INTR_EN_PAGE_MASK

/* ELM Location Configuration Register */
#define ECC_BCH_LEVEL_MASK

/* ELM syndrome */
#define ELM_SYNDROME_VALID

/* ELM_LOCATION_STATUS Register */
#define ECC_CORRECTABLE_MASK
#define ECC_NB_ERRORS_MASK

/* ELM_ERROR_LOCATION_0-15 Registers */
#define ECC_ERROR_LOCATION_MASK

#define ELM_ECC_SIZE

#define SYNDROME_FRAGMENT_REG_SIZE
#define ERROR_LOCATION_SIZE

struct elm_registers {};

struct elm_info {};

static LIST_HEAD(elm_devices);

static void elm_write_reg(struct elm_info *info, int offset, u32 val)
{}

static u32 elm_read_reg(struct elm_info *info, int offset)
{}

/**
 * elm_config - Configure ELM module
 * @dev:	ELM device
 * @bch_type:	Type of BCH ecc
 * @ecc_steps:	ECC steps to assign to config
 * @ecc_step_size:	ECC step size to assign to config
 * @ecc_syndrome_size:	ECC syndrome size to assign to config
 */
int elm_config(struct device *dev, enum bch_ecc bch_type,
	int ecc_steps, int ecc_step_size, int ecc_syndrome_size)
{}
EXPORT_SYMBOL();

/**
 * elm_configure_page_mode - Enable/Disable page mode
 * @info:	elm info
 * @index:	index number of syndrome fragment vector
 * @enable:	enable/disable flag for page mode
 *
 * Enable page mode for syndrome fragment index
 */
static void elm_configure_page_mode(struct elm_info *info, int index,
		bool enable)
{}

/**
 * elm_load_syndrome - Load ELM syndrome reg
 * @info:	elm info
 * @err_vec:	elm error vectors
 * @ecc:	buffer with calculated ecc
 *
 * Load syndrome fragment registers with calculated ecc in reverse order.
 */
static void elm_load_syndrome(struct elm_info *info,
		struct elm_errorvec *err_vec, u8 *ecc)
{}

/**
 * elm_start_processing - start elm syndrome processing
 * @info:	elm info
 * @err_vec:	elm error vectors
 *
 * Set syndrome valid bit for syndrome fragment registers for which
 * elm syndrome fragment registers are loaded. This enables elm module
 * to start processing syndrome vectors.
 */
static void elm_start_processing(struct elm_info *info,
		struct elm_errorvec *err_vec)
{}

/**
 * elm_error_correction - locate correctable error position
 * @info:	elm info
 * @err_vec:	elm error vectors
 *
 * On completion of processing by elm module, error location status
 * register updated with correctable/uncorrectable error information.
 * In case of correctable errors, number of errors located from
 * elm location status register & read the positions from
 * elm error location register.
 */
static void elm_error_correction(struct elm_info *info,
		struct elm_errorvec *err_vec)
{}

/**
 * elm_decode_bch_error_page - Locate error position
 * @dev:	device pointer
 * @ecc_calc:	calculated ECC bytes from GPMC
 * @err_vec:	elm error vectors
 *
 * Called with one or more error reported vectors & vectors with
 * error reported is updated in err_vec[].error_reported
 */
void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
		struct elm_errorvec *err_vec)
{}
EXPORT_SYMBOL();

static irqreturn_t elm_isr(int this_irq, void *dev_id)
{}

static int elm_probe(struct platform_device *pdev)
{}

static void elm_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
/*
 * elm_context_save
 * saves ELM configurations to preserve them across Hardware powered-down
 */
static int elm_context_save(struct elm_info *info)
{}

/*
 * elm_context_restore
 * writes configurations saved duing power-down back into ELM registers
 */
static int elm_context_restore(struct elm_info *info)
{}

static int elm_suspend(struct device *dev)
{}

static int elm_resume(struct device *dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);

#ifdef CONFIG_OF
static const struct of_device_id elm_of_match[] =;
MODULE_DEVICE_TABLE(of, elm_of_match);
#endif

static struct platform_driver elm_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_ALIAS();
MODULE_LICENSE();