summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* mec1322: Added support for sysjump.stabilize-7173.BDivya Jyothi2015-06-149-49/+179
| | | | | | | | | | | | | | | | | | | | | | | | changes added to support flashrom are: sysjump support to be able to copy the RO/RW image and jump to it without causing AP to reboot while its alreday ON. LPC init should be reinitialized on sysjump corrected gpio_set_flags_by_mask to make sure we update the register only for GPIO_LOW condition and not all else conditions. BUG=chrome-os-partner:38103 TEST=commands : flashrom -p ec -w ec.bin flashrom -p ec -r ec.bin BRANCH=none Change-Id: I23892f0378d756052030e73034c3acdd41477e34 Signed-off-by: Divya Jyothi <divya.jyothi@intel.com> Signed-off-by: Shamile Khan <shamile.khan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/272000 Reviewed-by: Shawn N <shawnn@chromium.org>
* coderam: Don't assume that RO/RW images reside at start of code memoryShawn Nematbakhsh2015-06-132-26/+59
| | | | | | | | | | | | | | | | | | RO/RW images may reside at an offset to the start of code memory, defined at the chip-level by CONFIG_R*_MEM_OFF. BUG=chrome-os-partner:38103 TEST=Manual on Cyan. Verify sysjump works correctly in both directions. BRANCH=None Change-Id: I54c5f20335a5646d49afcc8d3fa2eb90ca9349d0 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274434 Reviewed-by: Divya Jyothi <divya.jyothi@intel.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Divya Jyothi <divya.jyothi@intel.com> Reviewed-by: Mulin Chao <mlchao@nuvoton.com> Tested-by: Mulin Chao <mlchao@nuvoton.com>
* pd: ryu: set data role to UFP with debug accessoryVincent Palatin2015-06-134-5/+9
| | | | | | | | | | | | | | | | | | When a USB-PD debug accessory is plugged, set the default data role to UFP (USB device) on Ryu. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=none TEST=On Ryu, plug a SuzyQ and connect with ADB using a A-A cable. Change-Id: Ifa62b097532880ab5cadb7f2ab7774eec752f1e6 Reviewed-on: https://chromium-review.googlesource.com/277276 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
* accel: Fix BMM150 init sequenceGwendal Grignou2015-06-131-2/+4
| | | | | | | | | | | | | | | Without this change, after a while, the data from the accelerometer is garbled, weaker than expected. BUG=chromium:494270 TEST=Check that with this change, the accelerometer vector is always around 1G. BRANCH=smaug Change-Id: I9bb4acd208e8fa4111fc91e35c4cb5636f9425f4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276666 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* tcpc: disable TX timer as early as possible after DMA doneAlec Berg2015-06-131-3/+3
| | | | | | | | | | | | | | | | Move disabling the TX timer up to as soon as possible after DMA transmit is complete to avoid potentially clocking another bit, which could corrupt the end of the transaction. BUG=none BRANCH=smaug TEST=load on glados and use a scope to verify the end of transmit is clean. Change-Id: If52ba2475eeb9752da0acc8efc957c1f472bc711 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/277298 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* skylake: Properly handle apshutdown when AP is already shutdownShawn Nematbakhsh2015-06-131-2/+4
| | | | | | | | | | | | | | | | If the AP is already shutdown, apshutdown would previously power the AP up with a power press. Fix this by making sure we're not already in G3 before triggering the power press. BUG=chrome-os-partner:40677 TEST=Run 'apshutdown' on glados while in G3, verify that AP does not power up. BRANCH=None Change-Id: I8b898b034dcf40f0acef4fb6098af0aebba566c6 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/277400 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* tcpc: change pd_tx_done() to only wait for DMA done eventAlec Berg2015-06-131-5/+1
| | | | | | | | | | | | | | | | | | Change pd_tx_done() to wait specifically for the DMA complete event using task_wait_event_mask(). This fixes a potential bug where if we get another event, for example a TCPM event, while waiting for transmit to complete we restore the pending event after we are done. BUG=none BRANCH=smaug TEST=run on glados and make a bunch of contracts with zinger. Change-Id: Ie28d97eba3edcc7a98fe842e8b7eb6b9d7707047 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/277297 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* tcpc: Avoid missampling CC line immediately after transmitAlec Berg2015-06-131-16/+19
| | | | | | | | | | | | | | | | | | Change TCPC to not sample CC ADC channels immediately after transmit because we are likely to get a response immediately after transmit and this could cause us to sample while traffic is on the line and cause us to record the wrong voltage. BUG=none BRANCH=smaug TEST=test on glados. put a print when TCPM is notified of CC voltage change. without this CL, we occasionally get a false CC voltage change. with this change, CC status stays consistent. Change-Id: I9199a0ed98632b1f26b2b5b98f34928e4de328bf Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/277296 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* glados_pd: oak_pd: fix PD tx_disable timingAlec Berg2015-06-132-32/+36
| | | | | | | | | | | | | | | | | Disabling CC TX_DATA needs to be very fast to avoid clocking out an extra garbage bit at the end of transmit. This change fixes pd_tx_disable() to disable the TX_DATA line as fast as possible. BUG=chrome-os-partner:40920 BRANCH=none TEST=test on glados with scope attached to CC. note before this change we occasionally get a garbage bit at the end of CC transmit. With this change, it looks clean. Change-Id: I86b47881e3846b2e3dd4fc2afcf2d28386a068a6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/277295 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: do not glitch USB when going to S5 in debug modeVincent Palatin2015-06-132-26/+31
| | | | | | | | | | | | | | | | | | | | | | | | When we are going to S5 with a debug accessory plugged, we cannot transition through the 'PD_DRP_FORCE_SINK' else we would disable/re-enable the USB muxes triggering disconnections/glitches on the USB debug console. So, rework the management of the dual role toggling special case (used to detect debug accessories) : remove the special DRP state and re-write the conditions. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=chrome-os-partner:41399 TEST=on Ryu, connect to the EC console through Suzy-Q and issue the "apshutdown" command, then see the EC USB console is randomly disconnected/re-connected or acting up. Change-Id: Id44a9360a836e7c10a30f5afb2971bc7c3d01a5c Reviewed-on: https://chromium-review.googlesource.com/277275 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* pd: do not sleep when case closed debug communication is enabledVincent Palatin2015-06-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | The case closed debugging feature is using the USB controller, so it needs to disable the low power STOP mode of the MCU which is incompatible with USB communication. As the possibility of doing PD communication when a PD debug accessory is plugged "re-appeared", just set/use the USB_PD sleep disable bit with the debug accessory rather than creating a new one. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=chrome-os-partner:41399 TEST=on Ryu, connect to the EC console through Suzy-Q and issue the "apshutdown" command, then see the EC USB console is still alive. Change-Id: I8668b28220202ce6419f18cff13d57d410e3e9f3 Reviewed-on: https://chromium-review.googlesource.com/277116 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* core: Assert if task_get_current() cannot return a valid task IDShawn Nematbakhsh2015-06-124-0/+18
| | | | | | | | | | | | | | | | | | | If task_get_current() is called early during initialization when we have not yet done a context switch, our current_task pointer is invalid. Add an assert to detect this case and put it behind CONFIG_DEBUG_BRINGUP, a new config that's intended to enable possibly-costly pre-production debugging. BUG=chrome-os-partner:40677 TEST=Manual on glados. Define CONFIG_DEBUG_BRINGUP, then call i2c_write from board_init and verify the new assert fails. Remove the i2c_write and verify the new assert passes. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I6014ccf739dcc4c8f4f960be2b89f01e423b65b5 Reviewed-on: https://chromium-review.googlesource.com/273541 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* charge_manager: Don't cutoff charger when no battery is attachedShawn Nematbakhsh2015-06-122-6/+26
| | | | | | | | | | | | | | | | | | We normally do not charge from non-dedicated chargers. The process of determining whether a charger is dedicated or not involves PD protocol communication, so it can take some time to reach a determination. If no battery is attached, the charger is likely our only source of power, so don't cut it off. BUG=chrome-os-partner:41258 TEST=Attach donette to glados system with no battery, verify that glados boots to EC console and doesn't reset or panic. BRANCH=None Change-Id: I7c9cfcbd37b37ef16010cf1f246d8fddba6f6283 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/277074 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* glados: Enable BC1.2 USB chargingShawn Nematbakhsh2015-06-123-17/+63
| | | | | | | | | | | | | | | Enable charger detection through the pericom chips. BUG=chrome-os-partner:40920 TEST=Manual on Glados. Plug 1A Apple charger, verify that port is selected and charge limit is set correctly on both ports. Also verify that Zinger still charges correctly. BRANCH=None Change-Id: I7e462194560965b6140446f3444be225e5503616 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276886 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* spi/mec1322: Ensure that SPI Flash write chunks do not crossShamile Khan2015-06-122-15/+32
| | | | | | | | | | | | | | | | | | | | | | Page Boundary. If SPI Flash write is at an offset within the page and the length is greater than remainder of the page, the Flash page gets corrupted as addressing wraps to the beginning of page and previously written data gets overwritten. This change splits SPI Flash writes in such cases into two operations in different pages. BUG=None BRANCH=None TEST=During Software Sync, Depthcharge sends Flash write chunks that cross page boundary. With this change, the RW parition does not get corrupted. This can be confirmed by executing a successful "sysjump RW" after a Software Sync. Change-Id: I46349eea0d8e927353de7cb55a61e9960291adb6 Signed-off-by: Shamile Khan <shamile.khan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/275760 Reviewed-by: Shawn N <shawnn@chromium.org>
* usb: pi3usb9281: Allow flexible chip configurationsShawn Nematbakhsh2015-06-1214-126/+190
| | | | | | | | | | | | | | | | | | Previously we supported using a single pi3usb9281 chip, or using two chips on the same i2c bus behind a mux. Now that we need to support a third configuration of multiple chips on different busses, it makes sense to be able to configure the configuration freely at the board level. BUG=chrome-os-partner:40920 TEST=Manual on samus_pd. Plug USB charger, verify detection is correct on both charge ports. BRANCH=None Change-Id: I120dcb1c3ceb6f013b92407effcd8cb66e7ffcce Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276511 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* mec1322: Add servo serialname to flash_ec's flashrom call.Todd Broch2015-06-111-0/+5
| | | | | | | | | | | | | | | | | | | If host running flash_ec has multiple servo's connected it must use the USB serialname to identify the proper FTDI device to run flashrom on correctly. CL adds serial param to flashrom call to do just that. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=none BUG=none TEST=manual, successfully write glados EC w/ multiple servo V2's connected to the same host. Change-Id: I35c7d170f9bb80e96f69efae634cf70893eeef63 Reviewed-on: https://chromium-review.googlesource.com/276761 Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* commands: Add EC FIFO commandsGwendal Grignou2015-06-112-11/+177
| | | | | | | | | | | | | | | | | | Add command to read the sensors events FIFO from the AP: FIFO_INFO: get information on the FIFO state FIFO_READ: read and update the consumer pointer FIFO_FLUSH: insert a flush meta event and force a interrupt. A new MKBP event is added to tell the host the FIFO needs processing. BRANCH=smaug TEST=Test on ryu BUG=chrome-os-partner:39900 Change-Id: I11c0cf8cdc3087eb9e323f7d6780e6cf3a16257f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276264 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* mcdp28x0: Add more useful error codes.Todd Broch2015-06-112-31/+60
| | | | | | | | | | | | | | BRANCH=samus BUG=none TEST=compiles Signed-off-by: Todd Broch <tbroch@chromium.org> Change-Id: Id925acbafcb49dbf503f666a7edb79b7eb25fecd Reviewed-on: https://chromium-review.googlesource.com/276554 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* pd: change pd_transmit() to only wait for TX complete eventAlec Berg2015-06-111-3/+1
| | | | | | | | | | | | | | | | | Change pd_transmit() to wait specifically for the TX complete event using task_wait_event_mask(). This fixes a bug that if another event, it will now restore that event instead of consuming it. BUG=chrome-os-partner:40920, chrome-os-partner:41290 BRANCH=smaug TEST=load onto glados and zinger and attach them a bunch of times and get stable contract with no hard resets. Change-Id: I36514ea45b5e2b5fd42acdad94e5786da5bd90b6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276745 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* core: add task_wait_event_mask() function to other coresAlec Berg2015-06-114-2/+76
| | | | | | | | | | | | | | | Add task_wait_event_mask() function to core/cortex-m0, core/host and board/zinger/runtime in order to delay a task until a specific event occurs. BUG=none BRANCH=smaug TEST=make -j buildall Change-Id: Ic89487fcae5352eec53b745179c7f0d5893ad3e0 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276744 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* mec1322: fix flash_physical_get_writable_flags()Andrey Petrov2015-06-111-1/+5
| | | | | | | | | | | | Add spi_enable() before SPI transaction. This fixes a problem where protect host cmd ended up messing up SPI controller state. Change-Id: Ief61f279cbd0a90e55ce87d0c350072dc8616c31 Signed-off-by: Andrey Petrov <andrey.petrov@intel.com> Reviewed-on: https://chromium-review.googlesource.com/276338 Reviewed-by: Shawn N <shawnn@chromium.org> Tested-by: Divya Jyothi <divya.jyothi@intel.com> Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
* Stream: Remove in_stream/out_stream interfaceAnton Staaf2015-06-1118-554/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The in_stream and out_stream interfaces were a first attempt at providing an abstraction for multiple stream like devices (usart, USB, I2C/LPC host interfaces...). But, by baking the queue into the device it proved to be hard to use and required additional resources (task or deferred hook) to handle passing data from one stream to another. Since then the queue policy and producer/consumer interfaces have replaced the stream interfaces. This CL removes the old stream interfaces and updates the only users (deleting the test echo code from the discovery-stm32f072 board and updating the mcdp28x0 driver to use the queue interfaces). Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: Ic0d2abf81eafc4fb2e61172540151f2d0ba45caf Reviewed-on: https://chromium-review.googlesource.com/276163 Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
* mec1322: Fixed I2C handling on Repeat Start.Kevin K Wong2015-06-101-2/+1
| | | | | | | | | | | | | According to the datasheet, PIN should not be set in the CTRL register. BUG=none TEST=Verify with I2C analyzer that no error is observed. BRANCH=none Change-Id: Ifed58b413151b40ed951cb71b1164432fea28eca Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/276672 Reviewed-by: Shawn N <shawnn@chromium.org>
* glados: add battery cutoff functionalityAlec Berg2015-06-102-1/+29
| | | | | | | | | | | | | | | Add battery cutoff functionality to glados. BUG=none BRANCH=none TEST=use console cutoff command to verify that it cuts off battery and plug in zinger to verify that it comes out of it when AC is applied. Change-Id: I71ae113c398278ad9f67f3a4cedf6885754a5a72 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276690 Reviewed-by: Rong Chang <rongchang@chromium.org>
* charger: Move USB charger / BC1.2 task to common codeShawn Nematbakhsh2015-06-1024-523/+239
| | | | | | | | | | | | | | | | Move the task responsible for detection of USB chargers to common code to reduce code duplication. BUG=chrome-os-partner:40920 TEST=Manual on samus_pd. Plug USB charger, verify detection is correct on both charge ports. BRANCH=None Change-Id: I362f8b5b51741509e459c66928131f1f6d2a3b1d Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276210 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* glados: enable battery present detectionAlec Berg2015-06-103-5/+4
| | | | | | | | | | | | | | | Change battery temperature ADC into an input with a pull-up and use it for battery detection. BUG=none BRANCH=none TEST=boot with and without battery and check gpio accurately reflects battery status. Change-Id: Id30a6c2d7eaad2e6f3c69be4bab33dbcf0682e29 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276650 Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: change board hardware revisionsRong Chang2015-06-102-4/+4
| | | | | | | | | | | | | | Per discussion in CL:274728, hardware revision numbers are integer. So the previous rev1.5 becomes rev2. And the previous rev2 is now rev3. BRANCH=none BUG=none TEST=none Change-Id: Ic7a1a60ce0b17a3469965cdca99332df0243ce2a Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276577 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Remove obsolete board-specific codeRandall Spangler2015-06-1028-2804/+14
| | | | | | | | | | | | | | | | | Now that we've removed boards from ToT, also delete board-specific code used only by the removed boards. There are still more things to remove (unused charging chips, LED drivers, COMx support). More CLs coming. BUG=chromium:493866 BRANCH=none TEST=make buildall -j Change-Id: Ie6bdeaf96e61cadd77e3f6336c73b9b54ff4eabb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276524 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: enable type-C port 1 power up ECRong Chang2015-06-101-1/+1
| | | | | | | | | | | | | | | | When EC boots up on type-C port 1 VBUS power, it shouldn't turn off CHARGE_L control. BRANCH=none BUG=chrome-os-partner:41167 TEST=manual remove battery, plug type-C charger to port 1. check charging LED. Change-Id: I360715b2f81df5eba0901b854d2dd8e2f0a23651 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276589 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: initialize charge manager to use BC1.2 suppliersRong Chang2015-06-101-0/+42
| | | | | | | | | | | | | | | This change continues porting CL:275686 to oak. Since oak didn't connect VBUS wake signals to EC, it checks Pericom BC1.2 status on initialize VBUS suppliers. BRANCH=none BUG=chrome-os-partner:41167 TEST=none Change-Id: Idbc7032329f7c46aee8f35c3fdd1e8e4aa9c001c Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276587 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: enable battery present detectionRong Chang2015-06-102-1/+2
| | | | | | | | | | | | | | Rename BATT_TH to a more meaningful BAT_PRESENT_L. And enable GPIO based battery detection. BRANCH=none BUG=none TEST=none Change-Id: Icea2b6def889f887aad862b39fb75aedf72c7042 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276586 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: enable CHARGE_MANAGER to handle charging on both portsRong Chang2015-06-103-19/+119
| | | | | | | | | | | | | | | | | | | | This CL copies CL:275686 that enables charge manager to handle charging on two ports. Since oak has the same PD design, so both CHARGE_L controls need to be enabled to detect VBUS when no charger is plugged in. That means if you set chgoverride -1, this actually enable charging on both ports. BRANCH=none BUG=chrome-os-partner:41167 TEST=manual plug in zinger and donette onto both ports. verify that we charge from the first one plugged in. Change-Id: If5ed360e55f6c6b1a0315a68a5a6d924ae856c6d Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275853 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: use pdcmd task to handle tcpc interruptRong Chang2015-06-102-1/+18
| | | | | | | | | | | | | | This change syncs oak with glados change CL:275296. BRANCH=none BUG=chrome-os-partner:41167 TEST=manual load on oak and plug zinger in both ports many times. Change-Id: Idc00a50c2d7b7a865e70762e91b2e7a82c6e6896 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275852 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: add PD support for type-C port 1Rong Chang2015-06-106-11/+21
| | | | | | | | | | | | | | | | | | | Port CL:275072 to oak. Oak rev1 and rev1.5 type-C VBUS input controls are connected to PD phy instead of EC. This change wakes both USB PD task to handle power status change. This issue will be fixed in next hardware revision, or enable TCPC power status alert. BRANCH=none BUG=chrome-os-partner:41167 BUG=chrome-os-partner:41226 TEST=manual plug type-C charger into port 1 Change-Id: Ifea19276d0eb74f3e4cac509abece362e6e8af17 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275851 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* oak: Modify GPIO list for rev 1.5 boardsRong Chang2015-06-106-32/+104
| | | | | | | | | | | | | | | | Rev 1.5 hardware redefined EC and PD phy IO controls. This change adds macro to map configurations at compile time. BRANCH=none BUG=none TEST=manual build and flash ec.bin plug type-c charger on port 0 Change-Id: I60c2f1448fbdea9bb72d1f3b19de366cad150087 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274771 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* stm32: switch to ec_boot_mode servo controlRong Chang2015-06-101-2/+2
| | | | | | | | | | | | | | | | | | | | | hdctools adds an alias ec_boot_mode and remaps spi1_vref with onoff control. This change switches ARM systems with STM32 EC from spi1_vref:pp3300 to ec_boot_mode:on. CQ-DEPEND=CL:275251 BRANCH=none BUG=chrome-os-partner:40479 TEST=manual cd ~/trunk/platform/ec util/flash_ec --board oak --image oak_ec.bin util/flash_ec --board oak_pd --image oak_pd.bin Change-Id: I0f3a74eaa7fc937d1372cd51124c6b3d23351581 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274770 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
* mec1322: bugfix for flash_ec dut-control call.Todd Broch2015-06-101-1/+1
| | | | | | | | | | | | | | | | | | Direct call to shell command 'dut-control' wouldn't account for port argument in script. Change to function 'dut_control' within script that does. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: Id4f77dedb57ce8097059c33371b5cd697fdbdb0d Reviewed-on: https://chromium-review.googlesource.com/276534 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* ryu: allow charge manager to control CHARGE_EN gpioAlec Berg2015-06-102-10/+5
| | | | | | | | | | | | | | | | | | | Move control of CHARGE_EN from the PD state machine, where it was tied to our CC termination value, to charge manager when charge manager sets the active charge port. This allows ryu to charge from debug accessory where we advertise Rp but still want to charge. BUG=none BRANCH=smaug TEST=load onto ryu and plug in zinger, hoho, and suzyQ and make sure we negotiate a contract with PD partners, and that we charge from power supplies. Change-Id: I81d9997c011eac6d5136fca8e97a5da3470a8e8a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276543 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: enable charging through suzyQ debug accessoryAlec Berg2015-06-102-9/+40
| | | | | | | | | | | | | | | | | | | Enable charging through debug accessory by setting input current limit to 3A when debug accessory is detected. Add new dual-role toggling state for stay sink unless VBUS is detected, which allows us to detect debug accessory when we are not normally dual-role toggling. BUG=none BRANCH=smaug TEST=plug suzyQ into ryu in S0 and in S5 and make sure that we go to the SRC_ACCESSORY state and set charger input current limit appropriately. Change-Id: I6262c9d6cd0ae7159f343d36e19d290c2f2e0181 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276368 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* glados: limit type-C voltage to 5V to increase charging reliabilityAlec Berg2015-06-091-3/+5
| | | | | | | | | | | | | | | | | Change charging workaround on glados to limit the max input voltage to 5V. This provides more reliable charging by reducing the noise on the i2c bus to battery and charger. Note, this limits charging power to 15W. BUG=none BRANCH=none TEST=load onto 3 different glados boards and charge for 10 minutes with no i2c errors causing charging to stop. Change-Id: I4d67b62a18cf40d645b132081a431f9ce187168b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276366 Reviewed-by: Shawn N <shawnn@chromium.org>
* ectool: Fix cut and paste errors in motionsenseGwendal Grignou2015-06-091-24/+26
| | | | | | | | | | | | BUG=none BRANCH=none TEST=compile Change-Id: Ie1e5a453f2ffa023599ca6357d1fd2bee95b271d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276263 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* accel: move X,Y,Z definitionGwendal Grignou2015-06-094-14/+4
| | | | | | | | | | | | | | Move definition so that we can use it in accel driver. BUG=None TEST=Compile BRANCH=none Change-Id: I45d16a91d923cb0538b7fdf4110112566c87b6d0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/269837 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Queue: add peek_memcpy functionGwendal Grignou2015-06-092-11/+31
| | | | | | | | | | | | | | | | | Add queue_peek_memcpy to peek at queue and move the element using specific memcpy function. Also change memcpy prototype argument from void const * to const void*. BUG=none BRANCH=none TEST=Compile and use. Change-Id: I8c582563e7d204ee5568637f819d63404624faf6 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274226 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Anton Staaf <robotboy@chromium.org>
* glados: limit max input current to 1.5A to avoid i2c errorsstabilize-7155.BAlec Berg2015-06-093-1/+12
| | | | | | | | | | | | | | | | | | | | | Add workaround to limit the max input current to 1.5A due to i2c communication problems at higher currents. Note that this max should be removed when possible. This introduces a new CONFIG option to define the maximum input current limit for a board, as opposed to the already existing default input current limit. BUG=none BRANCH=none TEST=load on glados, charge with zinger, make sure input current is set to 1.5A and no recurring i2c errors talking to battery and charger. Change-Id: Ib7070772e1bf5475e98a2dc946ae75bf08047b70 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276169 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* glados: switch to isl9237Aaron Durbin2015-06-091-3/+3
| | | | | | | | | | | | | BUG=None BRANCH=None TEST=Charged battery on reworked glados. Change-Id: If5887b9bee304c24dbd49d5f01abf08e02df3074 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275069 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org>
* charger: Add Intersil charger ISL9237Rong Chang2015-06-083-0/+484
| | | | | | | | | | | | | | | | | | | | | | | ISL9237 is a buck-boost narrow output voltage DC charger. This change provides interfaces to satisfy external dependencies for charge_state_v2. ISL9237's charging voltage control is different from smart battery chargers. And there's no SBC compatible charging mode and status. So this CL modified charger_set_voltage() behavior by controlling VSYS voltage. BRANCH=none BUG=none TEST=ran on reworked glados Signed-off-by: Rong Chang <rongchang@chromium.org> Change-Id: Ibbbf805bbbe1ee06f87a41cde3e39acbf2e105b4 Reviewed-on: https://chromium-review.googlesource.com/272882 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Aaron Durbin <adurbin@chromium.org> Trybot-Ready: Aaron Durbin <adurbin@chromium.org> Tested-by: Aaron Durbin <adurbin@chromium.org>
* mec1322: Do not restrict SPI flash reads to Word Boundary.Shamile Khan2015-06-071-5/+1
| | | | | | | | | | | | | | BUG=chrome-os-partner:41145 BRANCH=None TEST=flashrom can update EC's RW partition. Change-Id: I29c450c8cffbc8a47228836ce1959f316026e743 Signed-off-by: Shamile Khan <shamile.khan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/275633 Reviewed-by: Icarus W Sparry <icarus.w.sparry@intel.com> Commit-Queue: Icarus W Sparry <icarus.w.sparry@intel.com> Tested-by: Icarus W Sparry <icarus.w.sparry@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* glados: enable CHARGE_MANAGER to handle charging on both portsAlec Berg2015-06-073-18/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | Enable CONFIG_CHARGE_MANAGER to handle charging on two ports. For now, we only use the type-C pull-up supplier and the PD supplier. This adds Pericom BC1.2 suppliers as well even though we aren't using them. Currently, on Glados, we can't detect VBUS unless charge_en GPIO is asserted. This means, when no charger is plugged in, we must have both ports enabled. And when one charger is plugged in, we must disable the other port. Practically, this means we always charge from first charger plugged in since we can't detect the second one. And, this means that if you do chgoverride -1, which normally stops charging, this will actually enable charging on both ports. BUG=chrome-os-partner:40920 BRANCH=none TEST=load onto glados and plug in zinger and donette onto both ports. verify that we always charge from first charger plugged in. plug in hoho to either port and make sure it gets VBUS. Change-Id: Ia5d5725ee86b25f6fec0f276d4c471f533c81112 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275686 Reviewed-by: Shawn N <shawnn@chromium.org>
* glados: enable ADC channelsAlec Berg2015-06-062-0/+26
| | | | | | | | | | | | | | | Enable ADC channels on Glados. For now only VBUS is scaled accurately into mV, the rest are ADC counts. BUG=none BRANCH=none TEST="adc" from EC console and verify VBUS measurement matches for zinger at 20V and donette at 5V. Change-Id: I1af70df5b851ba654c8feb7c97d190d393421a29 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275685 Reviewed-by: Shawn N <shawnn@chromium.org>