Commit Graph

646 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Randall Spangler
fcb1e1c819 Move power LED GPIO code from snow board.c into power_led.c
And remove the daisy power button LED task for now.  Since daisy
didn't have a board.c implementation (or a power button LED), its
power LED task did nothing.

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

Change-Id: I1eb3d0bd038d88685e7caad087eb1a1d1495ef9a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47442
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-04-08 10:00:35 -07:00
Randall Spangler
a3dcfd54ef Improve deferred function calls
1) Check vs. number of allowable deferred function calls is made at
link time.

2) Added a check for whether hook_call_deferred() has been made after
the start of calculating the time when the hook task should wake.  If
it has, go back and recalculate the wake time.  This works around a
race condition.

BUG=chrome-os-partner:18473
BRANCH=none
TEST=add a bunch of deferrable functions and recompile; generates a link error

Change-Id: Ie833e2a699c47b6702957ed67bf7d3925f2df099
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47266
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-04 16:32:27 -07:00
Randall Spangler
4d1aadaf60 Trigger dma_init() via HOOK_INIT
There's no need for it to be initalized in board_init(); it just needs
to be done before ADC / I2C / SPI initialize.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=boot spring; verify EC communication and 'adc' console command still work

Change-Id: I6039848fe031222d5ca59b459adfe18fc3e8ef08
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47182
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-04-03 11:49:07 -07:00
Randall Spangler
bdd16f8206 Split lid switch code out of switch.c to its own file
This will allow ARM code to use the same lid switch code (in a subsequent CL).

BUG=chrome-os-partner:18343
BRANCH=none
TEST=open lid; system boots. close lid; system suspends.  open lid; resumes.

Change-Id: I83536a3ad24c4446dccf8a6b6e296756659070a8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47043
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-02 14:12:57 -07:00
Randall Spangler
50c53c0d54 Move enabling AC_PRESENT interrupt to extpower_gpio.c
The interrupt handler moved a while ago, but the code to enable the
interrupt at init-time didn't.  Fix that.

BUG=chrome-os-partner:18256
BRANCH=none
TEST=boot system.  unplug AC.  replug AC.  UI charging indicator should update.

Change-Id: Ie16aa7f6eb9e871a6e3e8ecf6733ecbdc883be0b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47041
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-02 14:12:56 -07:00
Randall Spangler
97bf36c9d3 Add parse_bool() to centralize parsing boolean options
This way debug commands which previously took only yes/no or on/off or
enable/disable can take any of those options.

BUG=chrome-os-partner:18467
BRANCH=none
TEST=Try "on", "off", "yes", "no", "true", "false", "ena", "disable", for
each of the following commands:
  - ilim (spring)
  - pll (link)
  - power (spring/snow)
  - hcdebug (all)
  - kblog (link)
  - ksscan (all)
  - lp5562 (spring)

Change-Id: Ie8e0fae3775b1da711864bcba6682ba5e68a06f1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46900
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-29 15:39:34 -07:00
Randall Spangler
49b9c0faa9 Rename I8042CMD task to KEYPROTO
Since it's really the keyboard protocol task, not just handling i8042
commands.  For consistency across keyboard protocols.

No functional changes, just renaming.

BUG=chrome-os-partner:18360
BRANCH=none
TEST=boot link and type on keyboard

Change-Id: I800a691a344f82bf582693cae865414b7d5d382a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46885
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-29 15:39:32 -07:00
Randall Spangler
95a3a4107a Merge i8042.c into keyboard_8042.c
This is in preparation for cleaning up the 8042 protocol stack and
merging the typematic and i8042cmd tasks.

No functionality change, just shuffling code and renaming functions.

BUG=chrome-os-partner:18360
BRANCH=none
TEST=boot link and type on its keyboard

Change-Id: Iefc41cd5b8d18ac87830bff3080cfff92e9d10d2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46805
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-29 11:40:35 -07:00
Randall Spangler
c2b94fd184 Move files in preparation for merging keyboard_scan modules
This is part one of a series to merge the keyboard scan interface to
be common across all platforms.

This change just moves and renames files and APIs and removes some
read code, and sets up protocol-specific CONFIG options.  It makes the
next CL which actually merges keyboard scanning easier to parse.

BUG=chrome-os-partner:18360
BRANCH=none
TEST=compile all boards; test keyboard on spring and link

