Zhaoxin SMBus Linux Driver Release Note

Last update: 2024-04-02, v3.3.0


Contents

How to test

Device driver access example


Support Platforms

Hardware

All Shanghai Zhaoxin Platforms

Kernel Version

Kernel version supported by this driver is linux-3.16.0 ~ linux-6.6


Notices

Zhaoxin SMBus Linux driver support most protocols specified in the SMBus Specification 2.0. The protocols listed in the followed table. However, for our test board, only Read/Write Byte, Read/Write Word, Read/Write Block, can been tested, because the device connected to the SMBus in the board only support the protocol specified above. If you want to test the other protocol, you should connect the device supporting the protocol to the SMBus in the board.

Functionalities implemented:
------------------------------------
I2C                              no
SMBus Quick Command              yes
SMBus Send Byte                  yes
SMBus Receive Byte               yes
SMBus Write Byte                 yes
SMBus Read Byte                  yes
SMBus Write Word                 yes
SMBus Read Word                  yes
SMBus Process Call               yes
SMBus Block Write                yes
SMBus Block Read                 yes
SMBus Block Process Call         no
SMBus PEC                        yes
I2C Block Write                  yes
I2C Block Read                   yes

Driver install & uninstall

Before loading the driver, ensure that the firmware reports SMBus controller information. You can check by:

$ ls /sys/bus/platform/devices/SMB3324\:00

If the node does not exist on the system, please adjust your firmware Settings first.

Build driver

Before installing the driver for the first time, it should been compiled:

$ cd ./src/
$ make
Install driver

Use the followed command to install:

$ sudo make install

If the installation is successful, you can see message like below in dmesg:

[  965.375643] smbus_zhaoxin SMB3324:00: adapter /dev/i2c-0 registered. version 3.3.0

also, you can list the adapter name like below:

$ cat /sys/class/i2c-adapter/i2c-*/name | grep SMB3324
zhaoxin-0000:00:11.0-SMB3324:00
Uninstall driver

Use the followed command to uninstall:

$ sudo make uninstall
Clean old files

Use the followed command to clean:

$ make clean

How to test

Use i2ctool list adapter and device

A. adapter detect, for example:

$ i2cdetect -l 
i2c-0     i2c      	zhaoxin-0000:00:11.0-SMB3324:00         SMBus adapter

B. device detect, for example:

$ i2cdetect -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: 30 -- -- -- -- -- -- -- 36 -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- --

Notes: For more information about how to use this i2c-tools, see its help documentation please.

For SPD EEPROM, use i2cset to select BANK

Use the followed commands to select BANK0:

$ sudo i2cset -y 0 0x36 0 0

Use the followed commands to select BANK1:

$ sudo i2cset -y 0 0x37 0 0

Device driver access example

Most PC have a SPD on the DDR3/DDR4, here is an example to use device driver at24 to access this SPD.

Load device driver at24

$ sudo modprobe at24

Bound SPD to the adapter

sudo echo spd 0x51 > /sys/bus/i2c/devices/i2c-0/new_device

Read data from SPD by dd command

$ dd if=/sys/bus/i2c/devices/0-0051/eeprom of=./result.data count=16 bs=1
$ hexdump result.data
0000000 1123 020c 1984 0800 0000 0300 0309 0000
0000010

Revision History

Version Release Date Comments
V1.0.0 2017-03-02 This is the first driver release.
V1.1.0 2018-11-13 Adjusted protocol process.
V1.2.0 2018-12-04 Change to an independent driver.
V1.3.0 2019-03-13 Add IIC access function. Delete debug codes. Add Use Example in release note.
V2.0.0 2019-07-05 Framework adjustments have been made and removed alert function
V2.0.1 2019-08-09 add support for SMBus v02, add version id check.
V2.0.2 2020-05-08 add support for SMBus v10, add process about SMBALERT function.
V2.0.3 2021-08-06 Add support for SMBus v20, add host PEC check.
V3.0.0 2022-12-06 Change to a platform device driver to match the device reported by ACPI table
V3.0.1 2023-06-16 use prefix ZXSMB_ rename some marcos/funcitons, etc
V3.0.2 2023-06-16 Made some code style adjustments
V3.1.0 2023-11-23 remove alert function; remove bank related protocol
V3.2.0 2024-01-18 remove IIC access; update release notes
V3.3.0 2024-04-02 enable I2C Block read/write function

Back to Top

How to test

Device driver access example

≡