How to keep chipset register value persitently


I was able to change the chipset register value by using devmem but the register value will back to default after reboot. Chipset is MT7621

How can I keep the value? I don't want to set the value again every time I reboot.


You could write a shell script that sets the devmem value, and set the script to be run at boot.

(In practice, add the needed commands to /etc/rc.local ?)

Ideally, you tell a driver to do this for you. Depends on what register and function you are changing (that that hardware and functionality has Linux support), but you should be able to specify this in your DTS. For example, use pinctrl in DTS to have a SoC GPIO pin exposed as a different function.

Ideally the correct way would be to tweak the driver and ideally also document the change. Can you tell us what you are changing ? Maybe the feature is supported with ethtool

Thanks Johnth,

I want to config the 0x1E000060 register (GPIO mode), to use some PIN as a general GPIO purpose.

How could I do it with device tree configuration?

Then we want pinctrl.
mt7621 is a little special because of the pin groups, but see how you go.
The pinctrl node is defined, and referred to from the user (might be the GPIO controller for you). Examples here:

The binding documentation: