Commit Graph

4457 Commits

Author SHA1 Message Date
Gwendal Grignou
bde89ebc20 common: motion: move gesture actions in motion task.
Change the IRQ interface to allow adding events.
Move code to send the lightbar sequence from gesture.c to motion task.

TEST=compile, works on Ryu.
BRANCH=smaug
BUG=chrome-os-partner:44754

Change-Id: I981ea123ebef0e8e3d6aa320eade89f10e83b6fc
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296822
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 17:55:32 -07:00
Gwendal Grignou
3788806149 driver: si114x: Fix compilation when ACCEL_FIFO is disabled
Fix compilation error when we are not using the FIFO

BUG=none
TEST=compile
BRANCH=none

Change-Id: I50e12fe4ebc6a626638d6f9ae555a324f366fef9
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299947
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-09-18 17:55:32 -07:00
Gwendal Grignou
a2ef386ee7 common: motion: print return of drv->init()
In motion_sense_init, gather the result of the sensor init routine.

BUG=none
BRANCH=smaug
TEST=Get the result of init() when calling accelinit.

Change-Id: I8d0219a2b81fdf6d512976db5a28646ee5f6b994
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299946
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-09-18 17:55:31 -07:00
Aseda Aboagye
6e96a91f24 config_option_check.py: Ignore hidden files.
When this script is searching through CONFIG_* options used in the repo,
it should ignore hidden files.  I uncovered this by accidentally having
modified a file and the presubmit hook failed.  This is because emacs
auto-saves files with the format ".#filename.ext".  Now, the script will
ignore hidden files.

BUG=None
BRANCH=None
TEST=Use emacs to modify a c file but not save it. Run the script and
verify that no errors occur.
TEST=make -j buildall tests

Change-Id: Ie09cfcf66f2e416aeed99847945cb5168b457d1a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/300954
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-18 16:34:20 -07:00
Aseda Aboagye
d79b54fdd9 ecst: Print errors to stderr.
This commit makes all prints with the TERR error level print to standard
error so that it's more obvious what's wrong when an error occurs.

BUG=None
BRANCH=None
TEST=Checkout tree @ 5dfe8d2. Build npcx_evb and see that the error is
displayed during the build process.
TEST=make buildall tests

Change-Id: I4117dd83a9a85ae81baf533302b0b70f4da174bc
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/300613
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-18 16:34:18 -07:00
Vijay Hiremath
3c862e7f39 Kunimitsu: PMIC: Emergency reset on long press of power button
Configured the power button configuration register to issue an emergency
reset on long press of the power button (8s time).

There's no need to re-initialize the PMIC on sysjump.
Ported this change from Glados
 Change-Id: I1839e1bd357759ae2800d812b27bf4e0cd7772b4
 Reviewed-on: https://chromium-review.googlesource.com/293012

BUG=none
TEST=Hold the power button for 8s and DUT turns off the DSW rails.
BRANCH=none

Change-Id: Ibc0064e8ee88127cc6e3e418b97370e617b61b1d
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/298148
Commit-Ready: 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>
2015-09-18 01:25:56 -07:00
Ben Lok
0ed9b91d4c oak: revise the cold reset timing.
since we add debounce time (50 ms) for SUSPEND & POWER GOOD signal
after oak rev3 (commit e58a913b). It will causes the chipset_reset
function failure, because PMIC_COLD_RESET_L_HOLD_TIME is short.
PMIC_COLD_RESET_L_HOLD_TIME should be greater than 100 ms
[SUSPEND_DEBOUNCE_TIME (50 ms) + POWER_DEBOUNCE_TIME (50 ms)].
So, revise PMIC_COLD_RESET_L_HOLD_TIME to 120ms.
And, using hook to avoid blocking the EC console when executing
"apreset" EC console command.

BRANCH=none
BUG=chrome-os-partner:44955
TEST=manual
Run EC console command, after AP enter S0:
> apreset
AP should be reset normally.

Change-Id: I04e31aef8be3092ad39b5f1b1c2b75b78b4d1d7b
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/299625
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-09-18 01:25:56 -07:00
Bill Richardson
1b34f4bae7 Cr50: Add support for flash write & erase
This adds flash support for the SoC.

BUG=chrome-os-partner:44745
BRANCH=none
TEST=manual

Pick an unused section of flash and use the flasherase and
flashwrite commands to test it. The flashwrite command fills a
buffer with bytes, counting up (0x00, 0x01, 0x02, 0x03, ...),
then writes that buffer to the address given.

