linux/drivers/nvmem/stm32-romem.c

// SPDX-License-Identifier: GPL-2.0
/*
 * STM32 Factory-programmed memory read access driver
 *
 * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
 * Author: Fabrice Gasnier <[email protected]> for STMicroelectronics.
 */

#include <linux/arm-smccc.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/tee_drv.h>

#include "stm32-bsec-optee-ta.h"

/* BSEC secure service access from non-secure */
#define STM32_SMC_BSEC
#define STM32_SMC_READ_SHADOW
#define STM32_SMC_PROG_OTP
#define STM32_SMC_WRITE_SHADOW
#define STM32_SMC_READ_OTP

/* shadow registers offset */
#define STM32MP15_BSEC_DATA0

struct stm32_romem_cfg {};

struct stm32_romem_priv {};

static int stm32_romem_read(void *context, unsigned int offset, void *buf,
			    size_t bytes)
{}

static int stm32_bsec_smc(u8 op, u32 otp, u32 data, u32 *result)
{}

static int stm32_bsec_read(void *context, unsigned int offset, void *buf,
			   size_t bytes)
{}

static int stm32_bsec_write(void *context, unsigned int offset, void *buf,
			    size_t bytes)
{}

static int stm32_bsec_pta_read(void *context, unsigned int offset, void *buf,
			       size_t bytes)
{}

static int stm32_bsec_pta_write(void *context, unsigned int offset, void *buf,
				size_t bytes)
{}

static bool stm32_bsec_smc_check(void)
{}

static bool optee_presence_check(void)
{}

static int stm32_romem_probe(struct platform_device *pdev)
{}

/*
 * STM32MP15/13 BSEC OTP regions: 4096 OTP bits (with 3072 effective bits)
 * => 96 x 32-bits data words
 * - Lower: 1K bits, 2:1 redundancy, incremental bit programming
 *   => 32 (x 32-bits) lower shadow registers = words 0 to 31
 * - Upper: 2K bits, ECC protection, word programming only
 *   => 64 (x 32-bits) = words 32 to 95
 */
static const struct stm32_romem_cfg stm32mp15_bsec_cfg =;

static const struct stm32_romem_cfg stm32mp13_bsec_cfg =;

/*
 * STM32MP25 BSEC OTP: 3 regions of 32-bits data words
 *   lower OTP (OTP0 to OTP127), bitwise (1-bit) programmable
 *   mid OTP (OTP128 to OTP255), bulk (32-bit) programmable
 *   upper OTP (OTP256 to OTP383), bulk (32-bit) programmable
 *              but no access to HWKEY and ECIES key: limited at OTP367
 */
static const struct stm32_romem_cfg stm32mp25_bsec_cfg =;

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

static struct platform_driver stm32_romem_driver =;
module_platform_driver();

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