Lines Matching +full:ese +full:- +full:present

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
18 #include "st-nci.h"
47 gpiod_set_value(phy->gpiod_reset, 0); in st_nci_i2c_enable()
49 gpiod_set_value(phy->gpiod_reset, 1); in st_nci_i2c_enable()
52 if (phy->ndlc->powered == 0 && phy->irq_active == 0) { in st_nci_i2c_enable()
53 enable_irq(phy->i2c_dev->irq); in st_nci_i2c_enable()
54 phy->irq_active = true; in st_nci_i2c_enable()
64 disable_irq_nosync(phy->i2c_dev->irq); in st_nci_i2c_disable()
65 phy->irq_active = false; in st_nci_i2c_disable()
77 struct i2c_client *client = phy->i2c_dev; in st_nci_i2c_write()
79 if (phy->ndlc->hard_fault != 0) in st_nci_i2c_write()
80 return phy->ndlc->hard_fault; in st_nci_i2c_write()
82 r = i2c_master_send(client, skb->data, skb->len); in st_nci_i2c_write()
85 r = i2c_master_send(client, skb->data, skb->len); in st_nci_i2c_write()
89 if (r != skb->len) in st_nci_i2c_write()
90 r = -EREMOTEIO; in st_nci_i2c_write()
102 * -EREMOTEIO : i2c read error (fatal)
103 * -EBADMSG : frame was incorrect and discarded
104 * -ENOMEM : cannot allocate skb, frame dropped
112 struct i2c_client *client = phy->i2c_dev; in st_nci_i2c_read()
121 return -EREMOTEIO; in st_nci_i2c_read()
125 nfc_err(&client->dev, "invalid frame len\n"); in st_nci_i2c_read()
126 return -EBADMSG; in st_nci_i2c_read()
131 return -ENOMEM; in st_nci_i2c_read()
135 memcpy((*skb)->data, buf, ST_NCI_I2C_MIN_SIZE); in st_nci_i2c_read()
143 return -EREMOTEIO; in st_nci_i2c_read()
147 memcpy((*skb)->data + ST_NCI_I2C_MIN_SIZE, buf, len); in st_nci_i2c_read()
163 if (!phy || !phy->ndlc || irq != phy->i2c_dev->irq) { in st_nci_irq_thread_fn()
168 if (phy->ndlc->hard_fault) in st_nci_irq_thread_fn()
171 if (!phy->ndlc->powered) { in st_nci_irq_thread_fn()
177 if (r == -EREMOTEIO || r == -ENOMEM || r == -EBADMSG) in st_nci_irq_thread_fn()
180 ndlc_recv(phy->ndlc, skb); in st_nci_irq_thread_fn()
194 { "reset-gpios", &reset_gpios, 1 },
201 struct device *dev = &client->dev; in st_nci_i2c_probe()
205 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { in st_nci_i2c_probe()
206 nfc_err(&client->dev, "Need I2C_FUNC_I2C\n"); in st_nci_i2c_probe()
207 return -ENODEV; in st_nci_i2c_probe()
212 return -ENOMEM; in st_nci_i2c_probe()
214 phy->i2c_dev = client; in st_nci_i2c_probe()
223 phy->gpiod_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in st_nci_i2c_probe()
224 if (IS_ERR(phy->gpiod_reset)) { in st_nci_i2c_probe()
226 return -ENODEV; in st_nci_i2c_probe()
229 phy->se_status.is_ese_present = in st_nci_i2c_probe()
230 device_property_read_bool(dev, "ese-present"); in st_nci_i2c_probe()
231 phy->se_status.is_uicc_present = in st_nci_i2c_probe()
232 device_property_read_bool(dev, "uicc-present"); in st_nci_i2c_probe()
234 r = ndlc_probe(phy, &i2c_phy_ops, &client->dev, in st_nci_i2c_probe()
236 &phy->ndlc, &phy->se_status); in st_nci_i2c_probe()
238 nfc_err(&client->dev, "Unable to register ndlc layer\n"); in st_nci_i2c_probe()
242 phy->irq_active = true; in st_nci_i2c_probe()
243 r = devm_request_threaded_irq(&client->dev, client->irq, NULL, in st_nci_i2c_probe()
248 nfc_err(&client->dev, "Unable to register IRQ handler\n"); in st_nci_i2c_probe()
257 ndlc_remove(phy->ndlc); in st_nci_i2c_remove()
274 { .compatible = "st,st21nfcb-i2c", },
276 { .compatible = "st,st21nfcc-i2c", },