Change-Id: I815a40aae4e5d5f333b8501aff9656080533d913
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46549
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-27 11:35:20 -07:00
Randall Spangler
c5127abeee stm32: unimplemented hibernate hard-reboots instead of hanging
This more closely emulates what LM4 does if it hibernates and then
immediately wakes.  Keeps the system from becoming silently
unresponsive if a hibernate is triggered on STM32.

BUG=chrome-os-partner:18371
BRANCH=none
TEST=from ec console, 'hibernate' reboots instead of hanging

Change-Id: I031f79239725d69ba054323e4fbf8f59133f2093
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46286
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-03-25 11:45:19 -07:00
Randall Spangler
10ac310605 Move keyboard dimension and key constants to keyboard_config.h
These were previously duplicated between multiple keyboard_scan.c and
board.c files, and there were a bunch of different constants #defined
to be 13.

BUG=chrome-os-partner:18360
BRANCH=none
TEST=compile all boards; test keyboard on spring and link

Change-Id: I91bf9d56d2a56ff25ff307ff10883ca87b6937e5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46165
2013-03-22 11:24:29 -07:00
Randall Spangler
743c05f01f Add keyboard_raw interface
This is the low-level platform-dependent interface to drive keyboard
columns, read rows, and handle keyboard interrupts.

Both lm4 and stm32 had something like this before, but the interfaces
weren't fully explicit or compatible.

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

- Build all platforms.
- Boot system and test typing on keyboard.
- Hold power+refresh+esc to test boot key detection; should go to recovery.

Change-Id: Ie3bcc1d066a4da5204f0e236daeb52c4064a6213
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46156
2013-03-22 11:24:28 -07:00
Randall Spangler
447b05b828 Move asserting host keyboard interrupt signal to keyboard_scan
The implementation is identical on all stm32 hardware, so remove all
the duplicate copies from board.c files.  mccrosskey doesn't have
GPIO_EC_INT so stub it out like we do on bds.

No functional change, just moving code.

BUG=none
BRANCH=none
TEST=build mccrosskey,daisy,snow,spring

Change-Id: I7d4378650d7b4c640c15180c41459a41620f5bd3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45920
2013-03-20 17:42:04 -07:00
Randall Spangler
78b0e9863d Use chipset_reset() interface instead of system_warm_reboot()
We have a common chipset interface for performing a warm reset of the
AP, so move the implementation from system_warm_reboot() there.  (It
was never a system function anyway; system = EC+AP; chipset = AP)

No functional change; just renaming functions.

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

Change-Id: Ibc2c5efced5660c4335cd1868470184397800acd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45891
2013-03-20 15:23:29 -07:00
Randall Spangler
34e17d4c05 Move I2C arbitration to its own file
It's only board-specific in that we've only needed it on snow so far.
But by that logic, x86_power would be board specific because we've
only needed it on link.

No functionality change, just moving code between files and renaming
the interface to indicate it's not board-specific.

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

Change-Id: I35debdaa71829d55a2fbc5d3c62b2aaf6e467633
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45879
2013-03-20 15:23:29 -07:00
Vic Yang
19920f1f74 spring: reset TSU6721 when Toad's ID changes
When Toad's ID changes, VBUS goes low for 10ms. This, however, is not
picked up by TSU6721 and thus we need to monitor VBUS and reset TSU6721
when necessary. By resetting TSU6721, we can force it to update device
type.

BUG=chrome-os-partner:18292
TEST=manual
BRANCH=spring

Change-Id: Ib96bbb0f101c8c5f5371591603af2dee27f01cc8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45727
2013-03-20 01:02:09 -07:00
Randall Spangler
24f0d888dd Use common declaration of keyboard_scan_interrupt()
Code cleanup: declare keyboard_scan_interrupt() once, not per board;
the implementation is common anyway.

No functional changes; just renaming.

BUG=none
BRANCH=none
TEST=build daisy,snow,spring,mccrosskey

Change-Id: I1e33cbe2c868bc47b641d36d26f07c3b5a7ba3c7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45874
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-19 14:59:32 -07:00
ChromeOS Developer
6c285c0994 Move external power detect for link to its own file
Now that it doesn't need to leverage SWITCH_TASK to send the AC_CHANGE
notification, pure GPIO-based external power detection can move from
switch.c to its own file.

BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away

Change-Id: Id495f34185b7d971c241ac6d0a8311a6bf544507
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45789
2013-03-19 10:31:12 -07:00
David Hendricks
94f4bb38a0 Initial McCroskey support
This adds a board target for McCroskey. It is loosely based on
Snow.

The clock will be set up differently and the keyboard GPIOs are
not the same, so some stm32 code needed to be updated.

BUG=none
BRANCH=none
TEST=tested on McCroskey (we get to the serial console)
Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I5e11a3257fed1797f4cc4dcccf3530585b78da82
Reviewed-on: https://gerrit.chromium.org/gerrit/43414
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
2013-03-13 16:05:39 -07:00
David Hendricks
2f229ea226 stm32: make read_raw_input_state() more portable
This re-factors read_raw_input_state() to use GPIO port and mask
values from the board's gpio_list array. This eliminates the reliance
on hard-coded bit mask values and ports, thus making the code
adaptable for future designs.

As a slight optimization, the GPIO input data register is re-read
only if the port changes from the previous iteration. Thus, it's best
if the GPIOs are listed such that changes to the port address are
minimized.

BUG=none
BRANCH=none
TEST=Tested on Snow by running finger across keys.

Change-Id: I4a79363f060f37690bfebfd6763f7bfe6cb7991a
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44993
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-13 14:14:02 -07:00
David Hendricks
e1c1756808 stm32: remove unused kbc_gpio struct
This removes a struct which is unused.

BUG=none
BRANCH=none
TEST=locally compiled

Change-Id: I664714d371aac9829c984b5a5ed591745ef78eb1
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44983
2013-03-13 13:04:15 -07:00
David Hendricks
7c9f26b582 stm32: add some documentation to keyboard_scan.c
This adds some documentation explaining the method to the madness
involving the board's gpio_list array.

BUG=none
BRANCH=none
TEST=it's just comments.

Change-Id: I30731555bbc358b0bebd75f906cbbb3116206146
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44994
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-13 12:41:12 -07:00
David Hendricks
cdfbe88e92 stm32: list keyboard output ports on a per-board basis
This CL moves the keyboard port listing to board.h for each mainboard
to reduce board-specific clutter in keyboard_scan.c. Since the info
is now exposed outside of keyboard_scan.c, a more descriptive name was
chosen.

Note: GPIO_D does not need to be included in this list for any current
platform.

BUG=none
BRANCH=none
Test=tested on Snow by pressing all number and letter keys

Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I1ce924a41cafae557467997ecba9c5abeed86211
Reviewed-on: https://gerrit.chromium.org/gerrit/45284
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
2013-03-13 12:12:01 -07:00
Vic Yang
2823e7e132 stm32f: Add support for ADC watchdog
This makes it possible to have ADC module monitor an input voltage and
trigger interrupt when it goes out of accepted range.

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

Change-Id: Ia0c981fadd9bcaa40afe30ca2624c2f3644b95fe
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45277
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-13 12:11:59 -07:00
Todd Broch
eefc0ac8c5 spring: stm32: Generate battery key when charging status changes.
In order to update charger status we have added a virtual keystroke to
signal change to the kernel via the MKBP interface.

CL creates the virtual key press and calls it from within the
USB charging code.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BUG=chrome-os-partner:17927
BRANCH=spring
TEST=manual

1. Compile for daisy,snow,spring.
2. Test on spring.

Change-Id: I0afa0fc82c96fa3fd8119523a113b5028c8f64a3
Reviewed-on: https://gerrit.chromium.org/gerrit/45126
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2013-03-13 11:14:55 -07:00
David Hendricks
f5f30a22c6 stm32: Move KB_INPUTS to board.h
This moves KB_INPUTS from keyboard_scan.c to board.h where KB_OUTPUTS
is #defined. Although we use the same 13x8 keyboard matrix on all
platforms, KB_OUTPUTS is defined on a per-board basis due to its usage
in keyboard_test.

BUG=none
BRANCH=none
TEST=locally compiled

Change-Id: I0d66705d2959c7824b96cc8aae55368eca39a21a
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44970
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-11 22:08:56 -07:00
David Hendricks
0631409955 stm32: finish cleaning up row/column/input/output naming
This is a purely cosmetic change that removes any remaining
references of rows/columns in favor of inputs/outputs since the
former is inconsistent across platforms.

Higher-level code (such as MKBP) may still refer to logical rows
and columns, but low-level GPIO handling code will refer to GPIOs
by their input/output function.

BUG=none
BRANCH=none
TEST=Tested on Snow (ran finger across all numbers and letters)

