Commit Graph

1503 Commits

Author SHA1 Message Date
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
Randall Spangler
108235225d Refactor gpio_set_level() and gpio_pre_init()
gpio_set_level() now allows setting the pin level if GPIO_LOW or
GPIO_HIGH is specified.  Previously, stm32 platforms did this even
though the definition of gpio_set_level() said it wouldn't work.

Fixed gpio_set_level() not setting level after warm reboot on stm32
because it was checking the GPIO_DEFAULT flag in the wrong place.

Fixed LM4 still mucking with alternate function settings and levels
even if GPIO_DEFAULT was specified.

And checked gpio_list[] and all of the calls to gpio_set_flags() to
make sure everything still behaves the same way it did before (or
better, in the case of actual bugs).

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

Change-Id: I4b84815f76060252df235ff9a37da52c54a8eac5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48058
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-15 14:27:45 -07:00
Vic Yang
27459f8600 Fix test compilation error for link
Now pingpong and mutex tests compile. Still need some more work to
handle the i8042-specific KEYPROTO task for keyboard tests.

BUG=chrome-os-partner:18598
TEST=Build tests for link
BRANCH=None

Change-Id: I9ee35d4edb811f17b9a81beb799484a07c0bef14
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47981
2013-04-13 03:12:21 -07:00
Vic Yang
2b3c02bf9f Add debounce test to kb_deghost and change name to kb_scan
To minimize the number of test binaries, we should put as many tests in
a single binary as possible. This CL merges kb_debouncing and
kb_deghosting and renames them to kb_scan.

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

Change-Id: I876363ba68c692a7af10badfa474a2ea9a9d002c
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47980
2013-04-13 03:12:21 -07:00
Vic Yang
25fb06ce51 Remove unused mock setting for kb_deghost test
Those mock files were used by QEMU-based test. Now that we moved to
hardware test, we can remove them.

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

Change-Id: I1600b39132c598a07d3d6439fd837c0d78ea8820
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47968
2013-04-13 02:20:10 -07:00
Vic Yang
1cc01fdcbc Add a test for testing common utilities
BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: Ie10f81783a0c22a10b9535350dc29b972bffd87e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47962
2013-04-13 02:20:09 -07:00
Randall Spangler
6f2ec76a25 Remove unused GPIO macros
All accesses use the _OFF variants.  No need to have 2 ways of doing
the same thing.

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

Change-Id: I914e6dd9027bcf2268e33ae2e8cfb41093b0b05d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48032
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-12 23:58:02 -07:00
Randall Spangler
5531029744 Clean up alternate functions on STM32L
The MODER register is used to set (alt-func | analog | gpio-in |
gpio-out).  So there's no need to force things to be normal GPIOs in
board config, since gpio_pre_init() will clear the alternate
function-ness as part of setting the GPIO direction.

BUG=chrome-os-partner:18657
BRANCH=none
TEST=build pit and test-boot on daisy

Change-Id: I82db9d9f4d8877464d62c1ff2efaef36822fc0ca
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47904
2013-04-12 14:13:53 -07:00
Randall Spangler
ff1c7d68ce Daisy doesn't use STM32F100
So there's no need to check for BOARD_daisy there

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

Change-Id: I518e4a091d279fc6b23d1c9448362c3b315a6905
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47894
2013-04-12 09:24:19 -07:00
Randall Spangler
79c6132a6e Allow GPIO alternate function 0
gpio_set_alternate_function() used 0 to mean "normal GPIO function".
But on chips like STM32L, alternate function 0 is actually a function
on some pins.  So change "normal GPIO function" to -1.

Also add support for this on STM32L.

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

Change-Id: I9cdd9ad91a315b616e373a0dc9a50545cf9d20fa
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47903
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-11 15:38:09 -07:00
Randall Spangler
b9d0d9c60b Move gpio_get_name() to gpio_common.c
Its implementation is the same on all platforms.

No functional changes, just renaming/moving.

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

Change-Id: I78741c6587ea61e7ac8edae5a509502b7ab5078b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47898
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-11 15:38:08 -07:00
Randall Spangler
08f8c6857f Strip out old LPC command protocol
Nothing has used this since link EVT, so it's just dead code at this point.

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

- Update ectool but leave old firmware
- ectool version -> works
- ectool flashread 0 0x10000 foo -> puts the first 64KB of EC flash into foo

- Update firmware
- ectool version -> works
- ectool flashread 0 0x10000 foo -> puts the first 64KB of EC flash into foo
- power+esc+refresh -> recovery mode

Change-Id: Ib25a705bcd8280d5295c8e7890969d796542b6c9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47866
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-11 11:29:38 -07:00
Vic Yang
4adcb45f2c Fix kb_deghost test
BUG=chrome-os-partner:18598
TEST=Run test on Spring
BRANCH=none

Change-Id: Ia95ba6144dbdac0ffe77f6aef9c4ed948de181d8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47841
2013-04-11 11:29:32 -07:00
Vic Yang
5018f1d9d6 Fix mutex test
Puts test behind a console command and also fix uart_printf calls. Also
reduces stack size to fit tasks into STM32 memory.

BUG=chrome-os-partner:18598
TEST=Run mutex test on Spring.
BRANCH=none

Change-Id: Icac77876ae01fc98b4e38f27e07f788b6c9bdd70
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47834
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-11 11:29:32 -07:00
Vic Yang
f1eddf778a Exclude chipset task from test binaries
For most tests, we don't need to power the AP. Let's exclude chipset
task to save memory space.

BUG=chrome-os-partner:18598
TEST=Run pingpong test on Spring
BRANCH=none

