Commit Graph

19 Commits

Author SHA1 Message Date
Nick Sanders
ee3cb8c898 servo_micro: default to UART3 enabled
This sets power on defaults for UART3 to be routed to
the glados style uart-on-jtag pinout. This is pretty
standardized going forward.

BUG=None
BRANCH=servo-9040.b
TEST=miniterm.py /dev/google/Servo_Micro-2-1.2/serial/Servo_UART3

Change-Id: I397df8fc09da681eba28cae489e2f6eaef8a87d0
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/813180
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-12-07 05:09:29 -08:00
Nick Sanders
d81dbdff79 servo_micro: default to uart enabled.
This allows ec and cpu uart to start enabled,
so console or google serial can be used to log
output without servod.

Rename endpoints to be clearer in the non-servod
usecase. UART1 -> EC, UART2 -> CPU.

BUG=None
BRANCH=servo
TEST:miniterm.py -d  /dev/google/Servo_Micro-2-1.2/serial/EC

Change-Id: Ifd3b753a459fdd9b80d84cc6e4ec9cde1ccb74e0
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/804899
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2017-12-01 22:45:33 -08:00
Nicolas Boichat
cd1f377f16 usb_i2c: Remove usb_i2c_board_enable/disable
These functions are not used by usb_i2c.c on chip/stm32, let's
move them to board/cr50 which is the only place where they are
used.

BRANCH=none
BUG=None
TEST=make buildall -j

Change-Id: I8c1b292838b8dbee9a9001add9332e0add80c342
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/778749
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-20 23:25:45 -08:00
Nicolas Boichat
7501654d20 chip/stm32/usart: Add flags to usart_config
Allows setting TXINV/RXINV bits.

BRANCH=none
BUG=b:65697962
TEST=make BOARD=wand -j

Change-Id: Ib1bb290cd9758c53b98c8fc1ca1a9369c8cff39e
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/694561
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-18 08:30:16 -07:00
Stefan Reinauer
47115a93ef Fix compilation with coreboot-sdk
Signed-off-by: Stefan Reinauer <reinauer@google.com>
BRANCH=none
BUG=none
TEST=The following sequence passes
	sudo emerge coreboot-sdk
	export CROSS_COMPILE_arm=/opt/coreboot-sdk/bin/arm-eabi-
	export CROSS_COMPILE_i386=/opt/coreboot-sdk/bin/i386-elf-
	export CROSS_COMPILE_nds=/opt/coreboot-sdk/bin/nds32le-elf-
	make buildall -j

Change-Id: I4cafbcd70efd6bdf102f848f1cca4772b4ccd10e
Reviewed-on: https://chromium-review.googlesource.com/595207
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2017-08-04 18:08:16 -07:00
Randall Spangler
00ea73ab16 usb_i2c: Fail if board I2C bridge is disabled
Add usb_i2c_board_is_enabled().

On Cr50, this is now also connected to the I2C CCD capability.  The
USB-I2C bridge can only be used when the capability is available.

On other platforms (Servo V4, etc.) where usb_i2c_board_enable() is
a no-op, add a dummy implementation which always returns true.

See go/cr50-ccd-wp for more information.

BUG=b:62537474
BRANCH=cr50
TEST=manual with CR50_DEV=1
	Connect host PC to dev board USB port
	On host PC:
		sudo servod -c ccd_cr50.xml -c reef_r1_inas.xml
		dut-control pp3300_ec_shv_reg --> fail, error 0x8001

	ccdoops --> reset I2C config
	ccd i2c disable --> I2C disabled

	On host PC:
		sudo servod -c ccd_cr50.xml -c reef_r1_inas.xml
		dut-control pp3300_ec_shv_reg --> fail, error 0x0006

	ccd i2c enable --> I2C enabled
	ccdunlock --> I2C disabled
	ccdoops --> I2C enabled
	ccdset i2c unlesslocked
	ccdlock --> I2C disabled
	ccdunlock --> I2C enabled

