Skip to content

Acacia I2C, Serial and Timer + new Python tooling#751

Draft
omeh-a wants to merge 6 commits into
mainfrom
sdfgenpy
Draft

Acacia I2C, Serial and Timer + new Python tooling#751
omeh-a wants to merge 6 commits into
mainfrom
sdfgenpy

Conversation

@omeh-a

@omeh-a omeh-a commented Jul 8, 2026

Copy link
Copy Markdown
Member

This PR introduces Acacia to the sDDF and reworks all of our meta tooling around it.

  • Instead of storing our sDDF driver generation code in sdf_gen, we now store it locally in ./acacia_sddf/driver_class.py. Common logic is in ./acacia_sddf/sddf.py
  • tools/meta is removed and remaining Python like board.py is moved to ./acacia_sddf. This is to allow all of the Python in the sDDF to sit in one module that can be imported all in one blast. I moved acacia_sddf to the root of the repository to reflect its significance, as this code is in fact critical to assemble anything in the sDDF (as opposed to being a "two generic subdirectories deep tool")
  • board.py has been changed to get rid of some indirection, we now store compatible strings there for sanity.
  • All config.jsons are redundant and replaced with new functionality in driver_manifest.py. This file offers an API to let this same information be stored globally, and I intend for this to be used by each driver_class.py ... e.g. in i2c.py
# meson
add_driver_config(
    "meson",
    sDDFDriverConfig(
        compatible="amlogic,meson-axg-i2c",
        regions=[DTSRegion("regs", "rw", 4096, 0)],
        irqs=[DTSIRQ(0), DTSIRQ(1)],
    ),
)

# opentitan
add_driver_config(
    "opentitan",
    sDDFDriverConfig(
        compatible="eth,i2c",
        regions=[DTSRegion("regs", "rw", 4096, 0)],
        irqs=[DTSIRQ(4), DTSIRQ(0), DTSIRQ(1), DTSIRQ(7), DTSIRQ(9)],
    ),
)

... i.e. we store the old config.json in i2c.py.

There's not too much to see otherwise besides the new Acacia subsystem generation in i2c.py, serial.py and timer.py. Please let me know what you think about these.

I am leaving this PR as a draft until we have merged Acacia, just in case API changes occur.

I've implemented these three classes as an exemplar for Acacia usage in advance of porting the other classes by others. These three are also mutually dependent and it isn't possible to do i2c without the other two.

omeh-a added 3 commits July 3, 2026 09:20
Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>

Timer tests out with acacia

Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>

Serial tests out with Acacia

Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>

Refactor: acacia_sddf is now a python module that inherits all subfiles, sDDF itself is a python module for import! Needed for SDK

Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>

Fix issues with i2c.py - maps were swapped.

Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>

Further fixes to keep up with Acacia PR request changes

Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>
Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>
Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>
@omeh-a omeh-a added drivers Issues pertaining to driver code for a device class driver-examples Issues related to examples for drivers for a target serial timer i2c labels Jul 8, 2026
Comment thread acacia_sddf/board.py
blk: Optional[DriverDouble] = DriverDouble(None, None)
partition: int = 0
baud_rate: Optional[int] = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work when you have multiple ethernet devices (of the same or different kinds) in the same board? I think these should be lists of DriverDouble

Comment thread acacia_sddf/board.py

# Keep this list in alphabetical order by board name
# TODO: convert to Dictionary
BOARDS: List[Board] = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would prefer splitting these out one per supported board, then just importing the one you want.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I know the old sdfgen tooling did it this way)

Comment thread acacia_sddf/board.py
paddr_top=0xEC000000,
serial=DriverDouble("snps,dw-apb-uart", "serial@fe660000"),
timer=DriverDouble("rockchip,rk3568-timer", "rktimer@fe5f0000"),
ethernet=DriverDouble("", "ethernet@fe2a0000"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one has two ethernet ports

Comment thread acacia_sddf/board.py
arch=aarch64,
paddr_top=0x80000000,
timer=DriverDouble("cdns,ttc", "axi/timer@ff140000"),
serial=DriverDouble("xlnx,zynqmp-uart", "axi/serial@ff000000"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ethernet?

Comment thread acacia_sddf/i2c.py
from .sddf import sDDFDriverClass, DeviceResourcesFactory, RegionResourceFactory
from collections import defaultdict
from typing import List, Dict, Type, Union, Optional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rearrange imports to put standard ones first

Comment thread acacia_sddf/sddf.py
raise RuntimeError(
f"Multiple MRs with paddr={d_paddr}! -> {existing_mr}"
)
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of else after a raise

Comment thread acacia_sddf/timer.py


# pulp
add_driver_config(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon these should be in per-driver files imported rather than enumerated here. So that the tooling can be used with third-party drivers without changing this file.


SUPPORTED_BOARDS := \
odroidc4 \
maaxboard \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate change, different PR

Comment thread examples/serial/meta.py
board = next(filter(lambda b: b.name == args.board, BOARDS))
if board.arch != x86_64:
dtb = DeviceTreeBlob(args.dtb)
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative would be to fudge up a DTS for the X86 systems we use. Linux X86 can use a DTB as an additional source of information (mainly to get the PCI and IOAPIC info)

Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>
omeh-a added 2 commits July 13, 2026 10:09
Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>
Signed-off-by: Lesley Rossouw <lesley.rossouw@unsw.edu.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

driver-examples Issues related to examples for drivers for a target drivers Issues pertaining to driver code for a device class i2c serial timer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants