Lines Matching +full:hci +full:- +full:muxed

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2014-2015 Marvell International Ltd.
22 if (test_and_set_bit(NFCMRVL_NCI_RUNNING, &priv->flags)) in nfcmrvl_nci_open()
26 clear_bit(NFCMRVL_PHY_ERROR, &priv->flags); in nfcmrvl_nci_open()
28 err = priv->if_ops->nci_open(priv); in nfcmrvl_nci_open()
31 clear_bit(NFCMRVL_NCI_RUNNING, &priv->flags); in nfcmrvl_nci_open()
40 if (!test_and_clear_bit(NFCMRVL_NCI_RUNNING, &priv->flags)) in nfcmrvl_nci_close()
43 priv->if_ops->nci_close(priv); in nfcmrvl_nci_close()
52 nfc_info(priv->dev, "send entry, len %d\n", skb->len); in nfcmrvl_nci_send()
54 skb->dev = (void *)ndev; in nfcmrvl_nci_send()
56 if (priv->config.hci_muxed) { in nfcmrvl_nci_send()
58 unsigned char len = skb->len; in nfcmrvl_nci_send()
67 return priv->if_ops->nci_send(priv, skb); in nfcmrvl_nci_send()
106 return ERR_PTR(-ENOMEM); in nfcmrvl_nci_register_dev()
108 priv->drv_data = drv_data; in nfcmrvl_nci_register_dev()
109 priv->if_ops = ops; in nfcmrvl_nci_register_dev()
110 priv->dev = dev; in nfcmrvl_nci_register_dev()
111 priv->phy = phy; in nfcmrvl_nci_register_dev()
113 memcpy(&priv->config, pdata, sizeof(*pdata)); in nfcmrvl_nci_register_dev()
115 if (gpio_is_valid(priv->config.reset_n_io)) { in nfcmrvl_nci_register_dev()
116 rc = gpio_request_one(priv->config.reset_n_io, in nfcmrvl_nci_register_dev()
120 priv->config.reset_n_io = -EINVAL; in nfcmrvl_nci_register_dev()
131 if (priv->config.hci_muxed) in nfcmrvl_nci_register_dev()
142 priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols, in nfcmrvl_nci_register_dev()
144 if (!priv->ndev) { in nfcmrvl_nci_register_dev()
146 rc = -ENOMEM; in nfcmrvl_nci_register_dev()
156 nci_set_drvdata(priv->ndev, priv); in nfcmrvl_nci_register_dev()
158 rc = nci_register_device(priv->ndev); in nfcmrvl_nci_register_dev()
173 nci_free_device(priv->ndev); in nfcmrvl_nci_register_dev()
175 if (gpio_is_valid(priv->config.reset_n_io)) in nfcmrvl_nci_register_dev()
176 gpio_free(priv->config.reset_n_io); in nfcmrvl_nci_register_dev()
184 struct nci_dev *ndev = priv->ndev; in nfcmrvl_nci_unregister_dev()
187 if (priv->ndev->nfc_dev->fw_download_in_progress) in nfcmrvl_nci_unregister_dev()
192 if (gpio_is_valid(priv->config.reset_n_io)) in nfcmrvl_nci_unregister_dev()
193 gpio_free(priv->config.reset_n_io); in nfcmrvl_nci_unregister_dev()
202 if (priv->config.hci_muxed) { in nfcmrvl_nci_recv_frame()
203 if (skb->data[0] == NFCMRVL_HCI_EVENT_CODE && in nfcmrvl_nci_recv_frame()
204 skb->data[1] == NFCMRVL_HCI_NFC_EVENT_CODE) { in nfcmrvl_nci_recv_frame()
214 if (priv->ndev->nfc_dev->fw_download_in_progress) { in nfcmrvl_nci_recv_frame()
219 if (test_bit(NFCMRVL_NCI_RUNNING, &priv->flags)) in nfcmrvl_nci_recv_frame()
220 nci_recv_frame(priv->ndev, skb); in nfcmrvl_nci_recv_frame()
234 clear_bit(NFCMRVL_PHY_ERROR, &priv->flags); in nfcmrvl_chip_reset()
236 if (gpio_is_valid(priv->config.reset_n_io)) { in nfcmrvl_chip_reset()
237 nfc_info(priv->dev, "reset the chip\n"); in nfcmrvl_chip_reset()
238 gpio_set_value(priv->config.reset_n_io, 0); in nfcmrvl_chip_reset()
240 gpio_set_value(priv->config.reset_n_io, 1); in nfcmrvl_chip_reset()
242 nfc_info(priv->dev, "no reset available on this interface\n"); in nfcmrvl_chip_reset()
247 if (gpio_is_valid(priv->config.reset_n_io)) in nfcmrvl_chip_halt()
248 gpio_set_value(priv->config.reset_n_io, 0); in nfcmrvl_chip_halt()
256 reset_n_io = of_get_named_gpio(node, "reset-n-io", 0); in nfcmrvl_parse_dt()
258 pr_info("no reset-n-io config\n"); in nfcmrvl_parse_dt()
260 pr_err("invalid reset-n-io GPIO\n"); in nfcmrvl_parse_dt()
263 pdata->reset_n_io = reset_n_io; in nfcmrvl_parse_dt()
265 if (of_find_property(node, "hci-muxed", NULL)) in nfcmrvl_parse_dt()
266 pdata->hci_muxed = 1; in nfcmrvl_parse_dt()
268 pdata->hci_muxed = 0; in nfcmrvl_parse_dt()