Change-Id: Ia3df32e239a5f7c5915bc6c7e408ce0dc8b26c89
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/590577
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-07-31 21:39:39 -07:00
Nick Sanders
1106dea40d servo_micro: add parity setting
Add a control interface to set parity
for USB-UART bridge.

BRANCH=None
BUG=b:37513705
TEST=parity settable on command line or by servod

Signed-off-by: Nick Sanders <nsanders@chromium.org>
Change-Id: Ib859a70981162be58edfa79c7cb267e0084e05e6
Reviewed-on: https://chromium-review.googlesource.com/564150
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-07-13 17:30:40 -07:00
Nicolas Boichat
2b460c9830 common/update_fw: Remove board-specific rw_sections
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>
2017-04-15 04:08:07 -07:00
Nicolas Boichat
391056f9ee usb: Cleanup headers
Let's split the usb headers in 3 different parts, instead of having
usb_descriptor.h pull in usb_hw.h and usb_api.h.

 - usb_api.h: EC functions related to usb (e.g. connect/disconnect)
 - usb_descriptor.h: common USB names and structures
 - usb_hw.h: Functions required for interactive with EC's USB HW

BRANCH=none
BUG=b:35587171
TEST=make buildall -j

Change-Id: I37ead61e3be5e7ae464f1c9137cf02eaab0ff92e
Reviewed-on: https://chromium-review.googlesource.com/454861
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-03-16 11:25:50 -07:00
Scott
2e0df8b6c6 cr50: Have INAs and I2Cm enabled when rdd is attached
The INAs are only used for development and testing
purposes. Therefore, the 3.3V rail to the INAs is off by default and
the I2Cm module is not enabled. Enabling INA power and connecting the
I2Cm module was done at the beginning of each USB to I2C request. The
problem with this approach is that INA measurments didn't always
succeed due to not enough time for the INAs to initialize.

Rather than add some arbitrary delay, it is better to tie the INAs to
when rdd is attached/detached. It is only when rdd is attached that
the INAs will be accessed, so there is no need to enable/disable for
each individual I2C transaction.

This CL ties the enabling/disabling of the INA and I2Cm module to the
rdd state. This change makes the previous use of
usb_i2c_board_enable() and usb_i2c_board_disable() obslete.

BRANCH=none
BUG=chrome-os-partner:62375
TEST=manual
Connect servo with suzyq connected:
sudo servod -p 0x5014 -b eve -c eve_r0_inas.xml
Then execute single INA reads dut-control pp3300_dx_edp_mv and verify
that it returns meaningful numbers. Without this CL single reads via
dut-control would always return 0.

Change-Id: I799552bfd0701efd1828a0d720ac2a6cedee5ca1
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/436864
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-02-06 14:50:31 -08:00
Nick Sanders
a04fc68e72 usb_i2c: refactor into common
This combines stm32 and chip/g usb_i2c interfaces so they
will not diverge. Note that this fixes the chip/g implementation
to use 8-bit i2c addresses.

BUG=chrome-os-partner:57059
BRANCH=none
TEST=servod interacts with servo_micro and servo_v4

Change-Id: Ibff217d84b132556202c8a71e3d42c07d546c634
Reviewed-on: https://chromium-review.googlesource.com/405108
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-11-02 17:39:56 -07:00
Nick Sanders
7e14583689 servo_micro: increase SPI clock
While SPI routing on servo is not great, this is still fine
and asn't as painfully slow.

BUG=chromium:571477
TEST=flash some firmware
BRANCH=None

Change-Id: I26d67ed6cd1ba62a892388e96a21acc708265fc4
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366670
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-08 18:22:32 -07:00
Nick Sanders
3e42a3b059 servo_v4: servo_micro: cr50: fix usb power declaration
Servo_micro sets usb config maxpower to 100mA.

Servo_v4 is set to self powered as it's powered by a
shared vbus and not be the bub it's connected to.

cr50 is self powered as no power is transmitted as part of CCD.

* Add CONFIG_USB_MAXPOWER_MA to define USB maximum power draw requested
per board.
* Add CONFIG_USB_SELF_POWERED to indicate that a device is not
powered by allocated USB power.

