arch/arm/ameba: add shared I2C master driver (RTL8721Dx + RTL8721F) - #19780
Open
dcgong2917 wants to merge 2 commits into
Open
arch/arm/ameba: add shared I2C master driver (RTL8721Dx + RTL8721F)#19780dcgong2917 wants to merge 2 commits into
dcgong2917 wants to merge 2 commits into
Conversation
Add a shared NuttX I2C master lower-half for the Realtek Ameba I2C controllers (I2C0/I2C1) in arch/arm/src/common/ameba, driven through the SDK fwlib in polling mode. Per-chip wiring (controller count, register bases, clock masks, crossbar pad-mux codes and the fwlib I2C_InitTypeDef layout) lives in arch/arm/src/rtl8721dx/ameba_i2c_chip.h so a port to the other Ameba chips only supplies a same-named header. Each controller registers as /dev/i2cN from pke8721daf bring-up through the stock I2C character driver; a dedicated `i2c` defconfig drives the i2ctool for validation. Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: dechao_gong <dechao_gong@realsil.com.cn>
Wire the shared Ameba I2C master lower-half (arch/arm/src/common/ ameba/ameba_i2c.c) into the RTL8721F (amebagreen2) build through a per-chip header (ameba_i2c_chip.h), and register the RTL8721F EVB buses at /dev/i2cN. Per-chip differences from the other Ameba SoCs (non-secure register bases, crossbar pinmux codes, APB clock masks and the fwlib I2C_InitTypeDef layout) are isolated in ameba_i2c_chip.h; no change to the shared driver is needed. Verified end-to-end on hardware against a second Ameba board acting as an I2C slave: address ACK, register write and read-back over repeated-START, and bus scan all pass on I2C0 (PA22/PA23). Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: dechao_gong <dechao_gong@realsil.com.cn>
dcgong2917
requested review from
davids5,
jerpelea and
johannes-nivus
as code owners
August 11, 2026 01:59
xiaoxiang781216
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a shared NuttX I2C master lower-half for the Realtek Ameba I2C
controllers (I2C0/I2C1) under arch/arm/src/common/ameba, driven through
the SDK fwlib DesignWare block in polling mode. Per-chip wiring
(controller count, non-secure register bases, APB clock masks, crossbar
pad-mux codes and the fwlib I2C_InitTypeDef layout) is isolated in a
per-chip ameba_i2c_chip.h, so each SoC only supplies a same-named header.
Two commits:
driver + RTL8721Dx chip header + pke8721daf board glue +
i2cdefconfig.driver into the RTL8721F (amebagreen2) build via its chip header + EVB
board glue +
i2cdefconfig (no change to the shared driver).Each controller registers at /dev/i2cN and is exercised with the
system/i2c i2ctool.
Impact
New optional feature (CONFIG_AMEBA_I2C, default n); no impact when
disabled. Touches only arch/arm/src/common/ameba, arch/arm/src/rtl8721dx,
arch/arm/src/rtl8721f, their boards, and one nxstyle whitelist entry.
Testing
Verified end-to-end on RTL8721F EVB hardware against a second Ameba board
acting as an I2C slave: 7-bit address ACK, register write and read-back
over repeated-START, and full bus scan all pass on I2C0 (PA22/PA23).
Also validated on RTL8721Dx (pke8721daf): SS/FS 100k/400k, 8/16-bit
register access, both I2C0 and I2C1. checkpatch (
tools/checkpatch.sh -g)passes clean on both commits.