linux/drivers/nfc/port100.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Sony NFC Port-100 Series driver
 * Copyright (c) 2013, Intel Corporation.
 *
 * Partly based/Inspired by Stephen Tiedemann's nfcpy
 */

#include <linux/module.h>
#include <linux/usb.h>
#include <net/nfc/digital.h>

#define VERSION

#define SONY_VENDOR_ID
#define RCS380S_PRODUCT_ID
#define RCS380P_PRODUCT_ID

#define PORT100_PROTOCOLS

#define PORT100_CAPABILITIES

/* Standard port100 frame definitions */
#define PORT100_FRAME_HEADER_LEN
#define PORT100_FRAME_TAIL_LEN

#define PORT100_COMM_RF_HEAD_MAX_LEN

/*
 * Max extended frame payload len, excluding CC and SCC
 * which are already in PORT100_FRAME_HEADER_LEN.
 */
#define PORT100_FRAME_MAX_PAYLOAD_LEN

#define PORT100_FRAME_ACK_SIZE
static u8 ack_frame[PORT100_FRAME_ACK_SIZE] =;

#define PORT100_FRAME_CHECKSUM(f)
#define PORT100_FRAME_POSTAMBLE(f)

/* start of frame */
#define PORT100_FRAME_SOF
#define PORT100_FRAME_EXT
#define PORT100_FRAME_ACK

/* Port-100 command: in or out */
#define PORT100_FRAME_DIRECTION(f)
#define PORT100_FRAME_DIR_OUT
#define PORT100_FRAME_DIR_IN

/* Port-100 sub-command */
#define PORT100_FRAME_CMD(f)

#define PORT100_CMD_GET_FIRMWARE_VERSION
#define PORT100_CMD_GET_COMMAND_TYPE
#define PORT100_CMD_SET_COMMAND_TYPE

#define PORT100_CMD_IN_SET_RF
#define PORT100_CMD_IN_SET_PROTOCOL
#define PORT100_CMD_IN_COMM_RF

#define PORT100_CMD_TG_SET_RF
#define PORT100_CMD_TG_SET_PROTOCOL
#define PORT100_CMD_TG_SET_RF_OFF
#define PORT100_CMD_TG_COMM_RF

#define PORT100_CMD_SWITCH_RF

#define PORT100_CMD_RESPONSE(cmd)

#define PORT100_CMD_TYPE_IS_SUPPORTED(mask, cmd_type)
#define PORT100_CMD_TYPE_0
#define PORT100_CMD_TYPE_1

#define PORT100_CMD_STATUS_OK
#define PORT100_CMD_STATUS_TIMEOUT

#define PORT100_MDAA_TGT_HAS_BEEN_ACTIVATED_MASK
#define PORT100_MDAA_TGT_WAS_ACTIVATED_MASK

struct port100;

port100_send_async_complete_t;

/*
 * Setting sets structure for in_set_rf command
 *
 * @in_*_set_number: Represent the entry indexes in the port-100 RF Base Table.
 *              This table contains multiple RF setting sets required for RF
 *              communication.
 *
 * @in_*_comm_type: Theses fields set the communication type to be used.
 */
struct port100_in_rf_setting {} __packed;

#define PORT100_COMM_TYPE_IN_212F
#define PORT100_COMM_TYPE_IN_424F
#define PORT100_COMM_TYPE_IN_106A
#define PORT100_COMM_TYPE_IN_106B

static const struct port100_in_rf_setting in_rf_settings[] =;

/**
 * struct port100_tg_rf_setting - Setting sets structure for tg_set_rf command
 *
 * @tg_set_number: Represents the entry index in the port-100 RF Base Table.
 *                 This table contains multiple RF setting sets required for RF
 *                 communication. this field is used for both send and receive
 *                 settings.
 *
 * @tg_comm_type: Sets the communication type to be used to send and receive
 *                data.
 */
struct port100_tg_rf_setting {} __packed;

#define PORT100_COMM_TYPE_TG_106A
#define PORT100_COMM_TYPE_TG_212F
#define PORT100_COMM_TYPE_TG_424F

static const struct port100_tg_rf_setting tg_rf_settings[] =;

#define PORT100_IN_PROT_INITIAL_GUARD_TIME
#define PORT100_IN_PROT_ADD_CRC
#define PORT100_IN_PROT_CHECK_CRC
#define PORT100_IN_PROT_MULTI_CARD
#define PORT100_IN_PROT_ADD_PARITY
#define PORT100_IN_PROT_CHECK_PARITY
#define PORT100_IN_PROT_BITWISE_AC_RECV_MODE
#define PORT100_IN_PROT_VALID_BIT_NUMBER
#define PORT100_IN_PROT_CRYPTO1
#define PORT100_IN_PROT_ADD_SOF
#define PORT100_IN_PROT_CHECK_SOF
#define PORT100_IN_PROT_ADD_EOF
#define PORT100_IN_PROT_CHECK_EOF
#define PORT100_IN_PROT_DEAF_TIME
#define PORT100_IN_PROT_CRM
#define PORT100_IN_PROT_CRM_MIN_LEN
#define PORT100_IN_PROT_T1_TAG_FRAME
#define PORT100_IN_PROT_RFCA
#define PORT100_IN_PROT_GUARD_TIME_AT_INITIATOR
#define PORT100_IN_PROT_END

#define PORT100_IN_MAX_NUM_PROTOCOLS

