18c2ecf20Sopenharmony_ci/** 28c2ecf20Sopenharmony_ci * Marvell NFC driver 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2014-2015, Marvell International Ltd. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This software file (the "File") is distributed by Marvell International 78c2ecf20Sopenharmony_ci * Ltd. under the terms of the GNU General Public License Version 2, June 1991 88c2ecf20Sopenharmony_ci * (the "License"). You may use, redistribute and/or modify this File in 98c2ecf20Sopenharmony_ci * accordance with the terms and conditions of the License, a copy of which 108c2ecf20Sopenharmony_ci * is available on the worldwide web at 118c2ecf20Sopenharmony_ci * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 148c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 158c2ecf20Sopenharmony_ci * ARE EXPRESSLY DISCLAIMED. The License provides additional details about 168c2ecf20Sopenharmony_ci * this warranty disclaimer. 178c2ecf20Sopenharmony_ci **/ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#ifndef _NFCMRVL_H_ 208c2ecf20Sopenharmony_ci#define _NFCMRVL_H_ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include <linux/platform_data/nfcmrvl.h> 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#include "fw_dnld.h" 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Define private flags: */ 278c2ecf20Sopenharmony_ci#define NFCMRVL_NCI_RUNNING 1 288c2ecf20Sopenharmony_ci#define NFCMRVL_PHY_ERROR 2 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define NFCMRVL_EXT_COEX_ID 0xE0 318c2ecf20Sopenharmony_ci#define NFCMRVL_NOT_ALLOWED_ID 0xE1 328c2ecf20Sopenharmony_ci#define NFCMRVL_ACTIVE_ID 0xE2 338c2ecf20Sopenharmony_ci#define NFCMRVL_EXT_COEX_ENABLE 1 348c2ecf20Sopenharmony_ci#define NFCMRVL_GPIO_PIN_NFC_NOT_ALLOWED 0xA 358c2ecf20Sopenharmony_ci#define NFCMRVL_GPIO_PIN_NFC_ACTIVE 0xB 368c2ecf20Sopenharmony_ci#define NFCMRVL_NCI_MAX_EVENT_SIZE 260 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* 398c2ecf20Sopenharmony_ci** NCI FW Parmaters 408c2ecf20Sopenharmony_ci*/ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define NFCMRVL_PB_BAIL_OUT 0x11 438c2ecf20Sopenharmony_ci#define NFCMRVL_PROP_REF_CLOCK 0xF0 448c2ecf20Sopenharmony_ci#define NFCMRVL_PROP_SET_HI_CONFIG 0xF1 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* 478c2ecf20Sopenharmony_ci** HCI defines 488c2ecf20Sopenharmony_ci*/ 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define NFCMRVL_HCI_EVENT_HEADER_SIZE 0x04 518c2ecf20Sopenharmony_ci#define NFCMRVL_HCI_EVENT_CODE 0x04 528c2ecf20Sopenharmony_ci#define NFCMRVL_HCI_NFC_EVENT_CODE 0xFF 538c2ecf20Sopenharmony_ci#define NFCMRVL_HCI_COMMAND_CODE 0x01 548c2ecf20Sopenharmony_ci#define NFCMRVL_HCI_OGF 0x81 558c2ecf20Sopenharmony_ci#define NFCMRVL_HCI_OCF 0xFE 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_cienum nfcmrvl_phy { 588c2ecf20Sopenharmony_ci NFCMRVL_PHY_USB = 0, 598c2ecf20Sopenharmony_ci NFCMRVL_PHY_UART = 1, 608c2ecf20Sopenharmony_ci NFCMRVL_PHY_I2C = 2, 618c2ecf20Sopenharmony_ci NFCMRVL_PHY_SPI = 3, 628c2ecf20Sopenharmony_ci}; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_cistruct nfcmrvl_private { 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci unsigned long flags; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci /* Platform configuration */ 698c2ecf20Sopenharmony_ci struct nfcmrvl_platform_data config; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci /* Parent dev */ 728c2ecf20Sopenharmony_ci struct nci_dev *ndev; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci /* FW download context */ 758c2ecf20Sopenharmony_ci struct nfcmrvl_fw_dnld fw_dnld; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci /* FW download support */ 788c2ecf20Sopenharmony_ci bool support_fw_dnld; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci /* 818c2ecf20Sopenharmony_ci ** PHY related information 828c2ecf20Sopenharmony_ci */ 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci /* PHY driver context */ 858c2ecf20Sopenharmony_ci void *drv_data; 868c2ecf20Sopenharmony_ci /* PHY device */ 878c2ecf20Sopenharmony_ci struct device *dev; 888c2ecf20Sopenharmony_ci /* PHY type */ 898c2ecf20Sopenharmony_ci enum nfcmrvl_phy phy; 908c2ecf20Sopenharmony_ci /* Low level driver ops */ 918c2ecf20Sopenharmony_ci struct nfcmrvl_if_ops *if_ops; 928c2ecf20Sopenharmony_ci}; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_cistruct nfcmrvl_if_ops { 958c2ecf20Sopenharmony_ci int (*nci_open) (struct nfcmrvl_private *priv); 968c2ecf20Sopenharmony_ci int (*nci_close) (struct nfcmrvl_private *priv); 978c2ecf20Sopenharmony_ci int (*nci_send) (struct nfcmrvl_private *priv, struct sk_buff *skb); 988c2ecf20Sopenharmony_ci void (*nci_update_config)(struct nfcmrvl_private *priv, 998c2ecf20Sopenharmony_ci const void *param); 1008c2ecf20Sopenharmony_ci}; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_civoid nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv); 1038c2ecf20Sopenharmony_ciint nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb); 1048c2ecf20Sopenharmony_cistruct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, 1058c2ecf20Sopenharmony_ci void *drv_data, 1068c2ecf20Sopenharmony_ci struct nfcmrvl_if_ops *ops, 1078c2ecf20Sopenharmony_ci struct device *dev, 1088c2ecf20Sopenharmony_ci struct nfcmrvl_platform_data *pdata); 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_civoid nfcmrvl_chip_reset(struct nfcmrvl_private *priv); 1128c2ecf20Sopenharmony_civoid nfcmrvl_chip_halt(struct nfcmrvl_private *priv); 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ciint nfcmrvl_parse_dt(struct device_node *node, 1158c2ecf20Sopenharmony_ci struct nfcmrvl_platform_data *pdata); 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci#endif 118