linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Fitschen <me@jue.yt>
To: Ludovic Desroches <ludovic.desroches@microchip.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/3] i2c: at91: slave mode support
Date: Thu, 9 Nov 2017 18:21:24 +0100	[thread overview]
Message-ID: <cover.1510247114.git.me@jue.yt> (raw)

Based on the discussion we had on the i2c-linux list [1], I wrote a patch for
AT91 hardware and tried to fulfill the Linux I2C slave interface description
[2] as good as possible. This enables aforementioned hardware to act as an I2C
slave that can be accessed by a remote I2C master.


I have tested this patchset successfully on an ATSAMA5D27.

                                 ^  3.3V   ^  3.3V
    +-----------------------+    |         |         +-----------------------+
    | Slave: ATSAMA5D27     |   +-+       +-+        | Master: ATSAMA5D35    |
    | with i2c-slave-eeprom |   | | 100k  | | 100k   | with i2cset           |
    +-------------------+-+-+   +-+       +-+        +-+-+-------------------+
                        | |      |         |           | |
                        | +------+---------|---(SDA)---+ |
                        +------------------+---(SCL)-----+

    Schematic: Connection of slave and master with 100kOhm pullup resistors.

On the master the following BASH script has been used to stress the slave.

    root@emblinux:~# cat ./stress.sh
    #!/bin/bash
    I=0
    while true
    do
            if i2cset -y -r 1 0x64 0 $I w | grep mismatch
            then
                    echo "$(date): Error in transmission ${I}"
            fi
            ((I++))
            if [ $I -eq 65536 ]
            then
                    I=0
                    echo "$(date): Sent 65536 transmissions"
            fi
    done


After running the script for some time I had the following output. To me this
looks promising :)

    root@emblinux:~# ./stress.sh
    Thu Nov  9 13:58:45 CTE 2017: Sent 65536 transmissions
    Thu Nov  9 14:35:20 CTE 2017: Sent 65536 transmissions
    Thu Nov  9 15:12:11 CTE 2017: Sent 65536 transmissions
    Thu Nov  9 15:49:04 CTE 2017: Sent 65536 transmissions
    Thu Nov  9 16:26:00 CTE 2017: Sent 65536 transmissions
    Thu Nov  9 17:03:07 UTC 2017: Sent 65536 transmissions
    Thu Nov  9 17:40:15 UTC 2017: Sent 65536 transmissions

If you have some hardware with an at91-i2c interface included at hand, I really
would appreciate if you can run the test script on your hardware and test this
driver.


Best regards
  Juergen


Changes in v2:
 - Implemented all suggestions made by Ludovic. (Thank you!)
 - Reworked the IRQ handler completely. Have a look in patch 3 fort further
   details.

[1] https://marc.info/?t=150824004800001&r=1&w=1
[2] https://www.kernel.org/doc/Documentation/i2c/slave-interface

Juergen Fitschen (3):
  i2c: at91: segregate master mode specific code from probe and init
    func
  i2c: at91: split driver into core and master file
  i2c: at91: added slave mode support

 Documentation/devicetree/bindings/i2c/i2c-at91.txt |   14 +
 MAINTAINERS                                        |    3 +-
 drivers/i2c/busses/Kconfig                         |   10 +
 drivers/i2c/busses/Makefile                        |    4 +
 drivers/i2c/busses/i2c-at91-core.c                 |  390 ++++++
 drivers/i2c/busses/i2c-at91-master.c               |  806 +++++++++++++
 drivers/i2c/busses/i2c-at91-slave.c                |  216 ++++
 drivers/i2c/busses/i2c-at91.c                      | 1243 --------------------
 drivers/i2c/busses/i2c-at91.h                      |  191 +++
 9 files changed, 1633 insertions(+), 1244 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-at91-core.c
 create mode 100644 drivers/i2c/busses/i2c-at91-master.c
 create mode 100644 drivers/i2c/busses/i2c-at91-slave.c
 delete mode 100644 drivers/i2c/busses/i2c-at91.c
 create mode 100644 drivers/i2c/busses/i2c-at91.h

-- 
2.7.4

             reply	other threads:[~2017-11-09 17:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 17:21 Juergen Fitschen [this message]
2017-11-09 17:21 ` [PATCH v2 1/3] i2c: at91: segregate master mode specific code from probe and init func Juergen Fitschen
2017-11-09 17:22 ` [PATCH v2 2/3] i2c: at91: split driver into core and master file Juergen Fitschen
2017-11-09 17:22 ` [PATCH v2 3/3] i2c: at91: added slave mode support Juergen Fitschen
2017-12-03 18:02   ` Ludovic Desroches
2017-12-11  9:25     ` Juergen Fitschen
2018-06-02 21:35   ` [v2,3/3] " Wolfram Sang
2018-07-09 15:15     ` Ludovic Desroches
2018-07-09 15:51       ` Wolfram Sang
2018-07-10  8:42         ` Ludovic Desroches
2018-07-12 21:48           ` Wolfram Sang
2018-07-12 21:56           ` Wolfram Sang
2018-07-13  6:37             ` Ludovic Desroches

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=cover.1510247114.git.me@jue.yt \
    --to=me@jue.yt \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --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;
as well as URLs for NNTP newsgroup(s).