2011-08-09 15:04:41

by Elias, Ilan

[permalink] [raw]
Subject: [RFC] NFC: NCI protocol proposal

Hi Lauro, Aloisio, Samuel, all,

We would like to implement the NFC Controller Interface (NCI) protocol for the NFC subsystem.
The NCI is a standard communication protocol between an NFC Controller (NFCC) and a Device Host (DH), defined by the NFC Forum.

The NCI protocol implementation will be chip independent and responsible for:
- Reset, initialization and configuration of the NFC controller
- Sending commands/data to the NFC controller
- Receiving responses/notifications/data from the NFC controller
- Flow control for Control and Data Messages
- Segmentation and reassembly for Control and Data Messages
- An addressing scheme for NFC Execution Environments (NFCEE), e.g. secure element
- An addressing scheme for Remote NFC Endpoints (NFCEE or RF targets) (via logical connections)

The NCI protocol will be added to the NFC subsystem below the NFC core:

+--------------------------------------+
| USER SPACE |
+--------------------------------------+
^ ^
| low-level | control
| data exchange | operations
| |
| v
| +-----------+
| AF_NFC | netlink |
| socket +-----------+
| raw ^
| |
v v
+---------+ +-----------+
| rawsock | <---------> | NFC core |
+---------+ +-----------+
^
|
v
+-----------+
| NCI core |
+-----------+
^
|
V
+-----------+
| driver |
+-----------+

The driver will register itself to the NCI core, and in turn the NCI core will register itself to the NFC core.

We need to add the following 2 control operations (via generic netlink):
- Dev_up, which turn on the NFC controller (this operation may take a few seconds, as it can download new FW to the NFC controller)
- Dev_down, which turn off the NFC controller
The dev_up/down approach was also used with HCI protocol in the BlueZ project.

We suggest placing the NCI code in the net\nfc folder (beside the NFC code), as it's a generic and chip independent protocol, and not a driver.
This approach was also used with HCI protocol in the BlueZ project.
The driver itself will be located at drivers\nfc folder.

The NCI code will be divided in a few files, e.g. nci_core, nci_rsp, nci_ntf etc.

We'll appreciate your comments.

Thanks & BR
Ilan Elias
Texas Instruments


2011-08-11 15:38:45

by Elias, Ilan

[permalink] [raw]
Subject: RE: [RFC] NFC: NCI protocol proposal

Hi Lauro, Johannes,

>
> On Tue, 2011-08-09 at 14:43 -0300, Lauro Ramos Venancio wrote:
>
> > > We need to add the following 2 control operations (via generic
> > > netlink):
> > > - Dev_up, which turn on the NFC controller (this operation may
> > > take a few seconds, as it can download new FW to the NFC controller)
> > > - Dev_down, which turn off the NFC controller
> > > The dev_up/down approach was also used with HCI protocol in the BlueZ
> > > project.
> >
> > I am not completely convinced that we need the dev up/down. Why is it
> > not possible to load the FW in the probe?
>
> The usual problem, if the driver is built-in then the probe will run
> before userspace is available to load firmware.
>
> johannes

Thanks for your comments.

BR,
Ilan

2011-08-09 17:44:00

by Lauro Ramos Venancio

[permalink] [raw]
Subject: Re: [RFC] NFC: NCI protocol proposal

