Lines Matching +full:nfc +full:- +full:uart

1 // SPDX-License-Identifier: GPL-2.0+
3 * UART Link Layer for S3FWRN82 NCI based Driver
14 #include <linux/nfc.h>
38 err = serdev_device_write(phy->ser_dev, in s3fwrn82_uart_write()
39 out->data, out->len, in s3fwrn82_uart_write()
62 skb_put_u8(phy->recv_skb, *data++); in s3fwrn82_uart_read()
64 if (phy->recv_skb->len < S3FWRN82_NCI_HEADER) in s3fwrn82_uart_read()
67 if ((phy->recv_skb->len - S3FWRN82_NCI_HEADER) in s3fwrn82_uart_read()
68 < phy->recv_skb->data[S3FWRN82_NCI_IDX]) in s3fwrn82_uart_read()
71 s3fwrn5_recv_frame(phy->common.ndev, phy->recv_skb, in s3fwrn82_uart_read()
72 phy->common.mode); in s3fwrn82_uart_read()
73 phy->recv_skb = alloc_skb(NCI_SKB_BUFF_LEN, GFP_KERNEL); in s3fwrn82_uart_read()
74 if (!phy->recv_skb) in s3fwrn82_uart_read()
95 struct device_node *np = serdev->dev.of_node; in s3fwrn82_uart_parse_dt()
98 return -ENODEV; in s3fwrn82_uart_parse_dt()
100 phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0); in s3fwrn82_uart_parse_dt()
101 if (!gpio_is_valid(phy->common.gpio_en)) in s3fwrn82_uart_parse_dt()
102 return -ENODEV; in s3fwrn82_uart_parse_dt()
104 phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0); in s3fwrn82_uart_parse_dt()
105 if (!gpio_is_valid(phy->common.gpio_fw_wake)) in s3fwrn82_uart_parse_dt()
106 return -ENODEV; in s3fwrn82_uart_parse_dt()
114 int ret = -ENOMEM; in s3fwrn82_uart_probe()
116 phy = devm_kzalloc(&serdev->dev, sizeof(*phy), GFP_KERNEL); in s3fwrn82_uart_probe()
120 phy->recv_skb = alloc_skb(NCI_SKB_BUFF_LEN, GFP_KERNEL); in s3fwrn82_uart_probe()
121 if (!phy->recv_skb) in s3fwrn82_uart_probe()
124 mutex_init(&phy->common.mutex); in s3fwrn82_uart_probe()
125 phy->common.mode = S3FWRN5_MODE_COLD; in s3fwrn82_uart_probe()
127 phy->ser_dev = serdev; in s3fwrn82_uart_probe()
132 dev_err(&serdev->dev, "Unable to open device\n"); in s3fwrn82_uart_probe()
138 ret = -EINVAL; in s3fwrn82_uart_probe()
148 ret = devm_gpio_request_one(&phy->ser_dev->dev, phy->common.gpio_en, in s3fwrn82_uart_probe()
153 ret = devm_gpio_request_one(&phy->ser_dev->dev, in s3fwrn82_uart_probe()
154 phy->common.gpio_fw_wake, in s3fwrn82_uart_probe()
159 ret = s3fwrn5_probe(&phy->common.ndev, phy, &phy->ser_dev->dev, in s3fwrn82_uart_probe()
169 kfree_skb(phy->recv_skb); in s3fwrn82_uart_probe()
178 s3fwrn5_remove(phy->common.ndev); in s3fwrn82_uart_remove()
180 kfree_skb(phy->recv_skb); in s3fwrn82_uart_remove()
195 MODULE_DESCRIPTION("UART driver for Samsung NFC");