• Christophe Ricard's avatar
    NFC: st21nfca: Improved i2c Rx data correctness check · c97ffdbf
    Christophe Ricard authored
    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: default avatarChristophe Ricard <christophe-h.ricard@st.com>
    Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
    c97ffdbf
i2c.c 16 KB