Newer stuff: The MAX8677AE connections: PREQ Doesnt appear connected FLT Yes Active low - Fault DOK Yes Active low - DC power ok UOK No Active low - USB power ok CHG Yes Active low - is charging USB power input is not used (and so nor is UOK). Pulling CHG low turns on charge LED and raises GPIOS 105 and 106. ------------------------------------------------------------------------------------------------ This was all before I had the PXA310 docs so may be inaccurate/incomplete. App Subsytem bits in windows (a while after wakeup from very off-ish by plugging power in): #define PMCR 40F50000) /* Power Manager Control Register */ #define PSR 40F50004) /* Power Manager S2 Status Register */ #define PSPR 40F50008) /* Power Manager Scratch Pad Register */ #define PCFR 40F5000C) /* Power Manager General Configuration Register */ #define PWER 40F50010) /* Power Manager Wake-up Enable Register */ #define PWSR 40F50014) /* Power Manager Wake-up Status Register */ #define PECR 40F50018) /* Power Manager EXT_WAKEUP[1:0] Control Register */ #define DCDCSR 40F50080) /* DC-DC Controller Status Register */ #define PVCR 40F50100) /* Power Manager Voltage Change Control Register */ #define PCMD(x) 40F50110 + ((x) << 2)) 40f50000 | 00000000 00000000 5c014000 cc002002 | .........@.\. .. 40f50010 | 8000000f 00000000 10000000 00000000 | ................ 40f50020 | 00000000 00000000 00000000 00000000 | ................ /* Slave Power Managment Unit */ ASCR 40f40000 00002200 /* Application Subsystem Power Status/Configuration */ ARSR 40f40004 00000000 /* Application Subsystem Reset Status */ AD3ER 40f40008 800010a5 /* Application Subsystem Wake-Up from D3 Enable */ AD3SR 40f4000c 00000080 /* Application Subsystem Wake-Up from D3 Status */ AD2D0ER 40f40010 00201000 /* Application Subsystem Wake-Up from D2 to D0 Enable */ AD2D0SR 40f40014 00000000 /* Application Subsystem Wake-Up from D2 to D0 Status */ AD2D1ER 40f40018 00000000 /* Application Subsystem Wake-Up from D2 to D1 Enable */ AD2D1SR 40f4001c 00000000 /* Application Subsystem Wake-Up from D2 to D1 Status */ AD1D0ER 40f40020 00201000 /* Application Subsystem Wake-Up from D1 to D0 Enable */ AD1D0SR 40f40024 00000000 /* Application Subsystem Wake-Up from D1 to D0 Status */ AGENP 40f4002c 00000000 /* Application Subsystem General Purpose */ AD3R 40f40030 00000001 /* Application Subsystem D3 Configuration */ AD2R 40f40034 00000000 /* Application Subsystem D2 Configuration */ AD1R 40f40038 00000000 /* Application Subsystem D1 Configuration */ 40f40000 | 00002200 00000000 800010a5 00000080 | .".............. 40f40010 | 00201000 00000000 00000000 00000000 | .. ............. 40f40020 | 00201000 00000000 00808080 00000000 | .. ............. 40f40030 | 00000001 00000000 00000000 00000000 | ................ pwr scratch PSPR 40F50008 5c014000 - agrees with pxa3xx.c thing about OBM - nice!! pwr wakeup ena PWER 40f50010 8000000f pwr wakeup st PWSR 40f50014 00000000 Windows seems to use D1 to D0 and D2 to D0. Linux uses D2 to D0. D3 is also marked by windows - DEEP sleep like linux. D2/D1 to D0: 0000 0000 0010 0000 | 0001 0000 0000 0000 #define ADXER_MFP_WMMC1 (1 << 12) /* MFP: MMC1 */ #define ADXER_WKP (1 << 21) /* Keypad */ D3: 1000 0000 0000 0000 | 0001 0000 1010 0101 #define ADXER_WEXTWAKE0 (1 << 0) /* External Wake 0 */ #define ADXER_MFP_WAC97 (1 << 2) /* MFP: AC97 */ #define ADXER_MFP_WUART1 (1 << 5) /* MFP: UART1 */ #define ADXER_MFP_WUART3 (1 << 7) /* MFP: UART3 */ #define ADXER_MFP_WMMC1 (1 << 12) /* MFP: MMC1 */ #define ADXER_WRTC (1 << 31) /* RTC */ wake up status from D3 was UART3 after pluggin power in? wake up status from D3 was EXT_WAKE after pressing power button wake up status from D3 was RTC after alarm - yay :) EXT_WAKE in pxa27x is GPIO wakeup. So is power button on GPIO??... Edge trigger configs: UART3 is configured for n,8,1 and IRQ active lets disable the clock... doesn't detect power remove sticks loading ctrl panel, sticks loading power ctrl panel (comes on reenable) so that'll be the power chip then The search for the power button... IRQs: 40d00004 = IRQ mask = a6d00418. In normal operation: 1010 0110 1101 0000 0000 0100 0001 1000 3 USB Host 1 4 Keypad 10 GPIO_x 20 STUART 22 FFUART 23 MMC 25 DMA Ctrler 26 OS Timer 29 OS Timer 31 RTC Alarm Masked GPIO_x and pressed button - it still went off... hmmm Disable keypad, usb host and STUART, all from their own CTRL regitser... Doesnt power off!!! reenable keypad... Another time... disable only keypad: still goes off disable only stuart: backlight goes off then it crashes. LCD driver still on, hmmm... disable only usbhost: still goes off ARG, where is it???? ---- Looking at winCE fiddling with MFPs just before suspend (suspendLog.ods on ethics) A few pins have thie Alt Func swithed GPIO15 is normally AF0 but on this run was always AF5.. err, not sure about this GPIO15_AF5 = GPIO15_MMC1_CMD GPIO80, switched AF0 to AF4 on suspend, GPIO80_AF4 = GPIO80_MMC2_DAT3 GPIO18 switched AF0 to AF3 on suspend, GPIO18_AF3 = GPIO18_AC97_SDATA_IN_3 Seems to be todo with wakeup from wireless and ac97?? Also, (another time), get it banging away at GPIOs 101 and 107 in the same way as with GPIO80 and 18 before: GPIO101, switched AF0 to AF1, GPIO101_AF1 = GPIO101_UART1_CTS GPIO107, switched AF0 to AF1, GPIO107_AF1 = GPIO107_UART3_CTS So now UARTs are configed for wake-up by pushing those (originally GPIOs) into the CTS Nuts ----- Measuring the current draw without battery On BT WiFi Backlight Current 1 0 0 mid 180-200mA 1 1 0 mid 200-220mA 1 0 1 mid 330-400mA 1 0 0 Full 170mA 1 0 0 Full 280mA 0 0 0 Off 000mA ---------- Windows suspend/resume code (hehe) Found 0x5c014000 in suspend code in windows. Whatever you change it to DOES get copied into the PSPR but doesn't seem to effect window's ability to resume. Suspend is done at v(0x8004e764). Resume vector appears to be virt(0x8004e770) phys(0xbc04e770). This is written by another piece of code to 0xbc000800 (or maybe 0xbc000804). This is 0x800 bytes into memory. ---------------------------------------- Trying to find the bastard power button GPIO 26 was the only other thing that gets specifically SET to EDGE_ detects on suspend Hacked code so it doesn't set the EDGE_ detects Still wakes on power button Ok, another approach. Things set to edge detect before it starts playing: 15, 107, 108, 115, 116, 117, 118, 119, 120, 1002 Things that get determinatly fiddled with: 15, 18, 91, 101, 107, 113, 80, 26 So, the full list, what they are and whether the edge detect is set in the end GPIO In/Out MFP-Addr Edge Known 15 out 2ac BOTH MMC1: Card Detect 18 out 2b8 BOTH AC97: Switched from AF0 to AF3 on suspend (GPIO18_AC97_SDATA_IN_3), so something todo with AC97 26 in 2d8 BOTH ??? 91 50c 101 608 BOTH FFUART: Switched from AF0 to AF1 on suspend (GPIO101_UART1_CTS) so something todo with FFUART 107 620 RISE STUART: Switched from AF0 to AF1 on suspend (GPIO107_UART3_CTS) so something todo with STUART 108 624 BOTH ??? 113 638 ??? 115 640 BOTH Keypad Matrix In 0 116 644 BOTH Keypad Matrix In 1 117 648 BOTH Keypad Matrix In 2 118 64c BOTH Keypad Matrix In 3 119 650 BOTH ??? 120 654 BOTH ??? 80 4e0 FALL MMC2?: Switched to GPIO80_MMC2_DAT3 on suspend - so something todo with wakeup from wireless 1002 2dc BOTH ??? [31:0] 0000 0000 0001 1011 0x00 0101 1111 1110 00c [63:32] 0000 0000 0011 1111 1111 1111 1000 0000 010 [95:64] 0100 0000 0001 1110 0101 0000 1000 0000 014 [127:96] 1011 0001 1000 0101 1000 0001 1001 1111 10c Outputs: 1,2,3,4,5,6,7,8,10,16,17,19,20,39-53,71,,76,78,81,82,83,84,94,96,97,98,99,100,103,104,111,112,114,,119,120,124,125,127 All others input Looking at playing with LCD and ACCR on resume: ACCR goes: xxxxxxxx ??????????????? HSS ??? XN ??? XL |||||||| |..||..||..||.. ||. .|| ..| |.. ||..| 00003108 000000000000000 000 110 001 000 01000 00083108 000000000000100 000 110 001 000 01000 LCD 00087108 000000000000100 001 110 001 000 01000 01087108 000000010000100 001 110 001 000 01000 01087000 000000010000100 001 110 000 000 00000 010b7108 000000010000101 101 110 001 000 01000 01087000 000000010000100 001 110 000 000 00000 010b7210 000000010000101 101 110 010 000 10000 09273110 000010010010011 100 110 001 000 10000 Playing withy it does nothing visible... even setting 0003110 as it comes out of suspend. hmm, suspect this is just speeds, no on/off'ness ------------------------- Ok, MFPs that are set on way down... 15 In MMC1 CD 18 In AC97 91 In ??? 101 In ??? 107 In ??? 113 In ??? 80 In MMC2/WiFi related 26 In ??? All inputs... err.... bugger 00,04,08, 100 Level 0c,10,14, 10c Dir ---------------------------- On resume: (RESUMETRACES) ACCR 00003108 0000 0000 0000 0000 0011 0001 0000 1000 CKENA febfbfff 1111 1110 1011 1111 1011 1111 1111 1111 CKENB fffff7fd 1111 1111 1111 1111 1111 0111 1111 1101 GPIO DIR0 00000000 0000 0000 0000 0000 0000 0000 0000 0000 GPIO DIR1 00000000 0000 0000 0000 0000 0000 0000 0000 0000 GPIO DIR2 00000000 0000 0000 0000 0000 0000 0000 0000 0000 GPIO DIR3 00000000 0000 0000 0000 0000 0000 0000 0000 0000 GPIO LEVEL0 01400003 0000 0001 0100 0000 0000 0000 0000 0011 GPIO LEVEL1 00000000 0000 0000 0000 0000 0000 0000 0000 0000 GPIO LEVEL2 50000040 0101 0000 0000 0000 0000 0000 0100 0000 GPIO LEVEL3 20019600 0010 0000 0000 0001 1001 0110 0000 0000 LCD 0c 00000000 LCD 10 00000000 ... Ok, getting somewhere now... Code that turns LCD on/off is at 0x0bb08xxx MVA = 0x01b08xxx VA, but windows only maps the MVA'ed areas when it uses them.... wtf? Anyway, it runs (/sbBuild/disass/hal.S) with these addresses mapped: 00460000 40a00000 OS Timers 00480000 41340000 App Subsys Clocks 00490000 41000000 SSP1 004a0000 40e00000 GPIOs GPIO 112 is fiddled with, it seems to twiddle it during the switch on. Nopping the code to stop it twiddling it doesnt stop it going down/up. Turning it off myself kills the LCD and the code won't fix that if you NOP the fiddling. Weirdness Suspend/Resume from Cold boot: Oops on SR with power. Resets on battery. Pasting from-win MFP settings in from cold boot makes it come back to linux on battery then oops like on power. Have docs - yay!... PCFR - Power Management Unit Gen Config Reg: 40f5000c Windows: cc002002: c = x32kHz = 125ms delay c = Same in windows in general as in linux on suspend.