eMMC on NXP S32G#
In this use-case we will run the emmc-driver on the NXP S32G.
The emmc-driver provides access to eMMC and SD-Card like devices, and provide clients with a block interface to read and write blocks via Virtio-block protocol.
To run the emmc-driver, it needs access to the eMMC or SD controller of the platform which it gets via the io component.
An appropriate script for ned may look like this:
1-- vim:ft=lua
2
3local L4 = require("L4");
4local ld = L4.default_loader;
5
6local io_vbus_emmc = ld:new_channel();
7ld:start({
8 caps = {
9 icu = L4.Env.icu,
10 sigma0 = L4.Env.sigma0,
11 vbus_emmc = io_vbus_emmc:svr(),
12 },
13 }, "rom/io rom/hw_devices.io rom/vbus.io");
14
15 local emmc_driver = ld:new_channel();
16
17 ld:start({
18 caps = {
19 vbus = io_vbus_emmc,
20 svr = emmc_driver:svr(),
21 },
22 },
23 "rom/emmc-drv");
24
25 -- Provide clients access to specific GPT partitions. Either use a GPT
26 -- partition label or the GPT partition's UUID:
27 -- Example:
28 ld:start({
29 caps = {
30 virtio_blk1 = emmc_driver:create(0, "device=partlabel:NAME"),
31 virtio_blk2 = emmc_driver:create(0, "device=partuuid:B874C937-5588-4231-A85C-1E629BF4364E"),
32 },
33 }, "rom/client");
The script references two files for configuring the io component.
hw_devices.io
is the hardware device configuration of the S32G, as found
here.
vbus.io
creates a virtual bus for the emmc driver, using this content:
1-- vim:ft=lua
2
3local hw = Io.system_bus();
4
5Io.add_vbusses
6{
7 vbus_emmc = Io.Vi.System_bus(function()
8 usdhc0 = wrap(hw.usdhc0);
9 end);
10}
When launching this setup, the final output should be like this. No errors shall be displayed:
emmc-drv| eMMC[factory]: Assuming host clock of 400MHz.
emmc-drv| Capability 'sdhci_adma_buf' not found -- allocating buffer.
emmc-drv| Capability 'iobuf' not found -- allocating buffer.
emmc-drv| eMMC-0[device]: Found eMMC device.
emmc-drv| eMMC-0[device]: Device initialization took 260ms (0ms busy wait, 251ms sleep).
emmc-drv| eMMC-0[device]: Successfully set 'HS400 Dual Data Rate eMMC at 200MHz (1.8V)'.
When investigating any issues, adding -v
options to rom/io
and
rom/emmc-drv
, also multiple times, gives more valuable output.