This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5718: PMIC Register access over I2C

Part Number: AM5718

Hi,

           I am using AM5718 ,and ti-processor-sdk-linux-am57xx-evm-05.03.00.07.I would like to read/write PMIC TPS6590379 registers over i2c,I referred the below link,
                

but I didn't get any information regarding my query.Please help.

Regards,

Anjali

  • Hi Anjali,

    You can read/write PMIC registers from user space. You can use omapconf tool, refer to below wiki for details:


    You can also use I2C linux user space commands to read/write PMIC registers, these commamnds are i2cget and i2cset. Refer to below links for details:

    Regards,
    Pavel

  • Hi Pavel,

    Thanks for your quick reply

    I tried linux user space commads to read PMIC .I can only read registers  in PMIC page 0x0(slave address 0x12) .but while trying to read the registers in page0x1 (slave address 0x58) I got 'Device or resource busy 'from the Linux  and it is OK from u-boot.

    From kernel:

    root@am57xx-evm:~/apps# i2cget 0 0x12 0x2B

    [ 3448.994470] i2c /dev open

    WARNING! This program can confuse your I2C bus, cause data loss and worse!

    I will read from device file /dev/i2c-0, chip address 0x12, data address

    0x2b, using read byte data.

    Continue? [Y/n] Y

    0x3e

    root@am57xx-evm:~/apps# i2cget 0 0x58 0x27

    [ 3454.354488] i2c /dev open

    Error: Could not set address to 0x58: Device or resource busy

     

    From u boot:

    =>i2c md 0x12 2b.1 1

    002b: 3e

    =>i2c md 0x58 27.1 1

    0027: 5b

    What would be the reason for this issue?

    regards,

    anjali

  • Anjali,

    I2C chip at addr0x58 is used and busy by the linux kernel:

    linux-kernel/arch/arm/boot/am57xx-idk-common.dtsi

    &i2c1 {
        status = "okay";
        clock-frequency = <400000>;

        tps659038: tps659038@58 {
            compatible = "ti,tps659038";
            reg = <0x58>;

    While for addr 0x12 we do not have allocation in linux kernel.

    "Device or resource busy" literally means that your i2c driver is loaded and being used by some other module. Either you disable that module in kernel or use "force" option to see if the slave responds (use -f at your risk). Please refer to below e2e threads for details:

    Regards,
    Pavel

  • Hi ,

       I  want to set and reset   "DEV_ON" bit in the PMIC for implementing PMIC shutdown from linux.I reffered below link for this.

      http://e2e.ti.com/support/processors/f/791/t/807604?Linux-AM5718-Kernel-and-PMIC-shutdown

    but, while  trying to accessing slave 0x58(register address 0xA0 for DEV_ON ) I got  "Device or resource busy" ,then How  it can  be possible from userspace?

    regards

    Anjali

  • Anjiali,

    From what I understand, you need to know what "risk" you take when using the force option.

    This is generic Linux question, check below link.

    https://manpages.debian.org/unstable/i2c-tools/i2cset.8.en.html

    i2cset

    -f   Force access to the device even if it is already busy. By default, i2cset will refuse to access a device which is already under the control of a kernel driver. Using this flag is dangerous, it can seriously confuse the kernel driver in question. It can also cause i2cset to silently write to the wrong register. So use at your own risk and only if you know what you're doing.

    Regards,
    Pavel