spigen problem

Emmanuel Vadot manu at bidouilliste.com
Mon Apr 29 18:24:00 UTC 2019


On Mon, 29 Apr 2019 12:13:41 -0600
Ian Lepore <ian at freebsd.org> wrote:

> On Mon, 2019-04-29 at 19:57 +0200, Emmanuel Vadot wrote:
> > On Mon, 29 Apr 2019 11:34:34 -0600
> > Ian Lepore <ian at freebsd.org> wrote:
> > 
> > > On Tue, 2019-04-30 at 02:18 +0900, Mori Hiroki wrote:
> > > > Hi
> > > > 
> > > > I add small spi lcd on RT3050. This lcd controller is S6D0151.
> > > > 
> > > > S6D0151 transfer is tree byte command then tree byte data.
> > > > 
> > > > I use spigen mruby rapper. This rapper use SPIGENIOC_TRANSFER.
> > > > 
> > > > I try to send tree byte command. But spi transfer is six byte.
> > > > 
> > > > This is reason.
> > > > 
> > > > sys/dev/spibus/spigen.c
> > > > 
> > > >         error = copyin(st->st_command.iov_base, transfer.tx_cmd,
> > > >            transfer.tx_cmd_sz = transfer.rx_cmd_sz = st-
> > > > > st_command.iov_len);  
> > > > 
> > > > 
> > > > This lcd not work six byte transfer.
> > > > 
> > > > How do I fix this ?
> > > > 
> > > > Regards
> > > > 
> > > > Hiroki Mori
> > > > 
> > > 
> > > I'm not sure what you mean by "This is the reason", that code sets
> > > up
> > > the transfer for exactly as many bytes as you requested in
> > > st_command.iov_len.  If you set that to three bytes, only three
> > > bytes
> > > will be transfered.
> > > 
> > > -- Ian
> > 
> >  I guess that Mori-San wants to transfer 3 bytes but receive 6, if
> > it's
> > that you need to set tx_cmd_sz with dummy bytes count too. The tx
> > buffer will also need to contain the dummy bytes values.
> > 
> 
> If you mean send 3 command bytes and read back 3 response bytes, then
> set st_command.iov_len to 3 and st_data.iov_len to 3.
> 
> -- Ian

 Ah right, forgot about command/data being splitted.

-- 
Emmanuel Vadot <manu at bidouilliste.com> <manu at freebsd.org>


More information about the freebsd-mips mailing list