Hi Pirmin,
On Tue, Sep 01, 2020 at 10:57:07AM +0200, Pirmin Duss wrote:
Hello Genodians
I'm currenty working on a I2C driver for the iMX8 processor.
I actually started this before the 20.08 release. But when I read that the new platform driver for the iMX8 SoC can automatically enable/disable clocks for subsystems, I decided to use this new feature, as I had problems enabling the clocks before.
If my assumptions are correct (by reading the code of the usb_host_drv), one is able to get a capability to the IOMEM that the platform driver has mapped via `acquire_device().io_mem_dataspace()`.
You are right that with the new ARM and i.MX 8MQ platform driver you gain the device resources like I/O memory via the Platform::Device API. The Platform::Device API is accessible via a Device_capability, which is returned by acquire_device(String) of the Plaform::Session API. A driver should not requests its interrupts or I/O memory via core directly, but use these APIs instead, like it is the case on x86 for a longe time.
What is currently not clear to me, is how to map the `Attached_mmio` of the driver use the mapped IOMEM, to be able to use the register definitions?
The Attached_mmio abstraction from the `os/include/os/attached_mmio.h` header is no appropriated one for your use-case anymore. Instead you might use the Attached_dataspace abstraction to map the I/O memory into the address space, and put the resulting "local_addr" into the Mmio abstraction explicitly. That is the one you have used before for the register definitions and access.
Once the conversion of existing drivers to use the platform drivers is finished, we can either get rid of the "Attached_mmio", or change it to not use the "Attached_io_mem_dataspace anymore.
I hope this clarifies your questions.
Best regards Stefan
Or does a driver that uses the `platform_drv` component require an other way to access the registers?
My current work in progress code (with lots debug stuff in it) can be found at [1].
Best regards, Pirmin
[1] https://github.com/trimpim/genode/tree/i2c_dirver_imx8q_evk_20.08
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users