linux/drivers/nvmem/sc27xx-efuse.c

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

#include <linux/hwspinlock.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/nvmem-provider.h>

/* PMIC global registers definition */
#define SC27XX_MODULE_EN
#define SC2730_MODULE_EN
#define SC27XX_EFUSE_EN

/* Efuse controller registers definition */
#define SC27XX_EFUSE_GLB_CTRL
#define SC27XX_EFUSE_DATA_RD
#define SC27XX_EFUSE_DATA_WR
#define SC27XX_EFUSE_BLOCK_INDEX
#define SC27XX_EFUSE_MODE_CTRL
#define SC27XX_EFUSE_STATUS
#define SC27XX_EFUSE_WR_TIMING_CTRL
#define SC27XX_EFUSE_RD_TIMING_CTRL
#define SC27XX_EFUSE_EFUSE_DEB_CTRL

/* Mask definition for SC27XX_EFUSE_BLOCK_INDEX register */
#define SC27XX_EFUSE_BLOCK_MASK

/* Bits definitions for SC27XX_EFUSE_MODE_CTRL register */
#define SC27XX_EFUSE_PG_START
#define SC27XX_EFUSE_RD_START
#define SC27XX_EFUSE_CLR_RDDONE

/* Bits definitions for SC27XX_EFUSE_STATUS register */
#define SC27XX_EFUSE_PGM_BUSY
#define SC27XX_EFUSE_READ_BUSY
#define SC27XX_EFUSE_STANDBY
#define SC27XX_EFUSE_GLOBAL_PROT
#define SC27XX_EFUSE_RD_DONE

/* Block number and block width (bytes) definitions */
#define SC27XX_EFUSE_BLOCK_MAX
#define SC27XX_EFUSE_BLOCK_WIDTH

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

/* Timeout (us) of polling the status */
#define SC27XX_EFUSE_POLL_TIMEOUT
#define SC27XX_EFUSE_POLL_DELAY_US

/*
 * Since different PMICs of SC27xx series can have different
 * address , we should save address in the device data structure.
 */
struct sc27xx_efuse_variant_data {};

struct sc27xx_efuse {};

static const struct sc27xx_efuse_variant_data sc2731_edata =;

static const struct sc27xx_efuse_variant_data sc2730_edata =;

/*
 * 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 sc27xx_efuse_lock(struct sc27xx_efuse *efuse)
{}

static void sc27xx_efuse_unlock(struct sc27xx_efuse *efuse)
{}

static int sc27xx_efuse_poll_status(struct sc27xx_efuse *efuse, u32 bits)
{}

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

static int sc27xx_efuse_probe(struct platform_device *pdev)
{}

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

static struct platform_driver sc27xx_efuse_driver =;

module_platform_driver();

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