- Create docs/wiki/MOCHAbin-Kernel.md with complete LED kernel guide - Document Debian base config + SecuBox fragment approach - Document GPIO polarity fix for IS31FL3199 - Add build instructions and troubleshooting - Update sidebar with Kernel LED link - Update HISTORY.md with session 115 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6.5 KiB
MOCHAbin Kernel — LED & Hardware Support
SecuBox kernel configuration for GlobalScale MOCHAbin (Armada 7040)
Hardware Overview
| Component | Chip | Kernel Driver | Address |
|---|---|---|---|
| LED Controller | IS31FL3199 | leds-is31fl319x |
I2C-1 0x64 |
| Network PPv2.2 | Marvell PPv2 | mvpp2 |
Built-in |
| I2C Bus | MV64XXX | i2c-mv64xxx |
CP0 |
| eMMC | Xenon | mmc_sdhci_xenon |
CP0 |
| SFP Cage | PHY/SFP | sfp + phylink |
eth2 |
Build Strategy
Why Debian Base + SecuBox Fragment?
Previous custom minimal configs caused kernel panics due to missing network drivers (MVPP2, MVNETA). The current approach:
- Start with Debian arm64 kernel config — includes all working drivers
- Merge SecuBox fragment — enables LED drivers as built-in (
=y) - Apply DTS patch — fixes GPIO polarity for LED shutdown pin
# Build workflow
cd linux-6.12.85
cp config-6.12.85-debian-base .config
./scripts/kconfig/merge_config.sh -m .config config-6.12.85-secubox-led-v2.fragment
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- olddefconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc) Image modules dtbs
Config Files
Debian Base Config
Location: board/mochabin/kernel/config-6.12.85-debian-base
Extracted from working Debian MOCHAbin system with:
zcat /proc/config.gz > config-6.12.85-debian-base
Key working drivers (already =y or =m):
CONFIG_MVPP2=m— Marvell PPv2.2 EthernetCONFIG_MVNETA=m— Marvell NETA EthernetCONFIG_MVMDIO=m— Marvell MDIO busCONFIG_MARVELL_PHY=m— PHY driversCONFIG_I2C_MV64XXX=m— I2C controller
SecuBox LED Fragment
Location: board/mochabin/kernel/config-6.12.85-secubox-led-v2.fragment
# LED Driver (IS31FL3199 on MOCHAbin)
CONFIG_LEDS_IS31FL319X=y
CONFIG_LEDS_IS31FL32XX=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_MULTICOLOR=y
# LED Triggers
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_NETDEV=y
# I2C (for LED controller)
CONFIG_I2C_MV64XXX=y
CONFIG_I2C_CHARDEV=y
CONFIG_REGMAP_I2C=y
# Network (MOCHAbin PPv2.2)
CONFIG_MVPP2=y
CONFIG_MVMDIO=y
CONFIG_MVNETA=y
CONFIG_PHYLINK=y
CONFIG_FIXED_PHY=y
CONFIG_MARVELL_PHY=y
CONFIG_SFP=y
# MMC/eMMC (Xenon controller)
CONFIG_MMC_SDHCI_XENON=y
# GPIO (for LED shutdown pin)
CONFIG_GPIO_MVEBU=y
CONFIG_PINCTRL_MVEBU=y
CONFIG_PINCTRL_ARMADA_CP110=y
CONFIG_PINCTRL_ARMADA_AP806=y
# Debug: /proc/config.gz
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
DTS Patch — GPIO Polarity Fix
The Problem
The IS31FL3199 has a SDB (shutdown bar) pin that must be driven HIGH to enable the chip. The upstream kernel DTS incorrectly uses GPIO_ACTIVE_LOW, keeping the LED controller in permanent shutdown.
The Fix
Location: board/mochabin/patches/0001-fix-is31fl3199-led-gpio-polarity.patch
--- a/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts
+++ b/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts
@@ -236,7 +236,7 @@
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&is31_sdb_pins>;
- shutdown-gpios = <&cp0_gpio1 30 GPIO_ACTIVE_LOW>;
+ shutdown-gpios = <&cp0_gpio1 30 GPIO_ACTIVE_HIGH>;
reg = <0x64>;
Upstream Status
This fix should be submitted to linux-arm-kernel@lists.infradead.org for inclusion. Similar devices in the kernel (cn9130-cf-base.dts, cn9132-clearfog.dts) already use GPIO_ACTIVE_HIGH.
LED Hardware on MOCHAbin
I2C Detection
$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
LED Mapping
| LED | Color | DTS Name | Usage |
|---|---|---|---|
| led1 | Red | led@1 |
Activity |
| led2 | Green | led@2 |
System |
| led3 | Blue | led@3 |
Network |
| led4-9 | RGB | led@4-9 |
Status |
LED Control
# List available LEDs
ls /sys/class/leds/
# Set LED trigger
echo heartbeat > /sys/class/leds/led1_red/trigger
# Manual brightness
echo 255 > /sys/class/leds/led2_green/brightness
# Network activity trigger
echo netdev > /sys/class/leds/led3_blue/trigger
echo eth0 > /sys/class/leds/led3_blue/device_name
echo "rx tx" > /sys/class/leds/led3_blue/mode
LOCALVERSION Branding
The kernel is built with:
LOCALVERSION=-secubox-cybermind
This produces a kernel version string like:
Linux secubox 6.12.85-secubox-cybermind #1 SMP PREEMPT Thu May 8 2026 aarch64
Build Script
Location: kernel-build/rebuild-with-leds.sh
The script:
- Copies Debian base config
- Merges SecuBox LED fragment
- Applies GPIO polarity DTS patch
- Verifies critical options are built-in
- Builds Image + DTB + modules
- Creates
.debpackages
./kernel-build/rebuild-with-leds.sh
Output files:
arch/arm64/boot/Imagearch/arm64/boot/dts/marvell/armada-7040-mochabin.dtblinux-image-6.12.85-secubox-cybermind_*.deblinux-headers-6.12.85-secubox-cybermind_*.deb
Troubleshooting
LED Not Working
- Check I2C detection:
i2cdetect -y 1should show64 - Check dmesg:
dmesg | grep -i is31fl - Verify config:
zcat /proc/config.gz | grep IS31FL - Check GPIO:
gpioinfo | grep sdb
Network Panic
If network fails with panic:
- Verify
CONFIG_MVPP2=y(must be built-in, not module) - Verify
CONFIG_PHYLINK=y - Check DTB has correct MAC addresses
Build Failures
# Missing cross-compiler
apt install gcc-aarch64-linux-gnu
# Missing dependencies
apt install build-essential libssl-dev bc bison flex libelf-dev
# Verify ARCH is set
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
References
CyberMind — SecuBox-Deb · docs/wiki/MOCHAbin-Kernel.md