Commit Graph

229 Commits

Author SHA1 Message Date
Randall Spangler
3a460ea765 Disable fan PWM when +5VS is disabled
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8097
TEST=manual

faninfo
  should report fan is disabled
powerbtn
  system turns on, fan turns on
faninfo
  should report fan is enabled
powerbtn
  system turns off, fan turns off
faninfo
  should report fan is disabled again

Change-Id: I8e94c142bf18d07f83bac05287bcd503a098cee7
2012-02-27 11:09:32 -08:00
Randall Spangler
4f3f3fdf3d Merge "Only deassert RCINn in S0" 2012-02-27 11:06:42 -08:00
Gerrit
3f58f4aa66 Merge "stm32l: update GAIA power sequencing timings" 2012-02-26 20:40:40 -08:00
Gerrit
fc6fb08b56 Merge "stm32l: fix ACOK signal" 2012-02-26 20:40:40 -08:00
Randall Spangler
1d1a38a6cc Only deassert RCINn in S0
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8231
TEST=manual:

gpioget PCH_RCINn --> should return 0
powerbtn --> should turn system on
gpioget PCH_RCINn --> should return 1

Change-Id: I8e58e2b6a48c811d5e57549bdcaea27bca964c08
2012-02-24 18:02:20 -08:00
Vic Yang
675cddb258 Write temperature values to LPC mapped value space.
Add a task to update temperature values in LPC mapped value space every
second. Also modify ectool to read directly from LPC mapped space.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8065
TEST="ectool temps" gives same result as "temps" from ec console.

Change-Id: Idcdef8d822724f9bd22d7e819c717cba5af5eb77
2012-02-24 13:09:44 -08:00
Vincent Palatin
5a2649acf9 stm32l: update GAIA power sequencing timings
Update the timeouts during the power on sequence as recommended by
Frank.

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

BUG=None
TEST=run EC firmware on ADV board and let Frank control he likes the
signals.

Change-Id: I7391a1cdd5ad74e0c22e15eb996955c5b7719154
2012-02-24 11:07:02 -08:00
Vincent Palatin
64e6afdefa stm32l: fix ACOK signal
The PMIC_ACOK signal is active-low.
Let's drive it correctly.

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

BUG=None
TEST=On ADV board, check that a short key press on the power button is
now able to start the board

Change-Id: Iea71939aeb532618019a9e7774721703c632976f
2012-02-23 13:28:46 -08:00
Vic Yang
c977d241b3 Use mutex to arbitrate I2C buses.
We now have a task contantly polling temperature sensors, so we need to
use mutex to arbitrate I2C buses.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7491
TEST=temps, i2cscan, and i2cread all work fine.

Change-Id: I1360afb22d98b47da3da0820c95df45c15056f82
2012-02-22 11:17:39 -08:00
Gerrit
3cd360ad38 Merge "stm32l: add keyboard configuration for ADV and Daisy boards" 2012-02-22 08:17:13 -08:00
Gerrit
028df3ba51 Merge "stm32l: add a simple shutdown sequence for GAIA SoC." 2012-02-22 08:17:13 -08:00
Randall Spangler
12b12e5334 Add EC host commands for keyboard backlight
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8128
TEST='ectool setkblight X && ectool getkblight' for X=1, 20, 99, 100, 0

Change-Id: I540fd2d05f4caa110cd1dc45e9b5184fc8777a06
2012-02-21 12:59:44 -08:00
Gerrit
63c9ebaac9 Merge "Set VDD3ON flag when hibernating" 2012-02-21 11:46:12 -08:00
Randall Spangler
1d50137e31 Set VDD3ON flag when hibernating
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8125
TEST='hibernate 1000' should hibernate and wake back up

Change-Id: I3bf36171ea86a90415593bdc884c004bfff62c4c
2012-02-21 11:03:26 -08:00
Vincent Palatin
c651715a2c stm32l: add keyboard configuration for ADV and Daisy boards
Set the keyboard GPIO interrupts and task for the Daisy and ADV boards.

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

BUG=None
TEST=make BOARD=adv && make BOARD=daisy
run EC firmware on ADV board.

