summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ryu_p4p5: enable MBKP events for PD eventsstabilize-7131.BVincent Palatin2015-06-012-2/+33
| | | | | | | | | | | | | | | | | | | | | enable the MKBP event feature to send host event and wire up the PD specific events. This is the P5 version of the following Ryu CL: https://chromium-review.googlesource.com/273620 Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:33194 TEST=On Ryu P5, plug/unplug USB devices and add kernel trace to see the PD events happening. Change-Id: Ibe3a3e75919419bd97610c69303c43bca6107210 Reviewed-on: https://chromium-review.googlesource.com/274144 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* oak: Add PD communication to oakAlec Berg2015-05-3011-7/+724
| | | | | | | | | | | | | | | | | | Add TCPM on EC side and TCPC on PD side to allow PD communication. Enable PD communication on port 0. BUG=none BRANCH=none TEST=load on oak. plug in hoho on port 0, and make sure we successfully negotiate a PD contract. (note: you have to manually enable 5V VBUS right now) Change-Id: I0ce7c016545bc56c5e10f66b49b73722187f12dc Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/271829 Reviewed-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Sheng-liang Song <ssl@chromium.org> Commit-Queue: Sheng-liang Song <ssl@chromium.org>
* sb_firmware: fixed the last write delaysSheng-Liang Song2015-05-302-16/+33
| | | | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:40569 BRANCH=none TEST=Begin 1. Install noraml linux images 2. Connected Battery which is having old firmware(100) 3. power on DUT and goto crosh (In normal mode) 4. run "battery_firmware update " 5. Remove AC to interrupt the update 6. Power OFF and power on the DUT again 7. Now seen critical firmware update screen. 8. Reboot around 4 min. 9. See login window. End Change-Id: I2090cfa9200a7402a5fba2e111073dd1d7e7b422 Signed-off-by: Sheng-liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273660 Reviewed-by: Shawn N <shawnn@chromium.org>
* keyboard_mkbp: fix interrupt handling with MKBP_EVENTVincent Palatin2015-05-301-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_MKBP_EVENT is enabled, the current code is incorrect because we have a race condition when sending a new event (we force first the interrupt, then send the actual event content to the mkbp event framework which forces again the interrupt level). If the software still called EC_CMD_MKBP_STATE while CONFIG_MKBP_EVENT is enabled, this will kill the interrupt as soon as the FIFO is empty even though other events are pending in order to be backward compatible with firmware using the interrupt has a hint when polling the keyboard. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:33194 TEST=make buildall fiddle with keyboard on Oak. Change-Id: Iafaf4174124934328c4a0172adeca651e5551f28 Reviewed-on: https://chromium-review.googlesource.com/274070 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* mcdp28x0: Use custom appstest command for get_infoTodd Broch2015-05-302-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Firmware's original get_info command always returns the same values for family, chipid, irom & fw despite indeed having different versions. Currently its: family:000e chipid:0001 irom:1.0.0 fw:0.0.0 As we have a new stepping of the chip ('BB') and a corresponding new firmware (>=0.74) we need a mechanism to verify and log this change. CL uses the newly hatched appstest command (0x12) message 0x28 to surface information that properly reflects both hardware and firmware running. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:35939 TEST=manual, For devices running 0.54 | 0.74 fw see gpio MCDP_READY asserted. With CONFIG_CMD_MCDP in board/hoho/board.h see the following responses when executing 'mcdp info' Stepping | FW | Response -------------------------------------------------------------------- 'BA' 0.53 fails as expected 'BA' 0.54 family:0010 chipid:2850 irom:2.0.0 fw:0.54.0 'BB' 0.73 fails as expected 'BB' 0.74 family:0010 chipid:2850 irom:2.1.0 fw:0.74.0 Change-Id: I2c36393a298c617f903389dab24da631b60ec574 Reviewed-on: https://chromium-review.googlesource.com/274049 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* mcdp28x0: add appstest console command.Todd Broch2015-05-302-3/+66
| | | | | | | | | | | | | | | | Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:35939 TEST=manual, with CONFIG_CMD_MCDP in board/hoho/board.h Try appstest commands on hoho and see them work. Change-Id: I0b3f674251f0d7c68ba4958fd3376b7c8d81b13f Reviewed-on: https://chromium-review.googlesource.com/272792 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* glados: Fix typo in 'muxes' I2C busShawn Nematbakhsh2015-05-301-1/+1
| | | | | | | | | | | | | | 'muxes' refers to bus 0, port 1, not bus 0, port 0. BUG=chrome-os-partner:40677 BRANCH=None TEST=Manual on Glados. Run 'i2cscan', verify that bus "1" is scanned, and devices respond with ACK. Change-Id: I734306928a128fea5e70b37735a71a64483f4e88 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274125 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: query packet size and set them properly internally.Gwendal Grignou2015-05-304-6/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to negotiate the packet command and responses to whatever values the EC can support. Set the buffer size including the necessary V3 header. If the EC run v3 protocol with large packet support, but the kernel does not have v3 support (3.10), we can not support sending or receiving large commands. Be aware that on 3.10, commands like ectool console will fail if the EC wants to send command larger than the kernel can handle. Copied kernel_version_ge from libusb-1.0.19/libusb/os/linux_usbfs.c. BUG=chrome-os-partner:31989,chrome-os-partner:31660,chromium:454324,chrome-os-partner:39265 BRANCH=none TEST=Build a special firmware to exchange 300 bytes. Check ectool console works with the righ size. Check that ectool is calling uname. Check on Nyan_big: without change, "ectool version" crashes kernel. With changes, "ectool version" works. In conseuqence, it reverts commit be0bd9b83538427cc350ad38d64b821dfcad82a0, "ectool: Do not increase buffer size after probe max size from ec" Change-Id: I54ffd43488ea81272f30789dc87a261085769fe0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274086 Reviewed-by: Shawn N <shawnn@chromium.org>
* Cr50: Use USB structs instead of byte arrays for readabilityBill Richardson2015-05-292-25/+32
| | | | | | | | | | | | | | | | | The USB spec mandates that all structs are little-endian over the wire. Since we're a little-endian architecture (and the code we're changing is intentionally chip-specific), we can just cast the hardware buffer into the correct struct. This makes the code easier to read and understand. BUG=none BRANCH=none TEST=make buildall Change-Id: Ib2d3b04f4db1a531cb3f5ada1a2e6ee82e8a23aa Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274130 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* glados: Initialize PMIC V12 / V0.85A supplyShawn Nematbakhsh2015-05-293-0/+19
| | | | | | | | | | | | | | This change is necessary to ensure power-up of edge-case Skylake parts. BUG=chrome-os-partner:40677 TEST=Manual on Glados. Boot system to S0, run "i2cxfer r 4 0x60 0x38", verify that 0x7a is read. BRANCH=None Change-Id: Id9e62731aaa75fb2357a05d898ba2d4d28f87d9e Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274114 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* power: skylake: Wait for PCH_SLP_SUS_L deassertion when leaving G3Shawn Nematbakhsh2015-05-291-1/+1
| | | | | | | | | | | | | | | | PCH_SLP_SUS_L can take up to 29ms to be deasserted after power-on or RTC reset. BUG=chrome-os-partner:40677 BRANCH=None TEST=Manual on glados. Power board, verify that state machine transitions to S0. Run "reboot" on EC console, verify that state machine again transitions to S0. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I3f6e89eee1190a3fe84fdc7d939c05dfe5b94953 Reviewed-on: https://chromium-review.googlesource.com/274077 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Cr50: USB hardware uses 8-bit buffers, not 16-bitBill Richardson2015-05-298-112/+49
| | | | | | | | | | | | | | | Our USB buffers are just arrays of uint8_t in program RAM, so let's treat them that way. The DMA descriptors are in normal RAM, too. BUG=chrome-os-partner:40693 BRANCH=none TEST=make buildall Change-Id: Ibafe1a557a328bbf8cf37ce113675fcd35bad376 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273918 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* tcpc: fix alert bit masks for transmitAlec Berg2015-05-291-1/+1
| | | | | | | | | | | | | Fix alert transmit complete bit mask typo BUG=none BRANCH=none TEST=make buildall Change-Id: I70f9276f6448190aba5bafdbdab957fb8f0a4517 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274085 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: fix tcpc alert to handle multiple alert bits set at onceAlec Berg2015-05-291-3/+6
| | | | | | | | | | | | | | | | Fix tcpc_alert() so it can handle multiple alert bits. This is needed since the initial version of tcpc_alert() is read/clear and so we need to service all bits or else it will get lost. BUG=none BRANCH=none TEST=test on glados. see multiple alert bits and handle both of them. Change-Id: I4d2a19a5d5d6f85cad3d67a96217d65e6e65715c Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274084 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* mec1322: i2c: Fix open transaction i2x_xferShawn Nematbakhsh2015-05-291-11/+23
| | | | | | | | | | | | | | | | | - Don't re-send our slave address if we're not generating a start condition. - Handle repeated start vs new transaction properly in the Rx case. BUG=chrome-os-partner:40677 BRANCH=none TEST=Manual on glados. Verify 'battery' dumps correct info, and i2cscan succeeds. Also verify that tcpc communication with PD transmits the expected data. Change-Id: I30315d2d82857d6031fda6d4e6a787a52ec01382 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273956 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: Refine HPD debounce values.Todd Broch2015-05-296-35/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change refines HPD debounce values into both upstream and downstream values for packetizing across the type-C link. For LVL, the upstream type-C device will packetize any HPD transition >=2ms as either HIGH or LOW. On the downstream side the value is driven immediately. Additional debouncing should be done by true upstream device according to specification. For IRQ, the upstream type-C device will packetize any HPD pulse >250usec as an IRQ. On the downstream side it will be de-packetized to create 750usec pulse. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:39717 TEST=samus|macbook(2015) + hoho|dingdong|apple HDMI type-C dongles still drive screens successfully. Change-Id: Ide58f3b2d675a82c12ca6afc2be53ca6e2561ace Reviewed-on: https://chromium-review.googlesource.com/273867 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* ryu: add PD event loggingVincent Palatin2015-05-281-0/+2
| | | | | | | | | | | | | | | | | | | Enable the logging of important event on the PD stack and coming from the PD accessories. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=On Ryu P6, plug/unplug type-C devices, then read the kernel log and see the various events reported there. Change-Id: I93a8dd72d1280271a82c62597ec99159832cae15 Reviewed-on: https://chromium-review.googlesource.com/273635 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* ryu: enable MBKP events for PD eventsVincent Palatin2015-05-283-3/+34
| | | | | | | | | | | | | | | | | | | enable the MKBP event feature to send host event and wire up the PD specific events. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:33194 TEST=On Ryu P6, plug/unplug USB devices and add kernel trace to see the PD events happening. Change-Id: I21f47884a869987c917e56ed9b3f914815af51e4 Reviewed-on: https://chromium-review.googlesource.com/273620 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* power/skylake: Always enable PP*_EN signals for bring-upShawn Nematbakhsh2015-05-282-15/+3
| | | | | | | | | | | | | | Always enable these signals to help debug power sequencing. We'll need to revert this change later. BUG=chrome-os-partner:40677 BRANCH=none TEST=sequence to S0 on glados and stay there Change-Id: Ia845532fe7aed71bcb42b4ca6a9bfa20aa9e3e00 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273900 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* cleanup: Remove device-specific stuff from include/usb.hBill Richardson2015-05-283-72/+172
| | | | | | | | | | | | | | | | This moves the STM32-specific code out of the common header file and into the chip directory where it belongs. Note that this doesn't actually change the code for non-STM32 SoCs; that will happen in a separate CL for clarity. BUG=chrome-os-partner:40693 BRANCH=none TEST=make buildall Change-Id: Ifdf0086e86a1088fb011b9ac4d6c70ab8da47aec Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273577 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* mec1322: Added KBD SERIRQ supportKevin K Wong2015-05-281-7/+8
| | | | | | | | | | | | | | BUG=chrome-os-partner:24107 TEST=Keyboard keys are printed correctly on Kunimitsu. BRANCH=none Change-Id: Ia4ed6c1166fa20dc8623ea8d7147b6f587cbf993 Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/272504 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* pd: fix type-C current limit detectionVincent Palatin2015-05-281-2/+2
| | | | | | | | | | | | | | | | | | | | There was a small typo in get_typec_current_limit() since the introduction of the new TCPCI constants, we need to find the current limit by using the voltage values measured on the sink side. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:40719 TEST=Connect Donette to Ryu and see the current limit set to 3.0A using the "charger" command. Change-Id: Icb4a5ea4997265dc1edeeb4d3cc69e416b864707 Reviewed-on: https://chromium-review.googlesource.com/273679 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* power: skylake: Always mirror rsmrst input to outputShawn Nematbakhsh2015-05-281-6/+2
| | | | | | | | | | | | | | This change will help us to debug power sequencing and will likely need to be reverted later. BUG=chrome-os-partner:40677 BRANCH=none TEST=sequence to S0 on glados and stay there Change-Id: I85d1f0f97a3c93cf26c766a749feb23f9cf4ac62 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273680 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Initialize the memory-mapped AC_PRESENT flagTed Kuo2015-05-281-0/+8
| | | | | | | | | | | | | | | | | | | The memory-mapped AC_PRESENT flag needs to be initialized for the batteryless projects. BUG=chrome-os-partner:40384 TEST=make -j buildall, make -j tests BRANCH=None Signed-off-by: Ted Kuo <tedkuo@ami.com.tw> Change-Id: Ia64ad6564f99b4aae060d29a572b4fe173da62d9 Reviewed-on: https://chromium-review.googlesource.com/273082 Tested-by: Ted Kuo <tedkuo@ami.com.tw> Reviewed-by: Mohammed Habibulla <moch@google.com> Commit-Queue: Ted Kuo <tedkuo@ami.com.tw> (cherry picked from commit 6cc0ece36d4190e2461f7e44767e0f77f47401b8) Reviewed-on: https://chromium-review.googlesource.com/273462 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* glados: Treat RTCRST as active low signalDuncan Laurie2015-05-271-1/+1
| | | | | | | | | | | | | Change this to not be driven low by default. BUG=chrome-os-partner:40677 BRANCH=none TEST=sequence to S0 on glados and stay there Change-Id: I6f97c17a809fd3f69911ab117f589475c5f30b0a Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273419 Reviewed-by: Shawn N <shawnn@chromium.org>
* extra: add simple USB console app for discovery-stm32f072Bill Richardson2015-05-272-0/+491
| | | | | | | | | | | | | | | | | | | | | | | This provides a very simple console interface for talking to the discovery-stm32f072 board over its USB connection. It's a simpler way to check that the board is working than configuring udev and/or various drivers to recognize USB device 18d1:500f as a serial console. BUG=none BRANCH=none TEST=manual Connect a discovery-stm32f072, then cd extra/usb_console make ./usb_console Change-Id: Ib25baebe5b4f3a930cdc3a1367d6d20d05b70c56 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273570 Reviewed-by: Anton Staaf <robotboy@chromium.org>
* pd: avoid re-sending discovery VDMs after power swapAlec Berg2015-05-271-7/+6
| | | | | | | | | | | | | | | | | | | Avoid re-sending discovery VDMs after power swap from source to sink. BUG=chrome-os-partner:40657 BRANCH=samus TEST=tested connecting samus to samus. tested power swapping back and forth and verify that we don't re-send discovery VDMs. Tested soft reset and verified that we don't re-send discovery VDMs. Tested hard reset and verified that we DO re-send discovery VDMs. Change-Id: Ib48c134f460eb776b7c6f5c1d86a5b56bb08ebcc Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273420 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* strago: Added board version support.Kevin K Wong2015-05-272-4/+5
| | | | | | | | | | | BUG=none TEST=Verified correct board version is returned via "version" console command. BRANCH=none Change-Id: I85a21fc7afe5fb918541e3196ce5a8bd24b09b7d Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/272986 Reviewed-by: Shawn N <shawnn@chromium.org>
* pd: never answer malformed VDMVincent Palatin2015-05-271-0/+2
| | | | | | | | | | | | | | | | | | | When we are receiving a VDM which seems malformed, don't try to send an answer, else we can ping-pong broken messages with the other side. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=plug Ryu P6 to plankton, no longer see endless "ERR:CMDT:1" error messages. Change-Id: If5b581c5c68996c60e37ac6d96638fd5df24356f Reviewed-on: https://chromium-review.googlesource.com/273525 Reviewed-by: Todd Broch <tbroch@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* tcpm: return all non-zero errorsRong Chang2015-05-271-4/+4
| | | | | | | | | | | | | | TCPM functions calls I2C read/write, which returns positive error codes on stm32f0 based EC. BRANCH=none BUG=none TEST=none Change-Id: I8119074e7411e2fd88dd6ca696fc7b698d462623 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273506 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak_pd: add initial support for oak PDAlec Berg2015-05-2710-0/+371
| | | | | | | | | | | | | | | Add initial support for Oak PD MCU on rev1 boards. This does not include USB PD communication. BUG=none BRANCH=none TEST=build and load on oak and get console. test we resond to host commands from EC using "pdcmd 0 0" on EC console. Change-Id: I92045cf0fd682279ada6c286f5399f0e258a6305 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/271828
* pd: fix duplicate PD receive event on combined TCPM/TCPCAlec Berg2015-05-271-0/+9
| | | | | | | | | | | | | | | | | | Fix duplicate PD RX event when using combined TCPM/TCPC. Problem is that PD_EVENT_RX is already set in the phy layer in pd_rx_event when CC edges are detected. Therefore, we shouldn't set it again when the TCPC detects that receiving has started. BUG=none BRANCH=none TEST=test on samus. without this change we occasionally get a PD error and hard reset under certain timing circumstances due to the repeated event. with this change, those errors go away. Change-Id: If1034a549b75740f327e16810e81c9aa28d71b00 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273418 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cyan: Added board version support.Kevin K Wong2015-05-272-3/+4
| | | | | | | | | | | BUG=none TEST=Verified correct board version is returned via "version" console command. BRANCH=none Change-Id: I97cf9911e3279ea7b6ad2f3bb383cde43c5114ba Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/272985 Reviewed-by: Shawn N <shawnn@chromium.org>
* i2c: Make i2c_xfer a wrapper function to chip_i2c_xferShawn Nematbakhsh2015-05-279-25/+51
| | | | | | | | | | | | | | | | i2c_xfer was previously implemented at the chip-level, but now we want to add some global retry logic. Rename the chip-level i2c_xfer functions to chip_i2c_xfer and add a new global wrapper function i2c_xfer. BUG=chrome-os-partner:39613 TEST=Run "battery" from EC console on Cyan, verify that values + strings are correctly printed. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: If37c85cc3cf94fd53feb6931553e10c30ad6cad6 Reviewed-on: https://chromium-review.googlesource.com/272939 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* oak: Simplify GPIO listRong Chang2015-05-271-61/+61
| | | | | | | | | | | | | | Oak's initial commit was merged at same time with CL that changed GPIO macros. This change fixes oak build by applying new GPIO macros. BRANCH=none BUG=none TEST=make BOARD=oak -j Change-Id: I1b60a85b83aa46c81c5dd7fea44bb221646c0cf0 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273510 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: add initial support for oak board rev1Rong Chang2015-05-2718-47/+876
| | | | | | | | | | | | | | | Add initial support for Oak rev1 board. This is just the EC and includes battery charging but does not include USB PD. BUG=none BRANCH=none TEST=load on oak board and get console Signed-off-by: Rong Chang <rongchang@chromium.org> Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: I626f3921025fbc39ba22b04eeb6dd1084cd70777 Reviewed-on: https://chromium-review.googlesource.com/261678
* mec1322: Simplify GPIO listsSteven Jian2015-05-2762-2237/+2263
| | | | | | | | | | | | | | | Our existing GPIO macros use port# / gpio#, but the concept of different GPIO ports does not exist on the mec1322. Therefore, add new GPIO macros for chips which do not have distinct GPIO ports. BUG=None BRANCH=None TEST=make buildall -j Change-Id: Ibda97c6563ad447d16dab39ecadab43ccb25174b Signed-off-by: Steven Jian <steven.jian@intel.com> Reviewed-on: https://chromium-review.googlesource.com/262841 Reviewed-by: Anton Staaf <robotboy@chromium.org>
* flash_ec: Add support for glados and glados_pdShawn Nematbakhsh2015-05-271-1/+3
| | | | | | | | | | | BUG=None BRANCH=None TEST=`flash_ec --board=glados` Change-Id: I8a23cbd0324d9a321a07bdfd182c996efac79f4c Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273359 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: stm32f0: modify i2c driver to support TCPCIAlec Berg2015-05-273-1/+63
| | | | | | | | | | | | | | Modify the stm32f0 i2c driver to support the new TCPC interface. BUG=none BRANCH=none TEST=test on oak Change-Id: Ibcb205e67d59d99a97dce090bd84bbb714ad5032 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/270173 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: move non-phy layer config out of usb_pd_config.hAlec Berg2015-05-2755-497/+443
| | | | | | | | | | | | | | | | | | | | | Move parts of usb_pd_config.h that are not part of the phy layer out of usb_pd_config.h and into board.h. This cleans up the division between the TCPC and TCPM as only the TCPC needs to use usb_pd_config.h. Also cleans up the use of the CC detection voltage thresholds by creating standard macros to use based on Rp strength for the board. BUG=none BRANCH=none TEST=make -j buildall Change-Id: I946cceb38bea8233095b8a4b287102bb8a3a296d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/270337 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cyan: led controlHsu Henry2015-05-271-9/+39
| | | | | | | | | | | | | | New led control from Yuna since it is close to CrOS UI. BUG=chrome-os-partner:37576 BRANCH=cyan TEST="make BOARD=cyan" and check the two factors in CrOS: shutdown=4% and full= 97%. Change-Id: I8aa7ae5f35a3f3f6f15c6131a1f8fb581025de2d Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/272815 Reviewed-by: Mohammed Habibulla <moch@google.com>
* Cleanup: Use compound literals for static initializationAnton Staaf2015-05-272-38/+28
| | | | | | | | | | | | | | | | | | This just makes a couple of convenience macros a little prettier using compound literals. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I2bcd846067dbbe000b0ecb36c1d8da2d8cd730b3 Reviewed-on: https://chromium-review.googlesource.com/273287 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* i2c: Move i2c_read_string to common codeShawn Nematbakhsh2015-05-266-140/+31
| | | | | | | | | | | | | | | | | Since stm32 and mec1322 now support open-ended i2c_xfer, we can move the lm4 i2c_read_string implementation to common code and delete all chip-specific versions. BUG=chrome-os-partner:39613 TEST=Run "battery" from EC console on Cyan and Oak, verify that battery info + strings are correctly printed. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I06369df64bb2eb747d163664b4c96eeacb4b1faa Reviewed-on: https://chromium-review.googlesource.com/272938 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* mec1322: i2c: Support open-ended i2c transfersShawn Nematbakhsh2015-05-261-55/+59
| | | | | | | | | | | | | | | Modify i2c_xfer to support transfers where start and stop conditions are not issued together. BUG=chrome-os-partner:39613 TEST=Manual with subsequent commit. Verify that 'battery' shows proper values + strings. BRANCH=None Change-Id: If98c9493902326203880645828061c45c9cfd8be Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/272995 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Producer/Consumer: Refactor to use Queue policiesAnton Staaf2015-05-2617-379/+277
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the Producer and Consumer interfaces tracked the Consumer and Producer respectively at the other end of the queue that they interacted with. This was done to avoid modifying the queue implementation, but resulted in a rougher interface that required additional initialization steps and prevented alternative configurations; many producers and one consumer for example. This commit uses the new queue policies to track this information. The new direct policy behaves as the old producer and consumers did. Now the producers and consumers are just named references to the queue that they work on and a convenient location for a notification callback when the queue is updated in a way that is relevent to the producer or consumer. All users of Producer and Consumer have been updated including the stream adaptors which are in use by the echo test code and the mcdp28x0 driver. Use of the stream adaptors has also been simplified. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Manual testing of Ryu (P5) and discovery board echo task Change-Id: I704be6378a31b4e20f5063295eff9943e4900409 Reviewed-on: https://chromium-review.googlesource.com/271792 Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
* Queue: Add policies to queuesAnton Staaf2015-05-269-31/+84
| | | | | | | | | | | | | | | | | | | | Policies give a convenient place to hook into the queue operations and notify something that there is new space free in the queue or new units added. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I94b2aa94b8e8d07911191bc19a39fa827623b117 Reviewed-on: https://chromium-review.googlesource.com/271791 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
* Flashing: Add flash_ec rule to simplify flashingAnton Staaf2015-05-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | The flash_ec rule calls the flash_ec tool, passing the inferred board and image based on where make was run. This means that from a board directory you can run "make flash_ec" and an up to date image will be flashed using flash_ec. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j cd board/ryu_p4p5 make flash_ec Change-Id: I51e2a62f4d0de427f8d36e0848941aef742e0d3d Reviewed-on: https://chromium-review.googlesource.com/272264 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org>
* ryu: remove the pull-up on ACOKVincent Palatin2015-05-241-1/+1
| | | | | | | | | | | | | | | | | | | it was not needed before, it's now harmful for the new VBUS detection circuit on EVT2. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=on Ryu P6 reworked with the new VBUS detection circuit, probed voltages and did "gpioget CHGR_ACOK" with type-C unplugged. Change-Id: I1d99f249c1949aa35f98a896e7ac8ee019295e19 Reviewed-on: https://chromium-review.googlesource.com/273006 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* mec1322: Fixed incorrect value passed to I2C unwedge function.Kevin K Wong2015-05-231-2/+2
| | | | | | | | | | | BUG=chrome-os-partner:40175 TEST=Check i2c_unwedge is called with a valid port number by using debug print. BRANCH=none Change-Id: Ibc8e441116441b526c872a9cb33cb252650bca5a Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/272769 Reviewed-by: Shawn N <shawnn@chromium.org>
* mcdp28x0: Add devid console command.Todd Broch2015-05-222-7/+39
| | | | | | | | | | | | | | | | | | BRANCH=samus BUG=chrome-os-partner:35939 TEST=manual, with CONFIG_CMD_MCDP in board/hoho/board.h > mcdp devid 0 devid[0] = BOBCAT > mcdp devid 1 devid[1] = ST > mcdp devid 2 devid[2] = IROM Change-Id: I82938975be55bb924ced06e9d0a35f03dc47ae99 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/272693 Reviewed-by: Alec Berg <alecaberg@chromium.org>