Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-06-06 Thread Pavan Savoy
On Thu, Mar 31, 2011 at 9:30 AM, Samuel Ortiz sa...@linux.intel.com wrote: On Thu, Mar 31, 2011 at 06:24:50PM +0300, waldemar.rymarkiew...@tieto.com wrote: Hi Samuel, That's the Bluetooth approach, and it works just fine as well. However, the netlink option for sending commands and

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-06-06 Thread Pavan Savoy
On Mon, Jun 6, 2011 at 3:22 PM, Pavan Savoy pavan_sa...@sify.com wrote: On Thu, Mar 31, 2011 at 9:30 AM, Samuel Ortiz sa...@linux.intel.com wrote: On Thu, Mar 31, 2011 at 06:24:50PM +0300, waldemar.rymarkiew...@tieto.com wrote: Hi Samuel, That's the Bluetooth approach, and it works just

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-06-06 Thread Aloisio Almeida
On Mon, Jun 6, 2011 at 5:30 PM, Pavan Savoy pavan_sa...@sify.com wrote: Yes apparently I did miss a whole of patches in the series. So, for anyone who is interested on the list - this is the proposed architecture,

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-06-06 Thread Samuel Ortiz
Hi Pavan, On Mon, Jun 06, 2011 at 03:22:01PM -0500, Pavan Savoy wrote: On Thu, Mar 31, 2011 at 9:30 AM, Samuel Ortiz sa...@linux.intel.com wrote: On Thu, Mar 31, 2011 at 06:24:50PM +0300, waldemar.rymarkiew...@tieto.com wrote: Hi Samuel, That's the Bluetooth approach, and it works

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-04-01 Thread Aloisio Almeida
Hi all, On Thu, Mar 31, 2011 at 12:30 PM, Samuel Ortiz sa...@linux.intel.com wrote: On Thu, Mar 31, 2011 at 06:24:50PM +0300, waldemar.rymarkiew...@tieto.com wrote: Hi Samuel, That's the Bluetooth approach, and it works just fine as well. However, the netlink option for sending commands

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-04-01 Thread Arnd Bergmann
On Friday 01 April 2011 20:19:30 Aloisio Almeida wrote: We are finalizing a NFC stack prototype and we decided to use generic netlink. But during the implementation we found a disadvantage of this approach. While implementing data_exchange through netlink, it was not possible to avoid

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-31 Thread Samuel Ortiz
On Tue, Mar 29, 2011 at 01:05:02PM +0200, Arnd Bergmann wrote: On Tuesday 29 March 2011, waldemar.rymarkiew...@tieto.com wrote: Yes, NFC seems to be a good fit for a new socket family. Especially if we ever want to have a proper NFC p2p support from the kernel. Sending HCI commands

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-31 Thread Waldemar.Rymarkiewicz
My idea of an initial NFC subsystem architecture was actually the following one: - A core NFC layer against which NFC drivers would register. - A netlink socket for handling the HCI commands. That would put a big part of the NFC HCI layer in kernel land and could potentially simplify the

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-31 Thread Arnd Bergmann
On Thursday 31 March 2011, waldemar.rymarkiew...@tieto.com wrote: My idea of an initial NFC subsystem architecture was actually the following one: - A core NFC layer against which NFC drivers would register. - A netlink socket for handling the HCI commands. That would put a big part of the

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-31 Thread Samuel Ortiz
Hi Waldemar, On Thu, Mar 31, 2011 at 05:42:21PM +0300, waldemar.rymarkiew...@tieto.com wrote: My idea of an initial NFC subsystem architecture was actually the following one: - A core NFC layer against which NFC drivers would register. - A netlink socket for handling the HCI commands. That

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-31 Thread Waldemar.Rymarkiewicz
Hi Samuel, That's the Bluetooth approach, and it works just fine as well. However, the netlink option for sending commands and receiving answers to/from a subsystem sounds more appropriate, at least to me. I haven't used netlink in practice, so just wondering why netlink. I assume, then, it's

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-31 Thread Samuel Ortiz
On Thu, Mar 31, 2011 at 06:24:50PM +0300, waldemar.rymarkiew...@tieto.com wrote: Hi Samuel, That's the Bluetooth approach, and it works just fine as well. However, the netlink option for sending commands and receiving answers to/from a subsystem sounds more appropriate, at least to me. I

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-29 Thread Waldemar.Rymarkiewicz
Yes, NFC seems to be a good fit for a new socket family. Especially if we ever want to have a proper NFC p2p support from the kernel. Sending HCI commands should be done through a dedicated netlink socket too. I am currently strting to work on such solution, and I hope to be able to come up

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-29 Thread Arnd Bergmann
On Tuesday 29 March 2011, waldemar.rymarkiew...@tieto.com wrote: Yes, NFC seems to be a good fit for a new socket family. Especially if we ever want to have a proper NFC p2p support from the kernel. Sending HCI commands should be done through a dedicated netlink socket too. I am

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-29 Thread Alan Cox
The difference between the two is where you keep the common NFC logic: I think I'd disagree on that If you have a character device, it will be like a serial port connecting to a modem. Any higher-level protocols live in the user space and are limited to a single application then, which is

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-29 Thread Arnd Bergmann
On Tuesday 29 March 2011, Alan Cox wrote: The difference between the two is where you keep the common NFC logic: I think I'd disagree on that If you have a character device, it will be like a serial port connecting to a modem. Any higher-level protocols live in the user space and

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-29 Thread Alan Cox
I was under the impression that NFC was peer-to-peer, so the driver would already be handling both sides potentially. Your security requirements each side are going to be very different. A phone or handheld device is generally single user at a time, the other end may well be interacting with

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-29 Thread Arnd Bergmann
On Tuesday 29 March 2011, Alan Cox wrote: I was under the impression that NFC was peer-to-peer, so the driver would already be handling both sides potentially. Your security requirements each side are going to be very different. A phone or handheld device is generally single user at a

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-25 Thread Samuel Ortiz
On Fri, Mar 18, 2011 at 01:19:53PM +0100, Arnd Bergmann wrote: On Friday 18 March 2011, Waldemar Rymarkiewicz wrote: Add new driver for MicroRead NFC chip connected to i2c bus. See Documentation/nfc/nfc-microread.txt. As I said in my first review and Alan also pointed out now, the most

[PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Waldemar Rymarkiewicz
Updated patch after Arnd's comments. Waldek Waldemar Rymarkiewicz (1): NFC: Driver for Inside Secure MicroRead NFC chip Documentation/nfc/nfc-microread.txt | 46 drivers/nfc/Kconfig | 10 + drivers/nfc/Makefile|1 + drivers/nfc/microread.c

[PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Waldemar Rymarkiewicz
Add new driver for MicroRead NFC chip connected to i2c bus. See Documentation/nfc/nfc-microread.txt. Signed-off-by: Waldemar Rymarkiewicz waldemar.rymarkiew...@tieto.com --- Documentation/nfc/nfc-microread.txt | 46 drivers/nfc/Kconfig | 10 + drivers/nfc/Makefile

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Alan Cox
On Fri, 18 Mar 2011 11:40:24 +0100 Waldemar Rymarkiewicz waldemar.rymarkiew...@tieto.com wrote: Add new driver for MicroRead NFC chip connected to i2c bus. Ok we now have two devices and they have differing APIs and own device names and both from the same company. This has to stop right now and

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Wolfram Sang
Hi Waldemar, On Fri, Mar 18, 2011 at 11:40:24AM +0100, Waldemar Rymarkiewicz wrote: Add new driver for MicroRead NFC chip connected to i2c bus. See Documentation/nfc/nfc-microread.txt. Signed-off-by: Waldemar Rymarkiewicz waldemar.rymarkiew...@tieto.com Besides the stuff Alan mentioned...

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Arnd Bergmann
On Friday 18 March 2011, Mark Brown wrote: On Fri, Mar 18, 2011 at 01:19:53PM +0100, Arnd Bergmann wrote: On Friday 18 March 2011, Waldemar Rymarkiewicz wrote: + + mutex_lock(info-rx_mutex); + info-irq_state = 1; + mutex_unlock(info-rx_mutex); + +

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Waldemar.Rymarkiewicz
...@insidefr.com; matti.j.aalto...@nokia.com Subject: Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip On Fri, 18 Mar 2011 11:40:24 +0100 Waldemar Rymarkiewicz waldemar.rymarkiew...@tieto.com wrote: Add new driver for MicroRead NFC chip connected to i2c bus. Ok we now have two devices and they have

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Arnd Bergmann
On Friday 18 March 2011, waldemar.rymarkiew...@tieto.com wrote: Ermm nope.. why do we have do nothing ioctls ? onfc stack requires those ones, but they are only valid for a specific test enviroment. This should not be a case for driver and the stack should care about it if it needs

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Waldemar.Rymarkiewicz
Wolfram, +unsigned int irq_gpio; +unsigned int ioh_gpio; ... you should request and setup the GPIOs before using them. I assume the board specific code will do so. Waldek-- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Alan Cox
Would it not be lighter to use atomic bit ops ? Do you mean in order to remove rx_mutex? mutex_lock(info-rx_mutex); atomic_set(info-irq_state ,1); mutex_unlock(info-rx_mutex); looks a bit strange. I still need the rx_mutex to protect irq_state while reading i2c.

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Waldemar.Rymarkiewicz
I was thinking clear_bit/test_and_set_bit rather than atomic_t operations. I see, then I will for it. Waldek-- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Mark Brown
On Fri, Mar 18, 2011 at 05:08:39PM +0200, waldemar.rymarkiew...@tieto.com wrote: Wolfram, + unsigned int irq_gpio; + unsigned int ioh_gpio; ... you should request and setup the GPIOs before using them. I assume the board specific code will do so. The usual pattern is that the code

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Randy Dunlap
On Fri, 18 Mar 2011 11:40:24 +0100 Waldemar Rymarkiewicz wrote: Add new driver for MicroRead NFC chip connected to i2c bus. See Documentation/nfc/nfc-microread.txt. Signed-off-by: Waldemar Rymarkiewicz waldemar.rymarkiew...@tieto.com --- Documentation/nfc/nfc-microread.txt | 46

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Waldemar.Rymarkiewicz
Randy, +data to be read. Then, poll() will indicate that fact to the userspace. + +The application can use ioctl(MICROREAD_IOC_RESET)to reset the hardware. _RESET) to reset Thanks, all are now fixed. Waldek -- To unsubscribe from this list:

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-18 Thread Waldemar.Rymarkiewicz
+free_irq: +free_irq(client-irq, info); +free_buf: +kfree(info-buf); +free_info: +kfree(info); + +dev_info(client-dev, Not probed.); +return ret; +} When respinning, you could consider using managed devices (devm_*); this error path could completely go then. Well,

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-17 Thread Waldemar.Rymarkiewicz
Hi Arnd, Note that the microread_is_busy() logic does not protect you from having multiple concurrent readers, because multiple threads may share a single file descriptor. It's just used to ensure that only one reader can open the device. It's called only in open callback. The mutex

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-17 Thread Arnd Bergmann
On Thursday 17 March 2011, waldemar.rymarkiew...@tieto.com wrote: Note that the microread_is_busy() logic does not protect you from having multiple concurrent readers, because multiple threads may share a single file descriptor. It's just used to ensure that only one reader can open

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-17 Thread Waldemar.Rymarkiewicz
Arnd, An application can open the device, and then do a pthread_create() or a fork(). In either case, you have two concurrent threads that have access to the file pointer and can read from it concurrently, which is inherently racy regarding which of the processes gets the data. In that case

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-17 Thread Arnd Bergmann
On Thursday 17 March 2011, waldemar.rymarkiew...@tieto.com wrote: This is not very different from opening the file descriptor in multiple processes, which you prevent using your logic. but in the case when two independent applications try to open my device I can't let the second to access.

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-17 Thread Waldemar.Rymarkiewicz
As I said, it's not important if you do it and it certainly doesn't cause harm to prevent multiple open. It's just that generally we don't care too much about this problem. Ok, I get you. Thanks, Waldek-- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-15 Thread Waldemar.Rymarkiewicz
It sounds strange that this will be handled in user space, since it won't have any idea if the hardware is available again. I've tried to find the onfc stack that talks to this device but couldn't see it. Do you have a URL for this? Here you are http://sourceforge.net/projects/open-nfc/

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-15 Thread Arnd Bergmann
On Tuesday 15 March 2011 09:37:04 waldemar.rymarkiew...@tieto.com wrote: It sounds strange that this will be handled in user space, since it won't have any idea if the hardware is available again. I've tried to find the onfc stack that talks to this device but couldn't see it. Do you have

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-15 Thread Samuel Ortiz
Hi Arnd, Arnd Bergmann arnd@... writes: On Thursday 10 March 2011, Waldemar Rymarkiewicz wrote: Add new driver for MicroRead NFC chip connected to i2c bus. See Documentation/nfc/nfc-microread.txt. The imlpementation looks fairly clean, no objections on that. However, this is the

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-15 Thread Waldemar.Rymarkiewicz
Hi Samuel, The few currently available NFC stacks are all implementing the NFC HCI layer in userspace, on top of a a more or less big HAL. By at least moving the HCI layer down to the kernel, and having userspace talk to it through netlink, we could eventually get rid of those HALs. Is HCI

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-15 Thread Samuel Ortiz
Hi Waldemar, On Tue, Mar 15, 2011 at 02:59:09PM +0200, waldemar.rymarkiew...@tieto.com wrote: Hi Samuel, The few currently available NFC stacks are all implementing the NFC HCI layer in userspace, on top of a a more or less big HAL. By at least moving the HCI layer down to the kernel,

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-14 Thread Waldemar.Rymarkiewicz
Hi Arnd, Oh, I see you simply do ret = i2c_master_send(client, info-buf, len); usleep_range(1000, 1); and assume that the buffer can always be written within a milisecond, so you just slow down output enough to never have to worry about it, right? A nicer solution would be

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-14 Thread Arnd Bergmann
On Monday 14 March 2011, waldemar.rymarkiew...@tieto.com wrote: Oh, I see you simply do ret = i2c_master_send(client, info-buf, len); usleep_range(1000, 1); and assume that the buffer can always be written within a milisecond, so you just slow down output enough to

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-14 Thread Waldemar.Rymarkiewicz
Most serial drivers do this, see drivers/tty/serial for a number of examples, or drivers/serial on older kernels. Thanks, will check it. That would depend on your hardware. The only important part is that you make sure you can send out data at any time. If i2c_master_send() causes accesses to

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-14 Thread Arnd Bergmann
On Monday 14 March 2011, waldemar.rymarkiew...@tieto.com wrote: If the usleep_range is trying to synchronize between the NFC and the I2C chip, you must wait for a notication from the NFC hardware that it's done. No, it's simply there as I have been faceing i2c write error while I do two

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-14 Thread Waldemar.Rymarkiewicz
No, it's simply there as I have been faceing i2c write error while I do two consecutive writes. The second fails now and then. That's seems to be a chip issue. I will try to investigate this issue. Ok. It sounds like a bug in the i2c driver, you should also take a look there. Maybe it has

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-14 Thread Arnd Bergmann
On Monday 14 March 2011, waldemar.rymarkiew...@tieto.com wrote: No, it's simply there as I have been faceing i2c write error while I do two consecutive writes. The second fails now and then. That's seems to be a chip issue. I will try to investigate this issue. Ok. It sounds like a bug

[PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-10 Thread Waldemar Rymarkiewicz
Add new driver for MicroRead NFC chip connected to i2c bus. See Documentation/nfc/nfc-microread.txt. Signed-off-by: Waldemar Rymarkiewicz waldemar.rymarkiew...@tieto.com --- Documentation/nfc/nfc-microread.txt | 46 drivers/nfc/Kconfig | 10 + drivers/nfc/Makefile

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-10 Thread Arnd Bergmann
On Thursday 10 March 2011, Waldemar Rymarkiewicz wrote: Add new driver for MicroRead NFC chip connected to i2c bus. See Documentation/nfc/nfc-microread.txt. The imlpementation looks fairly clean, no objections on that. However, this is the second NFC driver (at least), and that means it's

RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-10 Thread Waldemar.Rymarkiewicz
Hi Arnd, However, this is the second NFC driver (at least), and that means it's time to come up with a generic way of talking to NFC devices from user space. We cannot allow every NFC controller to have another set of arbitrary ioctl numbers. What I suggest you do is to work with the

Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

2011-03-10 Thread Arnd Bergmann
On Thursday 10 March 2011, waldemar.rymarkiew...@tieto.com wrote: What I suggest you do is to work with the maintainers of the existing pn544 driver (Matti and Jari) to create an NFC core library that takes care of the character device interface and that can be shared between the two