Change-Id: I01c7f0112b7ab3382e04ad032a86fb0f3878b02b
2012-02-21 18:18:15 +00:00
Vincent Palatin
bd331737b4 stm32l: add a simple shutdown sequence for GAIA SoC.
Either a 8-second press on the power button or the XPSHOLD signal going
down (triggered the AP/PMIC shutdown sequence) will trigger a shutdown
of the system and switch off all power rails.

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

BUG=None
TEST=on Discovery, test manually various power key press duration and
see power on/power off traces.

Change-Id: Ic37e4a51fe6b131034e24c55f05dae8119ce9992
2012-02-21 17:54:08 +00:00
Vincent Palatin
66db728f60 use RTCK on Servo v2 JTAG
The FT4232 chip used on Servo v2 has adaptative clocking feature.
Let's try to use it to avoid signal integrity issue we observe on
Proto-0.5 JTAG.

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

BUG=None
TEST=connect to Link proto-0 and read/write all the SRAM without errors.

Change-Id: Ic2b91acc29c6d510fb6f3364dd253d3deb650949
2012-02-20 09:24:27 -08:00
Gerrit
ed9a5a5573 Merge "Add keyboard_scan for STM32" 2012-02-18 09:26:44 -08:00
Vic Yang
0fefd25c0c Temperature polling and temporal correction
A temperature polling task is added to achieve temporal correction and
also reduce the latency of reading temperature.

Factor out sensor specific part to keep code clean.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7801
TEST=On link, 'temps' shows all temperature readings.
Cover each sensor with hand and see object temperature rise.
Compilation succeeded on bds/adv/daisy/discovery.

Change-Id: I3c44c8b2e3ab2aa9ce640d3fc25e7fba56534b86
2012-02-18 13:37:53 +08:00
David Hendricks
a3d621f1b2 Add keyboard_scan for STM32
This loosely ports the LM4 keyboard_scan code to STM32

Notable differences:
- Keyboard GPIO layout is spread across multiple ports and is not
  contiguous in many places. Because of this, bitmasks are mostly
  generated on-the-fly instead of hard coded (IO is kept to a minimum)

- Longer timeout when scanning columns (100us versus 20us)

Also, some functions are stubbed out currently since they rely on
other bits being implemented:
- keyboard_state_changed()
- keyboard_has_char()
- keyboard_put_char()

BUG=none
TEST=Tested on STM32L-Discovery (monitoring keystrokes via UART)

Change-Id: I84985879589e70688b2b29b288ab17037f7668b2
2012-02-17 20:30:07 -08:00
Bill Richardson
737fbbd032 Delay enabling UART1 until after LPC bus is enabled.
BUG=none
TEST=manual

Try it on a bds with no LPC bus. It gets a BusFault without this patch.

Change-Id: If3f38df5f7bebaf4c7045a9f48fbe3ac66e8bdbf
2012-02-17 15:55:32 -08:00
Gerrit
ad7a0d5ae6 Merge "Add fixed-point temp calculation as backup option." 2012-02-16 16:46:12 -08:00
Gerrit
10c3954951 Merge "USB charging control LPC command." 2012-02-16 15:58:06 -08:00
Vic Yang
284c2dbb89 Add fixed-point temp calculation as backup option.
We prefer to use floating-point version but we might need fixed-point
version in the future if we don't have FPU support. If CONFIG_FPU flag
is not set, fixed-point object temperature calculation would be used.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7801
TEST=none

Change-Id: I69364b10bedf1351206e52266d669b4c566bd6f6
2012-02-16 15:37:44 -08:00
Vic Yang
e75a32d2e3 Temporarily remove image RW.B due to code size.
To accomodate our growing code, image RW.B is removed so that RO and
RW.A can both have 60K space. This is just a temporary solution. Add
RW.B back when we have enough space for all three images.

Also add license header to firmware_image.lds.S so that repo does not
complain about it.

BUG=chrome-os-partner:8079
TEST=build image and run on proto-0.

Change-Id: I85b723f3e645c12fd89b189263ca44d58c4621eb
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 14:06:55 -08:00
Vic Yang
6a60a7fbdc USB charging control LPC command.
Add a LPC command to control USB charging mode. Also add the command to
ectool.

BUG=chrome-os-partner:7476
TEST=Manually test on link proto-0.

Change-Id: Ica87d0a690bc86e28844bd695f31641398b21939
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 12:45:51 -08:00
Vincent Palatin
b221c77b62 stm32l: add support for ADV board
Compared to Daisy, it has the EC console on USART2 (pins PA2 and PA3)
and regulator enable GPIOS EN_PP1350 and EN_PP5000 are on PA9/PA10.

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

