#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 …
#define INTR_STATUS_PAGE_VALID …
#define INTR_EN_PAGE_MASK …
#define ECC_BCH_LEVEL_MASK …
#define ELM_SYNDROME_VALID …
#define ECC_CORRECTABLE_MASK …
#define ECC_NB_ERRORS_MASK …
#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)
{ … }
int elm_config(struct device *dev, enum bch_ecc bch_type,
int ecc_steps, int ecc_step_size, int ecc_syndrome_size)
{ … }
EXPORT_SYMBOL(…);
static void elm_configure_page_mode(struct elm_info *info, int index,
bool enable)
{ … }
static void elm_load_syndrome(struct elm_info *info,
struct elm_errorvec *err_vec, u8 *ecc)
{ … }
static void elm_start_processing(struct elm_info *info,
struct elm_errorvec *err_vec)
{ … }
static void elm_error_correction(struct elm_info *info,
struct elm_errorvec *err_vec)
{ … }
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
static int elm_context_save(struct elm_info *info)
{ … }
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(…) …;