Commit Graph

1530 Commits

Author SHA1 Message Date
Vic Yang
950d507366 Remove mock files
We are moving to a per-function mock mechanism, which is less likely to
break when someone adds a function to a file with a mock.

BUG=chrome-os-partner:18598
TEST=None
BRANCH=None

Change-Id: Ie625064730d2224accbaf1febbdc4750e793d047
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49451
2013-04-29 03:47:49 -07:00
Vic Yang
9cbd25052e Fix kb_scan test when CONFIG_LID_SWITCH is not defined
If we don't have lid switch, don't test it.

BUG=chrome-os-partner:18598
TEST=Build on mccroskey and see errors about GPIO_LID_OPEN go away.
BRANCH=None

Change-Id: I1084e1bfc2e6bd611dc393c1b2d501e786d2a0e3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49450
2013-04-29 03:47:49 -07:00
Vic Yang
0bc9888c83 Fill in I2C test parameters
This fills in test parameters for link, pit, snow, and daisy. Also fixes
compilation error due to CONFIG_ADC not defined.

BUG=chrome-os-partner:18598
TEST=Build test-stress. (Link failed due to unrelated issue.)
BRANCH=None

Change-Id: I8a5cfcf4acdae607c23dbe5cf3378945f91c7807
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49449
2013-04-29 03:47:48 -07:00
Bill Richardson
f5a154b161 Add 'clobber' target to Makefile to clean everything.
BUG=none
BRANCH=none
TEST=manual

  make BOARD=link
  make BOARD=snow
  make clobber

Change-Id: I862ec0d0240e48828091259dee7e8aef62544d47
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49370
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-26 17:17:20 -07:00
Bill Richardson
7363535f0e Add 'TAGS' target to Makefile
This creates cscope.files and an emacs TAGS file for the specified BOARD. If
you don't have etags installed, it just creates cscope.files.

BUG=none
BRANCH=none
TEST=manual

  make BOARD=link tags
  ls

Change-Id: I9b27ba42ac4e85822c5a5a6e8cb5b5148a3435c3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49356
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-26 17:17:20 -07:00
Bill Richardson
df06f61ccc Split pwm.c into pwm_fan.c and pwm_kblight.c
Sadly, the existence of fans may not always imply the existence of keyboard
backlights.

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

Use the Link EC console to make sure that both functions still behave.

  faninfo
  fanset 4400
  faninfo
  fanset 9999
  faninfo
  autofan
  faninfo
  fanduty 50
  faninfo
  fanduty 100
  faninfo
  autofan

  kblight 0
  kblight 100
  kblight 50
  kbligth 100

Change-Id: I2e07cd46c21bce2d0d4162275a8ea6ae40135e96
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49355
2013-04-26 16:07:21 -07:00
Randall Spangler
8bc24ec311 Rename i2c_commands.c to i2c_common.c
It will soon have cross-platform code moved to it.

This CL just does the renaming; no functional changes.

BUG=chrome-os-partner:18969
BRANCH=none
TEST=build spring,link

Change-Id: I8cc475f9dd1422a0a9c586c93eb0d7aaf21a001d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49359
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-26 16:07:20 -07:00
Randall Spangler
7a9e47d74e Allow disabling PMU charger task, and do so on pit
I2C communication doesn't work on pit yet, so the charger task is
spewing errors to the console.  This change allows the task to be
disabled cleanly on pit, and has no effect on other platforms.

BUG=chrome-os-partner:18657
BRANCH=none
TEST=build all platforms and see that charger task is still compiled
     everywhere but pit

Change-Id: I788e817d5630fb1a28694819f4ef9948a503a744
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49344
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-26 13:46:48 -07:00
Randall Spangler
fd38ba353c Move PMU charger irq handler to charger module
No code changes; this is just moving the irq to the module which
actually handles it.  This makes it simpler to disable the charger
task separately from the PMU module.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build pit, spring