Note that the "md" command uses the absolute address, while the
flash commands use the offset address within the flash memory.

For example:

Test bank 0:

  > md 0x7b000 16

  0007B000: 00000000 00000000 00000000 00000000
  0007B010: 00000000 00000000 00000000 00000000
  0007B020: 00000000 00000000 00000000 00000000
  0007B030: 00000000 00000000 00000000 00000000

  > flasherase 0x3b000 0x800
  Erasing 2048 bytes at 0x3b000...

  > md 0x7b000 16

  0007B000: ffffffff ffffffff ffffffff ffffffff
  0007B010: ffffffff ffffffff ffffffff ffffffff
  0007B020: ffffffff ffffffff ffffffff ffffffff
  0007B030: ffffffff ffffffff ffffffff ffffffff
  >

  > flashwrite 0x3b000 0x800
  Writing 2048 bytes to 0x3b000...

  > md 0x7b000 16

  0007B000: 03020100 07060504 0b0a0908 0f0e0d0c
  0007B010: 13121110 17161514 1b1a1918 1f1e1d1c
  0007B020: 23222120 27262524 2b2a2928 2f2e2d2c
  0007B030: 33323130 37363534 3b3a3938 3f3e3d3c

  > md .b 0x7b000 16

  0007B000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f

Test bank 1:

  > md 0xbb000 16

  000BB000: ffffffff ffffffff ffffffff ffffffff
  000BB010: ffffffff ffffffff ffffffff ffffffff
  000BB020: ffffffff ffffffff ffffffff ffffffff
  000BB030: ffffffff ffffffff ffffffff ffffffff

  > flasherase 0x7b000 0x800
  Erasing 2048 bytes at 0x7b000...

  > md 0xbb000 16

  000BB000: ffffffff ffffffff ffffffff ffffffff
  000BB010: ffffffff ffffffff ffffffff ffffffff
  000BB020: ffffffff ffffffff ffffffff ffffffff
  000BB030: ffffffff ffffffff ffffffff ffffffff

  > flashwrite 0x7b000 0x800
  Writing 2048 bytes to 0x7b000...

  > md 0xbb000 16

  000BB000: 03020100 07060504 0b0a0908 0f0e0d0c
  000BB010: 13121110 17161514 1b1a1918 1f1e1d1c
  000BB020: 23222120 27262524 2b2a2928 2f2e2d2c
  000BB030: 33323130 37363534 3b3a3938 3f3e3d3c

  > md .b 0xbb000 16

  000BB000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
  >

Change-Id: I956e813871949faed8d85ad9e46bdc64dee1a9e9
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299757
2015-09-18 01:25:55 -07:00
Dino Li
ad8efdee3f it8380dev: fix idle task and chip id
1. Fix system_get_chip_name() and system_get_chip_revision().
2. Fix EC doze mode.
3. Enable LPC cycle wake-up EC from doze / deep doze function.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. console "version".
            Chip:    ite it8390 cx
     2. EC doze mode is normally.
     3. ectool "version" command x 2000.

Change-Id: I167dbfb965e557eb86ed83f45a945e4315f5fa9f
Reviewed-on: https://chromium-review.googlesource.com/299110
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-18 01:25:52 -07:00
YH Huang
c935311856 oak: power: set 8s for long power key press to force shutdown
Since the firmware_ECPowerButton testcase holds down power button
about 10s to shut down without powerd, we set DELAY_FORCE_SHUTDOWN
about 8s to make sure the powerbutton is pressed long enough to
force shutdown.

BRANCH=none
BUG=chrome-os-partner:43412
TEST=manual
  run "firmware_ECPowerButton" testcase on rev3.

Change-Id: Ib41cdecfa0342236d618e6fdffcb64bf7f51b557
Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/296884
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-09-18 01:25:51 -07:00
Dino Li
62ea7121f8 it8380dev: fix ec2i and uart
1. Host access to the PNPCFG registers is disabled.
2. UART2 for host if necessary.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. host can't access the PNPCFG registers.
     2. out I/O port 0x2f8 '0x30, 0x31, 0x32, 0x33, and 0x34'
        will have console message '01234'.

Change-Id: If07bdc129105f5248661d929e6858d4063c452ee
Reviewed-on: https://chromium-review.googlesource.com/300266
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-17 23:52:32 -07:00
Aseda Aboagye
574c806571 GLaDOS: Add lid accelerometer.
This commit adds the lid accelerometer to the list of motion sensors on
the board.  It currently wrapped behind an ifdef for
HAS_TASK_MOTIONSENSE due to space contraints.

