From: Juergen Fitschen <me@jue.yt>
To: linux-i2c@vger.kernel.org
Subject: I2C slave mode for i2c-at91 driver
Date: Tue, 17 Oct 2017 12:56:24 +0200 [thread overview]
Message-ID: <97ba9ab73b527ac882e7d591b42ae621@jfitschen.de> (raw)
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
next reply other threads:[~2017-10-17 11:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 10:56 Juergen Fitschen [this message]
2017-10-18 7:31 ` I2C slave mode for i2c-at91 driver 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=97ba9ab73b527ac882e7d591b42ae621@jfitschen.de \
--to=me@jue.yt \
--cc=linux-i2c@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).