All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: Tomas Winkler <tomas.winkler@intel.com>,
	arnd@arndb.de, linux-kernel@vger.kernel.org
Subject: Re: [char-misc-next 1/3] mei: nfc: Initial nfc implementation
Date: Wed, 10 Apr 2013 13:03:12 -0700	[thread overview]
Message-ID: <20130410200312.GC5681@kroah.com> (raw)
In-Reply-To: <20130410191945.GH4874@zurbaran>

On Wed, Apr 10, 2013 at 09:19:45PM +0200, Samuel Ortiz wrote:
> Hi Greg,
> 
> On Wed, Apr 10, 2013 at 10:25:51AM -0700, Greg KH wrote:
> > On Tue, Apr 09, 2013 at 02:41:33AM +0300, Tomas Winkler wrote:
> > > From: Samuel Ortiz <sameo@linux.intel.com>
> > > 
> > > NFC ME device is exported through the MEI bus to be consumed by the
> > > NFC subsystem.
> > > 
> > > NFC is represented by two mei clients: An info one and the actual
> > > NFC one. In order to properly build the ME id we first need to retrieve
> > > the firmware information from the info client and then disconnect from it.
> > 
> > I still don't understand why you aren't tieing this into the existing
> > nfc kernel api.  What am I missing?
> We can't tie this into the existing NFC kernel API because mei/nfc.c is not an
> NFC driver, it's an ME specific shim layer that does not do anything NFC (as
> in NFC Forum specified) related.

Then why call it "NFC" if you don't want to confuse everyone :)

> At that point in the code the only thing we know is that there is an NFC
> device behind the ME. As I said, it can be any NFC device, but it's not an
> Intel specific or ME specific NFC hardware, it's just a regular NFC one
> (pn544, microread, etc...) that is only accessible through the ME. The typical
> setup is where you access the NFC hardware through i2c, SPI or USB, but here
> it's "hidden" behind the ME.

Ok, but once you "unhide" it, it needs to talk through the in-kernel NFC
api, not some other random interface.

> The patch below sends the needed commands to the ME in order to fetch some
> information (vendor ID, radio ID) and understand which exact chipset
> is physically hooked to the ME (0x0, 0x0 -> microread, 0x1, 0x1 -> pn544).
> Once that's done, we can add the right device on the ME bus (This is done on
> patch #2), the same way you would add an NFC device to the USB bus when your
> USB host controller tells you about the vendor and product IDs.
> So after patch #1 and #2, we have an NFC device on the ME and this could be
> e.g. a pn544. We do have a driver for pn544 under drivers/nfc/ which will hook
> into the NFC kernel APIs once probed (The pn544 is missing an mei.c file that
> will register itself as an mei_cl driver for "pn544", as described in
> Documentation/misc-devices/mei/mei-client-bus.txt). So the NFC kernel APIs are
> called from the actual NFC driver, because mei/nfc.c is not an NFC driver,
> it's a NFC specific ME layer that is needed to register the right device (as
> in the kernel device/driver model) on the MEI bus.

So when will you send the patch for the pn544 driver?

> > >  include/uapi/linux/mei/nfc.h  | 135 +++++++++++++++++++++++
> > 
> > Based on our previous off-list emails, you said that this .h file is
> > needed for the userspace api.  But the nfc userspace api is through the
> > nfc API, which doesn't use any of the structures defined here.  So who
> > exactly uses this file?
> You're right, an NFC application that would use the kernel NFC APIs (AF_NFC
> and the NFC generic netlink one) will not need this header.
> But the Android stack does not use any of the NFC kernel APIs, it implements
> the whole NFC stack in userspace and typically sends raw HCI frames to a dumb
> kernel driver (not upstreamed) through /dev/pn544 for example.

That's horrible, use the in-kernel apis, don't create your own, and
Android should be using the correct apis as well.  If it isn't, we don't
have to support it here, in fact, I would strongly suggest that we not,
so as it gets properly changed.

In fact, why don't you change it?

> That works fine with the typical case where your pn544 is directly accessible
> through i2c. But if it's sitting behind the ME, you will need to send
> commands exported through this file to fetch the vendor and radio IDs, but
> also to send those HCI frames that the vanilla Android stack builds after
> encapsulating them into a struct mei_nfc_cmd. And this is all done through the
> /dev/mei interface.

No NFC data should be going through /dev/mei, use the proper kernel apis
please.

greg k-h

  parent reply	other threads:[~2013-04-10 20:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 23:41 [char-misc-next 0/3 V6] Support NFC Device on MEI CL Bus Tomas Winkler
2013-04-08 23:41 ` [char-misc-next 1/3] mei: nfc: Initial nfc implementation Tomas Winkler
2013-04-10 17:25   ` Greg KH
2013-04-10 19:19     ` Samuel Ortiz
2013-04-10 19:46       ` Arnd Bergmann
2013-04-10 20:03       ` Greg KH [this message]
2013-04-10 21:15         ` Samuel Ortiz
2013-04-10 22:29           ` Arnd Bergmann
2013-04-10 22:52             ` Samuel Ortiz
2013-04-10 22:59               ` Greg KH
2013-04-08 23:41 ` [char-misc-next 2/3] mei: nfc: Add NFC device to the MEI bus Tomas Winkler
2013-04-08 23:41 ` [char-misc-next 3/3] mei: nfc: Implement MEI bus ops Tomas Winkler
2013-04-09  0:08 ` [char-misc-next 0/3 V6] Support NFC Device on MEI CL Bus Greg KH
2013-04-09 13:12   ` Winkler, Tomas
2013-04-09 13:46     ` Samuel Ortiz

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=20130410200312.GC5681@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=tomas.winkler@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.