BUG=chromium:631302
TEST=lsusb reports 100mA bMaxPower (micro), Self powered (v4)
BRANCH=None

Change-Id: I79b8ce46f32d94f16104a4a8080104e30dce7f2c
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363153
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-08 18:22:30 -07:00
Nick Sanders
08aebf624c servo_micro: add USB updater
This adds a Google FW update endpoint to
servo micro in place of a GPIO enpoint.

BUG=chromium:571477
TEST=successfully update servo micro via usb
BRANCH=None

Signed-off-by: Nick Sanders <nsanders@chromium.org>

Change-Id: I3d6c501d515b3f1db6e8259fbb829abe18f72e00
Reviewed-on: https://chromium-review.googlesource.com/361834
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-21 17:33:04 -07:00
Nick Sanders
3c44198c33 servo_micro: support servo micro v2, console gpio
* Remove GPIO USB endpoint to make room for update endpoint.
* Change GPIO mapping slightly to support servo micro v2.

BUG=chromium:571477
BRANCH=None
TEST=run servod, see new controls.

Change-Id: Id3b85b4c77b8f21afd9636b2ee459ace6f42f68e
Reviewed-on: https://chromium-review.googlesource.com/361383
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-07-20 22:22:32 -07:00
Daisuke Nojiri
815b135690 Remove Makefile symlinks under board directory
This feature is inconsistent. Not all boards have such a symlink
(for a obvious reason).

This feature is fragile. It's most likely not tested and going to be
broken if not already. Developers won't like it if they have to test
two different ways to build boards before submitting patches.

This feature is not necessary. If you build EC in the standard way
(e.g. make BOARD=samus), these symlinks are not needed.

This feature is wasteful. Extra disk spaces are used and extra lines
are added to Makefile (increasing code complexity slightly).

BUG=chromium:626776
BRANCH=none
TEST=make buildall

Change-Id: Id5444284d773cb0e9225f39abd877441b8f61440
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359321
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-07-09 01:40:47 -07:00
Nick Sanders
56ee8aefc3 servo_micro: add programmable serial number
This change provides a console command for setting,
and loading a usb serial number from flash. This
feature adds CONFIG_USB_SERIALNO, and currently only
has a useful implementation when PSTATE is present.

BUG=chromium:571477
TEST=serialno set abcdef; serialno load; reboot
BRANCH=none

Change-Id: I3b24cfa2d52d54118bc3fd54b276e3d95412d245
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/337359
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-26 16:17:26 -07:00
Nick Sanders
4e52ae607c servo_micro: add gpio mode get and set
GPIO console commands currently only show input voltage level,
and can only set level on predefined outputs.

This change allows GPIOs to be cycled between output, input,
and alternate function, as well as displaying the mode and
asserted level (if any) in gpioget.

This change creates CONFIG_CMD_GPIO_EXTENDED
as the internal gpio interface needs to be changed to support
this, and I can't test the other architectures. It may be
worthwhile to add this for all, or not.

This change is also necessary also for servo micro JTAG and PD
UART support, as several pins are tied together on the flex
and stm32 outputs need to be variously active or in high-z
depending on mode.

BUG=chromium:571477
TEST=gpioget <0|1|IN|A|ALT>; gpioget;
BRANCH=None

Change-Id: Iba32992db6244ee1e654db840d1c9c11dd2a0993
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338885
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-04-27 14:04:07 -07:00
Nick Sanders
d3a8bd0c36 servo_micro: add initial servo_micro build
* Update flash_ec to allow flashing servo_micro
* Add servo_micro build

BUG=chromium:571477
BRANCH=None
TEST=updated servod is able to control gpio, gpio extender,
     SPI flash, ec uart, ap uart on test yoshi

Signed-off-by: Nick Sanders <nsanders@google.com>

Change-Id: I4d69c83ae581cb41da928a27c39b7152475d7ca8
Reviewed-on: https://chromium-review.googlesource.com/327214
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-03-16 16:19:53 -07:00