Change-Id: Ife44a17f69bf21aa000d162318a459cea6fdf661
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49334
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-04-26 13:46:47 -07:00
Randall Spangler
088cd2c277 Increase UART output buffer on STM32L
STM32L has 16KB RAM, so can use a bigger output buffer.

BUG=chrome-os-partner:18657
BRANCH=none
TEST=boot pit, look at EC console output; shouldn't drop output

Change-Id: I8a3c7ff2923fd815eff748a898dc873f5d86b46c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49332
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-26 13:46:43 -07:00
Randall Spangler
ca2de14f9f Add pit support to flash_ec
Pit flashes the same way daisy does.

BUG=chrome-os-partner:18657
BRANCH=none
TEST=./util/flash_ec --board=pit --ro --image=build/pit/ec.bin

Change-Id: Id3db86b348963f66e7eb03c38a8efabe3379d21b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49320
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-26 13:46:37 -07:00
Vic Yang
0d645f105e spring: Show yellow LED when not fully charged
This includes two situations:
  1. When charge state machine is still trying to decide the next state.
  2. When we are waiting for acceptable condition to start charging.

For now, we show yellow for both.

BUG=chrome-os-partner:18914
TEST=none
BRANCH=spring

Change-Id: I5dd97c735a1ecfee29d506452695014c85d2da0b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49327
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-26 12:36:27 -07:00
Vic Yang
92bd863d8d Add new TPS65090 charge state REINIT and BAD_COND
Currently INIT state can mean different things. This change introduces
two new states to demultiplex INIT. Now, REINIT means charge state
machine is deciding the next state. BAD_COND means it's waiting for
acceptable charging condition. Note that the three states are doing the
same thing so there is no functional change.

BUG=chrome-os-partner:18914
TEST=none
BRANCH=spring
CQ-DEPEND=CL:49327

Change-Id: Ia783e76cf27e28103ef44fe7b8a43674dadccc54
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49326
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-26 12:36:26 -07:00
Vincent Palatin
79c3c04045 stm32: do not enable interrupts on I2C1
We don't have any interrupt handler for I2C1, so enabling of the I2C1
interrupts will just end up triggering a panic everytime the interrupt
fires.
By the way, I2C1 is used as master and all communications happen without
using the I2C interrupt.

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

BRANCH=spring
BUG=chrome-os-partner:18499
TEST=On Spring, run EC flashing in a loop from the AP
while true
do
        flashrom --fast-verify -p internal:bus=lpc -w ec.bin
        flashrom --fast-verify -p internal:bus=lpc -w ec_autest_image.bin
done
and check that we always succeed and have no panic.

Original-Change-Id: I6b071f309218410840707380d296bdf14b10e9f5
Reviewed-on: https://gerrit.chromium.org/gerrit/47749
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 8b3262d644003b3c9727998dc8d4b0c749450aef)

Change-Id: Ie2fc30e5661e7eade024e6893eaf16427f94cac2
Reviewed-on: https://gerrit.chromium.org/gerrit/49192
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-04-26 09:06:40 -07:00
Randall Spangler
45bc5c1a21 Split out power button code from switch.c
The power button code is platform-independent.  This change splits the
code out of the LM4 switch.c module so that a subseqent change to
STM32 platforms can start using it.

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

1. Power+refresh+esc goes to recovery mode,
2. Press power button at recovery screen turns off.
3. With system off, power button turns system on.
4. Press power button for a second; screen locks.
5. Press power button while typing; blocks keystrokes while it's pressed.
6. Hold power button down for 8 sec; system forced to shutdown.
7. From EC console, with system on:
   hostevent clear
   hostevent -> event 0x04 is clear
   press power button
   hostevent -> event 0x04 is set
8. From EC console, with system off:
   powerbtn -> system turns on
   powerbtn 5000 -> system turns off, just like power button was held for 5 sec

