From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Rayhan Faizel <rayhan.faizel@gmail.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, pbonzini@redhat.com, qemu-arm@nongnu.org
Subject: Re: [PATCH v3 1/3] hw/i2c: Implement Broadcom Serial Controller (BSC)
Date: Fri, 23 Feb 2024 07:15:58 +0100 [thread overview]
Message-ID: <6f947660-b116-4ba3-806d-6fd4a12836f5@linaro.org> (raw)
In-Reply-To: <20240220134120.2961059-2-rayhan.faizel@gmail.com>
On 20/2/24 14:41, Rayhan Faizel wrote:
> A few deficiencies in the current device model need to be noted.
>
> 1. FIFOs are not used. All sends and receives are done directly.
> 2. Repeated starts are not emulated. Repeated starts can be triggered in real
> hardware by sending a new read transfer request in the window time between
> transfer active set of write transfer request and done bit set of the same.
>
> Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
> ---
> docs/system/arm/raspi.rst | 1 +
> hw/i2c/Kconfig | 4 +
> hw/i2c/bcm2835_i2c.c | 278 +++++++++++++++++++++++++++++++++++
> hw/i2c/meson.build | 1 +
> include/hw/i2c/bcm2835_i2c.h | 80 ++++++++++
> 5 files changed, 364 insertions(+)
> create mode 100644 hw/i2c/bcm2835_i2c.c
> create mode 100644 include/hw/i2c/bcm2835_i2c.h
> +static const MemoryRegionOps bcm2835_i2c_ops = {
> + .read = bcm2835_i2c_read,
> + .write = bcm2835_i2c_write,
> + .endianness = DEVICE_NATIVE_ENDIAN,
Watch out, your implementation is 32-bit, so this misses:
.impl = {
.min_access_size = 4,
.max_access_size = 4,
},
> +};
> diff --git a/include/hw/i2c/bcm2835_i2c.h b/include/hw/i2c/bcm2835_i2c.h
> new file mode 100644
> index 0000000000..0a56df4720
> --- /dev/null
> +++ b/include/hw/i2c/bcm2835_i2c.h
> +#define BCM2835_I2C_C 0x0 /* Control */
> +#define BCM2835_I2C_S 0x4 /* Status */
> +#define BCM2835_I2C_DLEN 0x8 /* Data Length */
> +#define BCM2835_I2C_A 0xc /* Slave Address */
> +#define BCM2835_I2C_FIFO 0x10 /* FIFO */
> +#define BCM2835_I2C_DIV 0x14 /* Clock Divider */
> +#define BCM2835_I2C_DEL 0x18 /* Data Delay */
> +#define BCM2835_I2C_CLKT 0x20 /* Clock Stretch Timeout */
next prev parent reply other threads:[~2024-02-23 6:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 13:41 [PATCH v3 0/3] Add support for I2C in BCM2835 boards Rayhan Faizel
2024-02-20 13:41 ` [PATCH v3 1/3] hw/i2c: Implement Broadcom Serial Controller (BSC) Rayhan Faizel
2024-02-23 6:12 ` Philippe Mathieu-Daudé
2024-02-23 6:15 ` Philippe Mathieu-Daudé [this message]
2024-02-23 10:05 ` Peter Maydell
2024-02-20 13:41 ` [PATCH v3 2/3] hw/arm: Connect BSC to BCM2835 board as I2C0, I2C1 and I2C2 Rayhan Faizel
2024-02-23 6:20 ` Philippe Mathieu-Daudé
2024-02-20 13:41 ` [PATCH v3 3/3] tests/qtest: Add testcase for BCM2835 BSC Rayhan Faizel
2024-02-23 10:06 ` Peter Maydell
2024-02-22 17:54 ` [PATCH v3 0/3] Add support for I2C in BCM2835 boards Peter Maydell
2024-02-23 6:23 ` Philippe Mathieu-Daudé
2024-02-23 10:04 ` Peter Maydell
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=6f947660-b116-4ba3-806d-6fd4a12836f5@linaro.org \
--to=philmd@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rayhan.faizel@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 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).