Commit Graph

1606 Commits

Author SHA1 Message Date
Vic Yang
ce9d7ca9e9 Revert "Revert "Scale timer for emulator""
This reverts commit c58c01b14c.

Let's add time scaling back, but keep the default scale to 1. The
emulator behavior should be entirely the same. If a test need to be
speeded up, the scale can then be set for that test only.

BUG=chrome-os-partner:19235
TEST=Pass all tests.
BRANCH=None

Change-Id: I648780577a1ae2f964c30c71077ccf9bf38b9735
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51550
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-17 09:52:25 -07:00
Aaron Durbin
3155af43eb haswell: bring down EC_EDP_VDD_EN with PP330_DX
The display rail is generated from the PP3300_DX rail, but it
is enabled by the EC_EDP_VDD_EN signal. Therefore, bring down
the EC_EDP_VDD_EN signal before bringing down the PP330_DX
rail. Additionally, always set the EC_EDP_VDD_EN signal based
on the PCH_EDP_VDD_EN in the x86 power interrupt. The reasoning
is so the signal doesn't indavertently remained set.

BUG=chrome-os-partner:19398
BRANCH=None
TEST=booted and resumed

Change-Id: I43c2306f05d144b7dea243bafb5922118be1fe39
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51524
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-05-16 17:52:17 -07:00
Aaron Durbin
7c7928d8be haswell: bring up/down WLAN rail properly
The PP3300_WLAN rail was not being controlled. Fix this by bringing
up the rail in S3->S0 transition and bring it down in S0->S3
transition. This current sequencing will not allow the WLAN to
wake from suspend at the moment. To do that we'd need to move this
sequencing to the S5<->S3 transitions.

BUG=chrome-os-partner:19507
BRANCH=none
TEST=Brought up board. Noted WLAN card in lsusb and lspci.

Change-Id: I48e7610fa4f0471a2869933f2df5d2c7c525b155
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51483
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-05-16 15:06:27 -07:00
Randall Spangler
3c2c1398ec Set SPI lines to inputs when AP is off
When AP is off, turn off pullup on NSS, and set MISO to an input so
the SPI module won't drive it high if the last sent bit was a 1.  This
reduces leakage when the AP is off.

This patch also fixes a bug where gpio_set_alternate_function() set
the wrong pins to normal-mode when func=-1; that didn't hit anything
else because that functionality wasn't used on STM32 until now.

BUG=chrome-os-partner:19304
BRANCH=none
TEST=boot pit

On EC console, with AP on, 'rw 0x40020000' returns
read 0x40020000 = 0x6569aa20  <- must have 0x____aa__

Then 'apshutdown' and 'rw 0x40020000' returns
read 0x40020000 = 0x65690020  <- must have 0x____00__

