aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Cuissard <cuissard@marvell.com>2015-10-26 05:27:40 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2015-10-26 23:19:44 -0400
commit58d34aa677ec248539262c54a618d61804a893f1 (patch)
tree28445e1e86c73b08ba0990dcd6be335d55ab43d9
parent3194c6870158e305dac2af52f83681e9cb67280f (diff)
NFC: nfcmrvl: configure head/tail room values per low level drivers
Low-level drivers may need to add some data before and/or after NCI packet. Signed-off-by: Vincent Cuissard <cuissard@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/nfcmrvl/main.c13
-rw-r--r--drivers/nfc/nfcmrvl/nfcmrvl.h3
-rw-r--r--drivers/nfc/nfcmrvl/uart.c4
-rw-r--r--drivers/nfc/nfcmrvl/usb.c3
4 files changed, 14 insertions, 9 deletions
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
index 6fb23cc9a659..a24a7ca9f33d 100644
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -97,14 +97,16 @@ static struct nci_ops nfcmrvl_nci_ops = {
97 .fw_download = nfcmrvl_nci_fw_download, 97 .fw_download = nfcmrvl_nci_fw_download,
98}; 98};
99 99
100struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data, 100struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
101 void *drv_data,
101 struct nfcmrvl_if_ops *ops, 102 struct nfcmrvl_if_ops *ops,
102 struct device *dev, 103 struct device *dev,
103 struct nfcmrvl_platform_data *pdata) 104 struct nfcmrvl_platform_data *pdata)
104{ 105{
105 struct nfcmrvl_private *priv; 106 struct nfcmrvl_private *priv;
106 int rc; 107 int rc;
107 int headroom = 0; 108 int headroom;
109 int tailroom;
108 u32 protocols; 110 u32 protocols;
109 111
110 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 112 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -114,6 +116,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
114 priv->drv_data = drv_data; 116 priv->drv_data = drv_data;
115 priv->if_ops = ops; 117 priv->if_ops = ops;
116 priv->dev = dev; 118 priv->dev = dev;
119 priv->phy = phy;
117 120
118 memcpy(&priv->config, pdata, sizeof(*pdata)); 121 memcpy(&priv->config, pdata, sizeof(*pdata));
119 122
@@ -126,8 +129,10 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
126 nfc_err(dev, "failed to request reset_n io\n"); 129 nfc_err(dev, "failed to request reset_n io\n");
127 } 130 }
128 131
132 headroom = tailroom = 0;
133
129 if (priv->config.hci_muxed) 134 if (priv->config.hci_muxed)
130 headroom = NFCMRVL_HCI_EVENT_HEADER_SIZE; 135 headroom += NFCMRVL_HCI_EVENT_HEADER_SIZE;
131 136
132 protocols = NFC_PROTO_JEWEL_MASK 137 protocols = NFC_PROTO_JEWEL_MASK
133 | NFC_PROTO_MIFARE_MASK 138 | NFC_PROTO_MIFARE_MASK
@@ -138,7 +143,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
138 | NFC_PROTO_NFC_DEP_MASK; 143 | NFC_PROTO_NFC_DEP_MASK;
139 144
140 priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols, 145 priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols,
141 headroom, 0); 146 headroom, tailroom);
142 if (!priv->ndev) { 147 if (!priv->ndev) {
143 nfc_err(dev, "nci_allocate_device failed\n"); 148 nfc_err(dev, "nci_allocate_device failed\n");
144 rc = -ENOMEM; 149 rc = -ENOMEM;
diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h
index 1b30f043139c..f82678be5aa9 100644
--- a/drivers/nfc/nfcmrvl/nfcmrvl.h
+++ b/drivers/nfc/nfcmrvl/nfcmrvl.h
@@ -100,7 +100,8 @@ struct nfcmrvl_if_ops {
100 100
101void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv); 101void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv);
102int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb); 102int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
103struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data, 103struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
104 void *drv_data,
104 struct nfcmrvl_if_ops *ops, 105 struct nfcmrvl_if_ops *ops,
105 struct device *dev, 106 struct device *dev,
106 struct nfcmrvl_platform_data *pdata); 107 struct nfcmrvl_platform_data *pdata);
diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c
index 835582435560..4dccee2566cf 100644
--- a/drivers/nfc/nfcmrvl/uart.c
+++ b/drivers/nfc/nfcmrvl/uart.c
@@ -138,11 +138,11 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
138 pdata = &config; 138 pdata = &config;
139 } 139 }
140 140
141 priv = nfcmrvl_nci_register_dev(nu, &uart_ops, nu->tty->dev, pdata); 141 priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_UART, nu, &uart_ops,
142 nu->tty->dev, pdata);
142 if (IS_ERR(priv)) 143 if (IS_ERR(priv))
143 return PTR_ERR(priv); 144 return PTR_ERR(priv);
144 145
145 priv->phy = NFCMRVL_PHY_UART;
146 priv->support_fw_dnld = true; 146 priv->support_fw_dnld = true;
147 147
148 nu->drv_data = priv; 148 nu->drv_data = priv;
diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
index b27617434427..585a0f20835b 100644
--- a/drivers/nfc/nfcmrvl/usb.c
+++ b/drivers/nfc/nfcmrvl/usb.c
@@ -340,13 +340,12 @@ static int nfcmrvl_probe(struct usb_interface *intf,
340 init_usb_anchor(&drv_data->bulk_anchor); 340 init_usb_anchor(&drv_data->bulk_anchor);
341 init_usb_anchor(&drv_data->deferred); 341 init_usb_anchor(&drv_data->deferred);
342 342
343 priv = nfcmrvl_nci_register_dev(drv_data, &usb_ops, 343 priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_USB, drv_data, &usb_ops,
344 &drv_data->udev->dev, &config); 344 &drv_data->udev->dev, &config);
345 if (IS_ERR(priv)) 345 if (IS_ERR(priv))
346 return PTR_ERR(priv); 346 return PTR_ERR(priv);
347 347
348 drv_data->priv = priv; 348 drv_data->priv = priv;
349 drv_data->priv->phy = NFCMRVL_PHY_USB;
350 drv_data->priv->support_fw_dnld = false; 349 drv_data->priv->support_fw_dnld = false;
351 350
352 priv->dev = &drv_data->udev->dev; 351 priv->dev = &drv_data->udev->dev;