Change-Id: If2a9b02514a201e1d03c857d128e2ccab51a16ef
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49217
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-25 17:03:18 -07:00
Bill Richardson
b4b2c6ae70 Create board directory for Slippy.
This just copies the board/link stuff into board/slippy (with one formatting
tweak to pass the presubmit check). It builds, but of course is useless.
Customization will follow later.

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

  cd src/platform/ec
  make BOARD=slippy

Change-Id: I2ba62812d9199eec776f9da6732921c6281762ab
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49130
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-24 21:30:39 -07:00
Randall Spangler
a55e270f0b Temporarily enable all FETs at chipset poweron
This will allow debugging until the I2C passthru command is supported,
and should be removed once it is supported.

BUG=chrome-os-partner:18778
BRANCH=pit
TEST=build pit; can't test until we have boards

Change-Id: I6285e76763a5f3bfd759161115d4905697b56e6c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49096
Reviewed-by: Doug Anderson <dianders@chromium.org>
2013-04-24 17:33:09 -07:00
Randall Spangler
13d08cbce3 Fix typo in power_led.c
Should be BOARD_pit, not BOARD_PIT (Thanks, Doug!)

BUG=none
BRANCH=pit
TEST=build pit

Change-Id: I1d7ef9e2347f031aec8f94c7a2da87145aa83c4d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49111
Reviewed-by: Doug Anderson <dianders@chromium.org>
2013-04-24 17:33:05 -07:00
Bill Richardson
1fb81c9c7b Move LPC constants of out board.c and into chipset where they belong
These should be specific to the lm4's lpc.c, not the board.

BUG=chrome-os-partner:18343
TEST=build all, run link
BRANCH=none

Change-Id: Ie02bbd3cf90f09035d302f5dcaad4d33f4ef9e7c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49101
2013-04-24 16:32:58 -07:00
Bill Richardson
0bfb7ddd07 Replace generated CONFIG_TASK_ macros with HAS_TASK_
CONFIG_ macros should be set directly. Expanding the task names in the same
way made it difficult to tell what was a configuration choice and what was
due to changes in ec.tasklist

BUG=chrome-os-partner:18343
TEST=build all, run link
BRANCH=none

Change-Id: Ib82e34f974238ee2dd216f33b701b6f4c6a4f1f1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49098
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-24 16:32:58 -07:00
Bill Richardson
39b0f6ce0c Specify the LM4 GPIOs to use for UART1
UART0 is the EC console, and it's consistent.
UART1 is the AP console that we export via servo. It was connected to a
different set of GPIOS on the BDS.

BUG=chrome-os-partner:18343
TEST=build link, bds
BRANCH=none

Change-Id: Ib4c10fd4d2b7a8ffb4e41e216528d4760ba50de3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48975
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-24 10:59:48 -07:00
Vic Yang
be2a21338c Add test for keyboard disabling when lid closed
BUG=chrome-os-partner:17653
TEST=Run on Spring
BRANCH=none

Change-Id: Ib01f6f4cac3b0ef3039bb1e1daf3dd9c6c8e44c4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48895
2013-04-24 09:58:26 -07:00
Randall Spangler
9d8e0d0859 Move common chipset console commands to chipset.c
apreset and apshutdown are now the same across all platforms.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; make sure 'apreset warm', 'apreset cold', and
     'apshutdown' work.

Change-Id: I4ace1ab2bbda4d400528039ad5f84da63c9c7d0e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48942
2013-04-24 09:58:22 -07:00
Vic Yang
5f86cc0aa5 spring: Improve battery LED stability
Previously, we sometimes saw battery LED went off when going into or out
of battery assist mode. This CL adds a state machine to stabilize
battery LED. By controlling the state of lighting engine, the
tranisition from/to battery assist mode is seamless now.

BUG=chrome-os-partner:18844
TEST=On spring, check:
      1. LED doesn't go off when going into battery assist mode.
      2. LED doesn't suddenly change brightness when coming out of
         battery assist mode.
      3. LED goes red after few seconds when battery is not present.
      4. LED goes green when battery is charged.
BRANCH=spring
Signed-off-by: Vic Yang <victoryang@chromium.org>

