Commit Graph

1556 Commits

Author SHA1 Message Date
Bill Richardson
7e6becbe90 Remove Link peripherals from Slippy board
Temp sensors, I2C devices, ADC inputs, and keyboard GPIOs are all different.
This removes the things we don't need, connecting some of the things we
will.

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

Doesn't break Link.

Change-Id: Ifb9775d921f6e9952497bffa98d405353ed4df71
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49964
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-05-02 18:10:46 -07:00
Bill Richardson
7f28454e47 Disable the charger task for Slippy bringup
BUG=chrome-os-partner:18825
BRANCH=slippy
TEST=manual

Change-Id: Idbcd297e3f77c02539dcb215bf8c60b1bcfb2d92
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49933
2013-05-02 18:10:46 -07:00
Bill Richardson
9d2b32aabf Add some ifdefs to distinguish between Link and Slippy
I'll still need to decide what to do differently for Slippy, but for now
let's just identify the places where there will likely be a difference.

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

Link still works.

Change-Id: I950f0e5356ccf9838f2140d853122235f884e34f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49931
2013-05-02 18:10:45 -07:00
Bill Richardson
a182372cbd Support power button on slippy, make it compile again.
BUG=chrome-os-partner:18825
BRANCH=slippy
TEST=none

Change-Id: If20ebaf8e718bc24d61a976026586445ccb6685e
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49914
2013-05-02 18:10:44 -07:00
Randall Spangler
3e76215df4 Fix I2C port configuration on pit
1) Port needs to be open-drain.  Missed this when porting from STM32F
because open-drain and alternate function are set in the same register
on STM32F and are different regs on STM32L.

2) Queue a stop condition if a transaction failed, so the clock goes
back high.

BUG=chrome-os-partner:18969
BRANCH=none
TEST=i2cscan finds both the PMU at 0x90 and the battery at 0x16

Change-Id: I708b925e4e30da9d5864b74641b1cbe90c9313fe
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49898
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-05-02 12:05:49 -07:00
Bill Richardson
001fb660bd Split the USB port power control into smart and dumb versions.
Also renaming to avoid confusion as to what's being charged.

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

Build everything, Link still works.

Change-Id: I4205a1210c7dfe57cfbbdd740970ef57e6a011b8
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49775
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-05-01 15:36:22 -07:00
Bill Richardson
869caf9b50 Disable i2c for mccroskey. It's busted, but we don't care.
BUG=none
BRANCH=none
TEST=manual

make BOARD=mccroskey

Change-Id: Ide8d84d262a658d5c7fd33dec73353bc6ec797da
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49771
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2013-05-01 14:31:10 -07:00
Vic Yang
8961ef44e4 spring: Implement battery cut-off command
BUG=chrome-os-partner:18818
TEST='ectool batterycutoff' on Spring.
BRANCH=spring

Change-Id: Idf315562930744ae1e7425d6e15915b0477c2343
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49651
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-01 13:19:35 -07:00
Randall Spangler
d886035b20 Re-enable charging task on pit
Now that I2C works, we can re-enable the charging task to debug
battery charging.

BUG=chrome-os-partner:18657
BRANCH=none
TEST=in EC log, should see battery state messages

Change-Id: I600d0152ba416c13420ce853b55206afba9f6cec
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49649
2013-05-01 13:19:28 -07:00
Vic Yang
7319480603 Rename REINIT to IDLE0 in TPS65090 charge state machine
The state REINIT in TPS65090 charge state machine is more like IDLE0
state in charge_state.h. Rename it so that it's less confusing and
easier to merge the two state machines in the future. Also move the
state name definition to the header file.

BUG=chrome-os-partner:18914
TEST=Boot Spring
BRANCH=None

Change-Id: I116438fedc46ff188dfb6a3964795715b5af4d1f
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49732
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-01 13:19:20 -07:00
Vic Yang
7de52688be Monitor video detachment with ADC watchdog
This eliminates a per-second hook and removes a duplicated ADC read per
second. Also, TSU6721 is now reset after every detachment. This way, we
don't suffer from TSU6721 dirty state (most commonly seen after OTG
dongle detached.)

