linux/drivers/nvmem/bcm-ocotp.c

// SPDX-License-Identifier: GPL-2.0-only
// Copyright (C) 2016 Broadcom

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

/*
 * # of tries for OTP Status. The time to execute a command varies. The slowest
 * commands are writes which also vary based on the # of bits turned on. Writing
 * 0xffffffff takes ~3800 us.
 */
#define OTPC_RETRIES

/* Sequence to enable OTP program */
#define OTPC_PROG_EN_SEQ

/* OTPC Commands */
#define OTPC_CMD_READ
#define OTPC_CMD_OTP_PROG_ENABLE
#define OTPC_CMD_OTP_PROG_DISABLE
#define OTPC_CMD_PROGRAM

/* OTPC Status Bits */
#define OTPC_STAT_CMD_DONE
#define OTPC_STAT_PROG_OK

/* OTPC register definition */
#define OTPC_MODE_REG_OFFSET
#define OTPC_MODE_REG_OTPC_MODE
#define OTPC_COMMAND_OFFSET
#define OTPC_COMMAND_COMMAND_WIDTH
#define OTPC_CMD_START_OFFSET
#define OTPC_CMD_START_START
#define OTPC_CPU_STATUS_OFFSET
#define OTPC_CPUADDR_REG_OFFSET
#define OTPC_CPUADDR_REG_OTPC_CPU_ADDRESS_WIDTH
#define OTPC_CPU_WRITE_REG_OFFSET

#define OTPC_CMD_MASK
#define OTPC_ADDR_MASK


struct otpc_map {};

static struct otpc_map otp_map =;

static struct otpc_map otp_map_v2 =;

struct otpc_priv {};

static inline void set_command(void __iomem *base, u32 command)
{}

static inline void set_cpu_address(void __iomem *base, u32 addr)
{}

static inline void set_start_bit(void __iomem *base)
{}

static inline void reset_start_bit(void __iomem *base)
{}

static inline void write_cpu_data(void __iomem *base, u32 value)
{}

static int poll_cpu_status(void __iomem *base, u32 value)
{}

static int enable_ocotp_program(void __iomem *base)
{}

static int disable_ocotp_program(void __iomem *base)
{}

static int bcm_otpc_read(void *context, unsigned int offset, void *val,
	size_t bytes)
{}

static int bcm_otpc_write(void *context, unsigned int offset, void *val,
	size_t bytes)
{}

static struct nvmem_config bcm_otpc_nvmem_config =;

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

static const struct acpi_device_id bcm_otpc_acpi_ids[] __maybe_unused =;
MODULE_DEVICE_TABLE(acpi, bcm_otpc_acpi_ids);

static int bcm_otpc_probe(struct platform_device *pdev)
{}

static struct platform_driver bcm_otpc_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();