13.58.135.0
AS6704T
1133 visit from 2023.12.10.

Asus Lockerstore 4 Gen2 AS6704T as Linux server

After quite 10 years of whist it seems that everything became harder. For example: it was necessary to change my old linux server which serve my e-mails, web pages, files, etc. But nowadays impossible to buy a motherboard with quite new low-power processor - there are many, but or without a SATA port or just one. So after weeks of hesitation, I bought an Asus Lockerstore Gen2 AS6704T NAS device, with Jasper Lake 5105 processor, 4 SATA removable bay, 4 NVME M2.slot, 2 2.5G LAN etc. So far so good, but I cannot and don't want use the operating system Asus offer, not just for its simplicity, but I must retain my operating system and services - and the contents of the old machine RAID disks without enough room to copy.
Beginning of the process easy: on the bios (F2 key after reset) you can change the boot order, placing the EMMC boot as last resort. After that the operating system can start - in the case if it is an UEFI one. Because the low M.2 Nvme prices I'm already bought two 256G card ( and an additional 4G of compatible DDR4 RAM), so after boot from a UEFI drive, created an LVM raid from the two nvme and copy the operating system to it ( as I remember, using Nvme drives with pure mdadm is not so good). After change /etc/fdisk to contain my old RAID parameters (the BIG partition, everything except the operating system), the system works as before. Good - but this is a special device, which contains a 2x16 character display, five button, and a couple of special GPIO leds and pwm FAN controlled by the IT8625E superio chip. None working.
After some research found the following source: asustor-platform-driver - it is for the old NAS versions AS604T and AS6204T so impossible to use because the hardware incompatibility, but a good point to start. The first step was to identify the device for the module loading( digging the DMI info found the vendor: "Intel Corporation" and product name: "Jasper Lake Client Platform". Now the driver start, but there was just some info in /sys/class/hwmon/hwmon3 , for ex. there was no pwm fan setting. Long story short, there is an abandoned and reopened it87 driver on the kernel (which knows nothing about the IT8625E). It must disable and implement a new modified asustor-gpio.ko driver (derived from original it87-gpio) solved the problem, and after probing the gpios I found all the GPIOs on the superio chip.
The list ( /sys/class/gpio contains 2 directories: the chip 0: gpiochip684 contains 340 gpio and chip 1: gpiochip620 contains 64 gpio, this is the IT8625E, so to the numbers below add 620 to export):

GPIO#Function
56Blue Power LED
8Red Power LED
49Red Status LED
21Green USB LED
20USB Button input
59LCD power
13SATA1 Red LED
47SATA2 Red LED
52SATA3 Red LED
48SATA4 Red LED
12SATA1 Green LED
46SATA2 Green LED
51SATA3 Green LED
63SATA4 Green LED
50SATA 3rd,4th Bay Power - Dangerous!
After compile and install my: project source from Github (GPL, derived from mafredri work, with DKMS support) you get three kernel module: asustore-gpio.ko for the gpiochip, asustor-it87.ko for hwmon and asustor.ko for the leds and inputs. Loading the asustor.ko ( insert an asustor line into /etc/modules ) there are leds in /sys/class/leds/blue:power,etc. , hwmon infos in /sys/class/hwmon/hwmon3 ( there are 10 voltage info-don't know, the fan1_input contains the fan rpm, pwm1 is the fan speed input pwm value(21-255), pwm3 the LEDs brightness (0-255) ) and an input key for the USB button.

The only thing not discovered is the green status LED - it is annoyingly blinking, but the blink frequency can be set to 0Hz. Also all the SATA red disk trigger now set to "disc-activity", but we must wait the if-released ledtrig-blkdev module to drive them individually.

Next process is handling the built-in display. Luckily, at system start there is a /dev/ttyS1 device, which is the serial port driving the display with special protocol. There is an existing project using it:LCM written in Go language, but it is a complex one, so I implement a simple Node.js task which every 10 sec update the FAN speed according to the proc. temperature and change the display contents showing the Fan speed, environment and cpu, disk temperature, cpu usage and speed, disk and memory free, load avg, etc...
The lcm.js is the 2x16 character display and buttons manager, install the net,os,cpu-stat,diskspace modules and run: node lcm.js (I'm using it as subprocess of PM2).

I think that the driver also good for the other AS67xx versions, but the AS6702T has no built-in display and the AS6706T two additonal bays GPIOs must somehow find.
Todo:

The current GPIO map for the IT8625E in the kernel after the modules loaded:

gpiochip1 - 64 lines:
        line   0:  "it87_gp10"       unused   input  active-high 
        line   1:  "it87_gp11"       unused   input  active-high 
        line   2:  "it87_gp12"       unused   input  active-high 
        line   3:  "it87_gp13"       unused   input  active-high 
        line   4:  "it87_gp14"       unused   input  active-high 
        line   5:  "it87_gp15"       unused   input  active-high 
        line   6:  "it87_gp16"       unused   input  active-high 
        line   7:  "it87_gp17"       unused   input  active-high 
        line   8:  "it87_gp20"  "red:power"  output   active-low [used]
        line   9:  "it87_gp21"       unused   input  active-high 
        line  10:  "it87_gp22"       unused   input  active-high 
        line  11:  "it87_gp23"       unused   input  active-high 
        line  12:  "it87_gp24" "sata1:green:disk" output active-low [used]
        line  13:  "it87_gp25" "sata1:red:disk" output active-low [used]
        line  14:  "it87_gp26"       unused   input  active-high 
        line  15:  "it87_gp27"       unused   input  active-high 
        line  16:  "it87_gp30"       unused   input  active-high 
        line  17:  "it87_gp31"       unused   input  active-high 
        line  18:  "it87_gp32"       unused   input  active-high 
        line  19:  "it87_gp33"       unused   input  active-high 
        line  20:  "it87_gp34"       unused   input  active-high 
        line  21:  "it87_gp35"  "green:usb"  output   active-low [used]
        line  22:  "it87_gp36"       unused   input  active-high 
        line  23:  "it87_gp37"       unused   input  active-high 
        line  24:  "it87_gp40"       unused   input  active-high 
        line  25:  "it87_gp41"       unused   input  active-high 
        line  26:  "it87_gp42"       unused   input  active-high 
        line  27:  "it87_gp43"       unused   input  active-high 
        line  28:  "it87_gp44"       unused   input  active-high 
        line  29:  "it87_gp45"       unused   input  active-high 
        line  30:  "it87_gp46"       unused   input  active-high 
        line  31:  "it87_gp47" "green:status" output active-low [used]
        line  32:  "it87_gp50"       unused   input  active-high 
        line  33:  "it87_gp51"       unused   input  active-high 
        line  34:  "it87_gp52"       unused   input  active-high 
        line  35:  "it87_gp53"       unused   input  active-high 
        line  36:  "it87_gp54"       unused   input  active-high 
        line  37:  "it87_gp55"       unused   input  active-high 
        line  38:  "it87_gp56"       unused   input  active-high 
        line  39:  "it87_gp57"       unused   input  active-high 
        line  40:  "it87_gp60"       unused   input  active-high 
        line  41:  "it87_gp61"       unused   input  active-high 
        line  42:  "it87_gp62"       unused   input  active-high 
        line  43:  "it87_gp63"       unused   input  active-high 
        line  44:  "it87_gp64"       unused   input  active-high 
        line  45:  "it87_gp65"       unused   input  active-high 
        line  46:  "it87_gp66" "sata2:green:disk" output active-low [used]
        line  47:  "it87_gp67" "sata2:red:disk" output active-low [used]
        line  48:  "it87_gp70" "sata4:red:disk" output active-low [used]
        line  49:  "it87_gp71" "red:status"  output  active-high [used]
        line  50:  "it87_gp72"       unused   input  active-high 
        line  51:  "it87_gp73" "sata3:green:disk" output active-low [used]
        line  52:  "it87_gp74" "sata3:red:disk" output active-low [used]
        line  53:  "it87_gp75"       unused   input  active-high 
        line  54:  "it87_gp76"       unused   input  active-high 
        line  55:  "it87_gp77"       unused   input  active-high 
        line  56:  "it87_gp80" "blue:power"  output   active-low [used]
        line  57:  "it87_gp81"       unused   input  active-high 
        line  58:  "it87_gp82"       unused   input  active-high 
        line  59:  "it87_gp83"  "lcd_power"  output  active-high [used]
        line  60:  "it87_gp84"       unused   input  active-high 
        line  61:  "it87_gp85"       unused   input  active-high 
        line  62:  "it87_gp86"       unused   input  active-high 
        line  63:  "it87_gp87" "sata4:green:disk" output active-low [used]



Questions, Suggestions: Pálóczi-Horváth János< phj@phj.hu>