linux/drivers/nvmem/sprd-efuse.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2019 Spreadtrum Communications Inc.

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/hwspinlock.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
#include <linux/of.h>
#include <linux/platform_device.h>

#define SPRD_EFUSE_ENABLE
#define SPRD_EFUSE_ERR_FLAG
#define SPRD_EFUSE_ERR_CLR
#define SPRD_EFUSE_MAGIC_NUM
#define SPRD_EFUSE_FW_CFG
#define SPRD_EFUSE_PW_SWT
#define SPRD_EFUSE_MEM(val)

#define SPRD_EFUSE_VDD_EN
#define SPRD_EFUSE_AUTO_CHECK_EN
#define SPRD_EFUSE_DOUBLE_EN
#define SPRD_EFUSE_MARGIN_RD_EN
#define SPRD_EFUSE_LOCK_WR_EN

#define SPRD_EFUSE_ERR_CLR_MASK

#define SPRD_EFUSE_ENK1_ON
#define SPRD_EFUSE_ENK2_ON
#define SPRD_EFUSE_PROG_EN

#define SPRD_EFUSE_MAGIC_NUMBER

/* Block width (bytes) definitions */
#define SPRD_EFUSE_BLOCK_WIDTH

/*
 * The Spreadtrum AP efuse contains 2 parts: normal efuse and secure efuse,
 * and we can only access the normal efuse in kernel. So define the normal
 * block offset index and normal block numbers.
 */
#define SPRD_EFUSE_NORMAL_BLOCK_NUMS
#define SPRD_EFUSE_NORMAL_BLOCK_OFFSET

/* Timeout (ms) for the trylock of hardware spinlocks */
#define SPRD_EFUSE_HWLOCK_TIMEOUT

/*
 * Since different Spreadtrum SoC chip can have different normal block numbers
 * and offset. And some SoC can support block double feature, which means
 * when reading or writing data to efuse memory, the controller can save double
 * data in case one data become incorrect after a long period.
 *
 * Thus we should save them in the device data structure.
 */
struct sprd_efuse_variant_data {};

struct sprd_efuse {};

static const struct sprd_efuse_variant_data ums312_data =;

/*
 * On Spreadtrum platform, we have multi-subsystems will access the unique
 * efuse controller, so we need one hardware spinlock to synchronize between
 * the multiple subsystems.
 */
static int sprd_efuse_lock(struct sprd_efuse *efuse)
{}

static void sprd_efuse_unlock(struct sprd_efuse *efuse)
{}

static void sprd_efuse_set_prog_power(struct sprd_efuse *efuse, bool en)
{}

static void sprd_efuse_set_read_power(struct sprd_efuse *efuse, bool en)
{}

static void sprd_efuse_set_prog_lock(struct sprd_efuse *efuse, bool en)
{}

static void sprd_efuse_set_auto_check(struct sprd_efuse *efuse, bool en)
{}

static void sprd_efuse_set_data_double(struct sprd_efuse *efuse, bool en)
{}

static void sprd_efuse_set_prog_en(struct sprd_efuse *efuse, bool en)
{}

static int sprd_efuse_raw_prog(struct sprd_efuse *efuse, u32 blk, bool doub,
			       bool lock, u32 *data)
{}

static int sprd_efuse_raw_read(struct sprd_efuse *efuse, int blk, u32 *val,
			       bool doub)
{}

static int sprd_efuse_read(void *context, u32 offset, void *val, size_t bytes)
{}

static int sprd_efuse_write(void *context, u32 offset, void *val, size_t bytes)
{}

static int sprd_efuse_probe(struct platform_device *pdev)
{}

static const struct of_device_id sprd_efuse_of_match[] =;
MODULE_DEVICE_TABLE(of, sprd_efuse_of_match);

static struct platform_driver sprd_efuse_driver =;

module_platform_driver();

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