Commit graph

37 commits

Author SHA1 Message Date
Rajavardhan Gundi e71e803674 drivers: espi: Add support for ACPI_EC1 interface
This enables the ACPI_EC1 interface which is typically accessed
through ports 0x6A0 and 0x6A4 in Bios.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2020-06-25 17:05:43 -04:00
Venkataramana Kotakonda 69aa4eeee6 driver: espi: Enable espi uart port sirq based on uart mapping.
Espi has three uart port from 0 to 2 and uart sirq need to enabled for
the port which is active in the hardware. An active uart sirq shoudl be
enabled based on uart mapping configuration.

Signed-off-by: Venkataramana Kotakonda <venkataramana.kotakonda@intel.com>
2020-06-23 19:22:46 +02:00
Jose Alberto Meza a1b6dd51d0 drivers: espi: Add support for KBC status operations
In some systems, eSPI host perform operations directly over KBC HW
status.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-06-15 16:52:53 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Jose Alberto Meza eaaf1af79e drivers: espi: mchp: Report correct length during OOB Rx operation
Use correct HAL macro to report amount of bytes received.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-09 07:20:13 -04:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Jose Alberto Meza 06d4c6d8b3 drivers: espi: xec: Ensure OOB interrupts are not missed
MCHP Soc operation uses clear-on-write register for interrupt
status, read-OR-write operation may clear interrupts unintentional.
Fixes #24464

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-07 17:18:26 -07:00
Venkataramana Kotakonda e34133cd2c driver: espi: Re-enable bus interrupts after espi reset.
Espi bus interrupts need to re-enable after espi reset to get
all espi bus and vw signal interrupts.

Signed-off-by: Venkataramana Kotakonda <venkataramana.kotakonda@intel.com>
2020-04-23 18:22:49 +02:00
Venkataramana Kotakonda 7eccdf7b5c driver: espi: Enable OOB_RST_WARN virtual wire interrupt.
Epsi slave need to respond with an OOB_RST_ACK for OOB_RST_WARN sent by
master during host reset. Enable interrupt for OOB_RST_WARN to receive
signal changes and respond with ACK.

Signed-off-by: Venkataramana Kotakonda <venkataramana.kotakonda@intel.com>
2020-04-23 18:22:49 +02:00
Jose Alberto Meza 9538f7896e drivers: espi: xec: Add support for eSPI flash channel
Add driver implementation to support flash read/writ transactions
over eSPI bus.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-04-22 22:21:54 +02:00
Flavio Ceolin aeb70d5471 drivers: espi_mchp_xec: Update driver to espi API changes
espi driver API is passing struct by reference, just fixed this
driver to follow that changes.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-17 10:33:02 -07:00
Flavio Ceolin d62dd0737e drivers: espi: Change syscall APIs to pass structs by reference
Several functions that are syscalls were passing structs by value
instead of by reference. Just changed that and implemented missing
verfication handlers for them.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-17 10:33:02 -07:00
Flavio Ceolin a5b4e272e2 drivers: espi: Add some missing verification handlers
Add verification handlers for some syscalls that are just missing
that. Though there are syscalls still missing that but they need to be
fixed before adding verification handlers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-17 10:33:02 -07:00
Jose Alberto Meza f93c1926e6 drivers: espi: xec: Validate channels espi configuration
Ensure driver's client channel configuration selection is used.
Fixes: #24162

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-04-11 15:30:27 -04:00
Andy Ross 32bb2395c2 timeout: Fix up API usage
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04:00
Kumar Gala 7a81cd9747 drivers: microchip: Convert microchip drivers to new DT_INST macros
Convert older DT_INST_ macro use in microchip drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 16:31:52 -05:00
Jose Alberto Meza 150eee0fb6 drivers: espi: xec: Extend automatic warning VWire ack mechanism.
Expand configuration mechanism for additional eSPI host warnings.
Notify client driver when sleep A virtual wire is received.
Simplify virtual wire interrupt enabling.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-13 10:34:49 -04:00
Jose Alberto Meza b803b32541 drivers: espi: Obtain correct Rx lenght during OOB transaction.
MEC15xx eSPI OOB RX length register holds received message length
and receive buffer length, need to extract rcvd msg length.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-13 01:45:18 +02:00
Kumar Gala c68a1d427d drivers: espi: mchp_xec: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.  The driver mostly used DT_INST_ defines but
a few IRQ priority defines needed conversion.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Ulf Magnusson eddd98f811 kconfig: Replace some single-symbol 'if's with 'depends on'
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.

There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.

The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).

Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.

Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.

Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.

The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.