BUG=None
TEST=make BOARD=adv && make BOARD=daisy && make BOARD=discovery

Change-Id: I545f7c9b05480e58db913ea562c77a1a1cd2b11c
2012-02-16 02:52:29 +00:00
Vincent Palatin
8a37e9a0d8 stm32l: de-duplicate stubs used for all STM32L based boards
Avoid duplicating in each board file, the stub functions replacing not
implemented drivers on the STM32L platform.

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

BUG=None
TEST=make BOARD=daisy && make BOARD=discovery

Change-Id: I25cd949c31e53a90c39f623617c7d52517a3d205
2012-02-16 02:52:29 +00:00
Vincent Palatin
c9cb9bd6f3 stm32l: implement gpio_set_alternate_function
Allow to set easily the SoC pins to one of their native functions.

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

BUG=None
TEST=on Discovery board, check the muxing of the USART pins is still
working and we get traces.

Change-Id: I6e83d2eea8986d814720ad4b2fef588908b99079
2012-02-16 02:52:29 +00:00
Vincent Palatin
4778d823be stm32l: add a simple power sequencing for Daisy board
This should be enough to switch on the board from either the power
button or the EC console.

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

BUG=None
TEST=run Daisy firmware on Discovery board with logic analyzer attached
to GPIO pins. With an added task to simulate PMIC startup and AP
startup, check the timing chart looks good.

Change-Id: I5dfeab05d0481d121ddacb36b69a542cc1bd428c
2012-02-16 02:52:29 +00:00
David Hendricks
05f0eb3005 Make i8042 independent of host <--> KBC bus.
This CL attempts to abstract underlying bus from i8042 code. Nearly
all i8042 logic is isolated already. This patch is intended to allow
us to use i8042 logic for processing keys and commands on boards which
do not necessarily use LPC as the host <--> KBC bus interface.

This CL does the following:
- Define KBC bus <--> host (kbc_host_bus) on a per-board basis in
  board.c.

- Add generic wrappers in place of lpc_keyboard_* in i8042 code.

- Define the behavior of generic wrappers in EC-specific keyboard
  sources. If board.c specifies LPC, then send via LPC.

TODO: This needs to be tested on real hardware...

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

BUG=None
TEST=Locally compiled for Link, BDS and Discovery.

Change-Id: I9cabd514bd44fd6b508c26994eccc3011eedbc0f
2012-02-15 18:20:28 -08:00
Gerrit
30fc5d7284 Merge "Change TMP006 temperature calculation to use FP." 2012-02-15 17:29:01 -08:00
Vincent Palatin
dd3a4a4b7d build private files if present
If we have a private/ directory, check the build.mk there and build the
content, else safely ignore that part of the build.

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

BUG=None
TEST="make BOARD=link" with and without a private directory containing
some code with new console commands. Run the firmware and check if the console
commands are actually present.

Change-Id: I690ed97be24d029628e4acf508299dcbab657100
2012-02-16 00:53:22 +00:00
Vic Yang
93d77ada6c Change TMP006 temperature calculation to use FP.
The temperature calculation currently uses fixed point operations.
Change it to use floating point for better readability and maintenance.
Also changes disable_fpu() to accept parameter which serves as
optimization barrier to prevent floating point operations after
disabling FPU.

BUG=chrome-os-partner:7801
TEST=In console, tempremote "tempremote 29715 -105000 6390" gives 28506.

Change-Id: Ib766904b8feb9a78eac9f7cd53afeca85091c5a5
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-15 16:34:54 -08:00
Gerrit
9e50c75cdb Merge "stm32l: add external interrupt support for GPIOs" 2012-02-15 16:06:36 -08:00
Gerrit
274cbf3cc0 Merge "stm32l: fix Daisy GPIO declaration" 2012-02-15 16:06:36 -08:00
Gerrit
42c3bee3ea Merge "Reduce LPC command parameters to 128 bytes; add LPC memory-mapped space" 2012-02-15 16:06:35 -08:00
Vincent Palatin
9a242f6840 stm32l: add external interrupt support for GPIOs
Allow to setup edge triggered interrupts on the GPIOs.

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

