On Tue, 2016-04-12 at 02:58 +0100, Mark Brown wrote: > On Tue, Apr 05, 2016 at 08:48:48PM +0100, Ben Hutchings wrote: > > > We clamp frame_length to a maximum of 4096, but do not limit the > > number of words written or read properly. This causes 4K reads (which > > some m25p80-like flash chips support) to return garbage for the last > > few bytes. > > > Recalculate the length of each transfer, taking the frame length into > > account. Use this length in qspi_{read,write}_msg(), and to increment > > spi_message::actual_length. > > I'm having a hard time understanding what's actually wrong here or how > this change is intended to fix it, "4K reads...return garbage" That's wrong, no? > I think again because I don't know > what frame_length is intended to be. As far as I can tell frame_length > is the number of words we're going to transfer in the entire message Yes. > and the driver has in some places been mixing up words and bytes No, it's been completely ignoring the (potentially truncated) frame_length and using the original transfer lengths for each transfer. > which is > causing the breakage so the intention is to consistently use words > throught the driver. Is that correct? No. I'll add a renaming of variables to make it clearer. Ben. > > - ret = qspi_transfer_msg(qspi, t); > > + wlen = t->bits_per_word >> 3; > > For the benefit of readers: > > wlen = t->bits_per_word / 8. -- Ben Hutchings Software Developer, Codethink Ltd. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html