Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8690487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:54:47+00:00 2026-06-12T23:54:47+00:00

I try to implement a low power deep sleep functionality into uboot on button

  • 0

I try to implement a low power “deep sleep” functionality into uboot on button press. Button press is handled by linux and a magic code is set to make u-boot aware of the stay asleep do not reboot”

    printf ("\nDisable interrupts to restore them later\n");
    rupts = disable_interrupts();
    printf ("\nEnable interrupts to enable magic wakeup later\n");
    enable_interrupts();
    printf ("\nSuspending. Press button to restart\n");

    while(probe_button()/*gpio probe*/){
#if 1
            //FIXME recheck if that one actually needs an unmasked interrupt or any is ok
            __asm__ __volatile__(
                            "mcr p15, 0, %0, c7, c0, 4\n" /* read cp15 */
                            "mov %0, %0"
                            : "=r" (tmp)
                            :
                            : "memory"
            );
#else
            udelay (10000);
#endif
    }
    if (rupts) {
            printf ("\nRe-Enabling interrupts\n");
            enable_interrupts();
    }

Unfortunatly the power dissipation does not change at all (got power dissipation measurment tied to the chip), no matter if hotspinning is used or not. Beyond that, if I use the Wait-For-Interrupt CP15 instruction, it never wakes up. The button is attached to one of the GPIOs. The plattform is Marvell Kirkwood ARM9EJ-S based.

I enabled some CONFIG_IRQ_* manually, and create implementation for arch_init_irq() aswell as do_irq(), I think there is my issue.

According to the CP15 instruction docs it should be just enough that a interrupt gets triggered (no matter if masked or not!).

Can anyone tell me what I am doing wrong or what needs to be done beyond the code above?

Thanks a lot in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:54:48+00:00Added an answer on June 12, 2026 at 11:54 pm

    I’m not sure if it is the only reason your aproach isn’t working on power saving but your inline assembly isn’t correct. According to this article you need to execute:

    MOV R0, #0
    MCR p15, 0, r0, c7, c0, 4
    

    but your inline assembly

            __asm__ __volatile__(
                            "mcr p15, 0, %0, c7, c0, 4\n" /* read cp15 */
                            "mov %0, %0"
                            : "=r" (tmp)
                            :
                            : "memory"
            );
    

    produces

       0:   ee073f90    mcr 15, 0, r3, cr7, cr0, {4}
       4:   e1a03003    mov r3, r3
       8:   e12fff1e    bx  lr
    

    I am not sure what’s your intent but mov r3, r3 doesn’ẗ have any effect. So you are making coprocessor call with a random value. You also need to set r3 (ARM source register for mcr) before mcr call. Btw when you put ‘memory’ in clobber list it means

    … will cause GCC to not keep memory values cached in registers across the assembler instruction and not optimize stores or loads to that memory.

    Try this line,

    asm("MOV R0, #0\n MCR p15, 0, r0, c7, c0, 4" : : : "r0");
    

    it produces

       c:   e3a00000    mov r0, #0  ; 0x0
      10:   ee070f90    mcr 15, 0, r0, cr7, cr0, {4}
    

    For power saving in general, I would recommend this article at ARM’s web site.

    Bonus section:
    A small answer to your claim on backward compability of this coprocessor supplied WFI:

    ARMv7 processors (including Cortex-A8, Cortex-A9, Cortex-R4 and Cortex-M3) all implement the WFI instruction to enter “wait for interrupt” mode. On these processors, the coprocessor write used on earlier processors will always execute as a NOP. It is therefore possible to write code that will work across ARMv6K, ARMv6T2 and all profiles of ARMv7 by executing both the MCR and WFI instruction, though on ARM11MPCore this will cause “wait for interrupt” mode to be entered twice. To write fully portable code that enters “wait for interrupt” mode, the CPUID register must be read at runtime to determine whether “wait for interrupt” is available and the instruction needed to enter it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to implement the animation: when you enter iPhone Gallery, press the image,
I had try to implement the send me log feature into my apps but
i try to implement panning and zooming functionality like safari browser in ipad. i
I try to implement a Google +1 button in my website, but for some
I rewrote some of the code to implement the two answers below, and low
I try to implement a hover effect (effect when button is pressed) through putting
I try to implement a TableCellEditor that conains some fields and a delete-button. It
I try implement compound view for my dashboard activity. It's Button with TextView .
I try to implement footer datagrid with allowMultipleSelection properties. But in my case, it
I try to implement a browser-like app. I want to let it can open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.