[FIRMWARE] FreeNAS on PR4100 - updated!

The following posts contain some notes I took during development. I’ll update the first post when necessary.

The Braswell SMBus driver for FreeBSD is called ichsmb_pci.
Source: freebsd-src/ichsmb_pci.c at 384c7fc01983878ebbe90da5c3a309fd9b338373 · freebsd/freebsd-src · GitHub
It’s the starting point to get the fan / lcd control working.

List kernel modules

kldstat

Load modules

kldload iicbus smbus smb ichsmb

Show pci devices (lspci)

pciconf

Edit /etc/devfs.rules and add this section to enable creation of smb devices

[wdrules=101]                                                                                                                       
add path 'i2c*' mode 660 group uucp                                                                                                 
add path 'smb*' mode 660 group uucp                                                                                                 
add path 'ichsmb*' mode 660 group uucp 

Reload these new devfs rules

devfs rule applyset

Reload ichsmb driver and you’ll see /dev/smb0 is created now.
Now poll for devices on the bus.

[root@freenas /usr/include/dev]# smbmsg -p                                                                                          
Probing for devices on /dev/smb0:                                                                                                   
Device @0x10: w                                                                                                                     
Device @0x60: rw                                                                                                                    
Device @0x62: rw                                                                                                                    
Device @0x98: rw                                                                                                                    
Device @0xa0: rw                                                                                                                    
Device @0xa2: rw

Read temperatures from 2 sensors (like here)

smbmsg -s 0x98 -c 0x00 -i 1 -F %d
24  --> 36 degrees celcius
smbmsg -s 0x98 -c 0x01 -i 1 -F %d
25  --> 37 degrees celsius

I did not manage to get the stty device working yet. This is the serial config on debian, I just need to convert this info to something usable in BSD.

root@pr4100:~# dmesg | grep -C4 tty
2.259560] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    2.286971] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    2.296401] serial 0000:00:1e.3: enabling device (0000 -> 0002)
[    2.303396] 0000:00:1e.3: ttyS1 at MMIO 0x8161e000 (irq = 18, base_baud = 2764800) is a 16550A
[    2.313233] serial 0000:00:1e.4: enabling device (0000 -> 0002)
[    2.320173] 0000:00:1e.4: ttyS2 at MMIO 0x8161d000 (irq = 19, base_baud = 2764800) is a 16550A
[    2.330182] Linux agpgart interface v0.103

root@pr4100:~# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:28149 rx:0 RTS|DTR
1: uart:16550A mmio:0x8161E000 irq:18 tx:0 rx:0 CTS
2: uart:16550A mmio:0x8161D000 irq:19 tx:58 rx:0
3: uart:unknown port:000002E8 irq:3

The sio module is possibly the missing link… but it’s not part of the default FreeNAS kernel.

EDIT: the sio module is outdated. Just get the uart.ko and puc.ko modules from the trueos kernel (= FreeNAS baseline).

1 Like