summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Add 'version' option to ectool test command.Bill Richardson2013-07-161-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just handy to be sure we're correclty passing the command version to the EC. BUG=chromium:242706 BRANCH=falco, peppy TEST=manual Run "hcdebug params" the EC console (using ToT EC) Compare the output on the EC console when you run these two commands on the host: ectool test 0 13 ectool test 0 13 1 You should see these two lines (among other things): [5728.756652 HC 0x0a.0:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] [5730.809596 HC 0x0a.1:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] The "0x0a.0" and "0x0a.1" indicate that the version is being passed correctly. Change-Id: I23b97ac6622274a157717f9375945d0866691a37 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61920 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* spring: lower LED brightness to save powerVic Yang2013-07-152-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | Lower LED brightness: - Green: 0x80 -> 0x10 - Yellow: 0x80 -> 0x40 (looks equivalently bright to green @ 0x10) - Red: Not changed since it's an error condition BUG=chrome-os-partner:20768 TEST=Build success BRANCH=Spring Original-Change-Id: Ib80b4f5c746163d98a09e21246ea97a6aeb2c054 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61672 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 1f6e5f8a1e074bd91acd3fc0b3de268495199c10) Change-Id: I8f37cfa79d9fd30f503318e0913f4c12c1737219 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61852 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove fancy trickle charging logicRandall Spangler2013-07-154-278/+15
| | | | | | | | | | | | | | | | | | | | | | We implemented a fancy state machine for link to try and feed almost-dead batteries smaller amounts of current than the charger could normally supply, by dithering down the voltage to less than was requested. It's a lot simpler just to give the battery the smallest non-zero amount of current we can give it at the voltage it asks for. Remove the precharge code, since we won't use it on any future platform and link has already branched. BUG=chrome-os-partner:20881 BRANCH=none TEST=find a really dead batery and try to charge it, or do what I did and just hack the battery module to lie about the requested values, and see that it always gets the minimum current step at the requested voltage. Change-Id: I30bcb62bbe215abafb3a98c52e2afed3b74ead1a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61789
* Debug host command responses for error results too.Bill Richardson2013-07-151-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just because the EC doesn't like a host command doesn't mean it doesn't send a response. When we have HC debugging on, we want to see that too. BUG=chrome-os-partner:20647 BRANCH=falco, peppy TEST=manual Run "hcdebug params" on the EC console. Run "ectool test 3 13" on the host. Before this CL, you'd see [4369.366344 HC 0x0a.0:030000000d00000030313233343536373839616263646566303132333 43536373839414243444546] [4369.367315 HC err 3] After this CL, you see: [46.979220 HC 0x0a.0:030000000d0000003031323334353637383961626364656630313233343 536373839414243444546] [46.980067 HC err 3] [46.980344 HC resp:30313233343536373839616263] Change-Id: I9416a5e4a9c643dba0ce29b589832c62634e916b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61791 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* puppy: change XPSHOLD interrupt on both edgesYen Lin2013-07-121-1/+1
| | | | | | | | | | | | | | Change XPSHOLD interrupt from rising edge to rising and falling edges. Without this change, lid has to be opened twice to power on the system. BUG=nvbug 1323023 TEST=tested on Venice Change-Id: I49e953546140bc8de954ac22b59641efb299ba72 Signed-off-by: Yen Lin <yelin@nvidia.com> Reviewed-on: https://gerrit.chromium.org/gerrit/61697 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* x86: Enable all wireless switches when going into S0Dave Parker2013-07-123-6/+7
| | | | | | | | | | | | BUG=None BRANCH=slippy,peppy,falco,wolf TEST=Boot device and verify WLAN and WWAN enable GPIOs are active. Change-Id: I1b488bc26ddbe50c570aefd8fcd3cdcb4d5b38d4 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61653 Commit-Queue: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add console editing unit testVic Yang2013-07-113-1/+243
| | | | | | | | | | | | | This tests console editing and history functionality. BUG=chrome-os-partner:19236 TEST=Pass the test BRANCH=None Change-Id: Ia3edf2dd627d081fbcae7f775992d7570e5e1dd0 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61555 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add extpower-gpio unit testVic Yang2013-07-115-6/+101
| | | | | | | | | | | | | This tests host event and hook are triggered when AC status changes. BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I9e4263f3f6e273bfb0b24671a4e5c56b20a04e1a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61554 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add I8042 keyboard unit testVic Yang2013-07-119-4/+284
| | | | | | | | | | | | | This tests I8042 scancode and typematic. BUG=chrome-os-partner:19236 TEST=Pass all tests many times. BRANCH=None Change-Id: I8457b7b807b694b0bae32abf1647961f946dc5e1 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61553 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Basic G781 temp sensor support for Falco and Peppy.Dave Parker2013-07-117-19/+132
| | | | | | | | | | | | | | | | | | | This lets us read the internal and external temp values. More functionality to come once we figure out what is needed. BUG=chrome-os-partner:20432 BRANCH=falco,peppy TEST=run ec 'temps' command on Falco and Peppy. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I4f452f438e0a158dc8b34901e3faad3ce36d28b2 Reviewed-on: https://gerrit.chromium.org/gerrit/60145 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Split wireless power/radio control out of switch.cRandall Spangler2013-07-1119-106/+117
| | | | | | | | | | | | | | | | | | | | | | | | | Chipset control of wireless power uses the new API instead of overriding the wireless power itself. Refactor board-specific support for it to just a few config #defines instead of board-specific functions. This makes some assumptions about the polarity of the enable signals. Not making those assumptions would require defining an array of structs or some other heavier-weight board-specific info. Since the assumptions hold for all current boards, let's make them now because this is a step in the right direction, and reserve doing something more general until we actually have a use case for it (so we build in just the flexibility we need). BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; see that link wifi turns on at boot and off at shutdown (verify via 'gpioget' from EC console) Change-Id: Ic036e76158198d2d5e3dd244c3c7b9b1e8d62982 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61608 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move x86 backlight-enable passthru code to its own moduleRandall Spangler2013-07-1114-52/+92
| | | | | | | | | | | | | | | | | This code is not LM4-specific, it's x86-specific. So it doesn't belong in chip/lm4. Put it in its own module rather than leaving it in switch.c, since some x86 systems may need the power button state machine but not the backlight-enable passthru. BUG=chrome-os-partner:18343 BRANCH=none TEST=Quickly run a magnet over the lid switch; the backlight goes off and then back on. Change-Id: I72f7139b73f91539dcfbe6b5cb6d56587ab66fde Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61595 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Falco: AC adapter identification commandBill Richardson2013-07-113-0/+51
| | | | | | | | | | | | | | | | | | This adds a function to identify the AC adapter. We'll need this to set various battery charging limits, based on the capability. This only applies to Falco, AFAIK. BUG=chrome-os-partner:19594 BRANCH=none TEST=manual Plug in various approved adapters. From the EC console, run "adapter". It should tell you the rated power for each one. Change-Id: Id6d142fa81f20ec9233b0faa2fcb1d53cf7b7ef5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61515 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add thermal host and console command testVic Yang2013-07-112-6/+197
| | | | | | | | | | | | | | This checks the functionality of thermal engine related host and console commands. BUG=chrome-os-partner:19236 TEST=Pass all tests. BRANCH=None Change-Id: I604ed3bfed3549b2573fac65da83450acd3f2797 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60964 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add flash host read command testVic Yang2013-07-112-1/+39
| | | | | | | | | | | | | This checks the correctness of data returned by flash read host command. BUG=chrome-os-partner:19236 TEST=Pass all tests. BRANCH=None Change-Id: I3b97addb9b14922e9f33a71b865000ae9a8d40a8 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60963 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add function to inject console input from testVic Yang2013-07-112-2/+23
| | | | | | | | | | | | | This can be used to test console command. BUG=chrome-os-partner:19236 TEST=Build success BRANCH=None Change-Id: I7ce002f9e66fd7786492bacb453f126b9766d741 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60978 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Refactor x86 chipset codeRandall Spangler2013-07-1020-1297/+1136
| | | | | | | | | | | | | | | This moves most of the code into a common module, leaving only the board-specific GPIOs (now listed in a struct in board.c) and the chipset-specific state machine with multiple copies. BUG=chrome-os-partner:18343 BRANCH=none TEST=boot link; verify suspend and resume work; shut back down and see it go to G3 after 10 sec. Change-Id: Iafa8ba55a4870bb0119ff4161a1a9054fcc7955f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60949
* Improve over current detectionVic Yang2013-07-101-3/+25
| | | | | | | | | | | | | | | | | | | | | | | This includes: - Capturing over-current event on transition from known device type to unknown device type. - Limiting current draw when device type is not determined yet. - Shortening CABLE_DET delay to 0.6 seconds so that over-current event for USB host has a 0.6-second window for the charger to recover. BUG=chrome-os-partner:20648 TEST=Charge with Arrow BRANCH=Spring Original-Change-Id: Ie66ccd2d69adf8436a67e504f82da6eca3d0b14f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60730 (cherry picked from commit 03493a72db6ea5e12eda2a9488253d7fae6eec0b) Change-Id: I5d3cf7054960f5d4f924bce76f87257af57ebdb8 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61400 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Remove fast PWM tweak modeVic Yang2013-07-101-10/+4
| | | | | | | | | | | | | | | | | | | | | | Fast mode was originally introduced to prevent the user seeing battery assist mode. Now that we don't report battery assist mode to the user, let's remove this mode to improve stability. BUG=None TEST=Charge with various chargers. See stable PWM duty cycles. BRANCH=Spring Original-Change-Id: I4a2a66e03d50dea7a28fc826369dcf2b3452007a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60754 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 46a2073437f9a150656d37e8bd9219b01b1b3ac1) Change-Id: I8c5b24946385576ada9f08e342beb1a70c55c974 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61399 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Fix a bug of PWM duty cycle upper boundVic Yang2013-07-101-5/+10
| | | | | | | | | | | | | | | | | | | | | The return value from battery_current() is non-zero if there's an error. Also rewrite the condition to make it more readable. BUG=None TEST=Check PWM duty cycle can be set to 100% BRANCH=Spring Original-Change-Id: If13a295d87a1abd2e67f1bb216dc58d3f3d29ba4 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60735 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 29a157e5276a4f0ed004aaab365ad9e32b68c250) Change-Id: I7383bfd49931c8555f92a74e5960bd7e40102fa6 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61398 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Update battery LED less frequently when chargingVic Yang2013-07-101-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | When the user uses about the same amount of power the charger provides and the battery level is around 94%, the user might see the LED hop between green and yellow. We should update LED color less frequently in this case. BUG=chrome-os-partner:20677 TEST=Hack a console command to fake battery charge level. Change battery level between 93 and 94, and see LED color only change every 15 seconds. BRANCH=Spring Original-Change-Id: I55cda9aee5f79465e9094355a1f66666d018cddd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60851 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Vic Yang <victoryang@chromium.org> (cherry picked from commit d03e35c42835e4b52779499d0a4b8ebdcb1074f2) Change-Id: I51090418cdbb7a6fea0163e04d9a962b46268f34 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61397 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Drop support for VFET2 video poewr outputVic Yang2013-07-103-5/+9
| | | | | | | | | | | | | | | | | | | | | | VFET2 is only used by early stage boards. Let's drop it now. Also, disable power output when power good for VFET is not set. This essentially adds retry for video power output. BUG=chrome-os-partner:18186 TEST=Boot and test video output. BRANCH=Spring Original-Change-Id: I1937522a6a523a4f5dbeb9882518ca6e37655bea Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60852 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit e82589e073c5a863797fa87ecaa1dfafb1a9228d) Change-Id: Ib043f952e699eb99b373da205379f56230887f6a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61396 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Uprev panic data struct versionVic Yang2013-07-103-9/+34
| | | | | | | | | | | | | | | | The struct was changed in commit 74c34bbad, but the struct version was left as 1. We need to uprev this so the data returned by host command is useful. BUG=chrome-os-partner:16901 chrome-os-partner:20548 TEST='ectool panicinfo' with new and old struct. Compare output with output from console command 'panicinfo'. BRANCH=None Change-Id: I4df3142497dc5ee21d100c4cb8118fb7a0ce7a7e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60314 Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
* Use sample averaging on ADC to increase accuracyBill Richardson2013-07-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AC adapter detection isn't measuring the expected values, most likely because we're not providing enough current for the ADC circuitry to sample. This tells the ADC to take 64 samples for every reading and average them together. That seems to fix it. BUG=chrome-os-partner:19594 BRANCH=none TEST=manual To test, use a scope to probe the voltage pin 6 of the AC adapter connector. Compare that with the measured result from the ADC, by using the EC console's "adc" command. Before this change: Adapter Probed(mV) ADC(mV) error 45W 469 415 11.5% 65W 600 530 11.6% 90W 794 701 11.7% After this change: Adapter Probed(mV) ADC(mV) error 45W 469 452 3.6% 65W 600 590 1.6% 90W 794 773 2.6% Close enough. Change-Id: I5ab5526934a5a2711969a90a26631d54c7863da7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61346 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix EC_ENTERING_RW not being assertedRandall Spangler2013-07-095-2/+4
| | | | | | | | | | | | | GPIO_ENTERING_RW is an enum, not a macro, so the #ifdef evaluated to false. BUG=chrome-os-partner:20761 BRANCH=spring TEST=compile on all platforms; mccroskey doesn't break Change-Id: Ib50989c7d2e47ab573ebc242259709b1712297ea Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61295 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Initial board commit for Wolf based on Slippy.Dave Parker2013-07-098-4/+441
| | | | | | | | | | | | | Additional fix-ups will come in subsequent CLs. BUG=chrome-os-partner:20760 BRANCH=wolf TEST=Verify "make BOARD=wolf" complete succesfully. Change-Id: I24a37f3bebb1feb37c83c2c1b4f8f8db7bbcb2d8 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61318 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* Falco: Implement battery cut off comamnd for factoryDave Parker2013-07-091-0/+18
| | | | | | | | | | | | | | | BUG=chrome-os-partner:20723 BRANCH=falco TEST=Manual. On a DUT with a battery run "ectool batterycutoff" and power down if still connected to AC. Unplug AC. The EC should be unpowered. Verify the only way to boot the system is to plug AC back in. Change-Id: I7a4cef1f69efe673370a450385f6fa91722d2b50 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61294 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Add CONFIG_BOARD_VERSION flag for boards which have version strapping.Shawn Nematbakhsh2013-07-095-1/+5
| | | | | | | | | | | | | | | | | | | Rather than implementing board version only for Link, implement for each board which has version strapping. BUG=chrome-os-partner:20295. TEST=Manual. Run "ver" command on Peppy, verify correct board version is returned. BRANCH=None. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I57656a645c6bcd1fdb2e7e4aba91b4ec4b8ad8ec Reviewed-on: https://gerrit.chromium.org/gerrit/61186 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org> Tested-by: Shawn Nematbakhsh <shawnn@chromium.org> Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
* Fix uninitialized constant in util/comm-dev.cBill Richardson2013-07-091-1/+1
| | | | | | | | | | | | | | | | | | This made the /dev/cros_ec method fail when reporting the version. BUG=chrome-os-partner:20571 BRANCH=none TEST=manual ectool version Used to fail; now it works again. Change-Id: Ib5b7188f713981cffce36d065255d81b102d4bbe Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61133 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* Implement battery cut-off host command for Peppy.Dave Parker2013-07-091-0/+12
| | | | | | | | | | | | | BUG=chrome-os-partner:20720 BRANCH=peppy TEST=Run 'ectool batterycutoff' on the DUT, shut it down, and unplug AC power. Verify the only way to turn it on is by plugging the AC power back in. Change-Id: Ia6a93249843b72f4396d083cfe15a263d0a1836d Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61047 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* Keyboard backlight control should hook lid switch itselfRandall Spangler2013-07-092-5/+7
| | | | | | | | | | | | | | | | It previously relied on the switch module to enable/disable the keyboard backlight when the lid changed position. It can do that itself now. BUG=chrome-os-partner:20743 BRANCH=none TEST=Boot link in a dark room where the keyboard backlight is on. Briefly run a magnet over the lid switch and see the keyboard backlight blink off and then back on. Change-Id: Iadf02b780a4990db25b6f0b3e1e0692f49c5488d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61194 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* snow: Snow is the exception for power LED settingsRandall Spangler2013-07-081-14/+14
| | | | | | | | | | | | | | | Instead of #if defined(BOARD_foo) for all new boards, flip around the No functional changes, just rearranging code. BUG=chrome-os-partner:20529 BRANCH=none TEST=keyboard LED still blinks in suspend on pit Change-Id: I185d642a5f412c8b4b0d16e62373c6b2bba71b0f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61108 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* stm32l: Fix flash_is_erased() detectionRandall Spangler2013-07-083-9/+16
| | | | | | | | | | | | | | | | | | | | STM32L erases flash to 0, not 1, so we need a config value to indicate that. This speeds up flash erase on STM32L by not re-erasing already-erased blocks. BUG=chrome-os-partner:13066 BRANCH=none TEST=manual - hack flash_physical_erase() to print something just after flash_is_erased() check. 1. flasherase 0x1f800 0x800 2. flashwrite 0x1fa00 0x100 3. flasherase 0x1f800 0x800 -> only re-erases 0x1fa00 Change-Id: I4d726caf0605e7815b9360bb2d44bdfdd757b4a2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61110 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* stm32: Clean up JTAG registersChromeOS Developer2013-07-083-6/+30
| | | | | | | | | | | | No functional changes, just cleanup. BUG=chrome-os-partner:20529 BRANCH=none TEST=boot pit Change-Id: I2067dffc3b1335f001a95e63b22213a1022f3ae8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61095
* pit: Align spi protocol buffers on 32-bit boundaryRandall Spangler2013-07-081-7/+11
| | | | | | | | | | | | | | | Flash writes must be done from 32-bit-aligned source buffers. Force the protcol buffer to be aligned like we do for the lpc interface. BUG=chrome-os-partner:20571 BRANCH=none TEST=ectool flashread 0x1f800 0x800 /tmp/foo ectool flasherase 0x1f800 0x800 ectool flashwrite 0x1f800 /tmp/foo Change-Id: Icaa3259bcbc36be49345da5e19ad8a0790b73923 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60892
* Extend overcurrent delay to 1200 msVic Yang2013-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | Some chargers recover in about 1100 ms on overcurrent events. Let's extend this delay to support more chargers. BUG=chrome-os-partner:20408 TEST=Manual. Check we can reach a steady current with a charger that was not supported before. BRANCH=Spring Original-Change-Id: I7db0f98110dcb225ea5f123400c539e6a1260156 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60316 Reviewed-by: Todd Broch <tbroch@chromium.org> (cherry picked from commit 732f5130f1f7523ec18fb04d49ddeb1646389a2c) Change-Id: I884f8008158bf57c7d18109fb7860432095923ae Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60624 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Switch ID_MUX back on redetectingVic Yang2013-07-081-0/+2
| | | | | | | | | | | | | | | | | | | | | When we are redetecting, if ID_MUX is 1, we need to switch it back. Otherwise, no one is there to switch it and we are stuck in this state. BUG=None TEST=Check the EC detects device type after redetecting from device type 0x60400. BRANCH=Spring Original-Change-Id: I42378e2ea9177962524af7316d76c54b2518e614 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60041 (cherry picked from commit 7ebc1b269360f54dde29e3ec75f44e1976a15992) Change-Id: I89ec974030712dea6157405a3b1bc819dc130e94 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60623 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Poll CABLE_DET for a secondVic Yang2013-07-081-10/+27
| | | | | | | | | | | | | | | | | | | | | | We've seen CABLE_DET being asserted hundreds of milliseconds after ID_MUX is switched. To ensure video dongle is detected, let's poll CABLE_DET for a second before declaring it an USB host. BUG=chrome-os-partner:20405 TEST=Manual BRANCH=Spring Original-Change-Id: I1858f4075f526ee198b7b5f7ad2bb06cf6e3512c Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59887 Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org> (cherry picked from commit 2d37619a934264cf4f902078b081b76d607ddce1) Change-Id: I55fba167780fb7e04157655dc5b3a2e76b8999c5 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60622 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Notify kernel of USB device change after it stabilizesVic Yang2013-07-081-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | If we are overloading the charger and it browns out, the kernel reacts to this event as if the charger is disconnected. This may confuses the user as the backlight brightness might change. Let's delay this until the device type has stabilized. BUG=None TEST=Plug in a charger and observe backlight brightened. Check the backlight brightness doesn't change while the charger is overloaded. BRANCH=Spring Original-Change-Id: Ie89ed4261912bfd8cd75a70e5058411f1c929aa9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59878 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit af770935938c99e17f99eea38bc1c0f34cc862fe) Change-Id: I9c88d08100ba54f313506d495bc8e8dba5766dc7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60621 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Rename files in common/ to be more consistentRandall Spangler2013-07-0815-20/+14
| | | | | | | | | | | | | | | | This gets rid of mystery files like "ir357x" and "lp5562". All chip names are now prefixed with their module type (e.g. "chipset_", "led_driver_", etc.) No functional changes; renaming files and CONFIG constants only. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I3227fb0f6b0243bb08a13577cdb0f6def0e15d54 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60922
* haswell: Enable LTE module in S0Dave Parker2013-07-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | Note that the PP3300_LTE_EN signal does different things on different boards. On peppy/slippy it controls both LTE power and gates a wake interrupt to the PCH. On falco it just gates the wake interrupt; module power is tied to the DX rail. On all boards there is a separate DISABLE_L signal from the PCH. BUG=chrome-os-partner:20513 BRANCH=falco,peppy TEST=Manual. Verify module detectable via lsusb in S0. Verify power to module is disabled in S3. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I4984081009e4a1ce8ad8996e97f779c545829ce5 Reviewed-on: https://gerrit.chromium.org/gerrit/60941 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Move protocol v2 constants to ec_commands.hRandall Spangler2013-07-038-142/+158
| | | | | | | | | | | | | | | | These constants are scattered around the various interface implementations and should be in one place. This will also clean up the u-boot side when ec_commands.h is copied there. BUG=chrome-os-partner:20257 BRANCH=none TEST=build link, spring, pit; test 'ectool hello' Change-Id: Ib1425db00ec8220538d8c5c65107ac9548009516 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60810 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* charger: add support for TI BQ24715Aaron Durbin2013-07-033-0/+324
| | | | | | | | | | | | | | | | | | | | Add support for the TI BQ24715 smart battery charger. It provides the system power while limiting the battery charge limit based system power needs. This code is based off of the bq24725 code, however there is one change (aside from the min/max) to fit into the current charging state machine. The charging voltage setting is cached to provide the illusion of it being 0V which the hardware does not allow. BUG=chrome-os-partner:20372 BRANCH=None TEST=Used on a board containing this charger. Change-Id: I59af88fba6bf740e7caff72c9ed27eaf721758c4 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60804
* lm4: onewire: abstract out bank and pinAaron Durbin2013-07-032-7/+11
| | | | | | | | | | | | | | | | | As different boards can use the same EC but use different pins for the same functionality it is required to properly abstract out the bank and pin used for the one wire interface. Provide this ability. BUG=chrome-os-partner:20372 BRANCH=None TEST=built for failure and success on link Change-Id: Ie20f2319d9cd6f5ec63b4178ecebc45a90a51042 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60798 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ec: puppy: add support to flash ecJimmy Zhang2013-07-031-1/+1
| | | | | | | | | | | | BUG=none TEST=flashed ec on venice board Change-Id: I9a8ba6fcbc974d971af7af0f84ff7088cd69b987 Signed-off-by: Jimmy Zhang <jimmzhang@nvidia.com> Reviewed-on: https://gerrit.chromium.org/gerrit/60706 Reviewed-by: Andrew Chew <achew@nvidia.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ec: Add Puppy support to generic/common filesYen Lin2013-07-034-6/+7
| | | | | | | | | | | | | | | | add #ifdefs needed to support Puppy board in generic/common files BUG=none TEST=tested on Venice board Change-Id: I46592010cb5dfcc40db312c746f1e0d2886b3758 Signed-off-by: Yen Lin <yelin@nvidia.com> Reviewed-on: https://gerrit.chromium.org/gerrit/60688 Reviewed-by: Andrew Chew <achew@nvidia.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Jimmy Zhang <jimmzhang@nvidia.com> Commit-Queue: Jimmy Zhang <jimmzhang@nvidia.com>
* Use EC_CMD_READ_MEMMAP on platforms without mapped memory.Bill Richardson2013-07-031-6/+21
| | | | | | | | | | | | | | | | | | LPC-based ECs provide a region of memory that is mapped into the AP's address space, making it easy to read. This CL uses an alternate EC host command to read that region, for those systems that don't have mapped memory. BUG=none BRANCH=none TEST=none I tested this by building a special command into ectool. Change-Id: If5cc52356f61522ae96e20d4c5d365accc299987 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59662
* Retry ectool commands that return EC_RES_IN_PROGRESSBill Richardson2013-07-031-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This came up when testing issue 242706. If you tell the EC to return EC_RES_IN_PROGRESS, then the EC gets stuck and times out on the next command. I'm not entirely sure what the correct response should be, but I think that the EC might not be doing the right thing either. In any event, this keeps it from getting stuck. BUG=none BRANCH=none TEST=manual Try ectool test 8 14 ectool test 0 14 The first command fails because we told it to, but the second command also fails because the EC is expecting something else. After this change, the second command works. Change-Id: I513294396cff872018316c354d2c41953eb6fdf6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59661
* ectool: Correct the empty console checkSimon Glass2013-07-021-2/+3
| | | | | | | | | | | | | | | | | | | | ectool is waiting for an empty response from the EC to tell it to stop requesting console data. However, the EC only sends an empty response when there is no snapshot data. In particular, it seems to send a 1 byte response (containing just a \0 byte) when there is an empty string. Adjust the check to stop when no data is provided. BUG=chrome-os-partner:20639 BRANCH=none TEST=manual Run on test device and see that 'ectool console' now completes and does not run forever. Change-Id: I565f1be506833c823e5e7eca09be8b2420c8190c Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60640 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* haswell: fix RCIN_L leakageAaron Durbin2013-07-024-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's still unclear why the PL6 pin which is used for RCIN_L does not behave properly when configured as open drain. Work around the misbehavior by configuring the PL6 pin as an input. When it is required to be driven low the pin is reconfigured to an output and subsequently made an input again. This provides the open drain semantics that are required to eliminate leakage. BUG=chrome-os-partner:19811 BUG=chrome-os-partner:20054 BUG=chrome-os-partner:20173 BUG=chrome-os-partner:20175 BRANCH=None TEST=manual 'apreset warm' causes reset as expected. The pin is configured as an input by default without open drain or a pullup resistor: > rw 0x40062400 (GPIODIR) read 0x40062400 = 0x00000000 > rw 0x4006250c (GPIOODR) read 0x4006250c = 0x00000000 > rw 0x40062510 (GPIOPUR) read 0x40062510 = 0x00000000 Change-Id: Ia3ad6fa7fec06be1cbff6854d9341722d8617408 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60780 Reviewed-by: Sameer Nanda <snanda@chromium.org>