BUG=chrome-os-partner:17928
TEST=1. Test plugging/unplugging video dongle.
     2. Test Toad cable mode switching.
     3. Test charging with 200K charger.
BRANCH=spring

Change-Id: Ic035b7332e07ca385d766c735ce39efd31e46034
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49578
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-30 22:53:15 -07:00
Vic Yang
23cb998205 stm32: Fix ADC watchdog bug and extend sample time
This fixes a bug in ADC watchdog that sample sequence is not set before
enabling ADC watchdog. Also, current sample time isn't long enough for
some weakly driven net. This extends ADC sample time to 13.5 cycles.

BUG=chrome-os-partner:17928
TEST=Test with Toad cable and video dongle on Spring
BRANCH=spring

Change-Id: Iecdfd4aada4e974225a41144e213e92897f4797b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49680
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-30 22:53:14 -07:00
Bill Richardson
e63aade5bd Split x86_power.c into Ivybridge and Haswell variants
The voltage rails, inputs, and sequencing is completely different. Easiest
to just handle it separately for each chipset.

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

Built Link, still works.

Change-Id: Ibf26ef47cdf2284b7bfb3a2e5ccfb6841aba5ac6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49559
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-30 19:03:03 -07:00
Vic Yang
24c8610c7f Put a copy of test binaries under build/${BOARD}
This puts a copy of test binaries at build/${BOARD}/test-*.bin. This way
it is easier for us to get all test binaries.

BUG=chrome-os-partner:19057
TEST='make tests' and check build/${BOARD}/test-*.bin
BRANCH=None

Change-Id: I8394cea6bee95f00fc01d725d2494ca5e222f47d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49608
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-30 16:59:45 -07:00
Randall Spangler
312b884c42 Split STM32 i2c implementation for STM32F vs STM32L
STM32L doesn't need the DMA-based workarounds needed by STM32F, since
the STM32L I2C block isn't broken.  DMA adds a lot of code overhead
when transferring 2-3 bytes, and is implemented differently on STM32F
vs STM32L so it doesn't even work on STM32L

Add a simple polled I2C implementation for STM32L.  This is not the
final implementation, which will use interrupts, but for now it works,
unlike the DMA-based version.

BUG=chrome-os-partner:18969
BRANCH=none
TEST=i2cscan on pit finds a device at 0x90

Change-Id: Ie2a6c9ac6f62b7fd3c35e313b4015e080d9f937a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49555
2013-04-30 14:49:07 -07:00
Vincent Palatin
980df54979 add option to de-activate EC console input when WP is on
With a Toad cable, the user can access the EC serial console through the
micro-B connector.
We probably need to de-activate the input on the EC serial console when
the Write-Protect is on, since we have fairly "powerful" commands on the
EC command-line.
Add a new CONFIG_CONSOLE_RESTRICTED_INPUT on platforms with externally
accessible EC serial port.

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

BRANCH=spring
BUG=chrome-os-partner:18716
TEST=on Spring with CONFIG_CONSOLE_RESTRICTED_INPUT set, try with and without
write-protect, use successfully the EC console in the former case, and see
"Console is DISABLED" in the latter case.

Change-Id: Ic9646d5468183f4d8f94b5e5e1d2a727941d7bbe
Reviewed-on: https://gerrit.chromium.org/gerrit/49537
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2013-04-30 11:45:58 -07:00
Randall Spangler
0a6b7620d6 Move i2cread and i2cwrite functions to i2c_common
Also moves the handy i2cscan command to i2c_common.  The
platform-dependent interface is now i2c_xfer().

Still more to do in follow-up CLs; for example, i2c_read_string() has
platform-dependent implementation, and the i2c/i2cread console
commands aren't common yet.

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

Change-Id: Ia53d57beaa157bece293a4262257e20b4107589e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49492
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
2013-04-30 11:45:52 -07:00
Vic Yang
c08e0ade76 Fix ADC test for LM4
LM4 doesn't have implementation of adc_read_all_channels(). Let's use
adc_read_channel() in this case.

BUG=chrome-os-partner:18598
TEST=Build stress test for link. See no error about
adc_read_all_channels() undefined.
BRANCH=None

Change-Id: I5b13384468667cbd17b83faab9f9d3fdc48de91d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49589
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-30 10:38:43 -07:00
Vic Yang
115ab924fc Handle battery charged alarm
When battery flags TERMINATE_CHARGE or OVER_CHARGED alarm, we should
treat them as a signal of battery fully charged.

BUG=chrome-os-partner:18914
TEST=On Spring:
       1. Plug in adapter when battery if full, see green LED.
       2. Plug in adapter when battery is not full, see yellow LED.
BRANCH=spring

Change-Id: Ica414a0e1667b8f30a0cc9a5d66dba1b119a59ba
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49456
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-29 23:31:29 -07:00
Vic Yang
76b3ba079e Add cscope.out to .gitignore
With this, git doesn't complain about uncommited change if one uses
cscope.

BUG=none
TEST='git status' and see no uncommited change.
BRANCH=none

Change-Id: I30bb78e4d0a7541444ef1aced683335933a5aa73
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49457
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-29 23:31:28 -07:00
Randall Spangler
00f2041d86 Clean up gaia_power debug messages
Should use CPRINTF("[%T...\n]") so the messages are timestamped; this
is really helpful to see when things are going wrong.

No functional changes; just changing debug output.

BUG=none
BRANCH=none
TEST=build pit and spring; see prettier debug output

Change-Id: I9c658385b836a184a3ebb84856b844cbfc3224a7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49551
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-04-29 17:50:28 -07:00
Randall Spangler
deb05123f8 Don't enable charger interrupt if charger task is disabled
This fixes pmu_init() failing on pit, where the charger task isn't
enabled yet (and thus the charger interrupt is NULL - which can't be
enabled).

BUG=chrome-os-partner:18657
BRANCH=none
TEST=build all platforms; on pit, check that pmu_init() no longer fails

Change-Id: I191bbaeb4df10241e3508ccf7ef5ea83f42c5697
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49550
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-04-29 17:50:27 -07:00
Bill Richardson
d9bddaa072 Improved the BUILD_ASSERT macro to work outside of functions.
This will let us check the size of static array initializers.

Also moved this macro definition and ARRAY_SIZE into a new "tricks.h"
header, so that userspace utils can use it too.

BUG=none
BRANCH=none
TEST=manual

Built everything, tested on Link. Tried various assertions.

Change-Id: I612891108ea37dbca3572e0f25ab54a7bc0ed860
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49417
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-29 11:05:08 -07:00
Randall Spangler
7cebaa0a01 Fix charging state descriptions
Two states were added, but the descriptions weren't.  This caused a crash.

BUG=chrome-os-partner:18914
TEST=boot spring with no battery, wait a few secs; shouldn't crash
BRANCH=spring

Change-Id: I10f9280232259a1f467ea3b02f3b1b61cee57471
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49391
2013-04-29 10:03:44 -07:00
Vic Yang
6d19c024a9 spring: Enable both VFET2 and VFET4 for video
We are moving video power from VFET2 to VFET4. To support old boards, we
need to enable both of them. When new boards are in place, we can then
drop VFET2.

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

Change-Id: If0cbc1ac49affc1e3c7ec9650a661f80be826f97
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49431
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-29 03:47:56 -07:00
Vic Yang
dff3b9f2c0 Make test-list a per-board parameter
Some tests are not applicable to all boards. This change makes test-list
a per-board parameter so a test can be enabled/disabled for individual
boards. Also disable all the tests that don't compile now.

BUG=chrome-os-partner:18598
TEST=make tests for all boards
BRANCH=None

Change-Id: Id2d18e23856f5c64dbdc7c6ca5949f8ad61b5cc0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49452
2013-04-29 03:47:50 -07:00
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