linux/drivers/nvmem/jz4780-efuse.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * JZ4780 EFUSE Memory Support driver
 *
 * Copyright (c) 2017 PrasannaKumar Muralidharan <[email protected]>
 * Copyright (c) 2020 H. Nikolaus Schaller <[email protected]>
 */

/*
 * Currently supports JZ4780 efuse which has 8K programmable bit.
 * Efuse is separated into seven segments as below:
 *
 * -----------------------------------------------------------------------
 * | 64 bit | 128 bit | 128 bit | 3520 bit | 8 bit | 2296 bit | 2048 bit |
 * -----------------------------------------------------------------------
 *
 * The rom itself is accessed using a 9 bit address line and an 8 word wide bus
 * which reads/writes based on strobes. The strobe is configured in the config
 * register and is based on number of cycles of the bus clock.
 *
 * Driver supports read only as the writes are done in the Factory.
 */

#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/timer.h>

#define JZ_EFUCTRL
#define JZ_EFUCFG
#define JZ_EFUSTATE
#define JZ_EFUDATA(n)

/* We read 32 byte chunks to avoid complexity in the driver. */
#define JZ_EFU_READ_SIZE

#define EFUCTRL_ADDR_MASK
#define EFUCTRL_ADDR_SHIFT
#define EFUCTRL_LEN_MASK
#define EFUCTRL_LEN_SHIFT
#define EFUCTRL_PG_EN
#define EFUCTRL_WR_EN
#define EFUCTRL_RD_EN

#define EFUCFG_INT_EN
#define EFUCFG_RD_ADJ_MASK
#define EFUCFG_RD_ADJ_SHIFT
#define EFUCFG_RD_STR_MASK
#define EFUCFG_RD_STR_SHIFT
#define EFUCFG_WR_ADJ_MASK
#define EFUCFG_WR_ADJ_SHIFT
#define EFUCFG_WR_STR_MASK
#define EFUCFG_WR_STR_SHIFT

#define EFUSTATE_WR_DONE
#define EFUSTATE_RD_DONE

struct jz4780_efuse {};

/* main entry point */
static int jz4780_efuse_read(void *context, unsigned int offset,
			     void *val, size_t bytes)
{}

static struct nvmem_config jz4780_efuse_nvmem_config =;

static const struct regmap_config jz4780_efuse_regmap_config =;

static void clk_disable_unprepare_helper(void *clock)
{}

static int jz4780_efuse_probe(struct platform_device *pdev)
{}

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

static struct platform_driver jz4780_efuse_driver =;
module_platform_driver();

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