From: Jonathan Cameron via <qemu-arm@nongnu.org>
To: <AlanoSong@163.com>
Cc: <qemu-devel@nongnu.org>, <qemu-arm@nongnu.org>,
<cminyard@mvista.com>, <peter.maydell@linaro.org>,
<philmd@linaro.org>, <ani@anisinha.ca>, <pbonzini@redhat.com>,
<shannon.zhaosl@gmail.com>
Subject: Re: [PATCH 1/2] hw/i2c/dw: Add DesignWare I2C controller emulator
Date: Tue, 6 Jan 2026 15:52:18 +0000 [thread overview]
Message-ID: <20260106155218.0000310f@huawei.com> (raw)
In-Reply-To: <20260106131253.16192-2-AlanoSong@163.com>
On Tue, 6 Jan 2026 21:12:52 +0800
AlanoSong@163.com wrote:
> Add DesignWare I2C controller according to DesignWare
> I2C databook v2.01a.
> Confirmed the model with i2c-tools under v6.18
> linux driver.
>
> The slave mode is not implemented, cause this feature
> is usually not used.
>
> The 10 bit slave address is not implemented, cause
> this feature is usually not used, and not supported
> by qemu I2C core bus currently.
>
> Signed-off-by: Alano Song <AlanoSong@163.com>
Hi Alano,
A very superficial review. Sadly I don't have time to dig
much deeper at the moment.
Good to see this support.
Jonathan
> diff --git a/hw/i2c/dw_i2c.c b/hw/i2c/dw_i2c.c
> new file mode 100644
> index 0000000000..a5a31ec78c
> --- /dev/null
> +++ b/hw/i2c/dw_i2c.c
> @@ -0,0 +1,517 @@
> +/*
> + * DesignWare I2C Bus Serial Interface Emulation
> + *
> + * Copyright (C) 2026 Alano Song <AlanoSong@163.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> + * for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + *
> + */
As below. Can probably replace the boilerplate with an SPDX license
line and just have the copyright + intro text here.
> diff --git a/include/hw/i2c/dw_i2c.h b/include/hw/i2c/dw_i2c.h
> new file mode 100644
> index 0000000000..512c749f21
> --- /dev/null
> +++ b/include/hw/i2c/dw_i2c.h
> @@ -0,0 +1,151 @@
> +/*
> + * DesignWare I2C Bus Serial Interface Emulation
> + *
> + * Copyright (C) 2026 Alano Song <AlanoSong@163.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> + * for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
For new code in QEMU I think we are fine with just SPDX. See many examples
in tree. It saves on repeating this boilerplate.
> + *
> + */
> +
> +#ifndef DW_I2C_H
> +#define DW_I2C_H
> +
> +#include "hw/core/sysbus.h"
> +#include "qom/object.h"
> +#include "qemu/fifo8.h"
> +
> +#define TYPE_DW_I2C "dw.i2c"
> +OBJECT_DECLARE_SIMPLE_TYPE(DWI2CState, DW_I2C)
> +
> +#define DW_I2C_TX_FIFO_DEPTH 16
> +#define DW_I2C_RX_FIFO_DEPTH 16
> +
> +#define DW_IC_CON_MASTER BIT(0)
> +#define DW_IC_CON_SPEED_STANDARD (0x1 << 1)
> +#define DW_IC_CON_SPEED_FAST (0x2 << 1)
> +#define DW_IC_CON_SPEED_HIGH (0x3 << 1)
Smells of value being written to a field rather than
a series of values with meaning on their own. Qemu
has a rich set of register field macros. I'd look
at using those to make your life easier.
> +#define DW_IC_CON_RESTART_EN BIT(5)
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: <AlanoSong@163.com>
Cc: <qemu-devel@nongnu.org>, <qemu-arm@nongnu.org>,
<cminyard@mvista.com>, <peter.maydell@linaro.org>,
<philmd@linaro.org>, <ani@anisinha.ca>, <pbonzini@redhat.com>,
<shannon.zhaosl@gmail.com>
Subject: Re: [PATCH 1/2] hw/i2c/dw: Add DesignWare I2C controller emulator
Date: Tue, 6 Jan 2026 15:52:18 +0000 [thread overview]
Message-ID: <20260106155218.0000310f@huawei.com> (raw)
In-Reply-To: <20260106131253.16192-2-AlanoSong@163.com>
On Tue, 6 Jan 2026 21:12:52 +0800
AlanoSong@163.com wrote:
> Add DesignWare I2C controller according to DesignWare
> I2C databook v2.01a.
> Confirmed the model with i2c-tools under v6.18
> linux driver.
>
> The slave mode is not implemented, cause this feature
> is usually not used.
>
> The 10 bit slave address is not implemented, cause
> this feature is usually not used, and not supported
> by qemu I2C core bus currently.
>
> Signed-off-by: Alano Song <AlanoSong@163.com>
Hi Alano,
A very superficial review. Sadly I don't have time to dig
much deeper at the moment.
Good to see this support.
Jonathan
> diff --git a/hw/i2c/dw_i2c.c b/hw/i2c/dw_i2c.c
> new file mode 100644
> index 0000000000..a5a31ec78c
> --- /dev/null
> +++ b/hw/i2c/dw_i2c.c
> @@ -0,0 +1,517 @@
> +/*
> + * DesignWare I2C Bus Serial Interface Emulation
> + *
> + * Copyright (C) 2026 Alano Song <AlanoSong@163.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> + * for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + *
> + */
As below. Can probably replace the boilerplate with an SPDX license
line and just have the copyright + intro text here.
> diff --git a/include/hw/i2c/dw_i2c.h b/include/hw/i2c/dw_i2c.h
> new file mode 100644
> index 0000000000..512c749f21
> --- /dev/null
> +++ b/include/hw/i2c/dw_i2c.h
> @@ -0,0 +1,151 @@
> +/*
> + * DesignWare I2C Bus Serial Interface Emulation
> + *
> + * Copyright (C) 2026 Alano Song <AlanoSong@163.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> + * for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
For new code in QEMU I think we are fine with just SPDX. See many examples
in tree. It saves on repeating this boilerplate.
> + *
> + */
> +
> +#ifndef DW_I2C_H
> +#define DW_I2C_H
> +
> +#include "hw/core/sysbus.h"
> +#include "qom/object.h"
> +#include "qemu/fifo8.h"
> +
> +#define TYPE_DW_I2C "dw.i2c"
> +OBJECT_DECLARE_SIMPLE_TYPE(DWI2CState, DW_I2C)
> +
> +#define DW_I2C_TX_FIFO_DEPTH 16
> +#define DW_I2C_RX_FIFO_DEPTH 16
> +
> +#define DW_IC_CON_MASTER BIT(0)
> +#define DW_IC_CON_SPEED_STANDARD (0x1 << 1)
> +#define DW_IC_CON_SPEED_FAST (0x2 << 1)
> +#define DW_IC_CON_SPEED_HIGH (0x3 << 1)
Smells of value being written to a field rather than
a series of values with meaning on their own. Qemu
has a rich set of register field macros. I'd look
at using those to make your life easier.
> +#define DW_IC_CON_RESTART_EN BIT(5)
next prev parent reply other threads:[~2026-01-06 15:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 13:12 [PATCH 0/2] hw/i2c/dw: Add DesignWare I2C controller emulator AlanoSong
2026-01-06 13:12 ` [PATCH 1/2] " AlanoSong
2026-01-06 15:52 ` Jonathan Cameron via [this message]
2026-01-06 15:52 ` Jonathan Cameron via
2026-01-07 1:50 ` Alano Song
2026-01-06 13:12 ` [PATCH 2/2] hw/arm/virt: Add DesignWare I2C controller AlanoSong
2026-01-06 15:45 ` Jonathan Cameron via
2026-01-06 15:45 ` Jonathan Cameron via
2026-01-07 7:07 ` Alano Song
2026-01-07 9:47 ` Jonathan Cameron via
2026-01-07 9:47 ` Jonathan Cameron via
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=20260106155218.0000310f@huawei.com \
--to=qemu-arm@nongnu.org \
--cc=AlanoSong@163.com \
--cc=ani@anisinha.ca \
--cc=cminyard@mvista.com \
--cc=jonathan.cameron@huawei.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhaosl@gmail.com \
/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.