#define PORT100_TG_PROT_TU
#define PORT100_TG_PROT_RF_OFF
#define PORT100_TG_PROT_CRM
#define PORT100_TG_PROT_END

#define PORT100_TG_MAX_NUM_PROTOCOLS

struct port100_protocol {} __packed;

static const struct port100_protocol
in_protocols[][PORT100_IN_MAX_NUM_PROTOCOLS + 1] =;

static const struct port100_protocol
tg_protocols[][PORT100_TG_MAX_NUM_PROTOCOLS + 1] =;

struct port100 {};

struct port100_cmd {};

struct port100_frame {} __packed;

struct port100_ack_frame {} __packed;

struct port100_cb_arg {};

struct port100_tg_comm_rf_cmd {} __packed;

struct port100_tg_comm_rf_res {} __packed;

/* The rule: value + checksum = 0 */
static inline u8 port100_checksum(u16 value)
{}

/* The rule: sum(data elements) + checksum = 0 */
static u8 port100_data_checksum(const u8 *data, int datalen)
{}

static void port100_tx_frame_init(void *_frame, u8 cmd_code)
{}

static void port100_tx_frame_finish(void *_frame)
{}

static void port100_tx_update_payload_len(void *_frame, int len)
{}

static bool port100_rx_frame_is_valid(const void *_frame)
{}

static bool port100_rx_frame_is_ack(const struct port100_ack_frame *frame)
{}

static inline int port100_rx_frame_size(const void *frame)
{}

static bool port100_rx_frame_is_cmd_response(const struct port100 *dev,
					     const void *frame)
{}

static void port100_recv_response(struct urb *urb)
{}

static int port100_submit_urb_for_response(const struct port100 *dev,
					   gfp_t flags)
{}

static void port100_recv_ack(struct urb *urb)
{}

static int port100_submit_urb_for_ack(const struct port100 *dev, gfp_t flags)
{}

static int port100_send_ack(struct port100 *dev)
{}

static int port100_send_frame_async(struct port100 *dev,
				    const struct sk_buff *out,
				    const struct sk_buff *in, int in_len)
{}

static void port100_build_cmd_frame(struct port100 *dev, u8 cmd_code,
				    struct sk_buff *skb)
{}

static void port100_send_async_complete(struct port100 *dev)
{}

static int port100_send_cmd_async(struct port100 *dev, u8 cmd_code,
				struct sk_buff *req,
				port100_send_async_complete_t complete_cb,
				void *complete_cb_context)
{}

struct port100_sync_cmd_response {};

static void port100_wq_cmd_complete(struct work_struct *work)
{}

static void port100_send_sync_complete(struct port100 *dev, void *_arg,
				      struct sk_buff *resp)
{}

static struct sk_buff *port100_send_cmd_sync(struct port100 *dev, u8 cmd_code,
					     struct sk_buff *req)
{}

static void port100_send_complete(struct urb *urb)
{}

static void port100_abort_cmd(struct nfc_digital_dev *ddev)
{}

static struct sk_buff *port100_alloc_skb(const struct port100 *dev, unsigned int size)
{}

static int port100_set_command_type(struct port100 *dev, u8 command_type)
{}

static u64 port100_get_command_type_mask(struct port100 *dev)
{}

static u16 port100_get_firmware_version(struct port100 *dev)
{}

static int port100_switch_rf(struct nfc_digital_dev *ddev, bool on)
{}

static int port100_in_set_rf(struct nfc_digital_dev *ddev, u8 rf)
{}

static int port100_in_set_framing(struct nfc_digital_dev *ddev, int param)
{}

static int port100_in_configure_hw(struct nfc_digital_dev *ddev, int type,
				   int param)
{}

static void port100_in_comm_rf_complete(struct port100 *dev, void *arg,
				       struct sk_buff *resp)
{}

static int port100_in_send_cmd(struct nfc_digital_dev *ddev,
			       struct sk_buff *skb, u16 _timeout,
			       nfc_digital_cmd_complete_t cb, void *arg)
{}

static int port100_tg_set_rf(struct nfc_digital_dev *ddev, u8 rf)
{}

static int port100_tg_set_framing(struct nfc_digital_dev *ddev, int param)
{}

static int port100_tg_configure_hw(struct nfc_digital_dev *ddev, int type,
				   int param)
{}

static bool port100_tg_target_activated(struct port100 *dev, u8 tgt_activated)
{}

static void port100_tg_comm_rf_complete(struct port100 *dev, void *arg,
					struct sk_buff *resp)
{}

static int port100_tg_send_cmd(struct nfc_digital_dev *ddev,
			       struct sk_buff *skb, u16 timeout,
			       nfc_digital_cmd_complete_t cb, void *arg)
{}

static int port100_listen_mdaa(struct nfc_digital_dev *ddev,
			       struct digital_tg_mdaa_params *params,
			       u16 timeout,
			       nfc_digital_cmd_complete_t cb, void *arg)
{}

static int port100_listen(struct nfc_digital_dev *ddev, u16 timeout,
			  nfc_digital_cmd_complete_t cb, void *arg)
{}

static const struct nfc_digital_ops port100_digital_ops =;

static const struct usb_device_id port100_table[] =;
MODULE_DEVICE_TABLE(usb, port100_table);

static int port100_probe(struct usb_interface *interface,
			 const struct usb_device_id *id)
{}

static void port100_disconnect(struct usb_interface *interface)
{}

static struct usb_driver port100_driver =;

module_usb_driver();

MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();