summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add console command to fake battery state of chargetoolchain-3701.42.Bstabilize-3701.81.Bstabilize-3701.46.Bstabilize-3701.30.0bstabilize-3701.30.0release-R26-3701.BRandall Spangler2013-02-122-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new 'battfake' command is really handy for testing low-battery shutdown logic. BUG=chrome-os-partner:17124 BRANCH=link TEST=from EC console: reboot battfake -> using real battery level power on system -> lightbar should be blue battfake 5 lightbar turns red after a few seconds UI shows battery is very low (shows <5% due to different kernel math) 'ectool battery' from root shell shows present capacity ~5% of design capacity remove AC power battfake 4 UI shows low-battery screen and shuts down (may take a minute) battfake 50 power on system UI shows battery at 45-55% battfake 2 -> system shuts down immediately battfake -1 power on system UI shows actual battery level Change-Id: I3180e321241c0f586f3baad2150fb6a2b2d2e242 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43151 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Rename and document battery constantsRandall Spangler2013-02-123-32/+28
| | | | | | | | | | | | | | | | | | | | | In preparation for cleaning up low-battery logic. Make clear what comparison operator is used for each constant (<=, <, >=, >). Also remove hard-coded and unused display of design warning/low battery levels from ectool. Verified via code search that these are not used anywhere. Even if we later care about these levels, they should be battery-specific and not hard-coded as a platform-independent percentage of full capacity when ectool is compiled. BUG=chrome-os-partner:17124 BRANCH=link TEST=compile link; 'ectool battery' from root shell prints valid info Change-Id: I3650e27a08f4cc77067beb0685ee1488cc56d02f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43119 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: If a required power rail drops, shut downRandall Spangler2013-02-121-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | This protects the system from ending up in a weird state if one of the rails fails to come up, or shuts down after coming up. BUG=chrome-os-partner:17774 BRANCH=link TEST=manual - Boot system - From EC console: gpioset enable_1_5v_ddr 0 - System shuts down; EC console prints "x86 power lost input" - Press power button; system turns back on - From EC console: gpioset enable_vs 0 - System shuts down; EC console prints "x86 power lost input" - Press power button; system turns back on - Suspend system - From EC console: gpioset enable_1_5v_ddr 0 - System shuts down; EC console prints "x86 power lost input" - Press power button; system turns back on Change-Id: I8ae1630deb4001716b8dfd89d7dec7300cddb5ae Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43097 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* spring: Distinguish Apple Chargersstabilize-bluetooth-smartVic Yang2013-02-073-18/+61
| | | | | | | | | | | | | This uses D+/D- voltage to distinguish different Apple chargers. BUG=chrome-os-partner:14319 TEST=Manual on Spring BRANCH=none Change-Id: I50075d466f6e6b1adf613748cf433d7f43c04bfe Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42850 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Lengthen ADC sample timeVic Yang2013-02-061-4/+4
| | | | | | | | | | | | | | Current sample time 1.75us seems too short and some nets with weaker driver don't convert correctly. Let's lengthen it to 8.75us. BUG=chrome-os-partner:14319 TEST=See correct voltage level. BRANCH=none Change-Id: Ib65a07474787504e5f72522167bafad8bb5730bc Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42845 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32mon: add back flashing progressionVincent Palatin2013-02-061-8/+9
| | | | | | | | | | | | | | | | | | | As we no longer have the low-tech dots to show the progression of the on-going flashing, display a completion percentage to give the user a hint of the ETA. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=./util/flash_ec --board=spring and see accurate progression percentage reported. Change-Id: I75ccbe3433acd6c94d03a08bf462ea4516e4ce02 Reviewed-on: https://gerrit.chromium.org/gerrit/42733 Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* spring: Tweak battery LED policyVic Yang2013-02-051-2/+4
| | | | | | | | | | | | | | | | When battery is nearly full, we sometimes see: - Battery asks for no current, but slowly discharge (5-7 mA) - Battery asks for current, but not charging. For these cases, we consider the battery full and show green LED. BUG=chrome-os-partner:17561 TEST=Manual BRANCH=none Change-Id: I2808d4c1a89d37000244fb308197cdef473ec5be Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42688 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Limit USB port currentVic Yang2013-02-051-2/+24
| | | | | | | | | | BUG=chrome-os-partner:14319 TEST=Attach different chargers and see corresponding PWM duty cycle set. BRANCH=none Change-Id: I10c6e28ddf5a959849a6f14d9ca3894be4f16e30 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42691
* Mask 'tags' in .gitignoreVic Yang2013-02-051-0/+1
| | | | | | | | | | | | | | If ctags is used, git complains about uncommitted 'tags'. Let's add it to .gitignore. BUG=None TEST='git status' and doesn't see git complain about 'tags'. BRANCH=none Change-Id: I6026e83b1537eb61439f22a0b09dccb07283c820 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42689 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: implement SMBUS-style read block/stringVincent Palatin2013-02-051-3/+19
| | | | | | | | | | | | | | | | | | | | | Add support in the I2C driver for SMBUS-style read block operations. As defined by the SMBUS standard, a "read block" returns at most 32 bytes of data plus the size of response as the first byte. It's used to read smart battery strings such as manufacturer or model. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:14314 TEST=On Spring, read the battery manufacturer and model from a kernel patched for the smart-battery passthrough. Change-Id: I069ce7f64414817e94516e913643d3847a29d176 Reviewed-on: https://gerrit.chromium.org/gerrit/42647 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Control battery LEDVic Yang2013-02-055-17/+90
| | | | | | | | | | | | | | | | | This implements a basic battery LED policy: - Charged: green - Charging: yellow - Error: red - No charger: off BUG=chrome-os-partner:17561 TEST=Manual BRANCH=none Change-Id: I7fa8242efa4d0382d8ef0cafe80f01d44c390397 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42607 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Modify stm32mon to better suite autotest useVadim Bendebury2013-02-051-17/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces the following modifications: When used outside chroot on Goobuntu the serial interface fails to initialize if parity enable bit is set (for a reason not clearly understood). On top of that the tcsetattr() return value of zero is not a guarantee of success. To be sure that the settings came through one is supposed to read back the driver config and compare it with the desired config. To add insult to injury, gPrecise driver rejects attempts to enable parity. Parity setting is not essential in many cases, this is why we check the actual config and if the only missing setting is parity we print a warning message and continue. In case an operation fails, the exit value should reflect that (so that the autotest suite using the utility could report failure). Often when the programming attempt is undertaken soon after reset, this utility gets overwhelmed with the console output generated by the EC on resets. Consume the output before proceeding. Instead of printing a long set of dots (one per written/read block), print a spinning wheel instead. BRANCH=None BUG=chrome-os-partner:15610 TEST=manual . used the utility to program Snow EC both inside and outside chroot, it succeeded. Observed the failing attempt to set parity when running outside chroot. Observed spinning characters instead of stream of dots. Change-Id: Id25595d35a2a3ca578639cebd508f599e618787c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42310 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Change PWM frequencyVic Yang2013-02-051-1/+1
| | | | | | | | | | | | | | Current frequency is too low. Change it to 10kHz. BUG=chrome-os-partner:17585 TEST=none BRANCH=none Change-Id: I0ba21bcb6fe52b62f53a621acd220a646dbb9974 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42620 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Tweak lp5562 driver interfaceVic Yang2013-02-052-7/+14
| | | | | | | | | | | | | | This makes it possible to define color constants so as to reduce code size when called. BUG=chrome-os-partner:17561 TEST=Build success. BRANCH=none Change-Id: I800b8d4b84749907b071febfea58d27fef7cc2b7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42617 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32mon: add ID for stm32f102r8stabilize-3658.0.0David Hendricks2013-01-301-0/+1
| | | | | | | | | | | | | | | | | | This adds a table entry for stm32f102r8. BRANCH=none BUG=none TEST=ran flash_ec successfully on an stm32f102r8 (see notes below) ChipID 0x410 : STM32F102R8 Bootloader v2.2, commands : 00 01 02 11 21 31 43 63 73 82 92 Flash erased. Writing 65536 bytes at 0x08000000 ... (many more dots) ...Done. Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I1f4af0413a4df2c09a1043bdc78a429b79c28533 Reviewed-on: https://gerrit.chromium.org/gerrit/42270 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Add LP5562 driverVic Yang2013-01-214-0/+128
| | | | | | | | | | | BUG=chrome-os-partner:17341 TEST=Set LED color on Spring board BRANCH=none Change-Id: Ibae11a0cf8a724a38e96c5c49952799101bb5764 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41693 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add a pass-through for the smart batteryVincent Palatin2013-01-192-0/+112
| | | | | | | | | | | | | | | | | | | Allow to send commands to the smart battery using EC commands when the battery is connected to an I2C bus behind the EC. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:14314 TEST=on Spring, with a kernel including patch to use the pass-through for the sbs-battery driver, run "power-supply-info" and see the correct information. Change-Id: Ie10f1c95afe4a33cf0b55d5a0de7640d5971ebb3 Reviewed-on: https://gerrit.chromium.org/gerrit/41289 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* spring: remove hardcoded TPSchrome FET settingsVincent Palatin2013-01-181-2/+2
| | | | | | | | | | | | | | | | | Activate the pass-through for TPSchrome LDOs settings and remove hard-coded values used for bring-up. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:14314 TEST=on Spring, with an updated bootloader, see the screen is still coming up. Change-Id: I7fe67640e66939b1a19074b54d81d64459a34f4a Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41296 Reviewed-by: Vic Yang <victoryang@chromium.org>
* temp_metrics: set GPU min frequency to 450Sameer Nanda2013-01-171-5/+1
| | | | | | | | | | | | | | | | Removed the check for modem device and now unconditionally setting the GPU min frequency to 450. BUG=chrome-os-partner:16439 TEST="cat /sys/kernel/debug/dri/0/i915_min_freq" and verify that it returns 450 for systems with and without modem device. BRANCH=none Change-Id: I34d176e65420834a85a02755bad11124432ac33f Signed-off-by: Sameer Nanda <snanda@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41564 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* Add 'unprotect' flag for flashing link ec.Dave Parker2013-01-172-4/+21
| | | | | | | | | | | | | | | BRANCH=link BUG=chromium-os:37967 TEST=Remove write protect, reflash without 'unprotect', flag and verify the write protect flag is stil enabled with flashrom -p internal:bus=lpc --wp-status. Power down, then reflash with the --unprotect flag. Now verify the write protect status flag is disabled. Change-Id: Ie05b5dc85dd31d29ab43a392fe948a52d547fff3 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41477 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add a pass-through for TPSchrome LDOsVincent Palatin2013-01-162-0/+77
| | | | | | | | | | | | | | | | | Allow to send commands to switch on/off the TPSchrome LDOs by using EC commands when the TPSchrome chip is connected to an I2C bus behind the EC. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:14314 TEST=on Spring, with an updated bootloader, switch on screen FETs from U-Boot instead of hardcoding them in the EC board code. Change-Id: Ic6cebf04ba73a7c0ca2c54f532f8cf4c953ac0c1 Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41288 Reviewed-by: Vic Yang <victoryang@chromium.org>
* spring: Add a host command for USB mux switchingVic Yang2013-01-083-0/+72
| | | | | | | | | | | | | | To make test and bring-up easier, adds a host command for USB mux switching. BUG=chrome-os-partner:17111 TEST=manual BRANCH=none Change-Id: I9da43fe934881ce24f326275ef312c4e6a474f11 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40586 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Control BOOST_EN according to device typeVic Yang2013-01-081-0/+11
| | | | | | | | | | | | | BOOST_EN should be turned off when attached device needs power. BUG=chrome-os-partner:14319 TEST=Manual BRANCH=none Change-Id: Ic8d75bdad98eb33ab99792345ddfd90609a1ddbd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40200 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Configure ADC pinsVic Yang2013-01-081-4/+7
| | | | | | | | | | | | | | ADC pins should be configured as analog input pins. Also sets conversion factor to obtain voltage values in mV. BUG=chrome-os-partner:14319 TEST=Manual BRANCH=none Change-Id: I7e084052062c2b669f10da4309e99bf9e2954ded Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40199 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Sense attached device typeVic Yang2013-01-086-1/+86
| | | | | | | | | | | | | | This adds USB port control to charger task. For now, it only senses attached device type and log it to console. BUG=chrome-os-partner:14319 TEST=Attach/detach charger and see console output. BRANCH=none Change-Id: I1218d520c292d9d398c868122ae3876d3fc889bc Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40078 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* tps65090: Throttle PMU interrupt instead of charger taskVic Yang2012-12-283-12/+34
| | | | | | | | | | | | | | | | | | | | This is a prepartory work for integrating USB port control into PMU task. Currently TPS65090 charger task is throttled to only waken by event once per 500 ms. This in a way makes it hard to integrate other functionality into this task. This CL moves the throttling mechanism to interrupt handler so as to provide better control of when to throttle the interrupt event. BUG=chrome-os-partner:14319 TEST=Build success and boot on spring. BRANCH=none Change-Id: I72e63180442b379a379e1a87c10ef62395434872 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40189 Reviewed-by: Rong Chang <rongchang@chromium.org>
* spring: Setting for USB voltage sense ADCVic Yang2012-12-222-3/+7
| | | | | | | | | | | | | This changes ID pin sensing to VBUS sensing. BUG=chrome-os-partner:14319 TEST=Build success. BRANCH=none Change-Id: I179f7ab891f83d5c50ec7766372ba8826b3cd231 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40154 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Add interrupt and device type support for TSU6721Vic Yang2012-12-212-7/+88
| | | | | | | | | | | | | | | | This adds functions to control interrupt and get device type from TSU6721. Also expose initialization function so that we can initialize TSU6721 before we solve the initialization problem. BUG=chrome-os-partner:14318 TEST=Build success. BRANCH=none Change-Id: Ia50f1c93309360d35902a707090694e94a3f7a74 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40077 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add AP userspace scripts to tweak lightbar colorsBill Richardson2012-12-204-3/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | We have yet another tweak for the lightbar, but we don't want to update the EC. This CL adds an init script that runs on the AP at every boot and pokes the EC to modify the lightbar settings. We have to run it at every boot because the EC will hibernate after the AP has been off (not suspended) for an hour on battery power and will lose its settings. There's a corresponding CL for the ec-utils ebuild that installs the userspace scripts into the rootfs. BUG=chrome-os-partner:16827 BRANCH=link TEST=manual Build the image for Link, install, reboot. Run "ectool lightbar params". The output should match what's in /usr/share/ec/lightbar_params.txt Change-Id: If50ac2ef2432f7d60cdaf4c222b68dbdee80b2ec Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39979 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
* link: remove VR settings on the flyVincent Palatin2012-12-191-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code to re-program the IR3570A core regulator on the fly is no longer needed as the parts should be pre-programmed correctly and it is slow. This will break the EVT and older boards which have bad pre-programmed settings. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=link BUG=chrome-os-partner:15596 TEST=on Link, run the power_Resume test and observe the firmware resume time has decreased. Original-Change-Id: Id4f56a68d874879bf2f50047c21fbfabea16c850 Reviewed-on: https://gerrit.chromium.org/gerrit/36417 Reviewed-by: Puneet Kumar <puneetster@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 5c59877ee1878b8de380b662601592c817a8b0a8) Change-Id: I40937c0379a1b94c24679ee5e3110c242849986a Reviewed-on: https://gerrit.chromium.org/gerrit/39912 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Ready: Randall Spangler <rspangler@chromium.org>
* spring: Add function to switch ILIM pin between GPIO and PWMVic Yang2012-12-183-13/+69
| | | | | | | | | | | | | To save power, we need the ability to switch ILIM pin back to GPIO when we are not using PWM. BUG=chrome-os-partner:14319 TEST=In console, test 'ilim on', 'ilim off', and 'ilim 50'. BRANCH=none Change-Id: Ib3e0400266ef94df25fca1c6e5f118eba37b3848 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39835
* spring: Implement PWM control on ILIM_500Vic Yang2012-12-184-5/+102
| | | | | | | | | | | | | | This adds init code to configure PWM and a console command to adjust duty cycle. Also rename ILIM_1500 to BOOST_EN. BUG=chrome-os-partner:14319 TEST=Adjust PWM duty cycle and measure voltage. BRANCH=none Change-Id: I23856416da19ed523d46af39e6cbc3129ac25525 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39587
* Tidy ACPI debug outputRandall Spangler2012-12-181-1/+9
| | | | | | | | | | | | | | | | | | | | The host does a lot of ACPI keyboard backlight writes, which were scrolling the debug console output. Change to using CR instead of LF, so it's not so distracting. (No code changes other than debug output) BUG=none BRANCH=none TEST=Move laptop through different ambient light settings and look at console output as keyboard backlight ramps up and down. The 'ACPI kblight' messages shouldn't cause piles of scrolling. Change-Id: Iafde57ffe6090830fa54d4920c48b198c36d8d85 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39914 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: Workaround for errata 3.2Randall Spangler2012-12-171-2/+3
| | | | | | | | | | | | | | | Reads of HIBRTCC and HIBRTCCSS are not properly synchronized and may return incorrect data. We were re-checking HIBRTC, but not HIBRTCSS. BUG=chrome-os-partner:16864 BRANCH=link TEST=from ec console, do 'rtc' command repeatedly; printed values should be strictly increasing. Change-Id: I3e59dc840316ad36bb4851f03b66a3ae3df5cccd Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39795 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Reformat init.S to use tabs not spacesRandall Spangler2012-12-171-62/+64
| | | | | | | | | | | | | And tidy a few comments. No code changes, only comments and whitespace. BUG=none BRANCH=none TEST=compile code (nothing to test) Change-Id: I10faadc4f11147984cb911c4e630d05ac594cc56 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39796 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* spring: add basic TSU6721 driverVincent Palatin2012-12-134-0/+191
| | | | | | | | | | | | | | | | | for now, just control the USB pins muxing. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:14318 TEST=on Spring, put the EC UART on the micro-B connector and read it using a modified FTDI cable. Change-Id: Ib0c87e483fb0bbe1835bd6ea008176b88d6f12f8 Reviewed-on: https://gerrit.chromium.org/gerrit/38361 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Add option to select timer for hardware clockVic Yang2012-12-124-60/+88
| | | | | | | | | | | | | | Hardware clock uses two timers, currently TIM3 and TIM4. This CL adds an option to select between TIM2, TIM3, and TIM4, so that we can use any one the three timer as a PWM source. BUG=chrome-os-partner:14319, chrome-os-partner:7463 TEST=Build and run on snow/spring. Build success on daisy. BRANCH=none Change-Id: I1a00b3d491ee3e131708b573f6ea70e6b56c96dd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39584
* lm4: Postfix chip name when debug mode is enabledVic Yang2012-12-101-3/+23
| | | | | | | | | | | | | | | This adds a '-debug' postfix to chip name when debug mode is enabled, allowing us to probe debug mode from host. BUG=chrome-os-partner:16700 TEST='mosys -k ec info' and see chip name postfixed with '-tm' Test same thing on DVT and chip name is not postfixed. BRANCH=link Change-Id: Iade26f2009dd3bdb8ddbe92da0da8da5404c6e99 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39455 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add more paranoia for flash write protectRandall Spangler2012-12-102-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the entire flash is protected (as it normally is after software sync), fail all flash write/erase operations. Add a shadow copy of the all_now flag. BUG=chrome-os-partner:16727 BRANCH=link TEST=manual Verify that flash operations work properly before all_now. Then enable HW WP and flashwp enable flashwp now and try flasherase 0x38000 0x1000 flashwrite 0x38000 0x100 Those commands should fail with error 7 From the host side ectool flasherase 0x38000 0x1000 echo 'Khaaaaaaaaaaan' > /tmp/b16727 ectool flashwrite 0x38000 /tmp/b16727 should also fail. Change-Id: I99a4d2bb86080bd12c900582a8fbdfc79c99916c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39517 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: Increase cold reset hibernate time to 1 secondRandall Spangler2012-12-101-1/+1
| | | | | | | | | | | | | | | This gives VDDC more time to bleed out before the system reboots. This will require FAFT changes to compensate for the longer cold reset time. BUG=chrome-os-partner:16600 BRANCH=link TEST=from ec console, 'reboot cold' should take a second. Change-Id: I7e0e901958593262868151642560296f0c5496a7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39515 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Invalidate hash if flash operation changes the hashed regionRandall Spangler2012-12-103-8/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents the EC from returning a stale hash. BUG=chrome-os-partner:16668 BRANCH=link,snow TEST=manual, with WP disabled From EC console - Boot system and wait a second - hash --> prints valid hash - flasherase 0x20000 0x1000 - hash --> invalid - hash rw - hash --> prints valid hash - flashwrite 0x20000 0x1000 - hash --> invalid - hash rw - flasherase 0x38000 0x1000 - flashwrite 0x38000 0x1000 - hash --> still valid (since 0x38000 is outside the rw section) From root shell - ectool hash --> prints valid hash - ectool flasherase 0x20000 0x1000 - ectool hash --> invalid - ectool hash recalc RW - ectool hash --> prints valid hash - echo 'Making a hash of this' > /tmp/hashofthis - ectool flashwrite 0x20000 /tmp/hashofthis - ectool hash --> invalid - ectool hash recalc RW - ectool flasherase 0x38000 0x1000 - ectool flashwrite 0x38000 /tmp/hashofthis - ectool hash --> still valid (since 0x38000 is outside the rw section) Change-Id: Id915a504a7bc70b8b8c339b5ce55dc5bad5838fe Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39484 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Increase cold reset hibernate time to 200msstabilize2Randall Spangler2012-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The hardware fix for issue 16600 adds RC delays to ENABLE_5VALW, so that +5VALW stays on during a warm reset of the EC. In the worst case, +5VALW will drop around 150ms, which could then move the +3VALW glitch right into the time frame where the EC is booting following hibernate. Increase the cold reset hibernate time from 150ms to 200ms. This ensures that +5VALW has dropped before the EC comes out of hibernate. BUG=chrome-os-partner:16600 BRANCH=link TEST=manual From the EC console, 'reboot cold' a bunch of times. The system shouldn't hang. (Alternately, you can 'ectool reboot_ec cold' a bunch of times) Change-Id: I4bebdb552b8e917c6345badd6efb68b10d7d1f86 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39340 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: Enable +5VALW at boot and leave it enabledRandall Spangler2012-12-062-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | This works around a problem where disabling +5VALW glitches +3VALW_EC, which may cause the EC to brown out or hang. BUG=chrome-os-partner:16600 BRANCH=link TEST=manual 1. When the system boots, look for this line as the first x86 power state: [0.004977 x86 power state 0 = G3, in 0x0001] 2. Boot the system. Should boot normally. 3. Shut down the system using the power button. 4. After ~10 seconds, you should see that line of output again. 5. At the EC console: 'gpioget enable_5valw' should output: 1* ENABLE_5VALW This should ideally be combined with a hardware fix to add 30+ ms of delay to EC_EN_5V, since when the EC is reset via power+refresh that tri-states EC_EN_5V, and it takes ~22ms for the EC to boot and start driving EC_EN_5V again. Change-Id: Iba4d961d064105faf988a35c2277e9d7406e39e2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39334 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
* link: Disable interrupts while reading/writing bits via onewireRandall Spangler2012-11-291-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When reading, the line must be sampled in a narrow timing window after the output pulse. Interrupts or context switches during this time corrupt the data. Similarly, when writing, the difference between a 0-bit and a 1-bit is the length of the output pulse. So a context switch or interrupt there can turn a 1-bit into a 0-bit. BUG=chrome-os-partner:15507 BRANCH=link TEST=manual 0. plug in AC power 1. hold down shift key for the duration of this test 2. powerled yellow 3. powerled red 4. repeat steps 2-3 several times 5. release shift key Power adapter LED should toggle color each time. (It may also toggle to the normally expected color during this experiment, if the charging task updates it.) Power adapter LED should NOT turn off during this test. Change-Id: Ief11e6e9a5b07aa3a25c60c50e4e7744a4705713 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/38925 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fix potential deadlock in udelay()Randall Spangler2012-11-291-3/+13
| | | | | | | | | | | | | | | | | | | | | If interrupts are disabled and the deadline is across a 32-bit timer boundary from the current time, udelay() can lock up. The fix is to do 32-bit math directly in udelay(). BUG=chrome-os-partner:16472 BRANCH=link TEST=manual waitms 1 -> prompt returns almost instantly waitms 500 -> prompt returns after 0.5 sec waitms 1000 -> watchdog error printed, then prompt returns waitms 2000 -> watchdog reboot Change-Id: Ib8ca06cee414d48900c0142e629daa68aa0993c9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/38924 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* temp_metrics: Set GPU min freqSameer Nanda2012-11-281-4/+19
| | | | | | | | | | | | | | | | | | On systems with modems, a harmonic of the lowest GPU frequency of 350Mhz interferes with the cellular signal. Set the minimum GPU frequency for such systems to 450Mhz. BUG=chrome-os-partner:16439 TEST="cat /sys/kernel/debug/dri/0/i915_min_freq". On systems without this modem, it should read back 350. On systems with the modem, it should read back 450. BRANCH=none Change-Id: I103a55af11955aed2f3e8c945904444475c63865 Signed-off-by: Sameer Nanda <snanda@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/38826 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* Handle arbitration lost on I2C portsRandall Spangler2012-11-282-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This seems to happen when the I2C signals come up so that the EC sees a start condition from the remote end. In this case, the EC refuses to talk on the I2C port until the EC's I2C state machine is reset. Also, don't fail on bus-busy, since that's true during a multi-part transaction such as an I2C string read. BUG=chrome-os-partner:16262 BRANCH=link TEST=boot system; 'battery' and 'temps' should give good info Then run snanda's suspend_stress_test for a while and repeat. Or a better test is to open 2 crosh shells, sudo bash in each, and 1) while true; do ectool temps all; sleep 0.5; done 2) suspend_stress_test Then watch the EC console for "I2C5 bad status" errors. These happen rarely, only on some systems. With this fix, they'll be reported when they occur, but should not cause errors to be reported by 'ectool temps all', since the I2C module will clear the arbitration-lost status before retrying. Change-Id: Idfaf9cd7e8ef2abcc0130332890329dd5d2ca052 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/38686 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
* Prevent GCC4.7 from generating unaligned memory accessesVincent Palatin2012-11-271-0/+1
| | | | | | | | | | | | | | | | | | | The behavior of GCC seems to have changed between 4.6 and 4.7, now it might generate unaligned memory accesses, so we need to explicitly set "-mno-unaligned-access". Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:16391 TEST=make BOARD=link dis, then check the generated assembly for keyboard_scan_init Change-Id: I326479a77d6319f1d74e17efe483f5cde56ff325 Reviewed-on: https://gerrit.chromium.org/gerrit/38758 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
* Handle bus errors on thermal I2C busRandall Spangler2012-11-262-5/+43
| | | | | | | | | | | | | | | | | | | | | | | | | 1) Properly report I2C errors on TMP006 as error, not device-not-powered. 2) Treat clock timeout and bus-busy I2C status as error (previously ignored). 3) If clock timeout or bus-busy, reset I2C master for that bus to clear the error. These should help with systems where the thermal I2C bus gets into a weird state on suspend/resume. BUG=chrome-os-partner:16262 BRANCH=link TEST=boot system; 'battery' and 'temps' should give good info Then run snanda's suspend_stress_test for a while and repeat. Change-Id: I534be8236a4d6de82575fe6d33a68502ce0a3a95 Original-Change-Id: Iec5d6bbd357d2e5eb3dc3d361c829f353e996ab6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/38444 Reviewed-on: https://gerrit.chromium.org/gerrit/38659 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
* link: allow to decrease maximum battery charging currentVincent Palatin2012-11-073-0/+57
| | | | | | | | | | | | | | | | | | | | | Add an interface to allow the CPU to cap the maximum battery charging current. The maximum is removed every time the machine goes to S3 or S5. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=link BUG=chrome-os-partner:16041 TEST=on Link, plug AC to charge the battery, then run "ectool chargecurrentlimit 1200" and see the charging current in "power-supply-info" decreasing to 1.2 A. Change-Id: I10900e1c264d2db67809638ec0dcb836d721fa75 Reviewed-on: https://gerrit.chromium.org/gerrit/37532 Reviewed-by: Sameer Nanda <snanda@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>