BUG=chrome-os-partner:43494
BRANCH=None
TEST=Build GLaDOS EC with driver enabled and verify that valid
accelerometer data is read, and that range, resolution, and odr can all
be modified.
TEST=Verified that signs of accelerometer data conform to those shown in
the doc.
TEST=make buildall tests

CQ-DEPEND=CL:299013
CQ-DEPEND=CL:300510

Change-Id: Ib566f8eb2818c0694bf673af244aedbc91eac80f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/299504
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-17 22:19:01 -07:00
Alec Berg
18ff33318f lucid: set bq24773 switching frequency to 600kHz
Set bq24773 charger switching frequency to 600kHz for
efficiency.

BUG=none
BRANCH=none
TEST=removed #ifdef BOARD_LUCID and tested on samus. verified
that the option0 register was set correctly when charger
plugged in:
> i2cxfer r16 0 0xd4 0
0xe04e

Change-Id: I60d563d0040efc7ca7746985156c4e70b423f3a7
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300622
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-17 20:42:47 -07:00
Shawn Nematbakhsh
542a95c87b cleanup: Fix npcx build
The previous commits left npcx in a bad state. Change
CONFIG_PROGRAM_MEMORY_BASE to point to the actual start of code memory
and correct the linker file.

This still results in a non-working npcx image (more changes
forthcoming) but it does build.

BUG=chrome-os-partner:23796
TEST=make clean; make buildall -j
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia300c5d18695dccd8d9fd9a6122cd7d30353adfa
Reviewed-on: https://chromium-review.googlesource.com/300295
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-17 19:00:54 -07:00
Alec Berg
5717b3150c motion: add config option to use the old accelerometer ref frame
Add config option to use the old accelerometer reference frame,
which is used on samus and products using 3.14 or earlier kernel.

This fixes samus so that the lid angle calculation is correct
again.

This also moves the accel_orientation structure out of the board
directory and into common code, since it purely is a function of
the reference frame being used.

BUG=chrome-os-partner:43494
BRANCH=none
TEST=test on samus, verify lid angle calculation is correct once
again. also, enable the motion_lid test and verify that it passes.

Change-Id: I948a74a71964b54c68be66e828a030ddd0418947
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300510
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-17 19:00:53 -07:00
Aseda Aboagye
e686e95e9e ectool: Add chip description for Kionix KX022.
BUG=None
BRANCH=None
TEST=make buildall tests

Change-Id: If310c834269878bcbc428cd8bd4ab5479bb439e7
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/300620
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-17 17:35:17 -07:00
Alec Berg
7a87dae5c7 motion: fix task to guarantee task never exits
Fix motion_sense task to make sure the task never exits. Note,
before this change a task_wake(TASK_ID_MOTIONSENSE) would end
the task because task_wait_event() would return 0.

BUG=none
BRANCH=smaug
TEST=with following CL, run motion_lid test and make sure it
passes

Change-Id: I67bd2e535d67215baa0cc1dfd0010b8199152dbd
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300630
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-17 17:35:14 -07:00
Gwendal Grignou
5dfe8d2674 ectool: fix sizes one more time.
ectool is only sending payload. kernel is adding header for v3 commands.
(length, crc, ...)
Put back the header I previously deleted in cl:274086

BRANCH=ryu
BUG=chrome-os-partner:45304
TEST=ectool flashwrite now works.

Change-Id: I40fa30bc477a090261048eb51b382483f28d4ab1
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300024
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-17 16:09:43 -07:00
Bill Richardson
ac26c227a8 cleanup: remove accidental binary
The binary file "ec.bin" was introduced by accident with commit
1167cad6a8. This removes it.

BUG=chrome-os-partner:23796
BRANCH=none
TEST=make buildall

Change-Id: I165406f39f771cce645444fee99cda0f32702e7f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300530
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-17 16:09:40 -07:00
Ben Lok
c15faa4c2c usb_pd: Add TODO for pd soft reset process.
Just add comments, no code.

BUG=chrome-os-partner:45133
BRANCH=none
TEST=make buildall -j

Change-Id: I75bf98c7f920ddfa70fc9a3ce939131c57470d5c
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/299102
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-09-17 03:23:20 -07:00
Dino Li
2f99365a57 it8380dev: fix PWM moduel
1. Fix fan turns on during sysjump if fan is disabled.
2. Remove unused board function.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1-1. Console 'sysjump RW' and fan keeps off.
     1-2. Console 'fanset 4000' or 'fanset 0' and 'sysjump',
          it dose maintain the fan RPM.