Change-Id: Idb8b76e8d013568505d826c3a54a1ed8ce143d12
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44982
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-11 22:08:55 -07:00
David Hendricks
d4ca1d9c00 stm32: Dynamically generate keyboard IRQ mask
This replaces the hard-coded IRQ mask which has so far worked on
Chrome platforms with a variable that gets set in the initialization
part of keyboard_scan_task(). A simple loop is used to OR the GPIO
mask for each keyboard input provided by the board's gpio_list array.

This will make it easier to adapt the code to future targets with
different pin mappings.

BUG=none
BRANCH=none
TEST=Tested on Snow

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: I848ab3c7e8d276dbb807a97c6b26c5b3c05af166
Reviewed-on: https://gerrit.chromium.org/gerrit/44952
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-08 13:27:22 -08:00
David Hendricks
ea000b0fc0 stm32f10x: Initial import
This adds initial support for the other chips in the stm32f10x
series: stm32f101, stm32f102x, stm32f103x, stm32f105x, stm32f107x.

The main difference is in the register definitions. Clock, flash,
GPIO, and JTAG modules are similar enough that for now we can symlink
the existing source for stm32f100.

BRANCH=none
BUG=none
TEST=Tested on McCroskey (follow-up CL)
Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I67363d02578e21be51d842b6bd8b5e4848720993
Reviewed-on: https://gerrit.chromium.org/gerrit/43412
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
2013-03-08 12:01:46 -08:00
Randall Spangler
70cdf52ea1 Wait to power on system until battery state is known
This prevents the system from waking from hibernate at very low
battery, then powering on the AP to do software sync only to find that
the charge state machine shuts down the AP before software sync can
complete.

BUG=chrome-os-partner:17124
BRANCH=link
TEST=manual

On both AC and mostly-charged battery:
- With lid open, reboot EC -> on
- With lid open, reboot EC with power held down -> on
- With lid closed, reboot EC -> system boots and does EC software sync
- With system on -> battfake 2 shuts system down
  (and at that point, opening lid or pressing power does nothing)

With a hacked charge_state.c so fake_state_of_charge starts at 2:
- With lid open or closed, reboot EC -> off
- Opening lid does not turn on system
- Pressing power button does not turn on system
- Plug power back in and press power -> system turns on

Change-Id: Ie1f2933060fac87b1afe68718f374d51cb8994de
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44313
2013-03-05 10:26:20 -08:00
Vic Yang
f84a5fa8b1 stm32: Lengthen ADC sample time
Current sample time 1.75us seems too short and some nets with weaker
driver don't convert correctly. Let's lengthen it to 8.75us.

BUG=chrome-os-partner:14319
TEST=See correct voltage level.
BRANCH=none

Change-Id: Ib65a07474787504e5f72522167bafad8bb5730bc
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42845
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-06 23:17:15 -08:00
Vincent Palatin
231319c08c stm32: implement SMBUS-style read block/string
Add support in the I2C driver for SMBUS-style read block operations.
As defined by the SMBUS standard, a "read block" returns at most 32
bytes of data plus the size of response as the first byte.

It's used to read smart battery strings such as manufacturer or model.

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

BRANCH=none
BUG=chrome-os-partner:14314
TEST=On Spring, read the battery manufacturer and model from a kernel
patched for the smart-battery passthrough.

Change-Id: I069ce7f64414817e94516e913643d3847a29d176
Reviewed-on: https://gerrit.chromium.org/gerrit/42647
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-05 20:16:22 -08:00
Dave Parker
3182778dbb Add 'unprotect' flag for flashing link ec.
BRANCH=link
BUG=chromium-os:37967
TEST=Remove write protect, reflash without 'unprotect', flag
     and verify the write protect flag is stil enabled with
     flashrom -p internal:bus=lpc --wp-status. Power down,
     then reflash with the --unprotect flag. Now verify the
     write protect status flag is disabled.

Change-Id: Ie05b5dc85dd31d29ab43a392fe948a52d547fff3
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41477
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-01-17 13:44:24 -08:00
Randall Spangler
7326b7475a Tidy ACPI debug output
The host does a lot of ACPI keyboard backlight writes, which were
scrolling the debug console output.  Change to using CR instead of LF,
so it's not so distracting.

(No code changes other than debug output)

BUG=none
BRANCH=none

TEST=Move laptop through different ambient light settings and look at
console output as keyboard backlight ramps up and down.  The 'ACPI
kblight' messages shouldn't cause piles of scrolling.

Change-Id: Iafde57ffe6090830fa54d4920c48b198c36d8d85
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39914
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-18 18:18:19 -08:00