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.

Custom AM335x board with SDK08 kernel -- suspend not working

Hello;

I am using the following setup:
* custom HW based on AM335x SoC
* the Linux kernel from AM335xSDK 08.00.00.00
* since the board is custom, I am using my custom Device tree
* for Linux kernel configuration I used omap2plus_defconfig
* ARM Cortex-M3 firmware was obtained from git://git.ti.com/ti-cm3-pm-firmware/amx3-cm3.git (bin/am335x-pm-firmware.elf)
* Linux kernel .config file was modified to automatically load the CM3 FW:
  CONFIG_EXTRA_FIRMWARE="am335x-pm-firmware.elf"
  CONFIG_EXTRA_FIRMWARE_DIR="firmware"

Everything works like a charm until I try to suspend the system.

# echo mem > /sys/power/state
sh: write error: Invalid argument
# echo standby > /sys/power/state
sh: write error: Invalid argument

Dmesg output:

# dmesg | grep -i remoteproc
[ 3.585607] remoteproc0: wkup_m3 is available
[ 3.590345] remoteproc0: Note: remoteproc is still under development and considered experimental.
[ 3.600012] remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[ 3.616508] remoteproc0: powering up wkup_m3
# dmesg | grep -i wkup
[ 3.276263] platform 44d00000.wkup_m3: Driver wkup_m3 requests probe deferral
[ 3.585607] remoteproc0: wkup_m3 is available
[ 3.616508] remoteproc0: powering up wkup_m3
[ 3.621198] wkup_m3 44d00000.wkup_m3: rproc_boot failed

Is anything missing in my setup? Do I have to modify my device tree to make the suspend work?
I will appreciate your suggestions;
Rostislav Lisovy

  • The wikis are being updated. For SDK 8 the .elf is used instead of the .bin. I'm still trying to figure this out, but there should be a scale-data file in the device tree and in /lib/firmware in your target root file system. The .elf file goes in the /lib/firmware directory, too. I just booted a Beaglebone Black with SDK 8 and have:

    root@am335x-evm:~# ls -l /lib/firmware/
    -rw-r--r--    1 root     root         53563 Feb  7 20:44 TIInit_10.6.15.bts
    -rwxr-xr-x    1 root     root         70306 Feb  7 20:44 TIInit_11.8.32.bts
    -rw-r--r--    1 root     root         14610 Feb  7 20:44 TIInit_12.10.28.bts
    -rwxr-xr-x    1 root     root         70301 Feb  7 20:44 TIInit_12.8.32.bts
    -rwxr-xr-x    1 root     root         50215 Feb  7 20:44 TIInit_7.2.31.bts
    -rw-r--r--    1 root     root         50770 Feb  7 20:44 TIInit_7.6.15.bts
    -rw-r--r--    1 root     root            72 Feb  7 09:14 am335x-bone-scale-data.bin
    -rw-r--r--    1 root     root            16 Feb  7 09:14 am335x-evm-scale-data.bin
    -rw-r--r--    1 root     root        154420 Feb  7 09:14 am335x-pm-firmware.elf
    -rw-r--r--    1 root     root            40 Feb  7 09:14 am43x-evm-scale-data.bin
    drwxr-sr-x    2 root     root          4096 Feb  8 00:31 ti-connectivity
    root@am335x-evm:~#

    Notice the scale-data.bin files. Then in the .dts file for bone-common

    &wkup_m3 {
            ti,scale-data-fw = "am335x-bone-scale-data.bin";
    };

    Then at boot up I see

    [    4.408618]  remoteproc0: powering up wkup_m3
    [    4.414214]  remoteproc0: Booting fw image am335x-pm-firmware.elf, size 15442
    0
    [    4.423238] PM: CM3 Firmware Version = 0x190
    [    4.428459]  remoteproc0: remote processor wkup_m3 is now up

    Steve K.

  • Hello Steve;
    Thanks for your answer.

    If I omit the firmware there is "remoteproc0: failed to load am335x-pm-firmware.elf" in kernel log, thus I tried to load an ELF.
    What is the "scale data" and how do I generate it for my custom board?

    Rostislav;
  • Hello Steve;

    Is this the correct wiki page describing Power Management on AM335x? How is the wiki update going? Do I understand it correctly, that the TI has released its SDK (8.0) without documenting how to use the PM functionality?

    Best regards;
    Rostislav Lisovy

  • Hi Rostislav,

    I checked PM on the two am335x board EVM and SK and the suspend/resume works fine. I think that the issue is in your .config file not in new sdk8. I checked "CONFIG_EXTRA_FIRMWARE" definition and saw that on my configuration is not as yours. Please see the dts file that is closest to your board, also check .config file on your board and from sdk8.
    The pointed documentation is very close to sdk8 and I think that you can use it.

    BR
    Ivan
  • I have more information on the scale-data file format. I'm copy/paste/format-ing what I've learned:

       This CM3 firmware supports voltaeg scaling during low power modes

       using i2c sequences sent to the PMIC. These sequences are both board

       and PMIC specific. Add binaries containing the proper sequence to be

       loaded by the software in use and copied to DMEM. Firmware still can

       accept the offset of the wake and sleep sequence in IPC register 5 as

       was done previously.

     

       Currently firmware format contains 0x0C57 present as the first two

       bytes followed by one byte defining offset to sleep sequence followed by

       one byte defining offset to wake sequence. These can be used by software

       running on MPU to facilitate loading of the sequences, which immediately

       follow the offsets in the binary.

     

       The CM3 i2c code expects each sequence to be a series of I2C transfers

       in the form:

     

       u8 length | u8 chip address | u8 byte0/reg address | u8 byte1 | u8 byteN ..

     

       The length indicates the number of bytes to transfer, including the

       register address. The length of each transfer is limited by the I2C

       buffer size of 32 bytes.

     

     

    We can use am335x-evm-scale-data.bin as an example to explain the header and the rest of the sequence. Keep in mind that it's a raw binary file containing these actual values for the bytes, not typed in hex values, so you'd have to use something like hexedit to actually create one.

     

    am335x-evm-scale-data.bin:

     

    0C 57 00 06 00 34 02 2D 25 1F 00 34 02 2D 25 2B

     

    0C 57

    This is a magic number placed in the header, always the same value, that the PM code looks for just as a sanity check that this is the correct type of bin we are looking for.

     

    00 06

    These are offsets to the sleep sequence and the wake sequence from the byte starting after these two offset values. Because of this, the sleep offset will almost always be 0 and then the wake sequence offset will just be the length of the sleep sequence, since it starts immediately after.

     

     

    00 34 02 2D 25 1F

    This is the sleep sequence, first two bytes are the bus speed for i2c0, and then the four bytes after follow the sequence shown in the description above. These four bytes are the ones that would change if you were creating a bin for a new board. All we do here is scale the PMIC Core regulator down to .95V

     

    00 34 02 2D 25 2B

    This is the wake sequence. Same as above with the first two bytes indicating the bus speed and then a single i2c write to set the core reg to 1.1V. Again, this is what would change if you were making one for a custom board.

     

    So basically the bin file is just a way of recording the raw i2c write sequence for a pmic in order to scale voltages to proper levels during suspend and resume without the need for a big i2c driver.