Date: Wed, 20 Feb 2013 07:15:47 -0700 From: Warner Losh <imp@bsdimp.com> To: Aleksandr Rybalko <ray@freebsd.org> Cc: freebsd-arm@freebsd.org, freebsd-mips@freebsd.org Subject: Re: SPI, _sz fields in struct spi_command Message-ID: <54C08D8E-4C5F-49AF-BEE6-D78EC05D2A24@bsdimp.com> In-Reply-To: <20130220142140.f8e5a616c75d72e2519dbc69@freebsd.org> References: <20130220142140.f8e5a616c75d72e2519dbc69@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 20, 2013, at 5:21 AM, Aleksandr Rybalko wrote: > Hello ARM and MIPS hackers! >=20 > Sorry for cross-post, but we have supported SPI devices on both > platforms (and seems no others). >=20 > Anyone know any reasons to keep both TX and RX _sz fields with same > values? I wrote them to be separate for a reason.... I think I'd thought = there'd be cases when you'd want to throw away the results or transmit = garbage... I can't think of why right now... > sys/dev/flash/at45d.c > static int > at45d_get_mfg_info(device_t dev, uint8_t *resp) > { > ... > cmd.tx_cmd_sz =3D cmd.rx_cmd_sz =3D 5; > ... > } >=20 > or sys/dev/flash/mx25l.c > static int > mx25l_read(device_t dev, off_t offset, caddr_t data, off_t count) > { > ... > cmd.tx_cmd_sz =3D 5; > cmd.rx_cmd_sz =3D 5; > ... > } >=20 > That always require second but unused buffer or writable tx buffer. = And > not all controllers able to TX with RX same time. (at least rt305x > can't). So if nobody have any objections, I will update drivers (SPI > controllers and SPI attached devices) to set unused _sz field to zero. > IIRC, I will require help with AT91 controller update, at least with > testing. The AT91, I think, required a minimum size, which is why the at45d = driver set it I think.. I can't imagine an SPI controller that can't do both, because when you = write something with SPI, you usually have to read back the status at = the same time... Warner > Thanks. >=20 > WBW > --=20 > Aleksandr Rybalko <ray@freebsd.org> > _______________________________________________ > freebsd-mips@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mips > To unsubscribe, send any mail to = "freebsd-mips-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54C08D8E-4C5F-49AF-BEE6-D78EC05D2A24>