Lines Matching +full:reset +full:- +full:n +full:- +full:io
4 * Copyright (C) 2014-2015 Marvell International Ltd.
11 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
33 if (test_and_set_bit(NFCMRVL_NCI_RUNNING, &priv->flags)) in nfcmrvl_nci_open()
36 /* Reset possible fault of previous session */ in nfcmrvl_nci_open()
37 clear_bit(NFCMRVL_PHY_ERROR, &priv->flags); in nfcmrvl_nci_open()
39 err = priv->if_ops->nci_open(priv); in nfcmrvl_nci_open()
42 clear_bit(NFCMRVL_NCI_RUNNING, &priv->flags); in nfcmrvl_nci_open()
51 if (!test_and_clear_bit(NFCMRVL_NCI_RUNNING, &priv->flags)) in nfcmrvl_nci_close()
54 priv->if_ops->nci_close(priv); in nfcmrvl_nci_close()
63 nfc_info(priv->dev, "send entry, len %d\n", skb->len); in nfcmrvl_nci_send()
65 skb->dev = (void *)ndev; in nfcmrvl_nci_send()
67 if (priv->config.hci_muxed) { in nfcmrvl_nci_send()
69 unsigned char len = skb->len; in nfcmrvl_nci_send()
78 return priv->if_ops->nci_send(priv, skb); in nfcmrvl_nci_send()
117 return ERR_PTR(-ENOMEM); in nfcmrvl_nci_register_dev()
119 priv->drv_data = drv_data; in nfcmrvl_nci_register_dev()
120 priv->if_ops = ops; in nfcmrvl_nci_register_dev()
121 priv->dev = dev; in nfcmrvl_nci_register_dev()
122 priv->phy = phy; in nfcmrvl_nci_register_dev()
124 memcpy(&priv->config, pdata, sizeof(*pdata)); in nfcmrvl_nci_register_dev()
126 if (gpio_is_valid(priv->config.reset_n_io)) { in nfcmrvl_nci_register_dev()
127 rc = gpio_request_one(priv->config.reset_n_io, in nfcmrvl_nci_register_dev()
131 priv->config.reset_n_io = -EINVAL; in nfcmrvl_nci_register_dev()
132 nfc_err(dev, "failed to request reset_n io\n"); in nfcmrvl_nci_register_dev()
142 if (priv->config.hci_muxed) in nfcmrvl_nci_register_dev()
153 priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols, in nfcmrvl_nci_register_dev()
155 if (!priv->ndev) { in nfcmrvl_nci_register_dev()
156 nfc_err(dev, "nci_allocate_device failed\n"); in nfcmrvl_nci_register_dev()
157 rc = -ENOMEM; in nfcmrvl_nci_register_dev()
163 nfc_err(dev, "failed to initialize FW download %d\n", rc); in nfcmrvl_nci_register_dev()
167 nci_set_drvdata(priv->ndev, priv); in nfcmrvl_nci_register_dev()
169 rc = nci_register_device(priv->ndev); in nfcmrvl_nci_register_dev()
171 nfc_err(dev, "nci_register_device failed %d\n", rc); in nfcmrvl_nci_register_dev()
178 nfc_info(dev, "registered with nci successfully\n"); in nfcmrvl_nci_register_dev()
184 nci_free_device(priv->ndev); in nfcmrvl_nci_register_dev()
186 if (gpio_is_valid(priv->config.reset_n_io)) in nfcmrvl_nci_register_dev()
187 gpio_free(priv->config.reset_n_io); in nfcmrvl_nci_register_dev()
195 struct nci_dev *ndev = priv->ndev; in nfcmrvl_nci_unregister_dev()
198 if (priv->ndev->nfc_dev->fw_download_in_progress) in nfcmrvl_nci_unregister_dev()
203 if (gpio_is_valid(priv->config.reset_n_io)) in nfcmrvl_nci_unregister_dev()
204 gpio_free(priv->config.reset_n_io); in nfcmrvl_nci_unregister_dev()
213 if (priv->config.hci_muxed) { in nfcmrvl_nci_recv_frame()
214 if (skb->data[0] == NFCMRVL_HCI_EVENT_CODE && in nfcmrvl_nci_recv_frame()
215 skb->data[1] == NFCMRVL_HCI_NFC_EVENT_CODE) { in nfcmrvl_nci_recv_frame()
225 if (priv->ndev->nfc_dev->fw_download_in_progress) { in nfcmrvl_nci_recv_frame()
230 if (test_bit(NFCMRVL_NCI_RUNNING, &priv->flags)) in nfcmrvl_nci_recv_frame()
231 nci_recv_frame(priv->ndev, skb); in nfcmrvl_nci_recv_frame()
244 /* Reset possible fault of previous session */ in nfcmrvl_chip_reset()
245 clear_bit(NFCMRVL_PHY_ERROR, &priv->flags); in nfcmrvl_chip_reset()
247 if (gpio_is_valid(priv->config.reset_n_io)) { in nfcmrvl_chip_reset()
248 nfc_info(priv->dev, "reset the chip\n"); in nfcmrvl_chip_reset()
249 gpio_set_value(priv->config.reset_n_io, 0); in nfcmrvl_chip_reset()
251 gpio_set_value(priv->config.reset_n_io, 1); in nfcmrvl_chip_reset()
253 nfc_info(priv->dev, "no reset available on this interface\n"); in nfcmrvl_chip_reset()
258 if (gpio_is_valid(priv->config.reset_n_io)) in nfcmrvl_chip_halt()
259 gpio_set_value(priv->config.reset_n_io, 0); in nfcmrvl_chip_halt()
267 reset_n_io = of_get_named_gpio(node, "reset-n-io", 0); in nfcmrvl_parse_dt()
269 pr_info("no reset-n-io config\n"); in nfcmrvl_parse_dt()
271 pr_err("invalid reset-n-io GPIO\n"); in nfcmrvl_parse_dt()
274 pdata->reset_n_io = reset_n_io; in nfcmrvl_parse_dt()
276 if (of_find_property(node, "hci-muxed", NULL)) in nfcmrvl_parse_dt()
277 pdata->hci_muxed = 1; in nfcmrvl_parse_dt()
279 pdata->hci_muxed = 0; in nfcmrvl_parse_dt()