Change-Id: I531d49c2a8a9fea68af4507339c7be97367c504c
Reviewed-on: https://chromium-review.googlesource.com/299650
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 20:49:58 -07:00
Dino Li
f33ff43d93 it8380dev: fix lpc module
1. add lpc_keyboard_clear_buffer() function.
2. Enable P80L function, that LPC I/O port 80h data can be mapped
   to BRAM bank1 (offset 0x80 ~ 0xBF).

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. The lpc_keyboard_clear_buffer() function can clear OBF.
     2. 80h port, console command port80.
     3. 62h/66h port.
       3-a. out 66h 80h, out 62h 00h, in 62h 02h
       3-b. out 66h 81h, out 62h 01h, out 62h 55h
       3-c. out 66h 80h, out 62h 01h, in 62h 55h
       3-d. out 66h 80h, out 62h 02h, in 62h aah
     4. Host command "version".

Change-Id: Id2b5a5813cbe8edfc4ecc7b153874b819d460f43
Reviewed-on: https://chromium-review.googlesource.com/298421
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 20:49:57 -07:00
Dino Li
72a7796dcb it8380dev: fix flash module and reset cause.
1. Use flash common code commands for flash erase and write test.
2. Reset cause is "soft" if software reset is triggered by core.
3. Fix EC keeps rebooting after reboot command when write protection is set
   while WP pin is de-asserted.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. console commands "flashwrite" and "flasherase" OK.
     2. console "reboot", reset cause is soft.
     3. console command crash "assert", "divzero", and "stack" show
        reboot reason as soft.
     4. manually test with console commands.

flashinfo
Physical: 256 KB
Usable:   256 KB
Write:      4 B (ideal 1024 B)
Erase:   1024 B (to 1-bits)
Protect: 2048 B
Flags:
Protected now:
    ........ ........ ........ ........
    ........ ........ ........ ........
    ........ ........ ........ ........
    ........ ........ ........ ........
> flashwp enable
> flashinfo
Physical: 256 KB
Usable:   256 KB
Write:      4 B (ideal 1024 B)
Erase:   1024 B (to 1-bits)
Protect: 2048 B
Flags:   wp_gpio_asserted ro_at_boot
Protected now:
    ........ ........ ........ ........
    ........ ........ ........ ........
    ........ ........ ........ ........
    ........ ........ ........ ........
> reboot
Rebooting!

--- UART initialized after reboot ---
[Reset cause: soft]

flashinfo
Physical: 256 KB
Usable:   256 KB
Write:      4 B (ideal 1024 B)
Erase:   1024 B (to 1-bits)
Protect: 2048 B
Flags:   wp_gpio_asserted ro_at_boot ro_now
Protected now:
    YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY
    YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY
    ........ ........ ........ ........
    ........ ........ ........ ........
> flashinfo
Physical: 256 KB
Usable:   256 KB
Write:      4 B (ideal 1024 B)
Erase:   1024 B (to 1-bits)
Protect: 2048 B
Flags:   ro_at_boot ro_now
Protected now:
    YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY
    YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY
    ........ ........ ........ ........
    ........ ........ ........ ........
> reboot
Rebooting!

--- UART initialized after reboot ---
[Reset cause: soft]

flashinfo
Physical: 256 KB
Usable:   256 KB
Write:      4 B (ideal 1024 B)
Erase:   1024 B (to 1-bits)
Protect: 2048 B
Flags:   ro_at_boot ro_now INCONSISTENT
Protected now:
    YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY
    YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY
    ........ ........ ........ ........
    ........ ........ ........ ........

--- UART initialized after reboot ---
[Reset cause: power-on]

flashinfo
Physical: 256 KB
Usable:   256 KB
Write:      4 B (ideal 1024 B)
Erase:   1024 B (to 1-bits)
Protect: 2048 B
Flags:   ro_at_boot
Protected now:
    ........ ........ ........ ........
    ........ ........ ........ ........
    ........ ........ ........ ........
    ........ ........ ........ ........

Change-Id: Ifad48d190a84326ed3cb4cde497d906b8ab8cd5f
Reviewed-on: https://chromium-review.googlesource.com/297933
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 20:49:57 -07:00
Vijay Hiremath
f4b09f4f48 Kunimitsu: Enable "shmem" console command for FAFT testing
BUG=none
TEST=EC console command "help" lists the "shmem" console command.
BRANCH=none

