[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DG6C66CP0EB4.25ZLDO70LFB7K@kernel.org>
Date: Wed, 04 Feb 2026 17:59:42 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Igor Korotin" <igor.korotin@...ux.dev>
Cc: "Markus Probst" <markus.probst@...teo.de>,
<igor.korotin.linux@...il.com>, "Daniel Almeida"
<daniel.almeida@...labora.com>, "Miguel Ojeda" <ojeda@...nel.org>, "Boqun
Feng" <boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
<lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Alice
Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Wolfram
Sang" <wsa+renesas@...g-engineering.com>, <linux-kernel@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, <linux-i2c@...r.kernel.org>
Subject: Re: [PATCH 4/5] rust: i2c: add I2C wrappers
On Wed Feb 4, 2026 at 5:49 PM CET, Igor Korotin wrote:
> I'm not sure it is appropriate to use IO and register! here. I2C devices
> are different. Not all of them use register like access. For example
> EEPROM I2C devices allow random read/write operations inside their
> address space. After all I2C doesn't implement the same way of accessing
> its memory space as for example PCI devices.
Conceptually, it is not different, it is some device memory connected through
some bus.
Memory mapped I/O allows "random read/write operations" as well, see
memcpy_fromio() and memcpy_toio().
The same thing is true for DMA memory. While it's not owned by the device, it's
still shared with a device.
Gary just started working on a generic IoView<'io, T> type which will serve as a
general abstraction to interact with any kind of memory that is shared between a
device and the CPU [1].
So, for I2C this would mean that if you have register like accesses you can use
the register!() abstractions. If you want random read/write operations, you can
use IoView to copy from / to system memory or even to a user buffer directly.
Of course you can also still use Io::read32() and friends.
[1] https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Generic.20I.2FO.20backends/with/571786051
Powered by blists - more mailing lists