Change-Id: I3286b54a76edd77c65033ec3bbf0d81d916f7be0
Reviewed-on: https://gerrit.chromium.org/gerrit/48875
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2013-04-24 00:06:01 -07:00
Randall Spangler
01279936cb Unify lid switch processing
STM32-based platforms now use the same lid debouncing code as
LM4-based platforms, generate lid-open / lid-closed events, and
trigger lid-change hooks.

This is needed for disabling keyboard scanning when the lid is closed,
as well as future changes to mask off wake events when the lid is
closed.

BUG=chrome-os-partner:18896
BRANCH=spring
TEST=build all platforms; check that spring boots when lid is opened

Change-Id: I09a6e91119c3739297fe49b7eacac6efda988284
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48924
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-04-24 00:06:00 -07:00
Bill Richardson
3def4e04fa Allow keyboard_scan_config to be customized per-board
By default it's not, but if you #define CONFIG_CUSTOM_KEYSCAN, you can add
your own settings in board.c

BUG=chrome-os-partner:18343
TEST=build link, bds
BRANCH=none

Change-Id: I2a9dd48fd7f4610bc39dcc59e59a3fedec539e28
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48994
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-24 00:05:53 -07:00
Bill Richardson
c747652e49 Allow building without battery charging
Some experimental boards may want to build without a battery charging task
to make bringup easier.

BUG=chrome-os-partner:18343
TEST=build all boards
BRANCH=none

Change-Id: I4269fea4046325241ad7720ec3457b0534aadda3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48974
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-24 00:05:52 -07:00
Vic Yang
c6e5d592cb Add LP5562 functions to control engine execution state
This gives us better control over the execution state of lighting
engine.

BUG=chromium:233832
TEST=Build success
BRANCH=spring

Change-Id: Ibfa86be0eef2b7dff8495f770649577295d4cb6f
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48773
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-23 10:39:13 -07:00
Vic Yang
4d96bf649d Unify lid switch GPIO name
Link uses LID_SWITCH_L but it means the same thing as LID_OPEN. Changing
it to LID_OPEN so that all boards use the same name.

No functional changes, just renaming.

BUG=chrome-os-partner:18343
TEST=build link, bds
BRANCH=none

Change-Id: I74893e1365ad3068f13e7fe948f1a54c6c6301bb
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48893
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-23 10:39:10 -07:00
Vic Yang
2dd01e59ea Software flow control in console
This adds software flow control handling (a.k.a X-on/X-off). When Ctrl-Q
is received, UART transmitting is paused until Ctrl-S is received. If
the FIFO or buffer fill up during this period, console output is lost.

BUG=chrome-os-partner:18680
TEST=Press Ctrl-Q and see console stopped. Press Ctrl-S and see buffered
messages.
BRANCH=spring

Change-Id: I9ce1198a1119dadc558bb522c48037bb83bba415
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48887
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-23 10:39:09 -07:00
Bill Richardson
4d0c4b1a53 Increase EC low-battery threshold to 14% to match kernel
There is a 4% difference between the kernel's view of battery level and the
actual battery level, to give userspace a chance to shut down cleanly. The
EC should turn the lightbar red when the battery drops below 10%, so this
change makes that happen when the kernel says it's 10%, instead of the real
10%.

Note: We don't have to cherry-pick this to the Link branch. Although it
affects the EC, we already patch the EC lightbar parameters at boot and
that's done in userspace.

BUG=chromium:225500
BRANCH=none
TEST=manual

Unplug Link, let the battery run down. The lightbar should pulse red when
the battery level reported by the UI drops to 9% (there may be a little
delay due to rounding). Note that it's only red when on battery.

Change-Id: If3d335c54ceb37c86da59e4a66f8ecd46ce15664
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48904
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-23 10:39:09 -07:00
Randall Spangler
57b77a3a8f Active-low Link GPIOs end with _L, not n.
This is now consistent with other boards.

No functional changes, just renaming,

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build link, bds