The 'power on' and AP turns back on.  At u-boot prompt,
'sspi 2:0 256 9f00000000' returns
FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFEEC010001
(some number of 0xFD's followed by FEEC...)  This shows SPI
functionality is restored when AP is powered back on, and not
just at init time.

Change-Id: Ia3cd3e0bc222dc663d635509918fa3d383fd7971
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51182
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-05-16 13:07:15 -07:00
Wonjoon Lee
23ece32e08 pit: Add more delay for proper power_on sequence
It makes delay between 3.3V_EN and PMIC_ON
So we are now 5V EN -> 2ms Delay -> 3.3V EN -> 2ms Delay -> PMC3_ACOK

BUG=chrome-os-partner:19305
BRANCH=none
TEST=Using osiloscope, See until PMC3_ACOK is far from P3.3V_AUX as 5ms

Change-Id: I65bfece28f55edf4f5640fe411bd57caaaaa5e1d
Reviewed-on: https://gerrit.chromium.org/gerrit/50449
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2013-05-16 12:16:32 -07:00
Aaron Durbin
d7efe5cdda lm4: break out board-specific fan/tach pin config
The current lm4 pwm module was using board-specific
pins during this configuration. Move the implementation
of configure_fan_gpios() to the board-specific files
so that the pin configuration policy isn't a part of the
common infrastructure.

BUG=chrome-os-partner:19504
BRANCH=none
TEST=successfully booted slippy with backlight turning on in OS.

Change-Id: I325f1ac4639b4a78d8b860df7a8b688ca385b71b
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51471
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-05-16 12:16:31 -07:00
Vic Yang
89e688a332 Revert "Add thermal engine test"
Time-scale functionality is temporarily reverted and this test
is now taking too long. Revert this test now. Will add it back
when we solve the time-scale issue.

This reverts commit d9cf88b35a

Change-Id: Id9ce1071eb2114dd6968d3df9f0bce395edaeef6
Reviewed-on: https://gerrit.chromium.org/gerrit/51482
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
2013-05-16 11:10:28 -07:00
Vic Yang
c58c01b14c Revert "Scale timer for emulator"
This is causing instability on buildbot. Let's revert until we can make it more stable.

This reverts commit 3615ac4c0b

Change-Id: I0bd65832cc3706a24284ada80e2fb5102fa705cf
Reviewed-on: https://gerrit.chromium.org/gerrit/51479
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-16 10:08:22 -07:00
Vic Yang
c8b7b430fe Add console command to force enable console
When system is locked, the console is disabled. However, we need console
for debugging and testing. This CL uses a bit from back-up register to
indicate if the console should always be enabled. (This bit is currently
used by fake WP, which is removed in this CL.) With this, we can set
this bit with console command 'forceen 1' to ensure console is never
disabled.

To prevent device shipped in this state, the chip name is postfixed with
'-unsafe' so that the device is not able to pass HWID check.

BUG=chrome-os-partner:19293
TEST=Manual
BRANCH=spring

Change-Id: I88556e973ca542c1bdc27ba64988718291e01a26
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51086
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-15 20:12:47 -07:00
Aaron Durbin
3bcc4af4b6 haswell: move 5V rail enable/disable actions
The 5V rail should be enabled on S5->S3 transitions and
disabled on S3->S5 transitions.

BUG=chrome-os-partner:19398
BRANCH=none
TEST=successful state transitions: S0,S3,S5,G3

Change-Id: If9fd7ef16f015136238dd18f64602ecf33d9ec4a
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51359
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-05-15 15:28:07 -07:00
Aaron Durbin
6b814ddf52 haswell: fix S3 resume path
The PROCPWRGD signal is not well documented. It's not known if
it is an input or an output. Emperically it was discovered that
driving this pin during the resume path causes resume to fail.
Therefore, ignore the pin by setting it to an input.

BUG=chrome-os-partner:19398
BRANCH=none
TEST=successful state transition from S0 to S3 and back to S0

Change-Id: I55dc16c75c286af06806e2513197f0bb2c7b9d04
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51358
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-05-15 15:28:06 -07:00
Vic Yang
4bbf6f5d1a Relax timing constraints in hooks test
Current timing constraints are too tight that the test sometimes fails
when it shouldn't.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: Ib94ff44691ba36f14dbf02319d0371770b5ece5d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51250
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-15 12:12:24 -07:00
Vic Yang
d9cf88b35a Add thermal engine test
BUG=chrome-os-partner:19236
TEST=Pass the test.
BRANCH=None

Change-Id: I1c96437e1fb3492faa5352383f852dc1d2718ace
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51248
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-15 12:12:23 -07:00
Vic Yang
3addfe80f9 spring: Update PMU ADC constant
The current sense resistor has changed. Update constant here to reflect
the new values for DVT1.

BUG=None
TEST=Build Spring
BRANCH=Spring

Change-Id: Ib27c45cef569fa758db2fbb428150c8c2b6732ef
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49892
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-15 11:19:55 -07:00
Duncan Laurie
a26c722b0a Minor tweaks to haswell power sequencing
- pass through the eDP VDD enable from PCH
- Bring up suspend rail after DPWROK and before RSMRST,
as indicated for deep sleep sequencing
- de-assert CPU_PGOOD on S0->S3 transition, it was
getting left enabled

BUG=chrome-os-partner:19398
BRANCH=none
TEST=successful state transition from G3 to S0 and back to G3

Change-Id: Ie711275d6121edccff60b2de08b71575d2d035b7
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51154
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-05-14 14:19:31 -07:00
Vincent Palatin
24beb9976a do not store the keyboard state on the stack
As our stack for the keyboard scanning task might be small (256 bytes on
STM32), we store the full keyboard state in a global instead of the
stack to avoid consuming 16 bytes there.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:19389
TEST=run on Spring with CONFIG_OVERFLOW_DETECT and see that the KEYSCAN task
is now consuming 248 bytes of stack instead of 264.

Change-Id: I2dd7815f36e6807e7b9e88d59f8fd8a14b1988ab
Reviewed-on: https://gerrit.chromium.org/gerrit/51028
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-14 10:17:13 -07:00
Vic Yang
fa9c222a79 Add hook test
Test of hook functionality.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: I4700f3061edd0707932e935a719fc73c3976892e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50957
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-14 09:25:03 -07:00
Vic Yang
e1c0b58c96 Show run time of unit tests
This is useful for finding out which test runs for too long.

BUG=chrome-os-partner:19235
TEST=Run tests and see run time logged.
BRANCH=None

Change-Id: I5cb6727b2e1017fce1107e4892c1898e66598492
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51105
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-14 09:24:59 -07:00
Vic Yang
b167c7d3a6 Redirect emulator output to stderr if a test fails
If a test fails, redirect emulator output to stderr so that it shows up
even when V=1 is not set.

BUG=chrome-os-partner:19235
TEST=Manual
BRANCH=None

Change-Id: I6d8e05eaa222ebe043556bfcd3f63ca7e27c2721
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51097
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-14 09:24:59 -07:00
Duncan Laurie
199252ea21 slippy: Basic power sequencing
Still some work to do here but this now works.

NOTE: This makes the system behave like a normal
cros device where the power is applied automatically.
For some (other, unknown) reason the "reboot ap-off"
is not passing flags correctly to keep it off.

BUG=chrome-os-partner:19398
BRANCH=none
TEST=successful state transition from G3 to S0

Change-Id: I694136b9611e18ac8fb7b1e960bd10caa258ce28
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51077
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-05-14 08:35:16 -07:00
Vic Yang
3615ac4c0b Scale timer for emulator
The timer is the only source of timing for the emulator. This means we
can make it go faster without breaking the tests. This CL sets the
default scale to be 3x faster than normal time.

BUG=chrome-os-partner:19235
TEST=Pass all tests. Check the tests run faster.
BRANCH=None

Change-Id: Ib9035884b34f41c4e9aa2206284b5f1ec8fc0d1f
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50956
2013-05-14 00:31:40 -07:00
Vic Yang
8ab12847b5 spring: Fix a bug that ID_MUX is never switched back
If the user unplug video dongle before it is detected and handled, we
may be stuck with ID_MUX=1 and interrupt from TSU6721 disabled. This
essentially breaks charging.

BUG=chrome-os-partner:18997
TEST=Build and check charging port still works.
BRANCH=spring

Change-Id: I93e69287d07947fef743b4674857e52c26513835
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50969
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-13 22:55:15 -07:00
Vic Yang
cbebc28804 spring: Pull more current from video dongle
We cannot know how much current we can pull from video dongle, so let's
just try to pull as much as possible up to 2A.

BUG=chrome-os-partner:19324
TEST=Plug in video dongle and see 3.3V output.
TEST=Plug in video dongle with supplied charger, and see 50% PWM duty
cycle.
TEST=Plug in video dongle with normal charger, and see 70~80% PWM duty
cycle.
BRANCH=spring

Change-Id: I8b503f886fcafaa11e6757a5059ce673a8ed53cc
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50963
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-13 19:31:13 -07:00
Duncan Laurie
c18ef5f421 slippy: Enable internal pullup for recovery pin
The recovery pin input from servo is open drain and needs
an internal pullup enabled so it is not always low.

BUG=chrome-os-partner:19398
BRANCH=none
TEST=manual: ensure rec_mode can be turned off

$ dut-control rec_mode:off rec_mode
rec_mode:off

Change-Id: I387a53eb5b64bb0bf3a87fc47b5cca9b2063f6a9
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50993
2013-05-13 19:31:11 -07:00
Duncan Laurie
59921512e7 Clarify help text for dumb USB port power control
The help text says to pass 0 or 1 for the mode but
the code only accepts "on" or "off".

Fix up the help text to match and have the display
output for the port status also use on/off so it is
consistent with the input.

BUG=chrome-os-partner:18825
BRANCH=none
TEST=manual: verify "usbchargemode 0 on" works as
it is explained in the help text.

Change-Id: Ib32dc68af93989d277aa84a1cb53ae9b66a8b595
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50838
2013-05-13 19:31:10 -07:00
Duncan Laurie
e5ec5f34fc LM4: Support configurable host UART interface
Slippy uses UART2 instead of UART1 and so the EC needs
to be able to tolerate having the host use a different
interface.  There are of course many ways to accomplish
that but this approach adds two config variables to specify
the host uart and the host uart irq.

The UART port setup is split out to allow them to be
configured separately rather than needing to be adjacent
in a for loop.

The interrupt functions were renamed (to ec and host) in
order to indicate which interface they are responsible for.

BUG=chrome-os-partner:19356
BRANCH=none
TEST=boot slippy and see host serial output

Change-Id: I1913ff3d650f329224c9654eee7bb7412fae5402
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50837
2013-05-13 19:31:09 -07:00
Randall Spangler
c882edb530 Clean up SPI GPIOs
SPI is always enabled on pit, so remove #ifdefs

SPI1_CLK was aliased to AC_STATUS, which is left over from snow and
doesn't exist on pit.  That caused it to be driven high briefly during
EC boot.

Also set SPI pins for 40MHz speed so we can try faster SPI clock.

BUG=chrome-os-partner:19304
BRANCH=none
TEST=boot system; sspi 2:0 256 9f prints a bunch of FDs then FEEC010001

Change-Id: I10352cff3669d6a087939d9d8e302d70708e9ee3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51023
Reviewed-by: Doug Anderson <dianders@chromium.org>
2013-05-13 15:05:24 -07:00
Randall Spangler
7188b6f413 Tidy comments for I2C passthru message
No code changes; just fix a few comments.

BUG=chrome-os-partner:18778
BRANCH=none
TEST=build code

Change-Id: I7ed32b5af01a6dbd401334175b5a1b5b4786cac7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51017
Reviewed-by: Doug Anderson <dianders@chromium.org>
2013-05-13 15:05:23 -07:00
Duncan Laurie
7e24fdb4b1 slippy: Make EC_RCIN_L pin output and high by default
This is causing the host to reset because this pin is
going low when it is left as open drain, despite having
a 3.3V pullup.

BUG=chrome-os-partner:19355
BRANCH=none
TEST=manual: boot on slippy without RCIN# causing reset

Change-Id: I59e9316e85ce618edc84c7dd988d70ea4de1e71a
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50836
2013-05-13 11:26:04 -07:00
Bill Richardson
f10abeb19f Slippy: Changes needed to boot EC without bricking.
This commits the hacks made during board bringup. Bugs can be filed and
fixed based on this starting point.

BUG=chrome-os-partner:18825
BRANCH=slippy
TEST=manual

Try it and see.

Change-Id: Ia663eaf9a357633873b1b5d5cc6dbdda63513082
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50875
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-05-10 16:37:11 -07:00
Randall Spangler
1e4b0b6194 Implement I2C passthru command
This is a revised version of passthru which more closely resembles the
kernel interface.  It allows multiple read/write messages in a single
transaction, and sends back one accumulated result.

BUG=chrome-os-partner:18778
BRANCH=none
TEST=On link, from root shell:
    ectool i2cxfer 0 0xb 6 0x21
    Read bytes: 0x05 0x41 0x52 0x52 0x4f 0x57

(I did not actually run this with the updated code)

On pit, in U-Boot:

Read i2c values:
Peach #  crosec i2c md 48 0
0000: 00 00 3e 00 12 20 4b bf ff ff 20 00 1e 1e 1e 1f    ..>.. K... .....
Peach #  crosec i2c md 48 0 20
0000: 00 00 3e 00 12 20 4b bf ff ff 20 00 1e 1e 1e 1f    ..>.. K... .....
0010: 1f 1f 1f 1f 1f 1f 20 00 00 07 00 00 00 00 00 00    ...... .........

Update value at offset 10:
Peach #  crosec i2c mw 48 10 4
Peach #  crosec i2c md 48 0 20
0000: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f    ..>....... .....
0010: 04 1f 1f 1f 1f 1f 20 00 00 07 00 00 00 00 00 00    ...... .........
Peach #

On pit, in kernel:

localhost ~ # i2cdetect -y -a -r 20
 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

localhost ~ # i2cdump -f -y 20 0x48
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f    ..>.?.???. .????
10: 1f 1f 0e 1f 1f 0e 20 00 00 07 00 00 00 00 00 00    ?????? ..?......
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

localhost ~ # i2cset -f -y 20 0x48 0x10 0
localhost ~ # i2cdump -f -y 20 0x48
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f    ..>.?.???. .????
10: 00 1f 0e 1f 1f 0e 20 00 00 07 00 00 00 00 00 00    .????? ..?......
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

localhost ~ # i2cset -f -y 20 0x48 0x10 0x1f
localhost ~ # i2cdump -f -y 20 0x48
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f    ..>.?.???. .????
10: 1f 1f 0e 1f 1f 0e 20 00 00 07 00 00 00 00 00 00    ?????? ..?......

Change-Id: I14d47e1712828f726ac5caddc4beede251570ad3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Updated to simplify protocol:
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49958
Commit-Queue: Doug Anderson <dianders@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
2013-05-09 16:36:53 -07:00
Vic Yang
d2ca284bc6 Add power button test
This tests power button notification and debouncing.

BUG=chrome-os-partner:19236
TEST=Pass all tests
BRANCH=None

Change-Id: Ief8bc24a8725e01734d84e76ab4b6ae0506b811f
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50524
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-08 18:11:01 -07:00
Vic Yang
e71f008388 Put test utility macros in header
Several test utility macros have been duplicated across tests. Let's put
them in a single place.

BUG=chrome-os-partner:19236
TEST='make runtests', 'BOARD=spring make tests'
BRANCH=None

Change-Id: Ib0c9f829715425cc23e33b8ef456b17dfadab13c
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50513
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-08 18:11:01 -07:00
Vic Yang
4f463ebc46 Speed up mutex and kb_scan test
The current delay is unnecessarily long. This CL shortens the delay.

BUG=chrome-os-partner:19236
TEST='make runtests'
BRANCH=None

Change-Id: Ica07458e7ae15cf28c3482b6df96df66c0d45182
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50487
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-08 18:11:00 -07:00
Vic Yang
b1b91c82b6 spring: Hard-limit DCP current at 1.5A
The spec suggests we cannot reliably go over 1.5A and gracefully
recover. Let's avoid going over that limit.

BUG=chrome-os-partner:19267
TEST=Build spring
BRANCH=spring

Change-Id: I07411ff3ce4107e0289c5af5365ef5a23fd23e4e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50321
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-08 17:37:45 -07:00
Doug Anderson
b38a0988d7 i2c: Allow for i2c "ping" that's a write of 0 bytes
The i2cdetect command on Linux likes to probe by doing a write of 0
bytes.  Rather than always returning success because there was nothing
to write, let's actually implement this command.

At the moment we only implement for the stm32l.  We also don't try to
implement the "read of 0" bytes since I don't think anyone uses that.

BUG=chrome-os-partner:18778
BRANCH=none
TEST=i2cdetect -y -a 20 now detects the right devices

Change-Id: Ia159ce9b8c957d5cd11f187f1a179ca5967bf96f
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50009
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2013-05-08 15:39:38 -07:00
Doug Anderson
07d772db29 i2c: stm32l: Fix i2c reads of sizes other than 1
The STM32L manual has a whole section on i2c master reads and
describes the correct method for receiving exactly 2 bytes and more
than 2 bytes.  We weren't following those instructions and thus larger
transfers weren't working.

BUG=chrome-os-partner:19265
BRANCH=none
TEST=i2cxfer r16 0x90 0
...doesn't fail
TEST=i2cxfer r 0x90 0
...doesn't fail
TEST=Use pydevi2c and test some commands:
>>> tps = I2CDevice(20, 0x48)
>>> [hex(x) for x in tps.Get(0, 20)]
['0x1e', '0x0', '0x3e', '0x0', '0x12', '0x20', '0x4b', '0xbf',
 '0xff', '0xff', '0x20', '0x12', '0x1e', '0x1e', '0x1e', '0x1f',
 '0x1f', '0x1f', '0x1f', '0x1f']

Change-Id: Ifaab6d8b700e099bcd9c374c70fca0983858ed3f
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50229
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2013-05-08 15:39:38 -07:00
Vic Yang
5df7913825 Fix host command in 64-bit executable
On 64-bit platform, arrays should be aligned to 8 bytes. Also, change
the order of host_command fields so that it's packed on both 32-bit and
64-bit platforms.

BUG=chrome-os-partner:19257
TEST=Pass all tests. Print out and check the content of host commands.
BRANCH=None

Change-Id: I350a903bc11562d6d205c402548942f8967b75a5
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50467
2013-05-08 13:24:20 -07:00
Vic Yang
a0bfc0c669 Add lid switch test and enable kb_mkbp test
BUG=chrome-os-partner:19236
TEST=Pass both tests
BRANCH=None
CQ-DEPEND=CL:50467

Change-Id: I59cc407c2d1bf7f549ff9c46226cf7fa60fe7157
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50466
2013-05-08 13:24:19 -07:00
Vic Yang
ac3488cd0b spring: Improve charging current control
This includes:
  - Increase overcurrent retry count from 1 to 2.
  - Mark overcurrent event regardless of what current PWM duty cycle is.
  - PWM duty cycle settles faster.
  - PWM duty cycle starts from ~100%.

BUG=chrome-os-partner:19001, chrome-os-partner:19037
TEST=Manual
BRANCH=spring

Change-Id: Idf007fb589fde3baef6c8975dfa1f2fc1ec6e95d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50262
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-07 20:59:56 -07:00
Vic Yang
5007bbc009 Use uintptr_t when converting integer from/to pointer
Perviously we use uint32_t for this, but this doesn't compile for 64-bit
environment (and likely doesn't for 16-bit either.) Use uintptr_t so that
we don't get size mismatch errors.

BUG=chrome-os-partner:19257
TEST=Run host emulated tests
BRANCH=None

Change-Id: I3cd66a745fa171c41a5f142514284ec106586acb
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50358
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-07 20:59:53 -07:00
Vic Yang
235e6e1d0d stm32f: Set ADC single read timeout
If an ADC read fails and EOC bit is somehow never set, we will be stuck
in the read function holding mutex lock forever, which is really bad.
Let's set a timeout for this.

BUG=chrome-os-partner:18997
TEST=Boot Spring. Check ADC works.
BRANCH=spring

Change-Id: I19b108326f34f380497606fe92eabfaf0a778bb4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50338
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-07 20:59:47 -07:00
Doug Anderson
0fe217c745 spi: Fix OOBE in bounds-checking the reply
There was an off-by-one error in bounds checking the reply.  You could
trigger it with pydevi2c with:

>>> tps = I2CDevice(20, 0x48, force=True)
>>> tps.Get(0, 249)

The EC would show:
  ASSERTION FAILURE 'msg_len < sizeof(out_msg)' in reply() at
  chip/stm32/spi.c:184

BUG=chrome-os-partner:18778
BRANCH=none
TEST=Run the above commands and see no error.

Change-Id: I9789405a9d70c5dc3fa237504fea8f46a139386c
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50254
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-05-07 20:59:28 -07:00
Randall Spangler
37fcfb732c Fix and enable SPI for pit
I've simplified the SPI module, since we only ever use SPI1 (and there
were already a number of places which assumed this was true).
Somewhere along the way I fixed a number of problems keeping the code
from compiling and working on STM32L.  The code isn't currently used
anywhere else, but should still work there (that is, I don't think I
broke it working on STM32F if you re-enable it on some STM32F
platform).

BUG=chrome-os-partner:19073
BRANCH=none
TEST=from u-boot console, sspi 2:0 64 9f0000
     u-boot prints: FDFDFDFDFDFDFDFD
     ec prints: [193.740912 HC 0x9f][193.741141 HC err 1]

[sjg: gpio optimization back in for now]
[dianders: add comment as rspangler requested; update SOBs]

Change-Id: Ib9419403e4e44dadc1f17681e48401882cb49175
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49684
2013-05-07 20:59:28 -07:00
Vic Yang
0d99eadd77 Add persistent storage for emulator
This is needed for non-volatile register emulation. Also, this can be
used to implement system jump or reset flags.

BUG=chrome-os-partner:19235
TEST=Run utils test. Check persistent storage file exists.
BRANCH=None

Change-Id: I699f95718ef6f5de6c3bbb4e37619ee015fb6c4a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50313
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-07 16:02:30 -07:00
Vic Yang
0a45fa1708 Pthread-based emulator for unit testing
This is the first version of pthread-based RTOS emulator. With this, we
will be able to test high-level modules entirely on the host machine.

BUG=chrome-os-partner:19325
TEST='make runtests' and see tests passing.
BRANCH=None

Change-Id: I1f5fcd76aa84bdb46c7d35c5e60ae5d92fd3a319
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49954
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-07 09:09:50 -07:00
Vic Yang
b02c7b4617 Add test for keyboard MKBP protocol
A test that check keyboard MKBP module using keyboard scanning module and
host commands.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: Ic22a2c8f3069d8e72c1222882073d428b733bca3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50132
2013-05-06 11:36:21 -07:00
Vic Yang
2dfccc7d28 spring: Fix S3 USB charging bug
The EC currently assumes the AP only provides USB power during S0, which
is incorrect. This CL adds S3 so that it behaves when the device is
suspended.

BUG=chrome-os-partner:19190
TEST=Suspend and unplug power. Doesn't hear clicking sound.
BRANCH=Spring

Change-Id: Ice1421bda55b2fee408ba062ed3de7a697ccd0c8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50093
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-06 11:36:21 -07:00
Bill Richardson
b061f460eb Define slippy GPIOs, make power sequencing task do nothing.
This specifies the Slippy GPIOs. Because the power controls are completely
different from Link, we have to gut the power sequencing task to do nothing.
For bringup and test, we'll just manually set and get the GPIOs until we
know exactly what we need to do.

This is where the fun starts...

BUG=chrome-os-partner:18825
BRANCH=slippy
TEST=manual

Built everything, Link still works.

Change-Id: Ic1ce1d4085298f49dd98d99e81e04835eca5f11c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50004
2013-05-02 21:34:14 -07:00
Bill Richardson
1ec5206a31 Slippy uses dumb USB ports, not smart ones.
BUG=chrome-os-partner:18825
BRANCH=slippy
TEST=manual

Change-Id: I87459c177b8ae41b68e7157f26843eaf5ed93c60
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49975
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-05-02 18:10:46 -07:00