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
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>
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
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
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
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
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
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
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>
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
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
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
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>
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>
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
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
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
Signed-off-by: Dave Parker <dparker@chromium.org>
BUG=None
TEST=Verify files under a "private" subdirectory are ignored by git.
Change-Id: I551effa5cf8967b787e40f1cc82f9c3f91d9fa09
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
It was scrolling so much that the EC debug output for power state
transitions was getting lost. Now it uses CR instead of LF.
Use 'port80 scroll' to turn scrolling back on (it's off by default).
Port 80 history is still visible via the 'port80' command, in all cases.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST=powerbtn ; power on; should not scroll screen
port80 ; confirm history is still there
port80 scroll ; enable scrolling
powerbtn ; turn system off
powerbtn ; turn system back on; should scroll screen
port80 ; confirm history is still there
Change-Id: I85d058ff0b2b9d3d5296060747bde5e872b85817
Currently, 'tempsinfo' command would abort when encountering problems
reading temperature sensor info. Change this command to continue reading
succeeding sensors.
Also change 'temps' to show temperature in both 'K' and 'C' for better
reading and easier debugging.
BUG=chrome-os-partner:7527
TEST=none
Change-Id: I41a4068fb58804cb000e6725c0894aabd0104119
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:7839
TEST=none, work in progress
Change-Id: I20acde8db7f250227adcd4b9dc59328362e68720
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
These provide 8-bit accesses to registers within an I2C device.
BUG=chrome-os-partner:7839
TEST=none
Testing will come when I start using them.
Change-Id: Ib53d3347253bccee93cb9c5da12db92970155d92
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Remove id field from temp_sensor_t struct, since it's only used by the
console command (which already knows the id, because it's looping over
it).
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST='temps'
Change-Id: I0970850073d644509cd5501d7ac4421c7373143b
This change adds a common part of smart battery driver. Following
features are not implemented, or in chip specific driver:
Battery access control, authentication, factory mode
Manufacturer access/data commands
Block read/write, device name, flash data
Chip specific features, per cell info/temp/capacity
Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7856
TEST=console command check battery staus
[unplug power]
> battery
[check voltage,current,capacity,time to empty]
[plug power]
> charger voltage 8400
> charger current 4250
> battery
[check current,time to full]
> charger input 4032
> battery
[check current,time to full]
[wait 130 seconds, charger watch dog timeout]
> battery
[check current]
Change-Id: Ifac17a0892f52e8f37eebc14b00e71f18360776c
Signed-off-by: Rong Chang <rongchang@chromium.org>
We have to wait until the controller is no longer busy before we announce
that we're done. Just waiting for the first interrupt isn't enough, because
that's often just an error indicator and the controller still has to stop.
BUG=none
TEST=none
Change-Id: I065c049111d7de276bf8f7cd0eed39c3f5cff5f4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:7493
TEST='powerbtn' to boot main processor, then 'temps' and 'pecitemp'
Change-Id: Id57526ebb37c8aecb05ecebccc2824f462b9de1a
Development work switched over to a private repository while licensing
issues were sorted out. Now the development work that was done in private
can be opened under the Chromium license.
BUG=chrome-os-partner:7564
TEST=None
The Daisy board will have the EC UART on the debug connector wired to
USART1 (PA9/PA10 pins)
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=Run Discovery board with mini-servo attached to PA9/PA10 and see
the traces.
Change-Id: I97c59ba388fddb150ff6c76ec3317deedb567546
Implement TMP006 object temperature calculation. Also add a console
command to calculate temperature with manually entered data.
BUG=chrome-os-partner:7801
TEST=In console, "tempremote 29715 -105000 6390" gives 285.00K.
Change-Id: I0f9193fb970fdc36566399e7083e73ab58965a85
The current calculation was wrong in previous code import. This CL
fixes current calculation, remove init input current setting, and
adds charger set commands.
Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7855
TEST=build and flash link image, run following commands:
charger
charger voltage 4096
charger current 128
charger input 4032
charger
Change-Id: I156ffac9f03d490475088c430232622a12b9ec29
Supports turning system on and off via power button.
Also added 'powerbtn' command, which sends a power button press of the
specified duration, and deprecated the 'x86power s0' command, since
pressing the power button is a more correct way of powering on/off the
system.
Note that current coreboot doesn't seem to boot reliably; when it
fails, the x86 asks for S5 and then S0 a second later. It boots about
every 3rd try. No indication this is due to the EC; the EC just was
ignoring these requests until this CL.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:7851
TEST=reboot, 'powerbtn', system should power on
'powerbtn', system should power off
'powerbtn 5000', system should power off regardless of previous state
press power button, system should power on
press power button again, system should power off
hold power button 8 sec, system should power off regardless of previous state
Change-Id: I89f419553289b20c78a57bc8cb1699932b095aa1
Battery charging state machine contains many file changes.
This is the 1st part of the break down. Refactor original
test code into board dummy driver. Normalize charger API.
And import link's charger IC driver.
Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7855
TEST=build without warning and error
BOARD=bds make
BOARD=link make
BOARD=discovery make
Change-Id: I34b6e9862a45331378916bc77653d4adb22ca548
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:7850
TEST=reboot, press power button; system should turn on
reboot, type 'x86power s0'; system should also turn on
Change-Id: Iac114c2655240d8aba81283d12f667f8e64d3ad3