Change-Id: Ifd7c1ec608ab61f5f66800e91803ffafe1d944b6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48804
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-22 16:44:37 -07:00
Randall Spangler
dcb2425f45 Turn on 3.3V rail earlier in power sequence for pit
The 3.3V rails powers some of the buck supplies, so must be turned on
1ms after the 5V rail.

BUG=chrome-os-partner:18657
BRANCH=none
TEST=build pit, snow

Change-Id: I18a165744352ae375080824fecfeb56f6ac81a9c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48729
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-04-22 09:55:49 -07:00
Vic Yang
8f00a3beee Add more flash test
This adds write protect status check across reboots.

BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: Iba0c5d6f906c64af4216aaecac35b87c1392a873
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48752
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-21 23:02:03 -07:00
Vic Yang
9c38f43358 Add shared memory test
Also changes utils test to use EC_SUCCESS to indicate test success.

BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I4a9b08550c15f09cd467706b6a3c0142dd06a558
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48751
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-21 23:02:02 -07:00
Randall Spangler
aa18085df2 Support power button LED on pit
Pit uses GPIO PA2=TIM2_CH3 instead of Snow's PB3=TIM2_CH2.  Other than
that, the timer setup is identical (STM32F and STM32L are compatible
in this respect, anyway).

BUG=chrome-os-partner:18657
BRANCH=none
TEST=build snow, pit; no pit boards to test on yet

Change-Id: I8ba68f99641038e12c9a9c9dd29e3b64410a5eef
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48403
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-19 14:11:38 -07:00
Randall Spangler
8164026327 Move temp sensor struct into board.c
No need for it to be a separate file.

Just moving code, no functional changes.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build link

Change-Id: I25f84c73401929bce4ac76ebdcf6c86ad4852594
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48684
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-19 14:11:38 -07:00
Vic Yang
368dfc43f4 Add peripheral stress test
This includes I2C and ADC. PECI test will be added in another CL.

BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I7424dbf5d3cefda67cad9aaad60367d957c47529
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48614
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-19 10:41:33 -07:00
Daisuke Nojiri
74c34bbad4 Saving the main stack pointer at the entry of exception_panic.
CPU creates an exception frame on the main stack instead of the process
stack when the exception happens in a handler's context. So, we need to
save both msp and psp, and pick the right one to locate the exception frame.

Tested by marking the stack (as you see in the dump below) then triggering
divzero in svc_handler.

> crash svc

=== HANDLER EXCEPTION: 03 ====== xPSR: 6100000b ===
r0 :00000000 r1 :0000e237 r2 :000015cf r3 :000015cf
r4 :00000001 r5 :22222222 r6 :11111111 r7 :0000df01
r8 :00000000 r9 :2000545e r10:00000000 r11:00000000
r12:0000000d sp :20000fb8 lr :000055d7 pc :00000b40
Divide by 0, Forced hard fault
mmfs = 2000000, shcsr = 70080, hfsr = 40000000, dfsr = 0

=========== Process Stack Contents ===========
20002738: 11111111 22222222 33333333 44444444
20002748: 00000000 000003ad 000003c0 81000000
20002758: 00000000 0000557d 0000557c 21000000
20002768: 00000000 00000000 00000000 00000000

Rebooting...

BUG=chrome-os-partner:16901
BRANCH=none
TEST=mentioned above

Change-Id: I3ca08a1df20375953552b3dc926350e262b78b2a
Signed-off-by: Daisuke Nojiri <dnojiri@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/47495
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-18 20:56:15 -07:00
Vic Yang
5b04478423 Add flash write protect test
BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I6488ace5d6b758410c76d7625787413eba37cbe9
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48208
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-17 21:07:09 -07:00
Randall Spangler
36317d46f7 Move STM32 timer regs struct to registers.h
This is a struct representation of the STM32 timer registers, so
belongs in registers.h instead of the platform-independent hwtimer.h.