Change-Id: Icd9db01f27df2e228b69fc2e204014b14689e813
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/299969
Commit-Ready: 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>
2015-09-16 16:27:01 -07:00
Bill Richardson
248e1a8a31 md console command can dump memory in more formats
This adds optional format designations to the "md" console
command. By default it dumps memory in 32-bit words, but with
this change it can also display 16-bit words, bytes, and strings.

BUG=none
BRANCH=none
TEST=manual

For example:

> md 0x5c400 32

0005C400: 6d6d6f63 20646e61 75626564 756f2067
0005C410: 74757074 646f6d20 6f6e0065 6c616d72
0005C420: 65766500 70007972 6d617261 41550073
0005C430: 69205452 6974696e 7a696c61 61206465
0005C440: 72657466 73797320 706d756a 2d0a0a00
0005C450: 55202d2d 20545241 74696e69 696c6169
0005C460: 2064657a 65746661 65722072 746f6f62
0005C470: 2d2d2d20 525b000a 74657365 75616320

> md .h 0x5c400 32

0005C400: 6f63 6d6d 6e61 2064 6564 7562 2067 756f
0005C410: 7074 7475 6d20 646f 0065 6f6e 6d72 6c61
0005C420: 6500 6576 7972 7000 7261 6d61 0073 4155
0005C430: 5452 6920 696e 6974 6c61 7a69 6465 6120

> md .b 0x5c400 32

0005C400: 63 6f 6d 6d 61 6e 64 20 64 65 62 75 67 20 6f 75
0005C410: 74 70 75 74 20 6d 6f 64 65 00 6e 6f 72 6d 61 6c

> md .s 0x5c400 32

0005C400: command debug output mode\x00normal
>

Change-Id: Ic0dec9a1a3942acc66c88f46c5b02a80a8110817
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300020
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 14:49:59 -07:00
Alec Berg
c8d95f8a6d tcpc: update to tcpci RC3
Update TCPCI to match specification version RC3.

BUG=none
BRANCH=none
TEST=tested on glados and samus by plugging in a zinger with
both polarities and verifying we make a power contract.

Change-Id: I9cd6d8db7b7149995847ec1b071fba1f4d4cd5a3
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299713
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-16 14:49:47 -07:00
Gwendal Grignou
c2c02249a0 host: mock i2c_xfer
Instead of mocking i2c_read8/16/32, mock i2c_xfer.
We can now test code that call i2c_xfer directly and
test common/i2c.c

BRANCH=samus, ryu
BUG=chrome-os-partner:45223
TEST=Unit tests pass.

Change-Id: Iaa772515c40cf55d2050d0019e2062d63278adc0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299768
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-16 14:49:46 -07:00
Shawn Nematbakhsh
fe77303bec cleanup: Remove redundant FLASH_SIZE CONFIGs
Since there is no more concept of a flash region belonging only to the
EC, we only need one FLASH_SIZE config, which represents the actual
physical size of flash.

BRANCH=None
BUG=chrome-os-partner:23796
TEST=With entire patch series, on both Samus and Glados:
- Verify 'version' EC console command is correct
- Verify 'flashrom -p ec -r read.bin' reads back EC image
- Verify software sync correctly flashes both EC and PD RW images

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I18a34a943e02c8a029f330f213a8634a2ca418b6
Reviewed-on: https://chromium-review.googlesource.com/297824
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 14:49:33 -07:00
Shawn Nematbakhsh
1167cad6a8 cleanup: Change meaning of storage offset CONFIGs
In order to support architectures with non-contiguous writable and
protected regions, change storage offsets to be relative to writable and
protected regions, rather than relative to "the start of the region of
storage belonging to the EC".

Spec doc available at https://goo.gl/fnzTvr.

BRANCH=None
BUG=chrome-os-partner:23796
TEST=With entire patch series, on both Samus and Glados:
- Verify 'version' EC console command is correct
- Verify 'flashrom -p ec -r read.bin' reads back EC image
- Verify software sync correctly flashes both EC and PD RW images

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I796f8e7305a6336495bd256a78774595cb16a2e4
Reviewed-on: https://chromium-review.googlesource.com/297823
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 14:49:32 -07:00
Shawn Nematbakhsh
558c465165 cleanup: Remove CDRAM / CODERAM CONFIGs
CDRAM / CODERAM configs were previously used for chips which copied code
from external SPI to program memory prior to execution, and were used
inconsistently between npcx and mec1322.

