RE: [EXTERNAL] Re: [PATCH v9 4/9] spi: cadence: Add Marvell SDMA operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark
> 
> > +static void m_ioreadq(void __iomem  *addr, void *buf, int len) {
> > +	u64 tmp_buf;
> > +
> > +	while (len) {
> > +		tmp_buf = readq(addr);
> > +		memcpy(buf, &tmp_buf, len > 8 ? 8 : len);
> > +		len = len > 8 ? len - 8 : 0;
> > +		buf += 8;
> > +	}
> > +}
> 
> Wouldn't it be more efficient and readable to only do the memcpy() for the
> trailing bytes and just do this memcpy() for the final word?

The whole problem is with SDMA end - addr in that case. If code will try to
Read it in non 64b mode, all remaining bits, will be lost.
For example - doing 1B read on that register, will return 1B, but SDMA will
transfer 8B, dropping remaining 7B.
I have tried memcpy approach, and it was not stable.

Regards
Witek 





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux