1/* 2 * I2C Link Layer for ST21NFCA HCI based Driver 3 * Copyright (C) 2014 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 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, see <http://www.gnu.org/licenses/>. 16 */ 17 18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 19 20#include <linux/crc-ccitt.h> 21#include <linux/module.h> 22#include <linux/i2c.h> 23#include <linux/gpio.h> 24#include <linux/of_irq.h> 25#include <linux/of_gpio.h> 26#include <linux/miscdevice.h> 27#include <linux/interrupt.h> 28#include <linux/delay.h> 29#include <linux/nfc.h> 30#include <linux/firmware.h> 31#include <linux/platform_data/st21nfca.h> 32#include <asm/unaligned.h> 33 34#include <net/nfc/hci.h> 35#include <net/nfc/llc.h> 36#include <net/nfc/nfc.h> 37 38#include "st21nfca.h" 39 40/* 41 * Every frame starts with ST21NFCA_SOF_EOF and ends with ST21NFCA_SOF_EOF. 42 * Because ST21NFCA_SOF_EOF is a possible data value, there is a mecanism 43 * called byte stuffing has been introduced. 44 * 45 * if byte == ST21NFCA_SOF_EOF or ST21NFCA_ESCAPE_BYTE_STUFFING 46 * - insert ST21NFCA_ESCAPE_BYTE_STUFFING (escape byte) 47 * - xor byte with ST21NFCA_BYTE_STUFFING_MASK 48 */ 49#define ST21NFCA_SOF_EOF 0x7e 50#define ST21NFCA_BYTE_STUFFING_MASK 0x20 51#define ST21NFCA_ESCAPE_BYTE_STUFFING 0x7d 52 53/* SOF + 00 */ 54#define ST21NFCA_FRAME_HEADROOM 2 55 56/* 2 bytes crc + EOF */ 57#define ST21NFCA_FRAME_TAILROOM 3 58#define IS_START_OF_FRAME(buf) (buf[0] == ST21NFCA_SOF_EOF && \ 59 buf[1] == 0) 60 61#define ST21NFCA_HCI_I2C_DRIVER_NAME "st21nfca_hci_i2c" 62 63static struct i2c_device_id st21nfca_hci_i2c_id_table[] = { 64 {ST21NFCA_HCI_DRIVER_NAME, 0}, 65 {} 66}; 67 68MODULE_DEVICE_TABLE(i2c, st21nfca_hci_i2c_id_table); 69 70struct st21nfca_i2c_phy { 71 struct i2c_client *i2c_dev; 72 struct nfc_hci_dev *hdev; 73 74 unsigned int gpio_ena; 75 unsigned int irq_polarity; 76 77 struct st21nfca_se_status se_status; 78 79 struct sk_buff *pending_skb; 80 int current_read_len; 81 /* 82 * crc might have fail because i2c macro 83 * is disable due to other interface activity 84 */ 85 int crc_trials; 86 87 int powered; 88 int run_mode; 89 90 /* 91 * < 0 if hardware error occured (e.g. i2c err) 92 * and prevents normal operation. 93 */ 94 int hard_fault; 95 struct mutex phy_lock; 96}; 97 98static u8 len_seq[] = { 16, 24, 12, 29 }; 99static u16 wait_tab[] = { 2, 3, 5, 15, 20, 40}; 100 101#define I2C_DUMP_SKB(info, skb) \ 102do { \ 103 pr_debug("%s:\n", info); \ 104 print_hex_dump(KERN_DEBUG, "i2c: ", DUMP_PREFIX_OFFSET, \ 105 16, 1, (skb)->data, (skb)->len, 0); \ 106} while (0) 107 108/* 109 * In order to get the CLF in a known state we generate an internal reboot 110 * using a proprietary command. 111 * Once the reboot is completed, we expect to receive a ST21NFCA_SOF_EOF 112 * fill buffer. 113 */ 114static int st21nfca_hci_platform_init(struct st21nfca_i2c_phy *phy) 115{ 116 u16 wait_reboot[] = { 50, 300, 1000 }; 117 char reboot_cmd[] = { 0x7E, 0x66, 0x48, 0xF6, 0x7E }; 118 u8 tmp[ST21NFCA_HCI_LLC_MAX_SIZE]; 119 int i, r = -1; 120 121 for (i = 0; i < ARRAY_SIZE(wait_reboot) && r < 0; i++) { 122 r = i2c_master_send(phy->i2c_dev, reboot_cmd, 123 sizeof(reboot_cmd)); 124 if (r < 0) 125 msleep(wait_reboot[i]); 126 } 127 if (r < 0) 128 return r; 129 130 /* CLF is spending about 20ms to do an internal reboot */ 131 msleep(20); 132 r = -1; 133 for (i = 0; i < ARRAY_SIZE(wait_reboot) && r < 0; i++) { 134 r = i2c_master_recv(phy->i2c_dev, tmp, 135 ST21NFCA_HCI_LLC_MAX_SIZE); 136 if (r < 0) 137 msleep(wait_reboot[i]); 138 } 139 if (r < 0) 140 return r; 141 142 for (i = 0; i < ST21NFCA_HCI_LLC_MAX_SIZE && 143 tmp[i] == ST21NFCA_SOF_EOF; i++) 144 ; 145 146 if (r != ST21NFCA_HCI_LLC_MAX_SIZE) 147 return -ENODEV; 148 149 usleep_range(1000, 1500); 150 return 0; 151} 152 153static int st21nfca_hci_i2c_enable(void *phy_id) 154{ 155 struct st21nfca_i2c_phy *phy = phy_id; 156 157 gpio_set_value(phy->gpio_ena, 1); 158 phy->powered = 1; 159 phy->run_mode = ST21NFCA_HCI_MODE; 160 161 usleep_range(10000, 15000); 162 163 return 0; 164} 165 166static void st21nfca_hci_i2c_disable(void *phy_id) 167{ 168 struct st21nfca_i2c_phy *phy = phy_id; 169 170 pr_info("\n"); 171 gpio_set_value(phy->gpio_ena, 0); 172 173 phy->powered = 0; 174} 175 176static void st21nfca_hci_add_len_crc(struct sk_buff *skb) 177{ 178 u16 crc; 179 u8 tmp; 180 181 *skb_push(skb, 1) = 0; 182 183 crc = crc_ccitt(0xffff, skb->data, skb->len); 184 crc = ~crc; 185 186 tmp = crc & 0x00ff; 187 *skb_put(skb, 1) = tmp; 188 189 tmp = (crc >> 8) & 0x00ff; 190 *skb_put(skb, 1) = tmp; 191} 192 193static void st21nfca_hci_remove_len_crc(struct sk_buff *skb) 194{ 195 skb_pull(skb, ST21NFCA_FRAME_HEADROOM); 196 skb_trim(skb, skb->len - ST21NFCA_FRAME_TAILROOM); 197} 198 199/* 200 * Writing a frame must not return the number of written bytes. 201 * It must return either zero for success, or <0 for error. 202 * In addition, it must not alter the skb 203 */ 204static int st21nfca_hci_i2c_write(void *phy_id, struct sk_buff *skb) 205{ 206 int r = -1, i, j; 207 struct st21nfca_i2c_phy *phy = phy_id; 208 struct i2c_client *client = phy->i2c_dev; 209 u8 tmp[ST21NFCA_HCI_LLC_MAX_SIZE * 2]; 210 211 I2C_DUMP_SKB("st21nfca_hci_i2c_write", skb); 212 213 214 if (phy->hard_fault != 0) 215 return phy->hard_fault; 216 217 /* 218 * Compute CRC before byte stuffing computation on frame 219 * Note st21nfca_hci_add_len_crc is doing a byte stuffing 220 * on its own value 221 */ 222 st21nfca_hci_add_len_crc(skb); 223 224 /* add ST21NFCA_SOF_EOF on tail */ 225 *skb_put(skb, 1) = ST21NFCA_SOF_EOF; 226 /* add ST21NFCA_SOF_EOF on head */ 227 *skb_push(skb, 1) = ST21NFCA_SOF_EOF; 228 229 /* 230 * Compute byte stuffing 231 * if byte == ST21NFCA_SOF_EOF or ST21NFCA_ESCAPE_BYTE_STUFFING 232 * insert ST21NFCA_ESCAPE_BYTE_STUFFING (escape byte) 233 * xor byte with ST21NFCA_BYTE_STUFFING_MASK 234 */ 235 tmp[0] = skb->data[0]; 236 for (i = 1, j = 1; i < skb->len - 1; i++, j++) { 237 if (skb->data[i] == ST21NFCA_SOF_EOF 238 || skb->data[i] == ST21NFCA_ESCAPE_BYTE_STUFFING) { 239 tmp[j] = ST21NFCA_ESCAPE_BYTE_STUFFING; 240 j++; 241 tmp[j] = skb->data[i] ^ ST21NFCA_BYTE_STUFFING_MASK; 242 } else { 243 tmp[j] = skb->data[i]; 244 } 245 } 246 tmp[j] = skb->data[i]; 247 j++; 248 249 /* 250 * Manage sleep mode 251 * Try 3 times to send data with delay between each 252 */ 253 mutex_lock(&phy->phy_lock); 254 for (i = 0; i < ARRAY_SIZE(wait_tab) && r < 0; i++) { 255 r = i2c_master_send(client, tmp, j); 256 if (r < 0) 257 msleep(wait_tab[i]); 258 } 259 mutex_unlock(&phy->phy_lock); 260 261 if (r >= 0) { 262 if (r != j) 263 r = -EREMOTEIO; 264 else 265 r = 0; 266 } 267 268 st21nfca_hci_remove_len_crc(skb); 269 270 return r; 271} 272 273static int get_frame_size(u8 *buf, int buflen) 274{ 275 int len = 0; 276 277 if (buf[len + 1] == ST21NFCA_SOF_EOF) 278 return 0; 279 280 for (len = 1; len < buflen && buf[len] != ST21NFCA_SOF_EOF; len++) 281 ; 282 283 return len; 284} 285 286static int check_crc(u8 *buf, int buflen) 287{ 288 u16 crc; 289 290 crc = crc_ccitt(0xffff, buf, buflen - 2); 291 crc = ~crc; 292 293 if (buf[buflen - 2] != (crc & 0xff) || buf[buflen - 1] != (crc >> 8)) { 294 pr_err(ST21NFCA_HCI_DRIVER_NAME 295 ": CRC error 0x%x != 0x%x 0x%x\n", crc, buf[buflen - 1], 296 buf[buflen - 2]); 297 298 pr_info(DRIVER_DESC ": %s : BAD CRC\n", __func__); 299 print_hex_dump(KERN_DEBUG, "crc: ", DUMP_PREFIX_NONE, 300 16, 2, buf, buflen, false); 301 return -EPERM; 302 } 303 return 0; 304} 305 306/* 307 * Prepare received data for upper layer. 308 * Received data include byte stuffing, crc and sof/eof 309 * which is not usable by hci part. 310 * returns: 311 * frame size without sof/eof, header and byte stuffing 312 * -EBADMSG : frame was incorrect and discarded 313 */ 314static int st21nfca_hci_i2c_repack(struct sk_buff *skb) 315{ 316 int i, j, r, size; 317 318 if (skb->len < 1 || (skb->len > 1 && skb->data[1] != 0)) 319 return -EBADMSG; 320 321 size = get_frame_size(skb->data, skb->len); 322 if (size > 0) { 323 skb_trim(skb, size); 324 /* remove ST21NFCA byte stuffing for upper layer */ 325 for (i = 1, j = 0; i < skb->len; i++) { 326 if (skb->data[i + j] == 327 (u8) ST21NFCA_ESCAPE_BYTE_STUFFING) { 328 skb->data[i] = skb->data[i + j + 1] 329 | ST21NFCA_BYTE_STUFFING_MASK; 330 i++; 331 j++; 332 } 333 skb->data[i] = skb->data[i + j]; 334 } 335 /* remove byte stuffing useless byte */ 336 skb_trim(skb, i - j); 337 /* remove ST21NFCA_SOF_EOF from head */ 338 skb_pull(skb, 1); 339 340 r = check_crc(skb->data, skb->len); 341 if (r != 0) { 342 i = 0; 343 return -EBADMSG; 344 } 345 346 /* remove headbyte */ 347 skb_pull(skb, 1); 348 /* remove crc. Byte Stuffing is already removed here */ 349 skb_trim(skb, skb->len - 2); 350 return skb->len; 351 } 352 return 0; 353} 354 355/* 356 * Reads an shdlc frame and returns it in a newly allocated sk_buff. Guarantees 357 * that i2c bus will be flushed and that next read will start on a new frame. 358 * returned skb contains only LLC header and payload. 359 * returns: 360 * frame size : if received frame is complete (find ST21NFCA_SOF_EOF at 361 * end of read) 362 * -EAGAIN : if received frame is incomplete (not find ST21NFCA_SOF_EOF 363 * at end of read) 364 * -EREMOTEIO : i2c read error (fatal) 365 * -EBADMSG : frame was incorrect and discarded 366 * (value returned from st21nfca_hci_i2c_repack) 367 * -EIO : if no ST21NFCA_SOF_EOF is found after reaching 368 * the read length end sequence 369 */ 370static int st21nfca_hci_i2c_read(struct st21nfca_i2c_phy *phy, 371 struct sk_buff *skb) 372{ 373 int r, i; 374 u8 len; 375 u8 buf[ST21NFCA_HCI_LLC_MAX_PAYLOAD]; 376 struct i2c_client *client = phy->i2c_dev; 377 378 if (phy->current_read_len < ARRAY_SIZE(len_seq)) { 379 len = len_seq[phy->current_read_len]; 380 381 /* 382 * Add retry mecanism 383 * Operation on I2C interface may fail in case of operation on 384 * RF or SWP interface 385 */ 386 r = 0; 387 mutex_lock(&phy->phy_lock); 388 for (i = 0; i < ARRAY_SIZE(wait_tab) && r <= 0; i++) { 389 r = i2c_master_recv(client, buf, len); 390 if (r < 0) 391 msleep(wait_tab[i]); 392 } 393 mutex_unlock(&phy->phy_lock); 394 395 if (r != len) { 396 phy->current_read_len = 0; 397 return -EREMOTEIO; 398 } 399 400 /* 401 * The first read sequence does not start with SOF. 402 * Data is corrupeted so we drop it. 403 */ 404 if (!phy->current_read_len && !IS_START_OF_FRAME(buf)) { 405 skb_trim(skb, 0); 406 phy->current_read_len = 0; 407 return -EIO; 408 } else if (phy->current_read_len && IS_START_OF_FRAME(buf)) { 409 /* 410 * Previous frame transmission was interrupted and 411 * the frame got repeated. 412 * Received frame start with ST21NFCA_SOF_EOF + 00. 413 */ 414 skb_trim(skb, 0); 415 phy->current_read_len = 0; 416 } 417 418 memcpy(skb_put(skb, len), buf, len); 419 420 if (skb->data[skb->len - 1] == ST21NFCA_SOF_EOF) { 421 phy->current_read_len = 0; 422 return st21nfca_hci_i2c_repack(skb); 423 } 424 phy->current_read_len++; 425 return -EAGAIN; 426 } 427 return -EIO; 428} 429 430/* 431 * Reads an shdlc frame from the chip. This is not as straightforward as it 432 * seems. The frame format is data-crc, and corruption can occur anywhere 433 * while transiting on i2c bus, such that we could read an invalid data. 434 * The tricky case is when we read a corrupted data or crc. We must detect 435 * this here in order to determine that data can be transmitted to the hci 436 * core. This is the reason why we check the crc here. 437 * The CLF will repeat a frame until we send a RR on that frame. 438 * 439 * On ST21NFCA, IRQ goes in idle when read starts. As no size information are 440 * available in the incoming data, other IRQ might come. Every IRQ will trigger 441 * a read sequence with different length and will fill the current frame. 442 * The reception is complete once we reach a ST21NFCA_SOF_EOF. 443 */ 444static irqreturn_t st21nfca_hci_irq_thread_fn(int irq, void *phy_id) 445{ 446 struct st21nfca_i2c_phy *phy = phy_id; 447 struct i2c_client *client; 448 449 int r; 450 451 if (!phy || irq != phy->i2c_dev->irq) { 452 WARN_ON_ONCE(1); 453 return IRQ_NONE; 454 } 455 456 client = phy->i2c_dev; 457 dev_dbg(&client->dev, "IRQ\n"); 458 459 if (phy->hard_fault != 0) 460 return IRQ_HANDLED; 461 462 r = st21nfca_hci_i2c_read(phy, phy->pending_skb); 463 if (r == -EREMOTEIO) { 464 phy->hard_fault = r; 465 466 nfc_hci_recv_frame(phy->hdev, NULL); 467 468 return IRQ_HANDLED; 469 } else if (r == -EAGAIN || r == -EIO) { 470 return IRQ_HANDLED; 471 } else if (r == -EBADMSG && phy->crc_trials < ARRAY_SIZE(wait_tab)) { 472 /* 473 * With ST21NFCA, only one interface (I2C, RF or SWP) 474 * may be active at a time. 475 * Having incorrect crc is usually due to i2c macrocell 476 * deactivation in the middle of a transmission. 477 * It may generate corrupted data on i2c. 478 * We give sometime to get i2c back. 479 * The complete frame will be repeated. 480 */ 481 msleep(wait_tab[phy->crc_trials]); 482 phy->crc_trials++; 483 phy->current_read_len = 0; 484 kfree_skb(phy->pending_skb); 485 } else if (r > 0) { 486 /* 487 * We succeeded to read data from the CLF and 488 * data is valid. 489 * Reset counter. 490 */ 491 nfc_hci_recv_frame(phy->hdev, phy->pending_skb); 492 phy->crc_trials = 0; 493 } else { 494 kfree_skb(phy->pending_skb); 495 } 496 497 phy->pending_skb = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE * 2, GFP_KERNEL); 498 if (phy->pending_skb == NULL) { 499 phy->hard_fault = -ENOMEM; 500 nfc_hci_recv_frame(phy->hdev, NULL); 501 } 502 503 return IRQ_HANDLED; 504} 505 506static struct nfc_phy_ops i2c_phy_ops = { 507 .write = st21nfca_hci_i2c_write, 508 .enable = st21nfca_hci_i2c_enable, 509 .disable = st21nfca_hci_i2c_disable, 510}; 511 512#ifdef CONFIG_OF 513static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client) 514{ 515 struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); 516 struct device_node *pp; 517 int gpio; 518 int r; 519 520 pp = client->dev.of_node; 521 if (!pp) 522 return -ENODEV; 523 524 /* Get GPIO from device tree */ 525 gpio = of_get_named_gpio(pp, "enable-gpios", 0); 526 if (gpio < 0) { 527 nfc_err(&client->dev, "Failed to retrieve enable-gpios from device tree\n"); 528 return gpio; 529 } 530 531 /* GPIO request and configuration */ 532 r = devm_gpio_request_one(&client->dev, gpio, GPIOF_OUT_INIT_HIGH, 533 "clf_enable"); 534 if (r) { 535 nfc_err(&client->dev, "Failed to request enable pin\n"); 536 return r; 537 } 538 539 phy->gpio_ena = gpio; 540 541 phy->irq_polarity = irq_get_trigger_type(client->irq); 542 543 phy->se_status.is_ese_present = 544 of_property_read_bool(pp, "ese-present"); 545 phy->se_status.is_uicc_present = 546 of_property_read_bool(pp, "uicc-present"); 547 548 return 0; 549} 550#else 551static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client) 552{ 553 return -ENODEV; 554} 555#endif 556 557static int st21nfca_hci_i2c_request_resources(struct i2c_client *client) 558{ 559 struct st21nfca_nfc_platform_data *pdata; 560 struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); 561 int r; 562 563 pdata = client->dev.platform_data; 564 if (pdata == NULL) { 565 nfc_err(&client->dev, "No platform data\n"); 566 return -EINVAL; 567 } 568 569 /* store for later use */ 570 phy->gpio_ena = pdata->gpio_ena; 571 phy->irq_polarity = pdata->irq_polarity; 572 573 if (phy->gpio_ena > 0) { 574 r = devm_gpio_request_one(&client->dev, phy->gpio_ena, 575 GPIOF_OUT_INIT_HIGH, "clf_enable"); 576 if (r) { 577 pr_err("%s : ena gpio_request failed\n", __FILE__); 578 return r; 579 } 580 } 581 582 phy->se_status.is_ese_present = pdata->is_ese_present; 583 phy->se_status.is_uicc_present = pdata->is_uicc_present; 584 585 return 0; 586} 587 588static int st21nfca_hci_i2c_probe(struct i2c_client *client, 589 const struct i2c_device_id *id) 590{ 591 struct st21nfca_i2c_phy *phy; 592 struct st21nfca_nfc_platform_data *pdata; 593 int r; 594 595 dev_dbg(&client->dev, "%s\n", __func__); 596 dev_dbg(&client->dev, "IRQ: %d\n", client->irq); 597 598 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 599 nfc_err(&client->dev, "Need I2C_FUNC_I2C\n"); 600 return -ENODEV; 601 } 602 603 phy = devm_kzalloc(&client->dev, sizeof(struct st21nfca_i2c_phy), 604 GFP_KERNEL); 605 if (!phy) 606 return -ENOMEM; 607 608 phy->i2c_dev = client; 609 phy->pending_skb = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE * 2, GFP_KERNEL); 610 if (phy->pending_skb == NULL) 611 return -ENOMEM; 612 613 phy->current_read_len = 0; 614 phy->crc_trials = 0; 615 mutex_init(&phy->phy_lock); 616 i2c_set_clientdata(client, phy); 617 618 pdata = client->dev.platform_data; 619 if (!pdata && client->dev.of_node) { 620 r = st21nfca_hci_i2c_of_request_resources(client); 621 if (r) { 622 nfc_err(&client->dev, "No platform data\n"); 623 return r; 624 } 625 } else if (pdata) { 626 r = st21nfca_hci_i2c_request_resources(client); 627 if (r) { 628 nfc_err(&client->dev, "Cannot get platform resources\n"); 629 return r; 630 } 631 } else { 632 nfc_err(&client->dev, "st21nfca platform resources not available\n"); 633 return -ENODEV; 634 } 635 636 r = st21nfca_hci_platform_init(phy); 637 if (r < 0) { 638 nfc_err(&client->dev, "Unable to reboot st21nfca\n"); 639 return r; 640 } 641 642 r = devm_request_threaded_irq(&client->dev, client->irq, NULL, 643 st21nfca_hci_irq_thread_fn, 644 phy->irq_polarity | IRQF_ONESHOT, 645 ST21NFCA_HCI_DRIVER_NAME, phy); 646 if (r < 0) { 647 nfc_err(&client->dev, "Unable to register IRQ handler\n"); 648 return r; 649 } 650 651 return st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, 652 ST21NFCA_FRAME_HEADROOM, 653 ST21NFCA_FRAME_TAILROOM, 654 ST21NFCA_HCI_LLC_MAX_PAYLOAD, 655 &phy->hdev, 656 &phy->se_status); 657} 658 659static int st21nfca_hci_i2c_remove(struct i2c_client *client) 660{ 661 struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); 662 663 dev_dbg(&client->dev, "%s\n", __func__); 664 665 st21nfca_hci_remove(phy->hdev); 666 667 if (phy->powered) 668 st21nfca_hci_i2c_disable(phy); 669 670 return 0; 671} 672 673#ifdef CONFIG_OF 674static const struct of_device_id of_st21nfca_i2c_match[] = { 675 { .compatible = "st,st21nfca-i2c", }, 676 { .compatible = "st,st21nfca_i2c", }, 677 {} 678}; 679MODULE_DEVICE_TABLE(of, of_st21nfca_i2c_match); 680#endif 681 682static struct i2c_driver st21nfca_hci_i2c_driver = { 683 .driver = { 684 .owner = THIS_MODULE, 685 .name = ST21NFCA_HCI_I2C_DRIVER_NAME, 686 .of_match_table = of_match_ptr(of_st21nfca_i2c_match), 687 }, 688 .probe = st21nfca_hci_i2c_probe, 689 .id_table = st21nfca_hci_i2c_id_table, 690 .remove = st21nfca_hci_i2c_remove, 691}; 692 693module_i2c_driver(st21nfca_hci_i2c_driver); 694 695MODULE_LICENSE("GPL"); 696MODULE_DESCRIPTION(DRIVER_DESC); 697