spi.c (a1269dd116319335db6d73013a31c038486c813e) | spi.c (3648dc6d27f648b8e3ce9b48874627a833d53c3a) |
---|---|
1/* 2 * SPI Link Layer for ST NCI 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 * --- 39 unchanged lines hidden (view full) --- 48MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table); 49 50struct st_nci_spi_phy { 51 struct spi_device *spi_dev; 52 struct llt_ndlc *ndlc; 53 54 unsigned int gpio_reset; 55 unsigned int irq_polarity; | 1/* 2 * SPI Link Layer for ST NCI 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 * --- 39 unchanged lines hidden (view full) --- 48MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table); 49 50struct st_nci_spi_phy { 51 struct spi_device *spi_dev; 52 struct llt_ndlc *ndlc; 53 54 unsigned int gpio_reset; 55 unsigned int irq_polarity; |
56 57 struct st_nci_se_status se_status; |
|
56}; 57 58#define SPI_DUMP_SKB(info, skb) \ 59do { \ 60 pr_debug("%s:\n", info); \ 61 print_hex_dump(KERN_DEBUG, "spi: ", DUMP_PREFIX_OFFSET, \ 62 16, 1, (skb)->data, (skb)->len, 0); \ 63} while (0) --- 191 unchanged lines hidden (view full) --- 255 if (r) { 256 nfc_err(&dev->dev, "Failed to request reset pin\n"); 257 return r; 258 } 259 phy->gpio_reset = gpio; 260 261 phy->irq_polarity = irq_get_trigger_type(dev->irq); 262 | 58}; 59 60#define SPI_DUMP_SKB(info, skb) \ 61do { \ 62 pr_debug("%s:\n", info); \ 63 print_hex_dump(KERN_DEBUG, "spi: ", DUMP_PREFIX_OFFSET, \ 64 16, 1, (skb)->data, (skb)->len, 0); \ 65} while (0) --- 191 unchanged lines hidden (view full) --- 257 if (r) { 258 nfc_err(&dev->dev, "Failed to request reset pin\n"); 259 return r; 260 } 261 phy->gpio_reset = gpio; 262 263 phy->irq_polarity = irq_get_trigger_type(dev->irq); 264 |
265 phy->se_status.is_ese_present = 266 of_property_read_bool(pp, "ese-present"); 267 phy->se_status.is_uicc_present = 268 of_property_read_bool(pp, "uicc-present"); 269 |
|
263 return 0; 264} 265#else 266static int st_nci_spi_of_request_resources(struct spi_device *dev) 267{ 268 return -ENODEV; 269} 270#endif --- 16 unchanged lines hidden (view full) --- 287 288 r = devm_gpio_request_one(&dev->dev, 289 phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset"); 290 if (r) { 291 pr_err("%s : reset gpio_request failed\n", __FILE__); 292 return r; 293 } 294 | 270 return 0; 271} 272#else 273static int st_nci_spi_of_request_resources(struct spi_device *dev) 274{ 275 return -ENODEV; 276} 277#endif --- 16 unchanged lines hidden (view full) --- 294 295 r = devm_gpio_request_one(&dev->dev, 296 phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset"); 297 if (r) { 298 pr_err("%s : reset gpio_request failed\n", __FILE__); 299 return r; 300 } 301 |
302 phy->se_status.is_ese_present = pdata->is_ese_present; 303 phy->se_status.is_uicc_present = pdata->is_uicc_present; 304 |
|
295 return 0; 296} 297 298static int st_nci_spi_probe(struct spi_device *dev) 299{ 300 struct st_nci_spi_phy *phy; 301 struct st_nci_nfc_platform_data *pdata; 302 int r; --- 34 unchanged lines hidden (view full) --- 337 } else { 338 nfc_err(&dev->dev, 339 "st_nci platform resources not available\n"); 340 return -ENODEV; 341 } 342 343 r = ndlc_probe(phy, &spi_phy_ops, &dev->dev, 344 ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM, | 305 return 0; 306} 307 308static int st_nci_spi_probe(struct spi_device *dev) 309{ 310 struct st_nci_spi_phy *phy; 311 struct st_nci_nfc_platform_data *pdata; 312 int r; --- 34 unchanged lines hidden (view full) --- 347 } else { 348 nfc_err(&dev->dev, 349 "st_nci platform resources not available\n"); 350 return -ENODEV; 351 } 352 353 r = ndlc_probe(phy, &spi_phy_ops, &dev->dev, 354 ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM, |
345 &phy->ndlc); | 355 &phy->ndlc, &phy->se_status); |
346 if (r < 0) { 347 nfc_err(&dev->dev, "Unable to register ndlc layer\n"); 348 return r; 349 } 350 351 r = devm_request_threaded_irq(&dev->dev, dev->irq, NULL, 352 st_nci_irq_thread_fn, 353 phy->irq_polarity | IRQF_ONESHOT, --- 41 unchanged lines hidden --- | 356 if (r < 0) { 357 nfc_err(&dev->dev, "Unable to register ndlc layer\n"); 358 return r; 359 } 360 361 r = devm_request_threaded_irq(&dev->dev, dev->irq, NULL, 362 st_nci_irq_thread_fn, 363 phy->irq_polarity | IRQF_ONESHOT, --- 41 unchanged lines hidden --- |