cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

fw_dnld.h (1953B)


      1/* SPDX-License-Identifier: GPL-2.0-only */
      2/*
      3 * Marvell NFC driver: Firmware downloader
      4 *
      5 * Copyright (C) 2015, Marvell International Ltd.
      6 */
      7
      8#ifndef __NFCMRVL_FW_DNLD_H__
      9#define __NFCMRVL_FW_DNLD_H__
     10
     11#include <linux/workqueue.h>
     12
     13#define NFCMRVL_FW_MAGIC		0x88888888
     14
     15#define NCI_OP_PROP_BOOT_CMD		0x3A
     16
     17#define NCI_CORE_LC_PROP_FW_DL		0xFD
     18#define NCI_CORE_LC_CONNID_PROP_FW_DL	0x02
     19
     20#define HELPER_CMD_ENTRY_POINT		0x04
     21#define HELPER_CMD_PACKET_FORMAT	0xA5
     22#define HELPER_ACK_PACKET_FORMAT	0x5A
     23#define HELPER_RETRY_REQUESTED		(1 << 15)
     24
     25struct nfcmrvl_private;
     26
     27struct nfcmrvl_fw_uart_config {
     28	uint8_t flow_control;
     29	uint32_t baudrate;
     30} __packed;
     31
     32struct nfcmrvl_fw_i2c_config {
     33	uint32_t clk;
     34} __packed;
     35
     36struct nfcmrvl_fw_spi_config {
     37	uint32_t clk;
     38} __packed;
     39
     40struct nfcmrvl_fw_binary_config {
     41	uint32_t offset;
     42	union {
     43		void *config;
     44		struct nfcmrvl_fw_uart_config uart;
     45		struct nfcmrvl_fw_i2c_config i2c;
     46		struct nfcmrvl_fw_spi_config spi;
     47		uint8_t reserved[64];
     48	};
     49} __packed;
     50
     51struct nfcmrvl_fw {
     52	uint32_t magic;
     53	uint32_t ref_clock;
     54	uint32_t phy;
     55	struct nfcmrvl_fw_binary_config bootrom;
     56	struct nfcmrvl_fw_binary_config helper;
     57	struct nfcmrvl_fw_binary_config firmware;
     58	uint8_t reserved[64];
     59} __packed;
     60
     61struct nfcmrvl_fw_dnld {
     62	char name[NFC_FIRMWARE_NAME_MAXSIZE + 1];
     63	const struct firmware *fw;
     64
     65	const struct nfcmrvl_fw *header;
     66	const struct nfcmrvl_fw_binary_config *binary_config;
     67
     68	int state;
     69	int substate;
     70	int offset;
     71	int chunk_len;
     72
     73	struct workqueue_struct	*rx_wq;
     74	struct work_struct rx_work;
     75	struct sk_buff_head rx_q;
     76
     77	struct timer_list timer;
     78};
     79
     80int nfcmrvl_fw_dnld_init(struct nfcmrvl_private *priv);
     81void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv);
     82void nfcmrvl_fw_dnld_abort(struct nfcmrvl_private *priv);
     83int nfcmrvl_fw_dnld_start(struct nci_dev *ndev, const char *firmware_name);
     84void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
     85				struct sk_buff *skb);
     86
     87#endif