linux/drivers/edac/npcm_edac.c

// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2022 Nuvoton Technology Corporation

#include <linux/debugfs.h>
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include "edac_module.h"

#define EDAC_MOD_NAME
#define EDAC_MSG_SIZE

/* chip serials */
#define NPCM7XX_CHIP
#define NPCM8XX_CHIP

/* syndrome values */
#define UE_SYNDROME

/* error injection */
#define ERROR_TYPE_CORRECTABLE
#define ERROR_TYPE_UNCORRECTABLE
#define ERROR_LOCATION_DATA
#define ERROR_LOCATION_CHECKCODE
#define ERROR_BIT_DATA_MAX
#define ERROR_BIT_CHECKCODE_MAX

static char data_synd[] =;

static struct regmap *npcm_regmap;

struct npcm_platform_data {};

struct priv_data {};

static void handle_ce(struct mem_ctl_info *mci)
{}

static void handle_ue(struct mem_ctl_info *mci)
{}

static irqreturn_t edac_ecc_isr(int irq, void *dev_id)
{}

static ssize_t force_ecc_error(struct file *file, const char __user *data,
			       size_t count, loff_t *ppos)
{}

static const struct file_operations force_ecc_error_fops =;

/*
 * Setup debugfs for error injection.
 *
 * Nodes:
 *   error_type		- 0: CE, 1: UE
 *   location		- 0: data, 1: checkcode
 *   bit		- 0 ~ 63 for data and 0 ~ 7 for checkcode
 *   force_ecc_error	- trigger
 *
 * Examples:
 *   1. Inject a correctable error (CE) at checkcode bit 7.
 *      ~# echo 0 > /sys/kernel/debug/edac/npcm-edac/error_type
 *      ~# echo 1 > /sys/kernel/debug/edac/npcm-edac/location
 *      ~# echo 7 > /sys/kernel/debug/edac/npcm-edac/bit
 *      ~# echo 1 > /sys/kernel/debug/edac/npcm-edac/force_ecc_error
 *
 *   2. Inject an uncorrectable error (UE).
 *      ~# echo 1 > /sys/kernel/debug/edac/npcm-edac/error_type
 *      ~# echo 1 > /sys/kernel/debug/edac/npcm-edac/force_ecc_error
 */
static void setup_debugfs(struct mem_ctl_info *mci)
{}

static int setup_irq(struct mem_ctl_info *mci, struct platform_device *pdev)
{}

static const struct regmap_config npcm_regmap_cfg =;

static int edac_probe(struct platform_device *pdev)
{}

static void edac_remove(struct platform_device *pdev)
{}

static const struct npcm_platform_data npcm750_edac =;

static const struct npcm_platform_data npcm845_edac =;

static const struct of_device_id npcm_edac_of_match[] =;

MODULE_DEVICE_TABLE(of, npcm_edac_of_match);

static struct platform_driver npcm_edac_driver =;

module_platform_driver();

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