These CONFIGs are now completely redundant given new configs like
CONFIG_MAPPED_STORAGE_BASE and CONFIG_EXTERNAL_STORAGE.

BRANCH=None
BUG=chrome-os-partner:23796
TEST=With entire patch series, on both Samus and Glados:
- Verify 'version' EC console command is correct
- Verify 'flashrom -p ec -r read.bin' reads back EC image
- Verify software sync correctly flashes both EC and PD RW images

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I0e054ab4c939f9dcf54abee8e5ebd9b2e42fe9c4
Reviewed-on: https://chromium-review.googlesource.com/297804
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 14:49:32 -07:00
Shawn Nematbakhsh
d58e54730c cleanup: Rename geometry constants
Rename and add geometry constants to match spec doc -
https://goo.gl/fnzTvr.

CONFIG_FLASH_BASE becomes CONFIG_PROGRAM_MEMORY_BASE
CONFIG_FLASH_MAPPED becomes CONFIG_MAPPED_STORAGE

Add CONFIG_INTERNAL_STORAGE, CONFIG_EXTERNAL_STORAGE and
CONFIG_MAPPED_STORAGE_BASE where appropriate.

This CL leaves chip/npcx in a broken state -- it's fixed in a follow-up
CL.

BRANCH=None
BUG=chrome-os-partner:23796
TEST=With entire patch series, on both Samus and Glados:
- Verify 'version' EC console command is correct
- Verify 'flashrom -p ec -r read.bin' reads back EC image
- Verify software sync correctly flashes both EC and PD RW images

Change-Id: Idb3c4ed9f7f6edd0a6d49ad11753eba713e67a80
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/297484
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 14:49:31 -07:00
jongpil19.jung
4b3c13ddfe Celes: Add define to support GD25Q41B for External EC ROM.
MEC1322 use external spi rom. Now, we support W25X40 and W25Q64.
Celes will use GD25Q41B for external EC ROM.
So, we need to add define for GD25Q41B.

BUG=chrome-os-partner:45246
BRANCH=master
TEST=emerge-strago chromeos-ec

Change-Id: Idec79955306b2dd79027fa57afc15ed8474413e6
Signed-off-by: jongpil19.jung <jongpil19.jung@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/299576
Commit-Ready: Jongpil Jung <jongpil19.jung@samsung.com>
Tested-by: Jongpil Jung <jongpil19.jung@samsung.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-15 19:17:53 -07:00
Vincent Palatin
3154abd5c3 ryu: put additional temperature checks for battery charging
Whatever the battery gas gauge returns, ensure we never charge below 0 C
and above 60 C.

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

BRANCH=smaug
BUG=chrome-os-partner:44820
TEST=charge a Smaug DVT, use a cold spray on the battery and see the
charge stop.

Change-Id: I8670fbe1713b35aa079bebc9c5bb70e9f28cf8ac
Reviewed-on: https://chromium-review.googlesource.com/299945
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>
(cherry picked from commit 1d19259be3b0721667835ce01bfe719fb547785e)
Reviewed-on: https://chromium-review.googlesource.com/299906
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-09-15 19:17:52 -07:00
Aseda Aboagye
fa63597371 GLaDOS: Add 3ms delay to end of chipset_resume.
This commit fixes two issues:

 - When we transition from S3 to S0, we enable the sensor rail.  Very
   shortly thereafter, we attempt to initialize the motion sensors.
   They fail on the very first i2c transaction due to the fact that the
   senors are not ready.  Therefore, this commit adds a small 3ms delay
   to the end of the board_chipset_resume() hook.  This allows both the
   motion sensors to initialize successfully when the motion sense hook
   is called.

 - In order for the delay to be effective, it must be called prior to
   the motion sense hook.  Therefore, the priority of
   board_chipset_resume() is increased.

BUG=chrome-os-partner:43494
BRANCH=None
TEST=Build and flash GLaDOS EC, reboot several times verifying that both
sensors are initialized.
TEST=make buildall tests

Change-Id: I86ee87955f0750cac1960be147c2b39c7d922f0a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/299769
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-15 17:56:17 -07:00
Gwendal Grignou
2bff01f1ca common: math: Stop using FP_BITS directly.
To be able to use hardware FPUs, use fp_ functions instead of FP_BITS in
application code.

BRANCH=smaug
BUG=chrome-os-partner:39900
TEST=compile.

