From: Marc Dietrich <marvin24@gmx.de>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org, linux-sh@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Jean Delvare <jdelvare@suse.de>,
Magnus Damm <magnus.damm@gmail.com>,
Andrey Danin <danindrey@mail.ru>,
devicetree@vger.kernel.org,
Stephen Warren <swarren@wwwdotorg.org>
Subject: Re: [RFC 4/4] ARM: shmobile: r8a7790: adapt DTS for I2C slave support
Date: Fri, 12 Sep 2014 11:06:49 +0200 [thread overview]
Message-ID: <7627175.tG5quZH0VN@fb07-iapwap2> (raw)
In-Reply-To: <20140912083348.GA1289@katana>
[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]
Am Freitag, 12. September 2014, 10:33:48 schrieb Wolfram Sang:
> > > Why do you want DT to be involved at all?
> >
> > Imagine a device which supports both, slave or master mode. The driver
> > needs to know in which mode it should operate. This cannot be hard coded,
> > because on different boards, different modes can be used.
>
> Okay, it sounds weird to me that a device is not able to switch between
> master and slave, but if you say so. Also, solving this issue would also
> handle potential weird IP blocks which can be slave only, right?
I didn't said device. I meant the driver (software) needs to know if which
mode to operate the device. DT has to provide just enough information to
select the right mode depending on the board implementation.
> What if you use two different adapter drivers or compatibles? One for
> master-mode, one for slave-mode (slave could leave algo->master_xfer
> empty, so the slave mode driver cannot send packets). I'm brainstorming
> here, so while it should work IMO I will probably need a second thought.
>
> So, in the DT you would have a block registering the I2C slave core
> which binds to a simple driver providing reg_slave/unreg_slave and
> pass on the slave-event. Then you could instantiate slave clients as
> said before.
>
> Maybe we need a real world example?
ok, take our embedded controller driver (in staging/nvec) as an example. It's
basicly an MFD connecting keyboard, mouse, power, gpio, and some other stuff
to the soc. The MFD operates in master mode while the SOC is the I2C slave.
Theoretically, these roles could also switch (but that's not defined in the
nvec protocol).
So the i2c client driver sits in between the adapter (in slave or master mode)
and the the MFD children (keyboard, mouse, ...) and provides read/write/cb
functions (nvec uses a side channel gpio to be able to initiate writes on its
own) to its children. The MFD children don't care about how the i2c
communication is done, but the client driver needs to decide in which mode it
should talk to the EC. If this is not autodetectable, the mode needs to be
provided by the device tree.
In this case you cannot use separate drivers for master and slave mode (or you
would need another layer to hide the driver multiplexing).
> > The point is, that if we define a dt binding for master device on slave
> > adapters it will be there forever. So even if it makes no sense for the
> > example eeprom simulator (or even our embedded controller), it may make
> > sense for other or future devices.
>
> I don't know what you mean here. Again, an example might help?
I just wanted to say that the discussion here should find a *generic* way to
distinguish slave and master clients on the i2c bus by using a proper DT
binding.
Marc
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2014-09-12 9:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1410274470-12712-1-git-send-email-wsa@the-dreams.de>
[not found] ` <1410274470-12712-5-git-send-email-wsa@the-dreams.de>
2014-09-11 12:17 ` [RFC 4/4] ARM: shmobile: r8a7790: adapt DTS for I2C slave support Marc Dietrich
2014-09-11 14:12 ` Wolfram Sang
2014-09-11 14:40 ` Wolfram Sang
2014-09-11 14:52 ` Marc Dietrich
2014-09-11 14:54 ` Wolfram Sang
2014-09-12 7:51 ` Marc Dietrich
2014-09-12 8:08 ` Geert Uytterhoeven
2014-09-12 8:33 ` Wolfram Sang
2014-09-12 9:06 ` Marc Dietrich [this message]
2014-09-12 9:58 ` Wolfram Sang
2014-09-12 10:10 ` Geert Uytterhoeven
2014-09-12 10:26 ` Wolfram Sang
2014-09-12 11:42 ` Marc Dietrich
2014-09-12 12:15 ` Wolfram Sang
2014-09-11 14:49 ` Marc Dietrich
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=7627175.tG5quZH0VN@fb07-iapwap2 \
--to=marvin24@gmx.de \
--cc=danindrey@mail.ru \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=swarren@wwwdotorg.org \
--cc=wsa@the-dreams.de \
/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