Kernel configuration

You can manage the MCA driver support through the following kernel configuration option:

  • Digi Micro Controller Assist for ConnectCore (CONFIG_MFD_MCA)

This option enables support for the core functionality of the MCA and is enabled as built-in on the default ConnectCore 95 kernel configuration file.

Each one of the multi-function drivers implement their own kernel options.

Kernel driver

The MCA core driver is located at:

File Description

drivers/mfd/mca-core.c

MCA core driver

drivers/mfd/mca-i2c.c

MCA I2C communication driver

drivers/mfd/mca-irq.c

MCA interrupt driver

Device tree bindings and customization

The MCA device tree binding is documented at Documentation/devicetree/bindings/mfd/digi,mca-stm32u031.yaml.

The MCA is connected through I2C8 port of the i.MX95 CPU:

ConnectCore 95 device tree
&i2c8 {
	mca_cc95_smarc: mca@20 {
		compatible = "digi,mca-stm32u031";
		reg = <0x20>;
		interrupt-parent = <&gpio2>;
		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
		interrupt-controller;
		#interrupt-cells = <2>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mca>;

		[...]
	};
};
The MCA device tree node has one sub-node for each multi-function driver it supports.

System status registers

The MCA provides status information about the cause of reset and wake-up events via the sysfs.

Reset cause

Linux provides information about what caused a reset of the MCA microcontroller and i.MX95 processor.

MCA microcontroller

Use the following command to display event causes flagged on the last MCA reset:

# cat /sys/bus/i2c/devices/7-0020/last_mca_reset
Reset Pin
last_mca_reset value Description

Low Voltage

Low voltage on VCC_MCA

Watchdog

Internal MCA watchdog reset

Reset Pin

Assert of reset pin

Power On

Power on condition

Note that more than one value can be signaled simultaneously.

i.MX95 processor

Use the following command to display event causes flagged on the last i.MX95 reset:

# cat /sys/bus/i2c/devices/7-0020/last_mpu_reset
Power On
last_mpu_reset value Description

Power On

Power on condition

System Reset

System reset (system call)

Watchdog

Watchdog driver reset

Off wakeup

Wakeup from power off

MCA reset

An MCA reset (internal watchdog) triggered the MPU reset

Wake-up cause

Linux provides information about which MCA interface woke the system from low power (suspend or power off).

  • Status registers only include wake-up sources controlled by the MCA. If the CPU is awakened by a peripheral not controlled by the MCA, the status register indicates the wake-up source as CPU regardless of the actual wake-up source.

  • When main power is removed, wake-up causes are only reported correctly if a coin cell is connected to the device.

Use the following command to read the last ConnectCore 95 wake-up reason:

# cat /sys/bus/i2c/devices/7-0020/last_wakeup_reason
Power IO
last_wakeup_reason value Description

Power IO

Power IO pin. Commonly connected to the power button

Timer

Internal MCA timer

RTC

Real Time Clock Alarm

Tamper0, Tamper1, Tamper 2, Tamper3

Digital/analog tamper interface

IO0..IO28

Digital/analog IO pin (configured as digital interrupt or analog comparator)

Vcc

Vcc detection interrupt

CPU

Other CPU or PMIC interrupt

MCA NVRAM

The MCA provides 8 bytes of NVRAM memory. This general purpose memory preserves data in power-off mode when the board is connected to mains, or without power only if your board has a coin cell battery.

You can access this memory area through a sysfs file named: /sys/bus/i2c/devices/7-0020/nvram. You can write to the NVRAM by writing directly into the sysfs file using the following command:

# cd /sys/bus/i2c/devices/7-0020/
# echo -n "12345678" > nvram

You can read the content memory with the following commands:

# hexdump -c nvram
0000000   1   2   3   4   5   6   7   8
0000008

If the values are printable, you can also read them with commands like cat:

# cat nvram
12345678

SOM boot mode configuration

You can use mca_config_tool --boot_mode <mode> to configure how the MCA behaves in relation to booting the SOM. Allowed values for <mode> are:

  • W4PK (wait for power key): The system doesn’t boot until the MCA PWR_IO line is asserted low. This line is commonly connected to the power button.

  • BOP (boot on power): The SOM automatically boots as soon as power is applied. This is the default mode.

  • SMARCBP (SMARC bypass): The MCA bypasses SMARC-specification functionality:

    • MCA does not affect the SoC boot sequence. Parameters --pwroff_boot_duration and --reset_delay of the mca_config_tool configurations are ignored.

    • The POWER_BTN line of the SMARC connector is bypassed directly to the ONOFF pad of the ConnectCore 95 SOM.

    • The MCA power-key driver is bypassed.

    • The FORCE_RECOV# line is ignored.

See MCA configuration tool for additional information on this tool and functionality.

Safe system reboot and power-off

To perform a controlled and safe software reboot sequence:

  • Run reboot_safe [-t <timeout>] from the command line. It instructs the MCA to force a system reboot after a timeout (in seconds). The default timeout value is 30 seconds if the <timeout> parameter is not defined.

To perform a controlled and safe software power-off sequence:

  • Run poweroff_safe [-t <timeout>] from the command line. It instructs the MCA to force a system power-off after a timeout (in seconds). The default timeout value is 30 seconds if the <timeout> parameter is not defined.