Kernel configuration

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

  • Digi Micro Controller Assist for ConnectCore 6UL (CONFIG_MFD_MCA_CC6UL)

This option enables support for the core functionality of the MCA and is enabled as built-in on the default ConnectCore 6UL 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-cc6ul-core.c

ConnectCore 6UL MCA core driver

drivers/mfd/mca-cc6ul-i2c.c

ConnectCore 6UL MCA I2C communication driver

drivers/mfd/mca-cc6ul-irq.c

ConnectCore 6UL MCA interrupt driver

Device tree bindings and customization

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

The MCA is connected through I2C1 port of the {cpu-family} CPU:

ConnectCore 6UL device tree
&i2c1 {
	mca_cc6ul: mca@7e {
		compatible = "digi,mca-cc6ul";
		reg = <0x7e>;
		interrupt-parent = <&gpio5>;
		interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
		interrupt-controller;
		#interrupt-cells = <2>;
		fw-update-gpio = <&gpio4 14 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mca_cc6ul>;

		...
	};
};
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 {cpu-family} processor.

This functionality is supported on MCA firmware version 1.02 and later. You can use the sysinfo command to check your MCA firmware version.

MCA microcontroller

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

# cat /sys/bus/i2c/devices/0-007e/last_mca_reset
Low Voltage, Power On
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.

{cpu-family} processor

Use the following command to display event causes flagged on the last {cpu-family} reset:

# cat /sys/bus/i2c/devices/0-007e/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 6UL wake-up reason:

# cat /sys/bus/i2c/devices/0-007e/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

LP UART

MCA UART

Tamper0, Tamper1, Tamper 2, Tamper3

Digital/analog tamper interface

IO0, IO1, IO2, IO3, IO4, IO5, IO6, IO7

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

Vcc

Vcc detection interrupt

CPU

Other CPU or PMIC interrupt

This functionality is supported on MCA firmware version 1.02 and later. You can use the sysinfo command to check your MCA firmware version.

MCA NVRAM

This functionality is supported on MCA firmware version 1.02 and later. You can use the sysinfo command to check your MCA firmware version.

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/0-007e/nvram. You can write to the NVRAM by writing directly into the sysfs file using the following command:

# cd /sys/bus/i2c/devices/0-007e/
# 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

External 32.768 kHz output

You can configure pad MCA_IO6 to output a 32.768 kHz signal for clocking external peripherals.

The functionality is controlled by a sysfs entry. To enable the 32.768 kHz signal on MCA_IO6 pad:

# echo enabled > /sys/bus/i2c/devices/0-007e/ext_32khz

To disable it:

# echo disabled > /sys/bus/i2c/devices/0-007e/ext_32khz

To read the current status of the pad:

# cat /sys/bus/i2c/devices/0-007e/ext_32khz
disabled

Voltage reference 1.2 V

You can configure pad MCA_IO2/EXT_VREF to output a steady temperature-compensated 1.2 V output to use as a voltage reference for external peripherals.

You can use this signal as reference voltage for the MCA ADC signals. See Analog-to-Digital Converter (ADC) for more information.
For this functionality to work properly you must connect a 100 nF capacitor between MCA_IO2/EXT_VREF and ground to filter ripple signals in the output. Connect the capacitor as close as possible to the module pad.

The functionality is controlled by a sysfs entry. To enable the voltage reference on MCA_IO2/EXT_VREF pad:

# echo enabled > /sys/bus/i2c/devices/0-007e/vref

To disable it:

# echo disabled > /sys/bus/i2c/devices/0-007e/vref

To read the current status of the pad:

# cat /sys/bus/i2c/devices/0-007e/vref
disabled
If you configure the MCA ADC to use the internal 1.2 V voltage reference, the MCA_IO2/EXT_VREF pad automatically outputs the signal and sysfs controls have no effect.

SOM boot mode configuration

This functionality is supported on MCA firmware version 1.04 and later. You can use the sysinfo command to check your MCA firmware version. It also requires mca_config_tool version 1.14 or later for configuration.

MCA can be configured to boot the SOM in two different ways:

  • 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.

This functionality can be configured using the mca_config_tool --boot_mode argument.

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.