2

I have a power management device (PF1550) in an I.MX6ULL embedded linux platform and its registers are configured in the uboot once. I want to have something to pull its registers in the firmware right after boot up. Is kernel Module a good way to do this or there are simpler ways?

Thanks for your help in advance!

RAA
  • 23
  • 4
  • "*pull its registers*" -- What do you mean by "*pull*"? Do you mean *read*? If reading a device register is benign, i.e. doesn't modify or self-clear the register, then you could simply read the (physical) memory location (since it's memory mapped) from userspace using the **devmem** command of Busybox. BTW "*kernel module*" is ambiguous; not every "*module*" is a driver, nor does that necessarily mean that it's *loadable*. – sawdust Aug 18 '23 at 22:09
  • Sorry, I meant reading the device registers only. So you are saying that I can access (read) the registers of any device which is external to the main processor? – RAA Aug 18 '23 at 22:37
  • 2
    For device registers that are *memory mapped*, see https://stackoverflow.com/questions/12040303/how-to-access-physical-addresses-from-user-space-in-linux – sawdust Aug 18 '23 at 22:44
  • 1
    There is also an existing driver for the [PF1550](https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/drivers/regulator/pf1550-regulator-rpmsg.c) in NXP's kernel tree. If you are using this most of the PMICs characteristics will be visible in [sysfs](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-regulator). – Stuart Menefy Aug 23 '23 at 08:55
  • I am sure it is not included in my build. is there any document on how I can port it into my firmware source code ? – RAA Aug 24 '23 at 12:45

1 Answers1

1

NXP PF1550 has an I2C interface, so I can believe it is connected to your NXP i.MX6ULL SoC. If yes, you can probe i2c-dev userspace driver, and you can read/write any PF1550's reg config via /dev/i2c-X adapter. I suggest to use python-periphery to test it.

By the way, it seems to me that, there was made a patch for support PF1550 via I2C in Linux kernel, but I can not find it in the mainline and in NXP's Linux kernel, maybe it is still not approved. https://lore.kernel.org/lkml/1523974819-8711-1-git-send-email-abel.vesa@nxp.com/

Livius
  • 198
  • 4