On Fri, Feb 7, 2020 at 9:28 PM Eddie James <eajames@xxxxxxxxxxxxxxxxxx> wrote:
On 2/5/20 9:51 AM, Andy Shevchenko wrote:...
On Tue, Feb 4, 2020 at 6:06 PM Eddie James <eajames@xxxxxxxxxxxxx> wrote:
On 2/4/20 5:02 AM, Andy Shevchenko wrote:
On Mon, Feb 3, 2020 at 10:33 PM Eddie James <eajames@xxxxxxxxxxxxxxxxxx> wrote:
On 1/30/20 10:37 AM, Andy Shevchenko wrote:
Yes, I missed correction of the start address in memcpy(). OtherwiseFor me it looks likeThe shift-in is not the same as any byte-swap or unaligned operation.Why not to call put_unaligned() how the tail in this case (it's 0 orNo, these are shift in/out operations. The read register will also have+ for (i = 0; i < num_bytes; ++i)Redundant & 0xffULL part.
+ rx[i] = (u8)((in >> (8 * ((num_bytes - 1) - i))) & 0xffULL);
Isn't it NIH of get_unalinged_be64 / le64 or something similar?
previous operations data in them and must be extracted with only the
correct number of bytes.
can be easily made to be 0) will affect the result?
For however many bytes we've read, we start at that many bytes
left-shifted in the register and copy out to our buffer, moving right
for each next byte... I don't think there is an existing function for
this operation.
u8 tmp[8];
put_unaligned_be64(in, tmp);
memcpy(rx, tmp, num_bytes);
put_unaligned*() is just a method to unroll the value to the u8 buffer.
See, for example, linux/unaligned/be_byteshift.h implementation.
Unforunately it is not the same. put_unaligned_be64 will take the
highest 8 bits (0xff00000000000000) and move it into tmp[0]. Then
0x00ff000000000000 into tmp[1], etc. This is only correct for this
driver IF my transfer is 8 bytes. If, for example, I transfer 5 bytes,
then I need 0x000000ff00000000 into tmp[0], 0x00000000ff000000 into
tmp[1], etc. So I think my current implementation is correct.
it's still the same what I was talking about.
Ditto.I don't understand how this could work for transfers of less than 8Ditto.+ return num_bytes;Ditto as for above function. (put_unaligned ...)
+}
+static int fsi_spi_data_out(u64 *out, const u8 *tx, int len)
+{
bytes, any put_unaligned would access memory that it doesn't own.
+}