Change-Id: I8a1339140eb5ddab32dd3edc58fb5d3ccaef52e2
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299515
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-15 17:56:17 -07:00
Vincent Palatin
552e3ceaee pd: restart toggling immediatly when dual role mode is re-enabled
Kick the PD task when the dual role toggling is enabled to ensure we
start toggling immediatly and detect a UFP (USB device).
The issue was visible with the CONFIG_USB_PD_LOW_POWER change where the
task was waking up only every minute when the toggling was disabled,
the whole system would take up to a minute after resume to detect a peripheral
connected while in S3.

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

BRANCH=smaug
BUG=chrome-os-partner:45347
TEST=On Smaug, put the system into S3, plug a USB device (e.g. a USB
key), transition to S0 and verify that the kernel is receiving
immediatly the "host mode" notification.

Change-Id: I12d10941f9d2cefdfe711847ba0aec9f269e9bcd
Reviewed-on: https://chromium-review.googlesource.com/299796
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 6a0e8ec3b9b1a7a0eb222a9e6c132d88d33f60e2)
Reviewed-on: https://chromium-review.googlesource.com/299807
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-09-15 12:21:35 -07:00
Aseda Aboagye
16a18a5e0e driver: Refactor Kionix Accelerometer drivers.
This commit adds a new basic driver for the Kionix KX022 Accelerometer.
Currently, the driver is capable of reading the sensor data and
manipulating its ODR, resolution, and range.

This sensor also has integrated support for Directional
Tap/Double-Tap(TM), however that functionality is not yet implemented in
the driver.

Lastly, since this accelerometer is very similar to the previous KXCJ9,
this commit tries to combine the drivers.

Note, the variant of the Kionix accelerometer MUST be specified in the
private data structure.

BUG=chrome-os-partner:43494
BRANCH=None
TEST=Build GLaDOS EC with driver enabled and verify that valid
accelerometer data is read, and that range, resolution, and odr can all
be modified.
TEST=Build samus EC image and verify that the lid still
works. Additionally, verify that I can change the odr, rate, and
resolution.
TEST=make buildall tests

Change-Id: I238ff1dc13f5342a93f8f701a0da85c52f25d214
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/299013
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-15 11:02:43 -07:00
Bill Richardson
070a825248 cleanup: Remove ifdefs for older implementations
We're now on to FPGA B1, so version A1 won't ever be valid.

BUG=chrome-os-partner:43791
BRANCH=none
TEST=make buildall

Change-Id: I1b917b7220d427f7f358593ad78e51a0814f61dd
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299756
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-09-14 22:14:46 -07:00
Gwendal Grignou
0e4640cc67 samus: gyro is on all the time.
Given it is in the chip as the accelerometer, it is on all the time.
Put it in suspend by setting its ODR to 0 is S3 and S5.

BRANCH=smaug
BUG=none
TEST=gyro still works in S0 and after S3/S5 transitions.

Change-Id: Ibbf51eb555e2c513a6561a1d22e231796b3da4b4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299542
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-14 18:53:38 -07:00
Vincent Palatin
42288543f9 stm32: fix flash write protect check for STM32F3
Since the STM32 flash write protection was re-factored between STM32F0
and STM32F/F3, the common STM32 flash code checks whether the chip needs
a reboot to synchronize its write protection state (as this can be done
only with an OBL_LAUNCH triggered reset on STM32F0)
but for platforms able to set immediatly the full write-protection
(STM32F/STM32F3 with Cortex-M3 core using the bus fault interception
code) where there is no EC_FLASH_PROTECT_ALL_AT_BOOT flag, this might
trigger a reset loop in the RO code when the flash is write-protected.

Make the check conditional to the existence of EC_FLASH_PROTECT_ALL_AT_BOOT.

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

BRANCH=smaug
BUG=chrome-os-partner:45288
TEST=On a smaug board with hardware write protect enable,
enable software write protect from the AP command line:
flashrom -p ec --wp-range 0 0x20000
flashrom -p ec --wp-enable
ectool reboot_ec RO
reboot -p
then, go to fastboot mode :
adb reboot-bootloader
and see the machine booting properly.

Change-Id: I93f78cb8e9e918c8efe374bd757b79bc87243e2c
Reviewed-on: https://chromium-review.googlesource.com/299555
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 39a0feb45b0c14ea5eb008329f2b8ea7a9b17c8a)
Reviewed-on: https://chromium-review.googlesource.com/299762
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-09-14 18:53:35 -07:00
Vincent Palatin
a8d71bdb5b pd: add option to save power in S5
When we are in sink mode and not dual-role toggling, add the option to
disable the CC lines polling every 10 ms (thus waking up on the VBUS
transition or the 1-minute slow polling).

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

