linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* I2C slave mode for i2c-at91 driver
@ 2017-10-17 10:56 Juergen Fitschen
  2017-10-18  7:31 ` Uwe Kleine-König
  2017-10-18  7:37 ` Wolfram Sang
  0 siblings, 2 replies; 7+ messages in thread
From: Juergen Fitschen @ 2017-10-17 10:56 UTC (permalink / raw)
  To: linux-i2c

Hello,


Currently I'm working on a driver adding I2C slave support to some 
Atmel / Microchip MPUs. I already patched the i2c-at91.c and made the 
i2c-slave-eeprom backend working on an ATSAMA5D27. But this is still in 
the prototype status. My next steps are cleaning up the code and sharing 
the patch with you for review and merge into Linux.

But before I do so, I would like to hear your thoughts on some design 
decisions I'm going to make to fulfill the Linux I2C slave interface 
description [1] as good as possible:

1) According to [1] the return value of the I2C_SLAVE_WRITE_RECEIVED 
event determines whether the received byte shall be ACKed or NACKed. The 
problem with the Atmel hardware is that it is not possible to manipulate 
the ACK bit of the current byte in flight; it will be ACKed 
automatically. It is only possible to (N)ACK the following byte(s) since 
some FIFO magic is going on inside the hardware.
Do you think it is a valid approach to ignore the return value and 
always ACK received bytes? Or would you rather set the behaviour for the 
following bytes? That would delay the desired ACK bit by at least one 
byte.

2) The Atmel hardware does not support master and slave concurrently. 
The data sheet [2] examples disable master mode before entering the 
slave mode. (cf. p. 1362) Furthermore send and receive registers and 
their FIFOs are shared.
How would you implement blocking master transactions while slave mode 
is enabled? I would return EBUSY if master_xfer is called.


Best regards,
  Juergen Fitschen


[1] https://www.kernel.org/doc/Documentation/i2c/slave-interface
[2] http://ww1.microchip.com/downloads/en/DeviceDoc/DS60001476B.pdf

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-18 13:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 10:56 I2C slave mode for i2c-at91 driver Juergen Fitschen
2017-10-18  7:31 ` Uwe Kleine-König
2017-10-18  7:43   ` Wolfram Sang
2017-10-18  8:00     ` Uwe Kleine-König
2017-10-18 12:40   ` Juergen Fitschen
2017-10-18  7:37 ` Wolfram Sang
2017-10-18 12:32   ` Juergen Fitschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).