SGkgSWxhbiwKCjIwMTEvOC85IEVsaWFzLCBJbGFuIDxpbGFuZUB0aS5jb20+OgoKPiBXZSB3b3Vs
ZCBsaWtlIHRvIGltcGxlbWVudCB0aGUgTkZDIENvbnRyb2xsZXIgSW50ZXJmYWNlIChOQ0kpIHBy
b3RvY29sIGZvciB0aGUgTkZDIHN1YnN5c3RlbS4KPiBUaGUgTkNJIGlzIGEgc3RhbmRhcmQgY29t
bXVuaWNhdGlvbiBwcm90b2NvbCBiZXR3ZWVuIGFuIE5GQyBDb250cm9sbGVyIChORkNDKSBhbmQg
YSBEZXZpY2UgSG9zdCAoREgpLCBkZWZpbmVkIGJ5IHRoZSBORkMgRm9ydW0uCj4KPiBUaGUgTkNJ
IHByb3RvY29sIGltcGxlbWVudGF0aW9uIHdpbGwgYmUgY2hpcCBpbmRlcGVuZGVudCBhbmQgcmVz
cG9uc2libGUgZm9yOgo+IMKgIMKgIMKgIMKgLSBSZXNldCwgaW5pdGlhbGl6YXRpb24gYW5kIGNv
bmZpZ3VyYXRpb24gb2YgdGhlIE5GQyBjb250cm9sbGVyCj4gwqAgwqAgwqAgwqAtIFNlbmRpbmcg
Y29tbWFuZHMvZGF0YSB0byB0aGUgTkZDIGNvbnRyb2xsZXIKPiDCoCDCoCDCoCDCoC0gUmVjZWl2
aW5nIHJlc3BvbnNlcy9ub3RpZmljYXRpb25zL2RhdGEgZnJvbSB0aGUgTkZDIGNvbnRyb2xsZ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xvYWQgbmV3IEZXIHRvIHRoZSBORkMgY29udHJvbGxlcikKPiDCoCDC
oCDCoCDCoC0gRGV2X2Rvd24sIHdoaWNoIHR1cm4gb2ZmIHRoZSBORkMgY29udHJvbGxlcgo+IFRo
ZSBkZXZfdXAvZG93biBhcHByb2FjaCB3YXMgYWxzbyB1c2VkIHdpdGggSENJIHByb3RvY29sIGlu
IHRoZSBCbHVlWiBwcm9qZWN0LgoKSSBhbSBub3QgY29tcGxldGVseSBjb252aW5jZWQgdGhhdCB3
ZSBuZWVkIHRoZSBkZXYgdXAvZG93bi4gV2h5IGlzIGl0Cm5vdCBwb3NzaWJsZSB0byBsb2FkIHRo
ZSBGVyBpbiB0aGUgcHJvYmU/Cgo+Cj4gV2Ugc3VnZ2VzdCBwbGFjaW5nIHRoZSBOQ0kgY29kZSBp
biB0aGUgbmV0XG5mYyBmb2xkZXIgKGJlc2lkZSB0aGUgTkZDIGNvZGUpLCBhcyBpdCdzIGEgZ2Vu
ZXJpYyBhbmQgY2hpcCBpbmRlcGVuZGVudCBwcm90b2NvbCwgYW5kIG5vdCBhIGRyaXZlcgo+IFRo
aXMgYXBwcm9hY2ggd2FzIGFsc28gdXNlZCB3aXRoIEhDSSBwcm90b2NvbCBpbiB0aGUgQmx1ZVog
cHJvamVjdC4KPiBUaGUgZHJpdmVyIGl0c2VsZiB3aWxsIGJlIGxvY2F0ZWQgYXQgZHJpdmVyc1xu
ZmMgZm9sZGVyLgoKSSBhZ3JlZS4KCgpMYXVybwo=

2011-08-09 18:02:42

by Johannes Berg

[permalink] [raw]
Subject: Re: [RFC] NFC: NCI protocol proposal

On Tue, 2011-08-09 at 14:43 -0300, Lauro Ramos Venancio wrote:

> > We need to add the following 2 control operations (via generic netlink):
> > - Dev_up, which turn on the NFC controller (this operation may take a few seconds, as it can download new FW to the NFC controller)
> > - Dev_down, which turn off the NFC controller
> > The dev_up/down approach was also used with HCI protocol in the BlueZ project.
>
> I am not completely convinced that we need the dev up/down. Why is it
> not possible to load the FW in the probe?

The usual problem, if the driver is built-in then the probe will run
before userspace is available to load firmware.

johannes


2011-08-14 11:51:54

by Elias, Ilan

[permalink] [raw]
Subject: RE: [RFC] NFC: NCI protocol proposal

Hi Samuel,

> > We would like to implement the NFC Controller Interface (NCI) protocol
> > for the NFC subsystem.
> > The NCI is a standard communication protocol between an NFC Controller
> > (NFCC) and a Device Host (DH), defined by the NFC Forum.
> Just as a side note to our previous thread: As far as I know, NCI is still
> a draft (very close to the final version though) and as a consequence only
> available to NFC Forum members.
You're correct. We estimate it will be official by e/o this year.

