summaryrefslogtreecommitdiff
path: root/board/sweetberry
Commit message (Collapse)AuthorAgeFilesLines
* i2c: Split i2c_xfer into locked/unlocked versions.Jonathan Brandmeyer2018-08-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename i2c_xfer to i2c_xfer_unlocked. Audit all users of i2c_xfer to see if they can use simple locking semantics or require their own locking. Since locked accesses are only safe for I2C_XFER_SINGLE transactions, remove the flags parameter from i2c_xfer. This also makes the audit a bit easier. Some remaining applications hold the bus locked across several transactions that would otherwise be atomic, and a few others implement complex I2C transactions in multiple commands. Add a (nondeterministic) verification on the I2C port locking correctness. This will catch all statically incorrect locking patterns, although dynamically incorrect locking patterns may not be caught. Related: Revise the i2c_port_active_count to be a bitmap of the active ports instead of a count of the active ports. The EC's mutex does not provide an is_locked() primitive, and we would prefer not to have one. - board/glados: Custom locking for battery reset - board/mchpevb1: Custom locking for battery reset - board/oak: Custom locking for battery reset - board/samus: Custom locking for lightbar reset - board/sweetberry: simple locking - board/servo_micro: Custom locking for funky i2c transfers - capsense: simple locking - host_command_master: multi-command transactions - lb_common: manual locking to support samus power sequence - smbus: multi-command transactions - usb_i2c: simple locking - driver/tcpm/fusb302: simple locking and multi-command transactions - driver/tcpm/tcpi: Forward _unlocked and implicitly locked interface to fusb302 - driver/touchpad_elan: simple locking BUG=chromium:871851 BRANCH=none TEST=buildall; very careful audit TEST=grunt clamshell and Coral clamshell, test boot, battery charging, PD communication, and TCPC port low-power mode. Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: Ieabf22bcab42780bdb994fca3ced5d8c62519d56 Reviewed-on: https://chromium-review.googlesource.com/1169913 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* i2c: add i2c_lock before and after calling i2c_xferZhuohao Lee2018-08-071-0/+2
| | | | | | | | | | | | | | | According to the include/i2c.h, we need to call i2c_lock before and after calling i2c_xfer. This patch adds the lock to protect the i2c data transmission. BUG=none BRANCH=master TEST=make buildall -j Change-Id: If125333902105c35ca332c154bbb8012c363d1bf Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1163543 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* sweetberry: expose i2c over usbRuben Rodriguez Buchillon2018-05-212-12/+22
| | | | | | | | | | | | | | | | Expose the i2c interface through usb so that we can read power rails through servod leveraging the work being done there. BRANCH=none BUG=chromium:806148 TEST=manual testing - powerlog still works - i2c over usb using servod code works (other CLs needed) Change-Id: I48876bc4839509a397ce77376b337c37c556ae40 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1051136 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* chip/stm32/usb: Replace reset handler by generic event handlerNicolas Boichat2017-08-161-1/+1
| | | | | | | | | | | | | | | | | | | Some USB interface handlers need to know when USB has been successfully resumed after a wake event. For example, this is useful so that HID keyboard can send the events at the right time. BRANCH=none BUG=b:35775048 TEST=Using USB HID keyboard patches to queue keys in a FIFO: After USB autosuspends, press a single key and hold it. Without this patch the endpoint data only gets reloaded on the _next_ event. TEST=On hammer, I2C passthrough still works. Change-Id: I9b52b9de16767c8a66c702a5ae70369334a3d590 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/569547 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add flash command support to boards with STM32F4Gwendal Grignou2017-06-031-0/+2
| | | | | | | | | | | | | | | | | | | Add support to write and erase all flash with flashrom. Add support to use all the memory. Note that PSTATE must not used its own page, as the STM32F4 use big pages. BUG=b:38018926 BRANCH=none TEST=With flashrom, write all, RO, RW regions. Use flash command on the console, including flashwp Change-Id: I4f0aee1b3a4f342bdf4ca97bf5d8e8bcc153fd9c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/264032 Commit-Ready: Wei-Ning Huang <wnhuang@chromium.org> Tested-by: Wei-Ning Huang <wnhuang@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* common/update_fw: Remove board-specific rw_sectionsNicolas Boichat2017-04-151-19/+0
| | | | | | | | | | | | | | | | | | | | | | rw_sections is defined in the exact same way on all common code boards, let's remove it, and hard-code the values in update_fw.c instead. Take this as an opportunity to fold set_valid_section in fw_update_start (this will be useful later on, as we also want to return the inactive region version). BRANCH=none BUG=b:35587171 TEST=make buildall -j TEST=Can update hammer over USB using usb_updater2 Change-Id: I4dd3224f17f89c1851c379255f1195dc54528b3d Reviewed-on: https://chromium-review.googlesource.com/476451 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* sweetberry: add usb power logging interfaceNick Sanders2016-11-112-3/+12
| | | | | | | | | | | | | This allows logging of power data over sweetberry BUG=chromium:608039 TEST=log power data BRANCH=None Change-Id: I6f642384cbf223959294c7bd99bca0f9206775b8 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/385540 Reviewed-by: Todd Broch <tbroch@chromium.org>
* sweetberry: add usb fw updateNick Sanders2016-09-022-5/+33
| | | | | | | | | | | | | | | Port USB firmware update to stm32f4 dwc usb from st usb. This includes usb dwc usb stream inplementation, generic endpoint interfaces, and the sweetberry test case. BUG=chromium:608039 TEST=usb update works BRANCH=None Change-Id: Ia26e4f7e990ee64991468799c99b036f5f32190f Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/377520 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* sweetberry: remove superfluous gpiosNick Sanders2016-09-021-6/+9
| | | | | | | | | | | | | | | | | Sweetberry specifies UART pins as GPIOs, however this is not necessary for uart use. Let's remove these. UART4 is also dup'd with sweetberry's signal gpios, which is fixed with this CL. BUG=chromium:608039 TEST=boots BRANCH=None Change-Id: I81ee2351c0191ff5ec3d5fad37fe10866bf1ad32 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380439 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* sweetberry: add dwc usb supportNick Sanders2016-09-012-0/+64
| | | | | | | | | | | | | | | stm32f446 uses a synopsys designware USB block rather than the typical ST one. This change adds driver support for the new block, including usb console support. BUG=chromium:608039 TEST=usb console works BRANCH=None Change-Id: I0e143758ae0b5285f1c94ea2ec5aee159e22e00c Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/365448 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* sweetberry: add i2c supportNick Sanders2016-08-212-0/+28
| | | | | | | | | | | | | | | | | stm32f446 has two types of i2c blocks, the traditional stm i2c, and "fast mode plus" i2c, which need different drivers. This commit adds both, muxed in i2c-stm32f4, as the ec codebase doesn't really support multiple types of the same interface. BUG=chromium:608039 TEST=i2c works on all 4 channels BRANCH=None Change-Id: I6a9ac632f44142bd809ffee5782a192ae47af1f0 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/368358 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* sweetberry: add build target for sweetberryNick Sanders2016-08-195-0/+235
sweetberry is an stm32f446 based power monitoring board, with 48 channels of INA current sense chips BUG=chromium:608039 TEST=boots BRANCH=none Change-Id: If263bcee3a648ba3605f991999d481b7a0e2a1db Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/370718 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>