Change-Id: I545c5b3e1c27b0067d4ffe09a7971d32b75d6039
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47833
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-11 11:29:32 -07:00
Vic Yang
e3ca6d7d09 Fix pingpong test
This fixes outdated uart_printf calls and also put the test behind a
console command 'runtest'. The console command returns 'Pass' or 'Fail'.

BUG=chrome-os-partner:18598
TEST=Run pingpong test on Spring
BRANCH=none

Change-Id: Ia2c439685447e42b278556ca66c9f080d4cafe11
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47831
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-11 11:29:31 -07:00
Randall Spangler
e5f4032866 Clean up USB external power module
Make internal APIs static, and remove board_ prefix for clarity.

Move TSU6721 calls from charger task to extpower_usb functions for
better encapsulation.

No functional changes, just moving code.  Yes, this will make
cherry-picking back from spring to TOT less convenient, but now the
code is more readable and it will make maintaining the PMU code easier
as we add boards.

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

Change-Id: I52b37e57fc8519859996a110b0503277c6f0bbc8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47657
2013-04-10 14:24:10 -07:00
Randall Spangler
a1c99c7228 Remove unneeded USB_CHARGE_PORT_COUNT
This only needs to be defined if CONFIG_USB_CHARGE is defined (that
is, if the board has a USB charge controller.

(Note the difference between providing power over USB vs. receiving
power over USB; the names are confusing and I'll rename one of the two
imminently.)

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

Change-Id: I7355b4248bb2d4f5f71cc9f8d9d8f9d6c0069f2b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47658
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-10 11:19:39 -07:00
Randall Spangler
a649f52d5f Move REG16 and REG32 macros to common.h
And use them for LM4 as well as STM32.  Consistency is good.

No functional changes, just moving/renaming code.

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

Change-Id: I029a21fadb50726500255219dc38615874a369e7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47700
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-10 11:19:38 -07:00
Vic Yang
d6ce2852ae Fix tasklist for tests
This removes all tasks defined in board tasklist and changes syntax to
CONFIG_TEST_TASK_LIST and TASK_TEST.

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

Change-Id: Ie56c8edcb1dbf0ba0d0426ffce2a525594602a91
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47738
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-10 09:35:06 -07:00
Vic Yang
9aa3716ca0 Turn on/off 3.3V output properly
When the system is turned off and then back on, we need to re-enable
3.3V output from TPS65090. Also, when we see 5V input, we should shut
down 3.3V output and re-enable it when 5V input goes away.

BUG=chrome-os-partner:18186, chrome-os-partner:18482
TEST=Manual
BRANCH=spring

Change-Id: I0cf0597a60988cc9ec28282eea54908c81e5eabc
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47736
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-10 09:35:05 -07:00
Vic Yang
8a06eb1d35 Only includes necessary tasks for test binaries
This changes current TASK() syntax to TASK_BASE() and TASK_NORMAL(),
where TASK_BASE is necessary for the EC to boot on a board and
TASK_NORMAL represents the task that can be removed in a test binary.

Tasks introduced by a test should be listed as TASK_TEST().

Note that this CL breaks current tests (many of them are broken anyway),
which will be fixed in up coming CLs.

BUG=chrome-os-partner:18598
TEST=Build link/bds/spring/snow/daisy/mccroskey. (mccroskey failed for
unrelated issue)
BRANCH=none

Change-Id: Ic645cdae0906ed21dc473553f1f43c2537ec4bb9
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47531
2013-04-10 01:08:45 -07:00
Vic Yang
64ae15f3b3 Decouple gaia_power from keyscan task
This makes gaia_power.c compile when keyscan task is not present.

BUG=chrome-os-partner:18598
TEST=Build spring without keyscan task.
BRANCH=none

Change-Id: I70823fb562a2542d92929b9219d034216f636938
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47630
2013-04-10 01:08:43 -07:00
Randall Spangler
861d7d667d Rename usb_charging.c to extpower_usb.c and move to common/
This more clearly indicates what it does - it manages external power
supplied by USB.  This code will be common to multiple boards which
take power via USB, so it might as well move now.

No code changes, just moving the file.

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

Change-Id: Iae74122db38666bc346104a5096fa82df8cb0c19
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47656
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-09 14:47:28 -07:00
Randall Spangler
95250857ad Fix mccroskey build
There's no chipset for mccroskey, so its keyboard code stopped compiling.

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

Change-Id: If94dfaf2819f047a6aa825ee10aa1d320c8ca882
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47566
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-09 10:13:10 -07:00
Randall Spangler
3e9d365e2c Add pit board
GPIO mapping is correct for current schematics.

Things to fix are #ifdef'd out with PORT_TO_PIT, but those require
changing other files (which is most tidily done in separate CLs).

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

Change-Id: Id1d1bb0c2925cfc0c21ee2d91666028aa6d2a707
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47599
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-04-09 10:13:10 -07:00
Vic Yang
54ea657965 Decouple keyboard MKBP code from key scan code
When unit testing, we may need to disable key scan task but leave
keyboard protocol code for testing.

Also fix a bug in determining if ENABLE flag is set.

BUG=chrome-os-partner:18598
TEST=Remove KEYSCAN task and build for spring.
BRANCH=none

Change-Id: I3b3adf1257e8446fd1f57bce50b4c7a029b1ce3b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47539
2013-04-08 21:03:47 -07:00
Randall Spangler
6878c3da71 Clean up daisy GPIO and SPI init
Much of the board init duplicated stuff already done in gpio init, so remove it.

Powering the SPI module should be done in spi.c, not board.c.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; boot EC on daisy

Change-Id: I9a99eeeb971ebbf7de5b9c0548153684fbb7fff6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47469
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-08 10:31:43 -07:00