> > The NCI protocol implementation will be chip independent and responsible
> > for:
> > - Reset, initialization and configuration of the NFC controller
> > - Sending commands/data to the NFC controller
> > - Receiving responses/notifications/data from the NFC controller
> > - Flow control for Control and Data Messages
> > - Segmentation and reassembly for Control and Data Messages
> > - An addressing scheme for NFC Execution Environments (NFCEE), e.g.
> > secure element
> > - An addressing scheme for Remote NFC Endpoints (NFCEE or RF
> > targets) (via logical connections)
> Could you give us some more details about those last 2 points ?
As specified in the NCI spec, NFC Execution Environment (NFCEE) is an environment where NFC applications are executed (e.g. secure element).
NCI provides features to allow DH to NFCEE communication. NCI therefore includes methods to discover and enumerate connected NFCEEs and the Interfaces they support, and to establish connections between DH and NFCEE Interfaces.
A logical connection is a connection between the Device Host (DH) and the NFC Controller (NFCC) that is used for communication towards a target, either NFCEE or Remote NFC Endpoint. More than one Logical Connection MAY exist to the same target.

> Out of curiosity, is this NCI HW of yours based on the TRF7970A
> chipset ?
No, it's a new TI combo device, not in the market yet.

Thanks & BR
Ilan


2011-08-11 18:06:48

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [RFC] NFC: NCI protocol proposal

Hi Ilan,

On Tue, 2011-08-09 at 17:04 +0200, Elias, Ilan wrote:
> Hi Lauro, Aloisio, Samuel, all,
>
> We would like to implement the NFC Controller Interface (NCI) protocol for the NFC subsystem.
> The NCI is a standard communication protocol between an NFC Controller (NFCC) and a Device Host (DH), defined by the NFC Forum.
Just as a side note to our previous thread: As far as I know, NCI is still a draft
(very close to the final version though) and as a consequence only available to
NFC Forum members.


> The NCI protocol implementation will be chip independent and responsible for:
> - Reset, initialization and configuration of the NFC controller
> - Sending commands/data to the NFC controller
> - Receiving responses/notifications/data from the NFC controller
> - Flow control for Control and Data Messages
> - Segmentation and reassembly for Control and Data Messages
> - An addressing scheme for NFC Execution Environments (NFCEE), e.g. secure element
> - An addressing scheme for Remote NFC Endpoints (NFCEE or RF targets) (via logical connections)
Could you give us some more details about those last 2 points ?


>
> The NCI protocol will be added to the NFC subsystem below the NFC core:
>
> +--------------------------------------+
> | USER SPACE |
> +--------------------------------------+
> ^ ^
> | low-level | control
> | data exchange | operations
> | |
> | v
> | +-----------+
> | AF_NFC | netlink |
> | socket +-----------+
> | raw ^
> | |
> v v
> +---------+ +-----------+
> | rawsock | <---------> | NFC core |
> +---------+ +-----------+
> ^
> |
> v
> +-----------+
> | NCI core |
> +-----------+
> ^
> |
> V
> +-----------+
> | driver |
> +-----------+
>
> The driver will register itself to the NCI core, and in turn the NCI core will register itself to the NFC core.
It really looks like the HCI layer I'm currently (slowly) working on. So it does look good to me.



> We need to add the following 2 control operations (via generic netlink):
> - Dev_up, which turn on the NFC controller (this operation may take a few seconds, as it can download new FW to the NFC controller)
> - Dev_down, which turn off the NFC controller
> The dev_up/down approach was also used with HCI protocol in the BlueZ project.
So after talking with Lauro and Aloisio about it, and listening to
Johannes argument, I think it does make sense to add those 2 hooks.


>
> We suggest placing the NCI code in the net\nfc folder (beside the NFC code), as it's a generic and chip independent protocol, and not a driver.
Yep, you probably want to have an nci directory there.

Out of curiosity, is this NCI HW of yours based on the TRF7970A
chipset ?

Cheers,
Samuel.