i2c.c (e67e7e596f3ff19fb90520be9f2130aa54914181) i2c.c (3648dc6d27f648b8e3ce9b48874627a833d53c3a)
1/*
2 * I2C Link Layer for ST NCI NFC controller familly based Driver
3 * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 38 unchanged lines hidden (view full) ---

47MODULE_DEVICE_TABLE(i2c, st_nci_i2c_id_table);
48
49struct st_nci_i2c_phy {
50 struct i2c_client *i2c_dev;
51 struct llt_ndlc *ndlc;
52
53 unsigned int gpio_reset;
54 unsigned int irq_polarity;
1/*
2 * I2C Link Layer for ST NCI NFC controller familly based Driver
3 * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 38 unchanged lines hidden (view full) ---

47MODULE_DEVICE_TABLE(i2c, st_nci_i2c_id_table);
48
49struct st_nci_i2c_phy {
50 struct i2c_client *i2c_dev;
51 struct llt_ndlc *ndlc;
52
53 unsigned int gpio_reset;
54 unsigned int irq_polarity;
55
56 struct st_nci_se_status se_status;
55};
56
57#define I2C_DUMP_SKB(info, skb) \
58do { \
59 pr_debug("%s:\n", info); \
60 print_hex_dump(KERN_DEBUG, "i2c: ", DUMP_PREFIX_OFFSET, \
61 16, 1, (skb)->data, (skb)->len, 0); \
62} while (0)

--- 177 unchanged lines hidden (view full) ---

240 if (r) {
241 nfc_err(&client->dev, "Failed to request reset pin\n");
242 return r;
243 }
244 phy->gpio_reset = gpio;
245
246 phy->irq_polarity = irq_get_trigger_type(client->irq);
247
57};
58
59#define I2C_DUMP_SKB(info, skb) \
60do { \
61 pr_debug("%s:\n", info); \
62 print_hex_dump(KERN_DEBUG, "i2c: ", DUMP_PREFIX_OFFSET, \
63 16, 1, (skb)->data, (skb)->len, 0); \
64} while (0)

--- 177 unchanged lines hidden (view full) ---

242 if (r) {
243 nfc_err(&client->dev, "Failed to request reset pin\n");
244 return r;
245 }
246 phy->gpio_reset = gpio;
247
248 phy->irq_polarity = irq_get_trigger_type(client->irq);
249
250 phy->se_status.is_ese_present =
251 of_property_read_bool(pp, "ese-present");
252 phy->se_status.is_uicc_present =
253 of_property_read_bool(pp, "uicc-present");
254
248 return 0;
249}
250#else
251static int st_nci_i2c_of_request_resources(struct i2c_client *client)
252{
253 return -ENODEV;
254}
255#endif

--- 16 unchanged lines hidden (view full) ---

272
273 r = devm_gpio_request_one(&client->dev,
274 phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset");
275 if (r) {
276 pr_err("%s : reset gpio_request failed\n", __FILE__);
277 return r;
278 }
279
255 return 0;
256}
257#else
258static int st_nci_i2c_of_request_resources(struct i2c_client *client)
259{
260 return -ENODEV;
261}
262#endif

--- 16 unchanged lines hidden (view full) ---

279
280 r = devm_gpio_request_one(&client->dev,
281 phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset");
282 if (r) {
283 pr_err("%s : reset gpio_request failed\n", __FILE__);
284 return r;
285 }
286
287 phy->se_status.is_ese_present = pdata->is_ese_present;
288 phy->se_status.is_uicc_present = pdata->is_uicc_present;
289
280 return 0;
281}
282
283static int st_nci_i2c_probe(struct i2c_client *client,
284 const struct i2c_device_id *id)
285{
286 struct st_nci_i2c_phy *phy;
287 struct st_nci_nfc_platform_data *pdata;

--- 33 unchanged lines hidden (view full) ---

321 } else {
322 nfc_err(&client->dev,
323 "st_nci platform resources not available\n");
324 return -ENODEV;
325 }
326
327 r = ndlc_probe(phy, &i2c_phy_ops, &client->dev,
328 ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM,
290 return 0;
291}
292
293static int st_nci_i2c_probe(struct i2c_client *client,
294 const struct i2c_device_id *id)
295{
296 struct st_nci_i2c_phy *phy;
297 struct st_nci_nfc_platform_data *pdata;

--- 33 unchanged lines hidden (view full) ---

331 } else {
332 nfc_err(&client->dev,
333 "st_nci platform resources not available\n");
334 return -ENODEV;
335 }
336
337 r = ndlc_probe(phy, &i2c_phy_ops, &client->dev,
338 ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM,
329 &phy->ndlc);
339 &phy->ndlc, &phy->se_status);
330 if (r < 0) {
331 nfc_err(&client->dev, "Unable to register ndlc layer\n");
332 return r;
333 }
334
335 r = devm_request_threaded_irq(&client->dev, client->irq, NULL,
336 st_nci_irq_thread_fn,
337 phy->irq_polarity | IRQF_ONESHOT,

--- 43 unchanged lines hidden ---
340 if (r < 0) {
341 nfc_err(&client->dev, "Unable to register ndlc layer\n");
342 return r;
343 }
344
345 r = devm_request_threaded_irq(&client->dev, client->irq, NULL,
346 st_nci_irq_thread_fn,
347 phy->irq_polarity | IRQF_ONESHOT,

--- 43 unchanged lines hidden ---