Note that there are other problems with the use of this struct.  It
should be volatile, and if it's a win vs. the macros we should replace
ALL macro'd timer register accesses with the struct instead of just
those in hwtimer.c (that is, we shouldn't do things both ways).  I'll
address those in a subsequent CL after testing which way generates the
most compact code.

No functional changes, just moving the struct definition.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: If29d008fb38b9cc847b69eda1ee7c05e67f6e5e7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48415
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-17 18:47:05 -07:00
Vic Yang
6fec5d1397 Remove 'hello' test
Hello test should be a setup step for every test. This should be
implemented on the test server side. Remove it to reduce number of test
binaries.

BUG=chrome-os-partner:18598
TEST=None
BRANCH=None

Change-Id: I462156f6d7affdf7ceb67e4354804fedb18a5424
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48196
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-17 10:49:39 -07:00
Randall Spangler
5f18b03e1b PMIC_PWROK is active-high on pit
Add a function which handles translation of PWROK from logical level
to physical level.

Also implement chipset_force_shutdown() in gaia_power.c, so PMU code
doesn't need to know about PWROK physical level.

BUG=chrome-os-partner:18738
BRANCH=none
TEST=build all platforms; boot spring

Change-Id: I360266ef89b6ead49a633cd57b7530f791b04c9e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48251
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-16 14:55:13 -07:00
Randall Spangler
caad1bdbd4 Correct GPIOs to match Pit EVT schematics
The latest schematics move a few signals between GPIOs.  Update the
GPIO map to match.

BUG=chrome-os-partner:18657
BRANCH=pit
TEST=build pit (can't test the binary yet; no hardware)

Change-Id: I2d135412723fbe5cf4e7c1dbeb05fc68e6bb8c9e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48231
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-16 14:55:13 -07:00
Randall Spangler
9844e82ca8 Remove _OFF from GPIO register macros
This is left over from when we had a pair of macros for each GPIO
register, one which concatenated its base address name and one which
took a base address.  Only the latter has survived, but its naming is
longer than it needs to be and isn't consistent with other register
banks (USART, TIM, etc.).

No code changes, just renaming macros.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I15a282fd01db2a25219970e28ce551d8dc80193f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48226
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-16 14:55:12 -07:00
Todd Broch
357e508392 Allow either libftdi or libftdi1 at compile time.
Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=none
BUG=chromium:222299
TEST=manual, from chroot:

1. Install libftdi1 (https://gerrit.chromium.org/gerrit/#/c/44731/)
2. cd <path>/ec && make -B
   - compiles successfully
3. Install libftdi
4. cd <path>/ec && make -B
   - still compiles successfully

Change-Id: I6818d53faa1389937872b0a9826534db4760e448
Reviewed-on: https://gerrit.chromium.org/gerrit/47875
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2013-04-16 09:43:45 -07:00
Vincent Palatin
0498d68732 flash_ec: add support for flashing with Toad cable
Add support for flashing Spring board through the Toad cable (given the
Write Protect screw is not on).

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

BRANCH=spring
BUG=chrome-os-partner:17570
TEST=with both a Toad cable and a servo v2, flash EC on Spring EVT
with the following command:
./util/flash_ec --board=spring
and check the state of the servo/toad before and after.

Change-Id: Ia4e0d32b062d58b4e906d3f006003fa6097add83
Reviewed-on: https://gerrit.chromium.org/gerrit/48031
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-16 08:37:51 -07:00
Vic Yang
0ffc382af9 Put timer_dos test behind console command
BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I843591089c3d1bc739c452ee654da194355ddb09
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48092
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-15 20:40:03 -07:00
Vic Yang
12df5c4923 Fix timer_calib test
BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I55057ee7727858b040ea23ed8802ab7022cc63ac
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48091
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-15 20:40:03 -07:00
Vic Yang
216bb93128 Fix flash tests
This merges flash_overwrite and flash_rw_erase to a single test binary.

BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I1da7577cb5dc196178930dda3a07bb942d959866
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48090
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-15 20:40:02 -07:00