]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
NFC: st21nfca: Improved i2c Rx data correctness check
authorChristophe Ricard <christophe.ricard@gmail.com>
Thu, 24 Apr 2014 21:19:33 +0000 (23:19 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 4 May 2014 23:00:34 +0000 (01:00 +0200)
commitc97ffdbf51ec3f944e6661ecb16985d47c8073c7
tree268023b014a7f74f84776729a3a28fb26848ea4f
parente1fb97b9256f383ed9553a1fc0b1576dfc88d582
NFC: st21nfca: Improved i2c Rx data correctness check

A frame starts with ST21NFCA_SOF_EOF(0x7e) + 0x00.
A frame ends with ST21NFCA_SOF_EOF(0x7e).
It is possible that the i2c macrocell is stopped for other
communication interfaces with highest priority(RF or SWP).
This can be seen with some 0xFF data at the end of a received shdlc buffer.
If this happen we need to discard the frame because the CLF will repeat it.

In order to push accurate data to hci layer, we add the following fix:
- Instead of looking for the first 0x7e in the frame, check that the last
received byte is 0x7e.
- Check that the first frame reception block start with start of
frame(0x7e 0x00). If not, clear the buffer.
- Check that the next frame reception block do not start with start of
frame(0x7e). If so, clear the buffer.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/st21nfca/i2c.c