devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Cuissard <cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
To: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Vincent Cuissard
	<cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH v3 4/9] NFC: nfcmrvl: configure head/tail room values per low level drivers
Date: Fri, 23 Oct 2015 14:23:01 +0200	[thread overview]
Message-ID: <1445602986-3254-5-git-send-email-cuissard@marvell.com> (raw)
In-Reply-To: <1445602986-3254-1-git-send-email-cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>

Low-level drivers may need to add some data before and/or after NCI packet.

Signed-off-by: Vincent Cuissard <cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
 drivers/nfc/nfcmrvl/main.c    | 13 +++++++++----
 drivers/nfc/nfcmrvl/nfcmrvl.h |  3 ++-
 drivers/nfc/nfcmrvl/uart.c    |  4 ++--
 drivers/nfc/nfcmrvl/usb.c     |  3 +--
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
index 6fb23cc..a24a7ca 100644
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -97,14 +97,16 @@ static struct nci_ops nfcmrvl_nci_ops = {
 	.fw_download = nfcmrvl_nci_fw_download,
 };
 
-struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
+struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
+				void *drv_data,
 				struct nfcmrvl_if_ops *ops,
 				struct device *dev,
 				struct nfcmrvl_platform_data *pdata)
 {
 	struct nfcmrvl_private *priv;
 	int rc;
-	int headroom = 0;
+	int headroom;
+	int tailroom;
 	u32 protocols;
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -114,6 +116,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
 	priv->drv_data = drv_data;
 	priv->if_ops = ops;
 	priv->dev = dev;
+	priv->phy = phy;
 
 	memcpy(&priv->config, pdata, sizeof(*pdata));
 
@@ -126,8 +129,10 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
 			nfc_err(dev, "failed to request reset_n io\n");
 	}
 
+	headroom = tailroom = 0;
+
 	if (priv->config.hci_muxed)
-		headroom = NFCMRVL_HCI_EVENT_HEADER_SIZE;
+		headroom += NFCMRVL_HCI_EVENT_HEADER_SIZE;
 
 	protocols = NFC_PROTO_JEWEL_MASK
 		| NFC_PROTO_MIFARE_MASK
@@ -138,7 +143,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
 		| NFC_PROTO_NFC_DEP_MASK;
 
 	priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols,
-					 headroom, 0);
+					 headroom, tailroom);
 	if (!priv->ndev) {
 		nfc_err(dev, "nci_allocate_device failed\n");
 		rc = -ENOMEM;
diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h
index 1b30f04..f82678b 100644
--- a/drivers/nfc/nfcmrvl/nfcmrvl.h
+++ b/drivers/nfc/nfcmrvl/nfcmrvl.h
@@ -100,7 +100,8 @@ struct nfcmrvl_if_ops {
 
 void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv);
 int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
-struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
+struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
+				void *drv_data,
 				struct nfcmrvl_if_ops *ops,
 				struct device *dev,
 				struct nfcmrvl_platform_data *pdata);
diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c
index 8355824..4dccee2 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)
 		pdata = &config;
 	}
 
-	priv = nfcmrvl_nci_register_dev(nu, &uart_ops, nu->tty->dev, pdata);
+	priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_UART, nu, &uart_ops,
+					nu->tty->dev, pdata);
 	if (IS_ERR(priv))
 		return PTR_ERR(priv);
 
-	priv->phy = NFCMRVL_PHY_UART;
 	priv->support_fw_dnld = true;
 
 	nu->drv_data = priv;
diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
index b276174..585a0f2 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,
 	init_usb_anchor(&drv_data->bulk_anchor);
 	init_usb_anchor(&drv_data->deferred);
 
-	priv = nfcmrvl_nci_register_dev(drv_data, &usb_ops,
+	priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_USB, drv_data, &usb_ops,
 					&drv_data->udev->dev, &config);
 	if (IS_ERR(priv))
 		return PTR_ERR(priv);
 
 	drv_data->priv = priv;
-	drv_data->priv->phy = NFCMRVL_PHY_USB;
 	drv_data->priv->support_fw_dnld = false;
 
 	priv->dev = &drv_data->udev->dev;
-- 
2.2.0.33.gc18b867

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-10-23 12:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23 12:22 [PATCH v3 0/9] Marvell NFC drivers for i2c and spi Vincent Cuissard
     [not found] ` <1445602986-3254-1-git-send-email-cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2015-10-23 12:22   ` [PATCH v3 1/9] NFC: nfcmrvl: remove unneeded version defines Vincent Cuissard
2015-10-23 12:22   ` [PATCH v3 2/9] NFC: NCI: export nci_send_frame and nci_send_cmd function Vincent Cuissard
2015-10-23 12:23   ` [PATCH v3 3/9] NFC: nfcmrvl: add firmware download support Vincent Cuissard
2015-10-23 12:23   ` Vincent Cuissard [this message]
2015-10-23 12:23   ` [PATCH v3 5/9] NFC: nfcmrvl: add i2c driver Vincent Cuissard
2015-10-23 12:23   ` [PATCH v3 6/9] NFC: NCI: move generic spi driver to a module Vincent Cuissard
2015-10-23 12:23   ` [PATCH v3 7/9] NFC: NCI: allow spi driver to choose transfer clock Vincent Cuissard
2015-10-23 12:23   ` [PATCH v3 8/9] NFC: nfcmrvl: add spi driver Vincent Cuissard
2015-10-23 12:23   ` [PATCH v3 9/9] NFC: nfcmrvl: update device tree bindings for Marvell NFC Vincent Cuissard
     [not found]     ` <1445602986-3254-10-git-send-email-cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2015-10-23 13:17       ` Rob Herring
     [not found]         ` <CAL_JsqJ7a+MNA8BPseGu_L+3yMr=jK-3YiSo+HZkoqJq2XpWgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-23 13:47           ` Vincent Cuissard
2015-10-23 21:34             ` Rob Herring
     [not found]             ` <CE8AEFC3-74F2-44B9-B7B6-EBDD1966FB3A-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2015-10-23 23:00               ` [linux-nfc] " Samuel Ortiz
     [not found]                 ` <20151023230034.GA23609-nKCvNrh56OoJmsy6czSMtA@public.gmane.org>
2015-10-24  0:15                   ` Vincent Cuissard
     [not found]                     ` <3CAE2505-C17A-4A4F-A222-0F0D814B8491-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2015-10-24  0:22                       ` Samuel Ortiz
     [not found]                         ` <20151024002202.GC23609-nKCvNrh56OoJmsy6czSMtA@public.gmane.org>
2015-10-24  0:23                           ` Vincent Cuissard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445602986-3254-5-git-send-email-cuissard@marvell.com \
    --to=cuissard-eyqppykdwxrbdgjk7y7tuq@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).