Skip to content

RFC hw: aspeed_adc: Add initial Aspeed ADC support

[email protected] qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1hw: aspeed_adc: Add initial Aspeed ADC supporthw/adc/aspeed_adc.c hw/adc/meson.build hw/adc/trace-events +4 more+298 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] hw: aspeed_adc: Add initial Aspeed ADC support

From: Peter Delevoryas <[email protected]>

Hey everyone,

This patch mostly just does the basic, boilerplate setup for the ADC, so that we can start adding more ADC feature emulation in the future.

The only device behavior that I tried to add was emulating the control initialization sequence and the sequence for enabling "Auto compensating sensing mode". I didn't even use something like a timer to delay the response for each register write by a few cycles, it just immediately updates the register.

I was looking at the Nuvoton ADC model, "hw/adc/npcm7xx_adc.c", and I noticed that it has "enter_reset" and "hold_reset" methods, should I implement the initialization sequence as part of the "Resettable" interface? (It seems like I probably should, I'm just not really sure).

I could also add a timer to emulate the time it takes to initialize the ADC, I see the Nuvoton module also has a constant "NPCM7XX_ADC_RESET_CYCLES" but it's not used anywhere, but I imagine I could do something similar to the conversion timer in that module? I think the upstream drivers poll every 0.5 ms and timeout after 500 ms, so I could use that as a guide.

This patch, even without any conversion emulation, is useful to me because some OpenBMC platforms use Aspeed SDK ADC drivers, and they don't have error handling if the ADC doesn't respond, so they can't boot in QEMU without some basic emulation like this.

Thanks,
Peter

Peter Delevoryas (1):
hw: aspeed_adc: Add initial Aspeed ADC support

 hw/adc/aspeed_adc.c         | 205 ++++++++++++++++++++++++++++++++++++
 hw/adc/meson.build          |   1 +
 hw/adc/trace-events         |   4 +
 hw/arm/aspeed_ast2600.c     |  18 ++++
 hw/arm/aspeed_soc.c         |  17 +++
 include/hw/adc/aspeed_adc.h |  48 +++++++++
 include/hw/arm/aspeed_soc.h |   5 +
 7 files changed, 298 insertions(+)
 create mode 100644 hw/adc/aspeed_adc.c
 create mode 100644 include/hw/adc/aspeed_adc.h
Signature · 1 line
2.30.2