From: Igor Mitsyanko <i.mitsyanko@samsung.com>
To: qemu-devel@nongnu.org
Cc: kyungmin.park@samsung.com, m.kozlov@samsung.com,
e.voevodin@samsung.com, d.solodkiy@samsung.com
Subject: Re: [Qemu-devel] [PATCH 3/5] exynos4210: add Exynos4210 i2c implementation
Date: Wed, 07 Mar 2012 11:49:40 +0400 [thread overview]
Message-ID: <4F571314.70000@samsung.com> (raw)
In-Reply-To: <CAFEAcA_BBAZ_-G0Q+nh=nqs6_7mTPVU-4UOMeShbqn_ZOkuDAQ@mail.gmail.com>
On 03/06/2012 10:49 PM, Peter Maydell wrote:
> On 2 March 2012 11:35, Igor Mitsyanko<i.mitsyanko@samsung.com> wrote:
>> Create 9 exynos4210 i2c interfaces.
>>
>> Signed-off-by: Igor Mitsyanko<i.mitsyanko@samsung.com>
>
>> +#define EXYNOS4_I2C(obj) \
>> +OBJECT_CHECK(Exynos4210I2CState, (obj), TYPE_EXYNOS4_I2C)
>> +#define EXYNOS4_I2C_SLAVE(obj) \
>> +OBJECT_CHECK(Exynos4210I2CSlave, (obj), TYPE_EXYNOS4_I2C_SLAVE)
>
> Can you indent the second and subsequent lines of multi-line
> macro definitions, please?
OK
>> +enum {
>> + idle,
>> + start_bit_received,
>> + sending_data,
>> + receiving_data
>> +};
>> +
>> +struct Exynos4210I2CSlave {
>> + I2CSlave i2c;
>> + Exynos4210I2CState *host;
>> + uint32_t status;
>> +};
>
> I'm confused about the purpose of this class. My (possibly naive)
> model of i2c is that there's a controller (in this case TYPE_EXYNOS4_I2C
> , with its state in the struct Exynos4210I2CState) which is a subclass
> of SysBus or whatever, and then there are i2c slaves, which are
> subclasses of TYPE_I2C_SLAVE and communicate with the controller
> strictly via the methods provided by the I2C_SLAVE class. But
> this seems to be an I2CSlave subclass which has a direct pointer to
> the internal state of the controller and very little state of its own.
> What's it for?
>
The reasoning behind this is that Exynos i2c controller can operate as
i2c master or i2c slave (not simultaneously), so it must be a
SysBusDevice and I2CSlave at the same time. There shouldn't be any
communications of controller and some abstract I2C_SLAVE because
controller is in fact I2C_SLAVE by itself, internal state of
TYPE_EXYNOS4_I2C and TYPE_EXYNOS4_I2C_SLAVE is the same set of registers
(hence the pointer).
I took this approach from pxa2xx i2c implementation.
>> +static const VMStateDescription exynos4210_i2c_vmstate = {
>> + .name = TYPE_EXYNOS4_I2C,
>> + .version_id = 1,
>> + .minimum_version_id = 1,
>> + .fields = (VMStateField[]) {
>
> Why the big space?
>
I don't know :)
--
Mitsyanko Igor
ASWG, Moscow R&D center, Samsung Electronics
email: i.mitsyanko@samsung.com
next prev parent reply other threads:[~2012-03-07 7:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-02 11:35 [Qemu-devel] [PATCH 0/5] Exynos: i2c, gpio and touchscreen support for NURI board Igor Mitsyanko
2012-03-02 11:35 ` [Qemu-devel] [PATCH 1/5] qom: if @instance_size==0, assign size of object to parent object size Igor Mitsyanko
2012-03-02 11:35 ` [Qemu-devel] [PATCH 2/5] qom/object.c: rename type_class_init() to type_initialize() Igor Mitsyanko
2012-03-06 18:52 ` Peter Maydell
2012-03-02 11:35 ` [Qemu-devel] [PATCH 3/5] exynos4210: add Exynos4210 i2c implementation Igor Mitsyanko
2012-03-06 18:49 ` Peter Maydell
2012-03-07 7:49 ` Igor Mitsyanko [this message]
2012-03-02 11:35 ` [Qemu-devel] [PATCH 4/5] exynos4210: add exynos4210 GPIO implementation Igor Mitsyanko
2012-03-02 11:35 ` [Qemu-devel] [PATCH 5/5] hw: add Atmel maxtouch touchscreen implementation Igor Mitsyanko
2012-03-02 14:19 ` Andreas Färber
2012-03-02 14:43 ` Igor Mitsyanko
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=4F571314.70000@samsung.com \
--to=i.mitsyanko@samsung.com \
--cc=d.solodkiy@samsung.com \
--cc=e.voevodin@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=m.kozlov@samsung.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.