Skip to content

Commit 58d34aa

Browse files
Vincent CuissardSamuel Ortiz
authored andcommitted
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>
1 parent 3194c68 commit 58d34aa

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

drivers/nfc/nfcmrvl/main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,16 @@ static struct nci_ops nfcmrvl_nci_ops = {
9797
.fw_download = nfcmrvl_nci_fw_download,
9898
};
9999

100-
struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
100+
struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
101+
void *drv_data,
101102
struct nfcmrvl_if_ops *ops,
102103
struct device *dev,
103104
struct nfcmrvl_platform_data *pdata)
104105
{
105106
struct nfcmrvl_private *priv;
106107
int rc;
107-
int headroom = 0;
108+
int headroom;
109+
int tailroom;
108110
u32 protocols;
109111

110112
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -114,6 +116,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
114116
priv->drv_data = drv_data;
115117
priv->if_ops = ops;
116118
priv->dev = dev;
119+
priv->phy = phy;
117120

118121
memcpy(&priv->config, pdata, sizeof(*pdata));
119122

@@ -126,8 +129,10 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
126129
nfc_err(dev, "failed to request reset_n io\n");
127130
}
128131

132+
headroom = tailroom = 0;
133+
129134
if (priv->config.hci_muxed)
130-
headroom = NFCMRVL_HCI_EVENT_HEADER_SIZE;
135+
headroom += NFCMRVL_HCI_EVENT_HEADER_SIZE;
131136

132137
protocols = NFC_PROTO_JEWEL_MASK
133138
| NFC_PROTO_MIFARE_MASK
@@ -138,7 +143,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
138143
| NFC_PROTO_NFC_DEP_MASK;
139144

140145
priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols,
141-
headroom, 0);
146+
headroom, tailroom);
142147
if (!priv->ndev) {
143148
nfc_err(dev, "nci_allocate_device failed\n");
144149
rc = -ENOMEM;

drivers/nfc/nfcmrvl/nfcmrvl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ struct nfcmrvl_if_ops {
100100

101101
void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv);
102102
int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
103-
struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
103+
struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
104+
void *drv_data,
104105
struct nfcmrvl_if_ops *ops,
105106
struct device *dev,
106107
struct nfcmrvl_platform_data *pdata);

drivers/nfc/nfcmrvl/uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
138138
pdata = &config;
139139
}
140140

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);
142143
if (IS_ERR(priv))
143144
return PTR_ERR(priv);
144145

145-
priv->phy = NFCMRVL_PHY_UART;
146146
priv->support_fw_dnld = true;
147147

148148
nu->drv_data = priv;

drivers/nfc/nfcmrvl/usb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,12 @@ static int nfcmrvl_probe(struct usb_interface *intf,
340340
init_usb_anchor(&drv_data->bulk_anchor);
341341
init_usb_anchor(&drv_data->deferred);
342342

343-
priv = nfcmrvl_nci_register_dev(drv_data, &usb_ops,
343+
priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_USB, drv_data, &usb_ops,
344344
&drv_data->udev->dev, &config);
345345
if (IS_ERR(priv))
346346
return PTR_ERR(priv);
347347

348348
drv_data->priv = priv;
349-
drv_data->priv->phy = NFCMRVL_PHY_USB;
350349
drv_data->priv->support_fw_dnld = false;
351350

352351
priv->dev = &drv_data->udev->dev;

0 commit comments

Comments
 (0)