BUG=None
TEST=add a adhoc handler for the USER button and check its trace.

Change-Id: I11a280c412c1d333bab4a74f869221edf59fcf8e
2012-02-15 23:17:34 +00:00
Vincent Palatin
359b9eebab stm32l: fix Daisy GPIO declaration
The order of the GPIO in the header was not matching the signal list.
EC_INT is an output to trigger an interrupt on the application
processor.

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

BUG=None
TEST=make BOARD=daisy

Change-Id: Ib0eb675ad7d7e9e105b1d486c181a6df9bd5ad9b
2012-02-15 23:17:34 +00:00
Randall Spangler
6101cebb6a Reduce LPC command parameters to 128 bytes; add LPC memory-mapped space
This will allow more efficient access to EC-provided data (temperature,
fan, battery) by the main processor.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7857
TEST='ectool hello' from link main processor should still work

Change-Id: I2dc683f3441b34de9fb4debf772e386b9fdcfa82
2012-02-15 15:12:03 -08:00
Gerrit
8236345574 Merge "stm32l: set pin mux for USART1" 2012-02-15 15:04:04 -08:00
Vic Yang
94fb8ee096 Sqrt function for Cortex-M
Add an arch include folder. Implement sqrtf for Cortex-M in math.h.

BUG=chrome-os-partner:7920
TEST=none

Change-Id: Ib7b480b6a0bf7760f014a1f73df54673a9016cb6
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 05:43:29 +08:00
Vic Yang
502613771e FPU control
Implement enable_fpu() and disable_fpu().
enable_fpu() disables interrupt and then enables FPU.
disable_fpu() disables FPU and enables interrupt.
Also added a CONFIG_FPU flag.

BUG=chrome-os-partner:7920
TEST=none

Change-Id: I2d71f396d9c7d7ac4a6a2d525f3d86f8aae87521
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 05:42:08 +08:00
Vincent Palatin
ee9279c1a8 stm32l: set pin mux for USART1
When we are not running the ROM monitor first, we must set the pins used
for USART1 (PA9/PA10) as alternate function.

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

BUG=None
TEST=Run firmware on the discovery board not from the monitor and see
the traces.

Change-Id: I32be3d5a88a3e71828d081d74503722331a649b8
2012-02-15 18:24:04 +00:00
Gerrit
c160dae1d4 Merge "stm32l: Add skeleton for Daisy board" 2012-02-14 18:25:42 -08:00
Gerrit
3d9bccaa58 Merge "Refactor power button module to support lid events" 2012-02-14 16:13:42 -08:00
Randall Spangler
5575be5b48 Refactor power button module to support lid events
This also significantly refactors the module in other ways.  Instead
of polling for changes every second, the power button task sleeps
until its next state transition or input.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7508
TEST=manual

1. Reboot EC with lid open.  System should NOT power on.
2. Close lid.  System should power on.
3. Open lid.  System should power on.
4. Press power button.  System should power off.

For now, EC debug messages should also indicate [PB task wait] only
when transitions are taking place; the task function should be
sleeping at other times.

Change-Id: I86ac420506cebcdf9ca62bdca342e86857d9e242
2012-02-14 15:48:23 -08:00
Vincent Palatin
b34c1ce954 stm32l: Add skeleton for Daisy board
Necessary files to build it and GPIO definitions.

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

BUG=None
TEST=make BOARD=daisy && make BOARD=discovery && make BOARD=link

Change-Id: I22ad8d2d859f9c884bf2e3f92db02d992ad669a6
2012-02-14 23:02:14 +00:00
Dave Parker
0b99daff0b ec: Add "private/" to .gitignore.
Signed-off-by: Dave Parker <dparker@chromium.org>
BUG=None
TEST=Verify files under a "private" subdirectory are ignored by git.

Change-Id: I551effa5cf8967b787e40f1cc82f9c3f91d9fa09
2012-02-14 11:46:16 -08:00
Randall Spangler
805c89652f Check for recovery key sequence at init
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7451
TEST=hold down no keys; KB init state should be blank
hold down reload (F3); KB init should indicate recovery key pressed
hold down F3 + ESC; same
hold down F3 + F2 + ESC; KB init should NOT indicate recovery key pressed

Change-Id: I0fbf15407b20669396f667e6499ee5a9d545a4d5
2012-02-14 10:51:24 -08:00