linux/drivers/firmware/microchip/mpfs-auto-update.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Microchip Polarfire SoC "Auto Update" FPGA reprogramming.
 *
 * Documentation of this functionality is available in the "PolarFire® FPGA and
 * PolarFire SoC FPGA Programming" User Guide.
 *
 * Copyright (c) 2022-2023 Microchip Corporation. All rights reserved.
 *
 * Author: Conor Dooley <[email protected]>
 */
#include <linux/cleanup.h>
#include <linux/debugfs.h>
#include <linux/firmware.h>
#include <linux/math.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
#include <linux/platform_device.h>
#include <linux/sizes.h>

#include <soc/microchip/mpfs.h>

#define AUTO_UPDATE_DEFAULT_MBOX_OFFSET
#define AUTO_UPDATE_DEFAULT_RESP_OFFSET

#define AUTO_UPDATE_FEATURE_CMD_OPCODE
#define AUTO_UPDATE_FEATURE_CMD_DATA_SIZE
#define AUTO_UPDATE_FEATURE_RESP_SIZE
#define AUTO_UPDATE_FEATURE_CMD_DATA
#define AUTO_UPDATE_FEATURE_ENABLED

#define AUTO_UPDATE_AUTHENTICATE_CMD_OPCODE
#define AUTO_UPDATE_AUTHENTICATE_CMD_DATA_SIZE
#define AUTO_UPDATE_AUTHENTICATE_RESP_SIZE
#define AUTO_UPDATE_AUTHENTICATE_CMD_DATA

#define AUTO_UPDATE_PROGRAM_CMD_OPCODE
#define AUTO_UPDATE_PROGRAM_CMD_DATA_SIZE
#define AUTO_UPDATE_PROGRAM_RESP_SIZE
#define AUTO_UPDATE_PROGRAM_CMD_DATA

/*
 * SPI Flash layout example:
 * |------------------------------| 0x0000000
 * | 1 KiB                        |
 * | SPI "directories"            |
 * |------------------------------| 0x0000400
 * | 1 MiB                        |
 * | Reserved area                |
 * | Used for bitstream info      |
 * |------------------------------| 0x0100400
 * | 20 MiB                       |
 * | Golden Image                 |
 * |------------------------------| 0x1500400
 * | 20 MiB                       |
 * | Auto Upgrade Image           |
 * |------------------------------| 0x2900400
 * | 20 MiB                       |
 * | Reserved for multi-image IAP |
 * | Unused for Auto Upgrade      |
 * |------------------------------| 0x3D00400
 * | ? B                          |
 * | Unused                       |
 * |------------------------------| 0x?
 */
#define AUTO_UPDATE_DIRECTORY_BASE
#define AUTO_UPDATE_DIRECTORY_WIDTH
#define AUTO_UPDATE_GOLDEN_INDEX
#define AUTO_UPDATE_UPGRADE_INDEX
#define AUTO_UPDATE_BLANK_INDEX
#define AUTO_UPDATE_GOLDEN_DIRECTORY
#define AUTO_UPDATE_UPGRADE_DIRECTORY
#define AUTO_UPDATE_BLANK_DIRECTORY
#define AUTO_UPDATE_DIRECTORY_SIZE
#define AUTO_UPDATE_INFO_BASE
#define AUTO_UPDATE_INFO_SIZE
#define AUTO_UPDATE_BITSTREAM_BASE

#define AUTO_UPDATE_TIMEOUT_MS

struct mpfs_auto_update_priv {};

static bool mpfs_auto_update_is_bitstream_info(const u8 *data, u32 size)
{}

static enum fw_upload_err mpfs_auto_update_prepare(struct fw_upload *fw_uploader, const u8 *data,
						   u32 size)
{}

static void mpfs_auto_update_cancel(struct fw_upload *fw_uploader)
{}

static enum fw_upload_err mpfs_auto_update_poll_complete(struct fw_upload *fw_uploader)
{}

static int mpfs_auto_update_verify_image(struct fw_upload *fw_uploader)
{}

static int mpfs_auto_update_set_image_address(struct mpfs_auto_update_priv *priv,
					      u32 image_address, loff_t directory_address)
{}

static int mpfs_auto_update_write_bitstream(struct fw_upload *fw_uploader, const u8 *data,
					    u32 offset, u32 size, u32 *written)
{}

static enum fw_upload_err mpfs_auto_update_write(struct fw_upload *fw_uploader, const u8 *data,
						 u32 offset, u32 size, u32 *written)
{}

static const struct fw_upload_ops mpfs_auto_update_ops =;

static int mpfs_auto_update_available(struct mpfs_auto_update_priv *priv)
{}

static int mpfs_auto_update_probe(struct platform_device *pdev)
{}

static void mpfs_auto_update_remove(struct platform_device *pdev)
{}

static struct platform_driver mpfs_auto_update_driver =;
module_platform_driver();

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