summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Put timer_dos test behind console commandstabilize-4008.0.BVic Yang2013-04-151-8/+28
| | | | | | | | | | | BUG=chrome-os-partner:18598 TEST=Run on Spring BRANCH=None Change-Id: I843591089c3d1bc739c452ee654da194355ddb09 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48092 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix timer_calib testVic Yang2013-04-152-27/+38
| | | | | | | | | | | BUG=chrome-os-partner:18598 TEST=Run on Spring BRANCH=None Change-Id: I55057ee7727858b040ea23ed8802ab7022cc63ac Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48091 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix flash testsVic Yang2013-04-1510-280/+205
| | | | | | | | | | | | | This merges flash_overwrite and flash_rw_erase to a single test binary. BUG=chrome-os-partner:18598 TEST=Run on Spring BRANCH=None Change-Id: I1da7577cb5dc196178930dda3a07bb942d959866 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48090 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Refactor gpio_set_level() and gpio_pre_init()Randall Spangler2013-04-159-118/+138
| | | | | | | | | | | | | | | | | | | | | | | | | gpio_set_level() now allows setting the pin level if GPIO_LOW or GPIO_HIGH is specified. Previously, stm32 platforms did this even though the definition of gpio_set_level() said it wouldn't work. Fixed gpio_set_level() not setting level after warm reboot on stm32 because it was checking the GPIO_DEFAULT flag in the wrong place. Fixed LM4 still mucking with alternate function settings and levels even if GPIO_DEFAULT was specified. And checked gpio_list[] and all of the calls to gpio_set_flags() to make sure everything still behaves the same way it did before (or better, in the case of actual bugs). BUG=chrome-os-partner:18718 BRANCH=none TEST=build all platforms; boot spring and link Change-Id: I4b84815f76060252df235ff9a37da52c54a8eac5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48058 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Fix test compilation error for linkVic Yang2013-04-135-3/+27
| | | | | | | | | | | | | Now pingpong and mutex tests compile. Still need some more work to handle the i8042-specific KEYPROTO task for keyboard tests. BUG=chrome-os-partner:18598 TEST=Build tests for link BRANCH=None Change-Id: I9ee35d4edb811f17b9a81beb799484a07c0bef14 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47981
* Add debounce test to kb_deghost and change name to kb_scanVic Yang2013-04-137-319/+251
| | | | | | | | | | | | | | To minimize the number of test binaries, we should put as many tests in a single binary as possible. This CL merges kb_debouncing and kb_deghosting and renames them to kb_scan. BUG=chrome-os-partner:18598 TEST=Run on Spring BRANCH=None Change-Id: I876363ba68c692a7af10badfa474a2ea9a9d002c Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47980
* Remove unused mock setting for kb_deghost testVic Yang2013-04-131-5/+1
| | | | | | | | | | | | | Those mock files were used by QEMU-based test. Now that we moved to hardware test, we can remove them. BUG=chrome-os-partner:18598 TEST=Run on Spring BRANCH=None Change-Id: I1600b39132c598a07d3d6439fd837c0d78ea8820 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47968
* Add a test for testing common utilitiesVic Yang2013-04-133-1/+102
| | | | | | | | | | BUG=chrome-os-partner:18598 TEST=Run on Spring BRANCH=None Change-Id: Ie10f81783a0c22a10b9535350dc29b972bffd87e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47962
* Remove unused GPIO macrosRandall Spangler2013-04-121-25/+1
| | | | | | | | | | | | | | All accesses use the _OFF variants. No need to have 2 ways of doing the same thing. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I914e6dd9027bcf2268e33ae2e8cfb41093b0b05d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48032 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Clean up alternate functions on STM32LRandall Spangler2013-04-121-21/+9
| | | | | | | | | | | | | | | The MODER register is used to set (alt-func | analog | gpio-in | gpio-out). So there's no need to force things to be normal GPIOs in board config, since gpio_pre_init() will clear the alternate function-ness as part of setting the GPIO direction. BUG=chrome-os-partner:18657 BRANCH=none TEST=build pit and test-boot on daisy Change-Id: I82db9d9f4d8877464d62c1ff2efaef36822fc0ca Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47904
* Daisy doesn't use STM32F100Randall Spangler2013-04-121-1/+1
| | | | | | | | | | | | So there's no need to check for BOARD_daisy there BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I518e4a091d279fc6b23d1c9448362c3b315a6905 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47894
* Allow GPIO alternate function 0Randall Spangler2013-04-115-6/+17
| | | | | | | | | | | | | | | | | gpio_set_alternate_function() used 0 to mean "normal GPIO function". But on chips like STM32L, alternate function 0 is actually a function on some pins. So change "normal GPIO function" to -1. Also add support for this on STM32L. BUG=chrome-os-partner:18343 BRANCH=none TEST=build and boot link and daisy Change-Id: I9cdd9ad91a315b616e373a0dc9a50545cf9d20fa Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47903 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move gpio_get_name() to gpio_common.cRandall Spangler2013-04-115-25/+13
| | | | | | | | | | | | | | | Its implementation is the same on all platforms. No functional changes, just renaming/moving. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I78741c6587ea61e7ac8edae5a509502b7ab5078b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47898 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Strip out old LPC command protocolRandall Spangler2013-04-115-113/+33
| | | | | | | | | | | | | | | | | | | | | | Nothing has used this since link EVT, so it's just dead code at this point. BUG=chrome-os-partner:13213 BRANCH=none TEST=manual - Update ectool but leave old firmware - ectool version -> works - ectool flashread 0 0x10000 foo -> puts the first 64KB of EC flash into foo - Update firmware - ectool version -> works - ectool flashread 0 0x10000 foo -> puts the first 64KB of EC flash into foo - power+esc+refresh -> recovery mode Change-Id: Ib25a705bcd8280d5295c8e7890969d796542b6c9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47866 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Fix kb_deghost testVic Yang2013-04-115-4/+150
| | | | | | | | | | BUG=chrome-os-partner:18598 TEST=Run test on Spring BRANCH=none Change-Id: Ia95ba6144dbdac0ffe77f6aef9c4ed948de181d8 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47841
* Fix mutex testVic Yang2013-04-112-21/+32
| | | | | | | | | | | | | | Puts test behind a console command and also fix uart_printf calls. Also reduces stack size to fit tasks into STM32 memory. BUG=chrome-os-partner:18598 TEST=Run mutex test on Spring. BRANCH=none Change-Id: Icac77876ae01fc98b4e38f27e07f788b6c9bdd70 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47834 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Exclude chipset task from test binariesVic Yang2013-04-1111-6/+16
| | | | | | | | | | | | | | | For most tests, we don't need to power the AP. Let's exclude chipset task to save memory space. BUG=chrome-os-partner:18598 TEST=Run pingpong test on Spring BRANCH=none Change-Id: I545c5b3e1c27b0067d4ffe09a7971d32b75d6039 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47833 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fix pingpong testVic Yang2013-04-112-13/+40
| | | | | | | | | | | | | | This fixes outdated uart_printf calls and also put the test behind a console command 'runtest'. The console command returns 'Pass' or 'Fail'. BUG=chrome-os-partner:18598 TEST=Run pingpong test on Spring BRANCH=none Change-Id: Ia2c439685447e42b278556ca66c9f080d4cafe11 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47831 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Clean up USB external power moduleRandall Spangler2013-04-106-218/+269
| | | | | | | | | | | | | | | | | | | | Make internal APIs static, and remove board_ prefix for clarity. Move TSU6721 calls from charger task to extpower_usb functions for better encapsulation. No functional changes, just moving code. Yes, this will make cherry-picking back from spring to TOT less convenient, but now the code is more readable and it will make maintaining the PMU code easier as we add boards. BUG=chrome-os-partner:18343 BRANCH=none TEST=build spring Change-Id: I52b37e57fc8519859996a110b0503277c6f0bbc8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47657
* Remove unneeded USB_CHARGE_PORT_COUNTRandall Spangler2013-04-104-8/+0
| | | | | | | | | | | | | | | | | | This only needs to be defined if CONFIG_USB_CHARGE is defined (that is, if the board has a USB charge controller. (Note the difference between providing power over USB vs. receiving power over USB; the names are confusing and I'll rename one of the two imminently.) BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I7355b4248bb2d4f5f71cc9f8d9d8f9d6c0069f2b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47658 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move REG16 and REG32 macros to common.hRandall Spangler2013-04-104-151/+150
| | | | | | | | | | | | | | | And use them for LM4 as well as STM32. Consistency is good. No functional changes, just moving/renaming code. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I029a21fadb50726500255219dc38615874a369e7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47700 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Fix tasklist for testsVic Yang2013-04-1016-136/+47
| | | | | | | | | | | | | | This removes all tasks defined in board tasklist and changes syntax to CONFIG_TEST_TASK_LIST and TASK_TEST. BUG=chrome-os-partner:18598 TEST=None BRANCH=None Change-Id: Ie56c8edcb1dbf0ba0d0426ffce2a525594602a91 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47738 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Turn on/off 3.3V output properlyVic Yang2013-04-101-2/+26
| | | | | | | | | | | | | | | When the system is turned off and then back on, we need to re-enable 3.3V output from TPS65090. Also, when we see 5V input, we should shut down 3.3V output and re-enable it when 5V input goes away. BUG=chrome-os-partner:18186, chrome-os-partner:18482 TEST=Manual BRANCH=spring Change-Id: I0cf0597a60988cc9ec28282eea54908c81e5eabc Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47736 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Only includes necessary tasks for test binariesVic Yang2013-04-1012-69/+110
| | | | | | | | | | | | | | | | | | | | This changes current TASK() syntax to TASK_BASE() and TASK_NORMAL(), where TASK_BASE is necessary for the EC to boot on a board and TASK_NORMAL represents the task that can be removed in a test binary. Tasks introduced by a test should be listed as TASK_TEST(). Note that this CL breaks current tests (many of them are broken anyway), which will be fixed in up coming CLs. BUG=chrome-os-partner:18598 TEST=Build link/bds/spring/snow/daisy/mccroskey. (mccroskey failed for unrelated issue) BRANCH=none Change-Id: Ic645cdae0906ed21dc473553f1f43c2537ec4bb9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47531
* Decouple gaia_power from keyscan taskVic Yang2013-04-101-0/+2
| | | | | | | | | | | | This makes gaia_power.c compile when keyscan task is not present. BUG=chrome-os-partner:18598 TEST=Build spring without keyscan task. BRANCH=none Change-Id: I70823fb562a2542d92929b9219d034216f636938 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47630
* Rename usb_charging.c to extpower_usb.c and move to common/Randall Spangler2013-04-094-2/+4
| | | | | | | | | | | | | | | | | This more clearly indicates what it does - it manages external power supplied by USB. This code will be common to multiple boards which take power via USB, so it might as well move now. No code changes, just moving the file. BUG=chrome-os-partner:18343 BRANCH=none TEST=build spring Change-Id: Iae74122db38666bc346104a5096fa82df8cb0c19 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47656 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Fix mccroskey buildRandall Spangler2013-04-091-0/+8
| | | | | | | | | | | | | There's no chipset for mccroskey, so its keyboard code stopped compiling. BUG=chrome-os-partner:18343 BRANCH=none TEST=build mccroskey, spring, link Change-Id: If94dfaf2819f047a6aa825ee10aa1d320c8ca882 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47566 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add pit boardRandall Spangler2013-04-094-0/+349
| | | | | | | | | | | | | | | | | GPIO mapping is correct for current schematics. Things to fix are #ifdef'd out with PORT_TO_PIT, but those require changing other files (which is most tidily done in separate CLs). BUG=chrome-os-partner:18657 BRANCH=pit TEST=build pit (can't test the binary yet; no hardware) Change-Id: Id1d1bb0c2925cfc0c21ee2d91666028aa6d2a707 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47599 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org>
* Decouple keyboard MKBP code from key scan codeVic Yang2013-04-081-36/+58
| | | | | | | | | | | | | | | When unit testing, we may need to disable key scan task but leave keyboard protocol code for testing. Also fix a bug in determining if ENABLE flag is set. BUG=chrome-os-partner:18598 TEST=Remove KEYSCAN task and build for spring. BRANCH=none Change-Id: I3b3adf1257e8446fd1f57bce50b4c7a029b1ce3b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47539
* Clean up daisy GPIO and SPI initRandall Spangler2013-04-086-41/+12
| | | | | | | | | | | | | | | Much of the board init duplicated stuff already done in gpio init, so remove it. Powering the SPI module should be done in spi.c, not board.c. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; boot EC on daisy Change-Id: I9a99eeeb971ebbf7de5b9c0548153684fbb7fff6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47469 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move power LED GPIO code from snow board.c into power_led.cRandall Spangler2013-04-084-65/+27
| | | | | | | | | | | | | | | And remove the daisy power button LED task for now. Since daisy didn't have a board.c implementation (or a power button LED), its power LED task did nothing. BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy, snow, spring Change-Id: I1eb3d0bd038d88685e7caad087eb1a1d1495ef9a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47442 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Add macros for mocking functionsVic Yang2013-04-081-0/+12
| | | | | | | | | | | | | | | This introduces two symbols for mocking functions in existing code: - test_mockable - test_mockable_static BUG=chrome-os-partner:18598 TEST=none BRANCH=none Change-Id: Ia7251a9b609136c8f3b155c221634bac7dcb1d68 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47540 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Rename onewire_led functions and constantsRandall Spangler2013-04-051-30/+29
| | | | | | | | | | | | | | | | This removes overlap between onewire_led.c (LED on link cable) and powerled.c (LED on snow power button), which had the same names but did different things. No functional changes, just renaming. BUG=chrome-os-partner:18343 BRANCH=none TEST=build link Change-Id: I711f1a7e4e5512d1923872cb0f19d64be153c7c5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47420
* Clean up board configurationRandall Spangler2013-04-0516-97/+91
| | | | | | | | | | | | | | | | | Board configuration interfaces are now defined in board_config.h, not in every board.h file. Tidied /alphabetized CONFIG defines. No functional changes, just rearranging code. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all targets Change-Id: I6196591784f8fa9ce6dfccd31891b679fb200063 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47419
* Move board hard reset code into tpschrome driverRandall Spangler2013-04-057-72/+70
| | | | | | | | | | | | | | | | | Hard reset is done by shorting 3.3V to ground. This is only really necessary to work around the PMU's I2C engine getting into a weird / uncommunicative state. This should not make any functional changes; the code is behaving the same way it did before. BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy, snow, spring Change-Id: I0edbdfc11bd5f6643075ffc83f4df3e11fc14675 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47199
* Dumping stack contents on crash.Daisuke Nojiri2013-04-051-5/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | > crash divzero === EXCEPTION: 06 ====== xPSR: 01000200 =========== r0 :00000000 r1 :0000db92 r2 :4000c018 r3 :200029c8 r4 :00000001 r5 :00000000 r6 :200056e4 r7 :00000000 r8 :00000000 r9 :200056f2 r10:00000000 r11:00000000 r12:00000000 sp :20002958 lr :00000355 pc :00000360 Divide by 0 mmfs = 2000000, shcsr = 70008, hfsr = 0, dfsr = 0 =========== Process Stack Contents =========== 200029c4: 200029c8 0000033d 00000002 0000d1b8 200029d4: 000095ef 200056e4 200056ea 00000000 200029e4: 00000000 00000000 00000000 00000000 200029f4: 00000000 00000000 00000000 00000000 Rebooting... BUG=chrome-os-partner:16901 TEST=build link BRANCH=none Change-Id: I040a9cadf443bfdb3781ffc25a3376bf4aea30ef Signed-off-by: Daisuke Nojiri <dnojiri@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/46455 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Improve deferred function callsRandall Spangler2013-04-045-22/+33
| | | | | | | | | | | | | | | | | | | 1) Check vs. number of allowable deferred function calls is made at link time. 2) Added a check for whether hook_call_deferred() has been made after the start of calculating the time when the hook task should wake. If it has, go back and recalculate the wake time. This works around a race condition. BUG=chrome-os-partner:18473 BRANCH=none TEST=add a bunch of deferrable functions and recompile; generates a link error Change-Id: Ie833e2a699c47b6702957ed67bf7d3925f2df099 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47266 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Inhibit host interrupt for battery_key.Todd Broch2013-04-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Battery key is used to signal to the host that USB charging status has changed. This virtual keystroke should not wake the device like physical keystroke does. Change still copies keystroke to the keyboard fifo but bypasses sending host interrupt. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=spring BUG=chrome-os-partner:18333 TEST=manual, Scenario1: suspend device then plug/unplug USB charging. Device doesn't wake. When resume 'cat /sys/class/power_supply/cros_ec-charger/online' is correct. Scenario2: while true ; do cat /sys/class/power_supply/cros_ec-charger/online done plug/unplug USB charging and device online status changes in a timely manner Change-Id: I8938798b30e70c0c5021405d4fc5da9ce398c311 Reviewed-on: https://gerrit.chromium.org/gerrit/47251 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* Add common implementation for daisy/snow extpower_is_presentRandall Spangler2013-04-036-66/+49
| | | | | | | | | | | | | | The implementations are identical for daisy and snow, so move to a common file instead of having duplicate code in board.c BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy, snow Change-Id: I63597885607fd03b3bf87bcebf2146190b301f22 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47183 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Trigger dma_init() via HOOK_INITRandall Spangler2013-04-037-21/+8
| | | | | | | | | | | | | | There's no need for it to be initalized in board_init(); it just needs to be done before ADC / I2C / SPI initialize. BUG=chrome-os-partner:18343 BRANCH=none TEST=boot spring; verify EC communication and 'adc' console command still work Change-Id: I6039848fe031222d5ca59b459adfe18fc3e8ef08 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47182 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Clean up board.c filesRandall Spangler2013-04-036-50/+20
| | | | | | | | | | | | | Just renaming functions and reordering #defines; no functional changes. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all EC boards Change-Id: I90e9ea860110625012cd5fb99de966283ec82880 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47179 Reviewed-by: Vic Yang <victoryang@chromium.org>
* spring: Add host command to limit external power currentVic Yang2013-04-023-3/+73
| | | | | | | | | | | | | | This is useful for debugging and the factory. BUG=chrome-os-partner:18530 TEST=On spring, check we can set PWM duty cycle and can go back to automatic control. BRANCH=spring Change-Id: I3da75f0a356cc0f21d748bf135e3b95fbd9c465b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47105 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Retry when over current detectedVic Yang2013-04-021-2/+11
| | | | | | | | | | | | | | | | When we detect over current event, it might be a genuine over current event or the user messing with the charger. Let's add retry machinism to reduce the probability that a user re-plugging adapter causes charging current to be limited. BUG=chrome-os-partner:18527 TEST=Manual BRANCH=spring Change-Id: I2b55a9eae39c56ada929e167cf09c4e91a32a55e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47107 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Remove unused EC_SWITCH_KEYBOARD_RECOVERYRandall Spangler2013-04-022-6/+4
| | | | | | | | | | | | | | | | | This was left over from the way we reported keyboard recovery early in link/snow, before we had host events. No shipping EC ever reported it. Coreboot and u-boot look for this flag, so we can't repurpose it until they ignore it too. BUG=chrome-os-partner:18512 BRANCH=none TEST=compile link,spring Change-Id: I38fbf0fa7d958c3774c8b293d4be25faaecdadea Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47058 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Split lid switch code out of switch.c to its own fileRandall Spangler2013-04-0210-139/+204
| | | | | | | | | | | | | This will allow ARM code to use the same lid switch code (in a subsequent CL). BUG=chrome-os-partner:18343 BRANCH=none TEST=open lid; system boots. close lid; system suspends. open lid; resumes. Change-Id: I83536a3ad24c4446dccf8a6b6e296756659070a8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47043 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move enabling AC_PRESENT interrupt to extpower_gpio.cRandall Spangler2013-04-022-1/+7
| | | | | | | | | | | | | | The interrupt handler moved a while ago, but the code to enable the interrupt at init-time didn't. Fix that. BUG=chrome-os-partner:18256 BRANCH=none TEST=boot system. unplug AC. replug AC. UI charging indicator should update. Change-Id: Ie16aa7f6eb9e871a6e3e8ecf6733ecbdc883be0b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47041 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add support for calling deferred functionsRandall Spangler2013-04-026-36/+147
| | | | | | | | | | | | | | | | | This is a cleaner way of deferring work from interrupt-time to task-time without requiring a task for each module which needs this. Replaces/supersedes delayed hook notification, which didn't scale well (since every function would have needed to be its own hook type). BUG=chrome-os-partner:18473 BRANCH=none TEST=boot system. plug/unplug AC power; notifies the host properly Change-Id: I50263fe1ce37e74c1ef8db3671379098997102ed Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46953 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add parse_bool() to centralize parsing boolean optionsRandall Spangler2013-03-2910-63/+85
| | | | | | | | | | | | | | | | | | | | | | This way debug commands which previously took only yes/no or on/off or enable/disable can take any of those options. BUG=chrome-os-partner:18467 BRANCH=none TEST=Try "on", "off", "yes", "no", "true", "false", "ena", "disable", for each of the following commands: - ilim (spring) - pll (link) - power (spring/snow) - hcdebug (all) - kblog (link) - ksscan (all) - lp5562 (spring) Change-Id: Ie8e0fae3775b1da711864bcba6682ba5e68a06f1 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46900 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Rename charging task to CHARGER, charger_taskRandall Spangler2013-03-298-12/+11
| | | | | | | | | | | | | | | This makes the charging task name consistent across platform. No functional changes, just renaming. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all EC boards Change-Id: I348b31313f6604df2a05b474bdf6e0be7450c8c9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46891 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Rename I8042CMD task to KEYPROTORandall Spangler2013-03-2911-15/+15
| | | | | | | | | | | | | | | | Since it's really the keyboard protocol task, not just handling i8042 commands. For consistency across keyboard protocols. No functional changes, just renaming. BUG=chrome-os-partner:18360 BRANCH=none TEST=boot link and type on keyboard Change-Id: I800a691a344f82bf582693cae865414b7d5d382a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46885 Reviewed-by: Bill Richardson <wfrichar@chromium.org>