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.

How to reset AM335x processor?

Hi,

    I'm working with am335x and I'd like to know a way to "reset" am335x mpu.  I want to be able to do similar to cold-reset of am335x.  The kernel I'm using is 3.12. Could you help?

Thanks.

  • Hi Steve,

    Do you need to reset the AM335x board in user space, after kernel v3.12 boot up?

    BR
    Pavel
  • Hi Pavel,
    Yes, user-space is preferred but in kernel or at uboot is also ok with me. How can I achieve it?

    Thanks
  • Steve,

    Can you provide the output of the "help" command passed to the u-boot? You should have there "reset" command:

    Hit any key to stop autoboot:  0

    U-Boot # help

    reset   - Perform RESET of the CPU

    From user space you can try with "reboot" command and/or "init 6". See the below wiki page for more info regarding "init 6" command:

    Regards,
    Pavel

  • Hi Pavel, thanks for the quick reply. However, I'm looking for a way to do a cold-reset. Is there a register in am335x that I can set using devmem2?
  • Check the below sections in AM335x TRM:

    8.1.7.3.4 Global Cold Software Reset (GLOBAL_COLD_SW_RST)
    The source for GLOBAL_COLD_SW_RST is generated internally by the PRM. It is activated upon setting the PRM_RSTCTRL.RST_GLOBAL_COLD_SW bit in the PRM memory map. This bit is self-clearing, i.e., it is automatically cleared by the hardware.

    8.1.13.5.1 PRM_RSTCTRL Register (offset = 0h) [reset = 0h]

    You can also check which reset exactly is generated from the reset, reboot, init 6 commands with the PRM_RSTST status register.

    Regards,
    Pavel
  • Hi, before writing that bit to in PRM_RSTCTRL, do I need to exit all applications first and do sync()?

    Also, bits[31:2] in PRM_RSTCTRL are reserved, so is it safe to write 0x1 or 0x2 to it? Or do I have to read this reg first, then "OR" the result? Thank you so much.
  • STEVE HUYNH said:
    Hi, before writing that bit to in PRM_RSTCTRL, do I need to exit all applications first and do sync()?

    Yes, this is recommended. You can also unmount any mounted devices before initiating this reset.

    STEVE HUYNH said:
    Also, bits[31:2] in PRM_RSTCTRL are reserved, so is it safe to write 0x1 or 0x2 to it? Or do I have to read this reg first, then "OR" the result? Thank you so much.

    Applying a mask (thus modify only the bit you need) is recommended.

    BR
    Pavel

  • Hi Pavel, this is helpful information. After I wrote GLOBAL_COLD_SW_RST bit in PRM_RSTCTRL, my am335x unit reboots and PRM_RSTST register indicates that it's GLOBAL_COLD_RST.

    However, this doesn't seem to reset the I2C bus of am335x (like unplug/plug PowerSupply). Any ideas?
  • STEVE HUYNH said:
    However, this doesn't seem to reset the I2C bus of am335x (like unplug/plug PowerSupply). Any ideas?

    Do you mean that AM335x I2C registers are not in their default/reset state after GLOBAL_COLD_SW_RST?

    Regards,
    Pavel

  • Hi,
    I2C devices will not be reset unless they are connected to the reset output pin of AM335.
    You need to check the schematic diagram of your board for the I2C devices' reset circuitry. You may need to issue reset from the PMIC.
    Also, there is a chance some I2C devices can be resettable by software through the I2C bus. Check their datasheets.
    If I misunderstood "reset the I2C bus of am335x (like unplug/plug PowerSupply)", sorry for the spam.
    Regards,
    Stan

  • Hi Pavel,  setting GLOBAL_COLD_SW_RST bit in PRM_RSTCTRL causes my board to reboot and PRM_RSTST is stating that we have GLOBAL_COLD_RST.   Before the board is rebooted, it has I2C "timeout waiting for bus ready" on OMAP I2C Adapter 1.

    I thought after doing GLOBAL_COLD_SW_RST, all the am335x peripherals would reset.  But I'm still seeing I2C timeout and 3axis sensor on that I2C bus 1 is not working unless I power-cycle the board.

    Thanks.

  • Steve,

    STEVE HUYNH said:
    I thought after doing GLOBAL_COLD_SW_RST, all the am335x peripherals would reset.  But I'm still seeing I2C timeout and 3axis sensor on that I2C bus 1 is not working unless I power-cycle the board.

    Do you mean that AM335x I2C peripheral is not reset or 3axis sensor is not reset? Do you connect the 3axis sensor only to AM335x I2C pins or also to RESETIN_OUT pin?

    Can you check the AM335x I2C registers values before and after GLOBAL_COLD_SW_RST, are they the same? If yes, then you should also use the I2C_SYSC[1] SRST. See AM335x TRM, section 21.3.3 I2C Reset


    BR
    Pavel




  • Hi, my sensor is connected to I2C pins of am335x.

    a) How do I connect to RESETIN_OUT pin of am335x? Through HW wiring or can I do it in SW (device tree config)?
    b) I tried to set bit[1] of I2C_SYSC but it fails. Is it because the I2C bus 1 is already messed up?
    # ./devmem2 0x4802A010 w 0x2
    /dev/mem opened.
    Memory mapped at address 0xb6f6f[ 175.142984] Unhandled fault: external abort on non-linefetch (0x1018) at 0xb6f6f010
    000.
    Bus error

    c) Are there other ways to reset I2C adapter module?

    Thanks.
  • STEVE HUYNH said:
    a) How do I connect to RESETIN_OUT pin of am335x? Through HW wiring or can I do it in SW (device tree config)?

    Most of the I2C sensors do not have reset input, what about your specific sensor? If it has, then HW wiring is needed.

    STEVE HUYNH said:
    b) I tried to set bit[1] of I2C_SYSC but it fails. Is it because the I2C bus 1 is already messed up?
    # ./devmem2 0x4802A010 w 0x2
    /dev/mem opened.
    Memory mapped at address 0xb6f6f[ 175.142984] Unhandled fault: external abort on non-linefetch (0x1018) at 0xb6f6f010
    000.
    Bus error

    Looks like the I2C1 clock is not functional. Can you try with reading any I2C1 status register with devmem2, what is the result?

    STEVE HUYNH said:
    c) Are there other ways to reset I2C adapter module?

    What is your definition of "I2C adapter module"? Is this AM335x I2C module or external I2C sensor or else?

    BR
    Pavel

  • My sensor doesn't seem to have reset input.

    Which I2C1 stat registers can I read and what should the expected output be?
    I meant to ask if you knew other ways to reset "I2C module of AM335x".

    Thanks a lot.
  • STEVE HUYNH said:
    Which I2C1 stat registers can I read and what should the expected output be?

    You can read I2C_IRQSTATUS/0x4802A028 and the expected output should be successful read access.

    STEVE HUYNH said:
    I meant to ask if you knew other ways to reset "I2C module of AM335x".

    I have already provided to you all the ways to reset AM335x I2C module, see AM335x TRM, section 21.3.3 I2C Reset

    BR
    Pavel

  • Hi Pavel,
    My board also has PMIC tps6591x. Is there a command from Kernel userspace or uboot to write to PMIC to reset am335x processor? I appreciate your help.

    Thanks.
    Hiep
  • Steve,

    There is PMIC forum for handling PMIC related questions. You can go and ask there.

    BR
    Pavel
  • Hi Steve,
    I was not able to look in the PMIC driver, but if you see the tps6591x datasheet, there are 2 bits to set:
    1. Ensure SWOFF_COLDRST[2] SW_RST = 1 (cold restart)
    2. Set DEV_CTRL[1] SW_RST = 1 (Writing 1 will initiate restart of the device (turn-off sequence followed by turn-on sequence))

    Regards,
    Stan

  • Hi Stan, can I write these bits from userspace using devmem2? Or from Uboot? Could you help give me examples? Thank you.
  • Hi,

    I'm sorry I did not try this myself.

    Take into account that PMIC's registers are available through I2C interface (typically I2C1 of SoC, which should be /dev/i2c0 in linux).

    You can try to write registers through /dev/i2c0 or use the pmic driver from http://www.ti.com/tool/tps65910sw-linux#descriptionArea

    In  u-boot you must use i2c driver to write pmic registers.