(Everything above is true for choices, menus, and comments as well.)

Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-08 08:32:42 -05:00
Jose Alberto Meza 77b7b42f1d drivers: espi: xec: Allow to intercept eSPI host suspend/reset warnings
Fix #22188
Introduce config option to disable automatic acknowledge via
virtual wires on response to eSPI host suspend and reset warnings.
This will give the opportunity for eSPI slave systems that need to
perform preparations before reset or suspend.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-01-28 20:13:36 +02:00
Jose Alberto Meza 35c28a3dbf drivers: espi: xec: Use DT IRQ priority values
Use  DT define IRQ priorities instead KConfig.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-01-28 20:13:36 +02:00
Jose Alberto Meza d1f0fbfec5 drivers: espi: xec: Add support for eSPI OOB channel operations
Implement send/receive out-of-band packet APIs

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-01-23 12:17:48 -05:00
Jose Alberto Meza 9fa30e02f2 drivers: espi: xec: Enable OOB channel by default
Enable ESPI OOB channel by default in XEC driver.
Enable OOB channel transmit interrupt and handle OOB up/down correctly.
Change interrupt clearing, clear low level interrupt bits in subhandlers
and high level interrupt in aggregate handlers at the end.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-12-11 13:22:38 -08:00
Francisco Munoz 66baf7f38d drivers: espi: Implement peripheral api in the driver
Initial implementation of the keyboard controller peripheral
in the eSPI driver. This allows to communicate ps2 and kscan
data between EC and Host

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2019-11-20 15:02:08 -05:00
Francisco Munoz 4538ddaea3 drivers: espi: Kconfig cosmetic changes
Several cosmetic changes applied to the Kconfig for ESPI driver

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2019-11-20 15:02:08 -05:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
David B. Kinder 241044f178 doc: fix misspellings in Kconfig files
Fix misspellings in Kconfig files missed during regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-10-30 10:24:30 +01:00
Jose Alberto Meza da5a595f24 drivers: espi: mchp: Remove duplicated KConfig option
Fix #20086 by removing duplicate kconfig option.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-10-26 07:36:55 -05:00
Ulf Magnusson 677f1e6db9 kconfig: Turn pointless/confusing 'menuconfig's into 'config's
Defining a symbol with 'menuconfig' just tells the menuconfig to display
any dependent symbols that immediately follow it in a separate menu.
'menuconfig' has no effect on symbol values.

Making a symbol that doesn't have any dependent symbols after it a
'menuconfig' should be avoided, because then you end up with an empty
menu, which is shown as e.g.

    [*] Enable foo ---

This is how it would be shown if there were children but they all
happened to be invisible as well.

With a regular 'config', it turns into

    [*] Enable foo

Change all pointless 'menuconfig's to 'config's.

See the section on 'menuconfig' on the Kconfig - Tips and Best Practices
page as well.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 13:53:06 -05:00
Jose Alberto Meza d52a3660de drivers: espi: xec: Report espi reset correctly to app
Handle espi reset interrupt before clearing it
So it can send correct notification.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-10-14 14:15:26 -07:00
Anas Nashif 9d70a87f20 drivers: espi: move header to include/drivers
Driver APIs need to go into include/drivers/.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-10-01 16:18:36 -04:00
Jose Alberto Meza e9dd54ed1c drivers: espi: xec: Ensure all eSPI VW are transmitted
When a eSPI slave needs to send back-to-back packets
updating status signal need to guarantee both status
reach the eSPI host, i.e. SCI=0 followed by SCI=1.
This change guarantees both packets are transmitted
over esSPI bus.

Allow to map eSPI host logical UART to a soc UART.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-09-20 14:30:40 -04:00
Kumar Gala 59bbf3a521 drivers: espi: espi_mchp_xec: Fix wrong size type for status var
In status variable in espi_pc_isr should have been a 32-bit unsigned int
as ESPI_PC_REGS->PC_STATUS is 32-bits.

Fixes #18359
Coverity-CID: 203521

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-19 17:48:42 +02:00
Ulf Magnusson a9490541d6 drivers: espi: kconfig: Remove redundant ESPI_PERIPHERAL_CHANNEL deps.
The ESPI_PERIPHERAL_* symbols are surrounded by an
'if ESPI_PERIPHERAL_CHANNEL' in the same file, so no
need to put 'depends on ESPI_PERIPHERAL' on them.

'if' is just a shorthand for 'depends on'.

Also remove a redundant 'if ESPI' from ESPI_XEC.
drivers/espi/Kconfig.xec is sourced within an 'if ESPI' in
drivers/espi/Kconfig.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-08-07 04:27:03 -04:00
Jose Alberto Meza 64c334f0b3 drivers: espi: Add driver for microchip XEC family
Add eSPI Microchip XEC driver
Include support for peripheral & virtual wires (channel 0-1)
OOB and flash support can be added in the future

Fix compilation error in pinmux driver

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-07-25 08:23:38 -07:00
Jose Alberto Meza a7e44ebf44 drivers: espi: Add Kconfig for eSPI driver
Adds the Kconfig for generic eSPI drivers

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-07-25 08:23:38 -07:00