Ignore:
Timestamp:
03/08/07 23:04:04 (6 years ago)
Author:
werner
Message:

board/neo1973/neo1973.c (board_late_init): poll for the boot menu also on RAM

boot, reset, or unknown cause

board/neo1973/neo1973.c (board_late_init): don't look for the power key if

woken up by the charger

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/u-boot/patches/boot-menu.patch

    r1193 r1283  
    1212u-boot/common/console.c, include/console.h: added "console_poll_hook" to be 
    1313  called when waiting for console in put in "getc" and "tstc" 
     14board/neo1973/neo1973.c (board_late_init): poll for the boot menu also on RAM 
     15  boot, reset, or unknown cause 
     16board/neo1973/neo1973.c (board_late_init): don't look for the power key if 
     17  woken up by the charger 
    1418 
    1519- Werner Almesberger <werner@openmoko.org> 
     
    359363--- u-boot.orig/board/neo1973/neo1973.c 
    360364+++ u-boot/board/neo1973/neo1973.c 
    361 @@ -196,6 +196,7 @@ int board_late_init(void) 
     365@@ -196,10 +196,15 @@ int board_late_init(void) 
    362366        extern unsigned char booted_from_nand; 
    363367        unsigned char tmp; 
    364368        char buf[32]; 
    365369+       int menu_vote = 0; /* <= 0: no, > 0: yes */ 
     370+       int seconds = 0; 
    366371  
    367372        /* Initialize the Power Management Unit with a safe register set */ 
    368373        pcf50606_init(); 
    369 @@ -219,25 +220,18 @@ int board_late_init(void) 
     374  
     375+       /* if there's no other reason, must be regular reset */ 
     376+       neo1973_wakeup_cause = NEO1973_WAKEUP_RESET; 
     377+ 
     378        if (!booted_from_nand) 
     379                goto woken_by_reset; 
     380  
     381@@ -209,45 +214,41 @@ int board_late_init(void) 
     382        setenv("pcf50606_int1", buf); 
     383  
     384        if (tmp & PCF50606_INT1_ALARM) { 
     385-               /* we've been woken up by RTC alarm or charger insert, boot */ 
     386+               /* we've been woken up by RTC alarm, boot */ 
     387                neo1973_wakeup_cause = NEO1973_WAKEUP_ALARM; 
     388                goto continue_boot; 
     389        } 
     390        if (tmp & PCF50606_INT1_EXTONR) { 
     391+               /* we've been woken up by charger insert */ 
     392                neo1973_wakeup_cause = NEO1973_WAKEUP_CHARGER; 
     393        } 
    370394  
    371395        if (tmp & PCF50606_INT1_ONKEYF) { 
    372                 int seconds = 0; 
    373 + 
    374                 neo1973_wakeup_cause = NEO1973_WAKEUP_POWER_KEY; 
     396-               int seconds = 0; 
     397-               neo1973_wakeup_cause = NEO1973_WAKEUP_POWER_KEY; 
    375398                /* we've been woken up by a falling edge of the onkey */ 
     399+               neo1973_wakeup_cause = NEO1973_WAKEUP_POWER_KEY; 
     400+       } 
    376401  
    377402-               /* we can't just setenv(bootdelay,-1) because that would 
     
    386411-                       if (oocs & PFC50606_OOCS_ONKEY) 
    387412-                               break; 
    388 +               while (neo1973_on_key_pressed()) { 
    389 +                       if (neo1973_911_key_pressed()) 
    390 +                               menu_vote++; 
    391 +                       else 
    392 +                               menu_vote--; 
    393   
     413- 
    394414-                       int1 = pcf50606_reg_read(PCF50606_REG_INT1); 
    395415-                       if (int1 & PCF50606_INT1_SECOND) 
    396 +                       if (neo1973_new_second()) 
    397                                 seconds++; 
     416-                               seconds++; 
    398417- 
    399                         if (seconds >= POWER_KEY_SECONDS) 
    400                                 goto continue_boot; 
    401                 } 
    402 @@ -262,6 +256,11 @@ continue_boot: 
     418-                       if (seconds >= POWER_KEY_SECONDS) 
     419-                               goto continue_boot; 
     420-               } 
     421-               /* Power off if minimum number of seconds not reached */ 
     422-               neo1973_poweroff(); 
     423+       if (neo1973_wakeup_cause == NEO1973_WAKEUP_CHARGER) { 
     424+               /* if we still think it was only a charger insert, boot */ 
     425+               goto continue_boot; 
     426        } 
     427  
     428 woken_by_reset: 
     429-       /* if there's no other reason, must be regular reset */ 
     430-       neo1973_wakeup_cause = NEO1973_WAKEUP_RESET; 
     431+ 
     432+       while (neo1973_wakeup_cause == NEO1973_WAKEUP_RESET || 
     433+           neo1973_on_key_pressed()) { 
     434+               if (neo1973_911_key_pressed()) 
     435+                       menu_vote++; 
     436+               else 
     437+                       menu_vote--; 
     438+ 
     439+               if (neo1973_new_second()) 
     440+                       seconds++; 
     441+               if (seconds >= POWER_KEY_SECONDS) 
     442+                       goto continue_boot; 
     443+       } 
     444+       /* Power off if minimum number of seconds not reached */ 
     445+       neo1973_poweroff(); 
     446  
     447 continue_boot: 
     448        jbt6k74_init(); 
     449@@ -262,6 +263,11 @@ continue_boot: 
    403450        /* switch on the backlight */ 
    404451        neo1973_backlight(1); 
     
    412459 } 
    413460  
    414 @@ -313,6 +312,16 @@ void neo1973_vibrator(int on) 
     461@@ -313,6 +319,16 @@ void neo1973_vibrator(int on) 
    415462                gpio->GPBDAT &= ~(1 << 10); 
    416463 } 
Note: See TracChangeset for help on using the changeset viewer.