BRANCH=smaug
BUG=chrome-os-partner:44229
TEST=on Smaug DVT, measure power consumption in S5 and wake-up time when
plugging a power supply.

Change-Id: Idee6581af550de01760feffe604d7bd453a625a8
Reviewed-on: https://chromium-review.googlesource.com/299022
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>
(cherry picked from commit d14a0045568e61a36695ffee48ed39ddc60ebb3a)
Reviewed-on: https://chromium-review.googlesource.com/299023
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-09-14 18:53:32 -07:00
Rong Chang
8db5a8185a oak: remove dual-port charge enable workaround
This change picks CL:298067 into oak. Removes workaround for initial
board version. Also cleanup unnecessary TODO in usb_pd_policy.

BUG=none
BRANCH=none
TEST=tested on oak, plug low power charge to one port, then plug in
zinger. check charge port becomes the high power one.

Signed-off-by: Alec Berg <alecaberg@chromium.org>
Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: I134be07d89fefad124eb6cceebf862a83e8bd3b4
Reviewed-on: https://chromium-review.googlesource.com/299150
2015-09-14 00:48:39 -07:00
Rong Chang
2eabf6fe8c oak_pd: tcpm_power_status: Update power status on init
Oak board relies on TCPCI power status. When board init, PD should
update it's VBUS status and TCPM needs to get power status after enable
TCPC power status mask.

BRANCH=none
BUG=chrome-os-partner:44952
TEST=manual
  build and load on oak, disconnect battery.
  power on system with zinger, and check PD state.

Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: Ic0d4b50d38ac39ff31b3a257c4b3b5dde0ebda4b
Reviewed-on: https://chromium-review.googlesource.com/297871
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-14 00:48:39 -07:00
Vijay Hiremath
ea6c69c839 Driver: Add TI TPS650830 PMIC driver header file
Added initial TI TPS650830 PMIC driver header file containing the
macros for registers & register values.

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

Change-Id: I936d8263d44e771bc24b3786aedea95feaa2b30c
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/297515
Commit-Ready: 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>
2015-09-11 23:00:13 -07:00
Vijay Hiremath
a8fb14fc81 Kunimitsu: Enable keyboard console commands for FAFT testing
BUG=none
TEST=EC console command "help" lists the keyboard console commands.
BRANCH=none

Change-Id: Ib0f64bd1291de972b7a939ab72d03d7935215f75
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/299501
Commit-Ready: 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>
2015-09-11 21:21:27 -07:00
Vijay Hiremath
fc4c501199 Kunimitsu: Disable motion_sense_task to save space
BUG=none
TEST=make buildall -j
BRANCH=none

Change-Id: I9a0746a2ab6f0f9d193f93a98fc8062aac71c0a7
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/299500
Commit-Ready: 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>
2015-09-11 21:21:27 -07:00
Alec Berg
39c422597a usb_charge: fix custom event mask
Fix custom event mask, which should be a power of 2.

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

Change-Id: Iaeacf9b07817ee94452c58beb6a794a5a9733355
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299262
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-11 13:51:07 -07:00
Alec Berg
fd92f9bfeb pd: add swap commands to USB_PD_CONTROL host command
Add all swap commands to USB_PD_CONTROL host command: data,
power, and vconn swap.

BUG=none
BRANCH=smaug
TEST=tested on both samus and ryu while connected to each other.

Change-Id: I280a0da2d3c5a5436243134ab3f2ec353ebf6ab8
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299290
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-11 13:51:00 -07:00
Gwendal Grignou
17296409d8 common: Add variable to enable software gesture recognition.
Gesture recognition can be done in software (by the EC) or in
hardware, by the sensor itself.
Add variable to compile gesture.c only in the software case.

BRANCH=smaug
TEST=compile.
BUG=b:23570481

Change-Id: I22bef0bf744516df267020d9458e0299a4da3d72
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296211
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-11 13:50:56 -07:00
Gwendal Grignou
3b1847d810 motion: Fix a bug in accelrate
Allow accelrate to suspend a sensor, even if the AP is using it.
For debugging only.

BRANCH=smaug
TEST=before accelrate 0 0 would not suspend the accelerometer in SO,
the AP is using it.
BUG=b:23570481

Change-Id: Iea4f616d0a0d1b4a0b0fa2bc942d05b2a2425926
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296210
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-11 13:50:56 -07:00