Soft reset LS1021A from Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Soft reset LS1021A from Linux

1,398 Views
rahulr
Contributor II

My understanding is that the Linux reboot command will cause a watchdog timeout to create the reset condition. Is there a Linux command to perform a core soft reset?

Section 4.4.3 (Core soft reset) of the LS1021A reference manual explains steps for soft reset. Since I am using Linux, do I need to manually manipulate registers and create ISRs if I were to write a tool for soft reset?

  1. Write '1' to SCFG_CORESRENCR[CORESREN], to enable the soft reset to the corresponding core.
  2. Write '1' to SCFG_CORE0_SFT_RST[SOFT_RESET] and SCFG_CORE1_SFT_RST[SOFT_RESET] to enable the soft reset to the core 0 and core 1 respectively. Writing '1' to these bits triggers the corresponding interrupt to respective cores (Interrupt ID 228 and Interrupt ID 229). The interrupts need to be configured as edge trigger interrupt.
  3. Perform the GIC interrupt mapping as follows:
    • Enable the interrupt.
    • Select edge trigger mode.
    • Route 228 to core 0 and 229 to core 1.
  4. In the core 0 ISR, set SCFG_CORE0SFTRSTSR[SFTRST] for the chip to recognize the soft reset to core 0 and execute WFI instruction.
  5. In the core 1 ISR, execute the WFI instruction.
  6. Once the cores execute WFI instruction, COP generates the corresponding core soft reset.
Labels (1)
3 Replies

977 Views
erdani80
Contributor III

If you look at arch/arm/mach-imx/platsmp.c you can see the code used to boot the secondary procesor in SMP configuration.

If you just want to reset this core you can use the linux CPU hotplug support to bring the secondary core down and up again.

0 Kudos

977 Views
rahulr
Contributor II

I can turn off cpu1 by writing 0 to /sys/devices/system/cpu/cpu1/online

echo 0 > /sys/devices/system/cpu/cpu1/online

LS1021A does not allow shutting down cpu0 this way.

I am looking for a way to perform core soft reset instead of turning off/on cpu cores.

0 Kudos

977 Views
erdani80
Contributor III

Then probably the best option is to add the soft reset to the kernel either in a driver or into a custom syscall and call this code from userspace using a compatible method: syscall calling from C code or driver manipulation using sysfs or ioctl for example.