Commit graph

737 commits

Author SHA1 Message Date
Erwan Gouriou
bd7387947e drivers/gpio: stm32: Remove redundant AFIO bit for STM32F1
Specific code is present GPIO_DEVICE_INIT_STM32 in
GPIO_DEVICE_INIT_STM32 to handle LL_APB2_GRP1_PERIPH_AFIO bit.
Though, this bit is already included in device tree information,
in clocks property, 'bits' field, which carries for each GPIO,
both LL_APB2_GRP1_PERIPH_GPIOX and LL_APB2_GRP1_PERIPH_AFIO.
Hence, it is already taken into account in
CONFIG_GPIO_STM32_GPIO##__SUFFIX##_CLOCK_BITS and it is redundant
to handle it in GPIO_DEVICE_INIT_STM32 macro.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-13 07:09:35 -06:00
Krzysztof Chruscinski
97345dbb1b logging: Fix errors in log usage
Couple of findings which were revealed after changing
LOG_MODULE_REGISTER macro:
- missing semicolons after LOG_MODULE_REGISTER()
- missing LOG_LEVEL defines
- other

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-10 12:38:29 -05:00
Martin Bertsche
9892f40204 gpio: stm32 use dts extracted information to populate gpio instances.
The information extracted from the device tree is now used to initialize
GPIO device instances. Up until now the GPIO device driver made no use
of this information. Actual instance creation is still controlled using
the Kconfig method. Missing GPIO device tree nodes were added in the
process for STM32L073, STM32F413 and STM32F373.

The information for gpio instance initialization has already been
present for supported STM32 SoCs but remained unused. Changes in the
device tree had no effect on GPIO functionality and was essentially
redundant. Using the device tree for hardware description seems
plausible and less painful than a myriad of defines in some SoC
description header.

The change was implemented under the assumption that current device
trees provide a correct description of the SoCs. Base register addresses
and RCC register bits were not explicitly checked for each device.

Manual tests were executed on:
	- NUCLEO-F103RB
	- STM32F429I-DISCO
	- STM32F746G-DISCO
	- NUCLEO-F767ZI

Manual tests consisted of blinky on different GPIOs and pins on each
board.

sanitycheck was executed for all STM32 based boards

Fixes: #10629

Signed-off-by: Martin Bertsche <martin72216@googlemail.com>
2018-11-09 04:49:59 -06:00
Sean Nyekjaer
c206b0239f drivers: gpio: shell: rectify gpio get error msg
Previous the error for get was:
- Wrong parameters for set
Now:
- Wrong parameters for get

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
2018-11-08 08:25:06 -05:00
Kumar Gala
ac7da0b65c gpio: ti cc32xx: Add device tree support for GPIO
Convert gpio_cc32xx driver over to using device tree. Added binding
files, updates to dts for various SoCs that use cc32xx.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-05 11:08:35 -06:00
Daniel Leung
a87a6d82ac soc: apollo_lake: fix build errors for GPIO due to DTS changes
The DTS changes introduced in 7ae220c845
changes the naming of GPIO related macros. This updates the usage
of previous macros via DTS fixup.

Fixes #10993

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-11-02 21:58:02 -04:00
David B. Kinder
ee47f7fb7a doc: fix kconfig misspellings
Fix misspellings in Kconfig files that show up in the configuration
documentation (and make menuconfig screens).

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-02 17:58:16 -04:00
Kumar Gala
aa2bdbe322 drivers: Remove board.h include
We either don't need board.h in the driver or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:21:11 -04:00
Anas Nashif
8eff21a8dd drivers: gpio: add shell for controlling GPIO
Provide basic commands for configuring/setting/reading GPIO ports.

> gpio conf ..
> gpio set ..
> gpio get ..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-18 10:15:50 -04:00
qianfan Zhao
94fa5ca91b drivers: gpio_sam: fix gpio_sam_write ACCESS_BY_PORT mode
The 'value' param in ACCESS_BY_PORT mode means the state of a port,
one bit represented one pin in param 'value'.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-17 08:03:38 -04:00
qianfan Zhao
ccab779b48 drivers: gpio_sam: Add ACCESS_BY_PORT mode for gpio config
ACCESS_BY_PORT mode can configure all the pins the same way in the port.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-17 08:03:38 -04:00
Nathaniel Graff
c0a680166d drivers: gpio: sifive: Fix GPIO extern interrupts
IRQ_CONNECT calls in the SiFive GPIO driver were misconfigured when the
conversion to DeviceTree support occurred.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2018-10-15 21:39:21 -04:00
Kumar Gala
c3076d6eb2 gpio: silabs gecko: Add device tree support for GPIO
Convert gpio_gecko driver over to using device tree. Added binding
files, updates to dts for various SoCs that use gpio_gecko.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-09 22:34:56 -04:00
Anas Nashif
c2551ea57b gpio: log: rename level variable
Rename log level variable:
 CONFIG_LOG_GPIO_LEVEL to CONFIG_GPIO_LOG_LEVEL

Use template for log levels.

Register modules in drivers using logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif
ab3f56577f gpio_sch: fix log message
log message missing a parameter for the pin.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Olivier Martin
9339d65e6e drivers: gpio: Migrate to new logging subsys
Migrate from `SYS_LOG` to `LOG` logging mechanism.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-10-08 17:49:12 -04:00
Kumar Gala
da7ac50683 gpio: sifive: Add device tree support for GPIO generation
Add the missing bits to the yaml, dts, and Kconfig to enable GPIO pin
generation based on device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-05 13:21:49 -05:00
Kumar Gala
db2ca70a23 dts: pulpino: Add device tree support for GPIO controller
Add the needed bits to get device tree support for the GPIO controller
on the Zedboard-Pulpino.  This will allow us to move LED & button info
into the board.dts.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-04 07:48:32 -05:00
Kumar Gala
58ec6fd30f gpio: remove unused GPIO_INT_CLOCK_SYNC flag
GPIO_INT_CLOCK_SYNC wasn't implemented by anything, so remove it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-03 08:23:24 -05:00
Maureen Helm
75bc6ba454 drivers: boards: Merge HAS_DTS_I2C_DEVICE with HAS_DTS_I2C
Every board that uses dts-enabled i2c drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_I2C_DEVICE and
HAS_DTS_I2C.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm
5dc584975b drivers: gpio: Select HAS_DTS_GPIO in various drivers
Selects HAS_DTS_GPIO in various gpio drivers that already support dts,
similar to how we select HAS_DTS_SPI in spi drivers and HAS_DTS_I2C in
i2c drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-28 11:44:03 -05:00
Daniel Leung
8d18ebde9b gpio: add driver for Intel Apollo Lake SoC
This adds a driver for GPIO controller on the Intel
Apollo Lake SoC.

Origin: Original

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-19 21:36:16 -04:00
Flavio Ceolin
67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Rajavardhan Gundi
dc45def9d0 drivers/gpio_sam: Fix incorrect flag checking
Corrected the checking for edge/level interrupts in the flags
variable.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-09-13 11:29:17 -04:00
Andrzej Głąbek
61eb2a1c80 drivers: gpio: nrfx: Use GPIOTE HAL for checking allocated channels
Replaces direct accesses to the peripheral registers structure
with the proper GPIOTE HAL function added recently to nrfx.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-09-11 12:55:07 -04:00
Pawel Dunaj
fb10377ecc drivers: gpio: Fix two bugs in nrfx gpio
Commit fixes two issues:
- Return correct value from gpiote_channel_alloc
- Check if pending event interrupt was not disabled

Jira:DESK-270

Fixes #9535

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2018-08-27 10:30:04 -04:00
Michael Scott
7983606327 drivers: gpio: sx1509b: Kconfig options depend on GPIO_SX1509B
When CONFIG_GPIO_SX1509B was not set, the related Kconfig options
were still showing up in .config.  Let's make them depend on
GPIO_SX1509B so they can go away when not being used.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-08-23 15:45:16 -07:00
Nathaniel Graff
ca12b3f7d4 drivers: gpio: SiFive GPIO allows <32 pins
Add ifdefs to the SiFive GPIO driver IRQ bindings to allow fewer than
32 pins to be configured based on the DTS configuration

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2018-08-18 10:46:36 -07:00
Mieszko Mierunski
4f6aac1a67 dts: nrf5: Changed GPIO and GPIOTE define names
Changed names using nrf5 to nrf for consistency with other drivers.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski
d25c887f63 drivers: nrf: Remove redundant gpio_nrf5 shim
After GPIO shim using NRFX has been implemented, old gpio_nrf5
shim is no longer needed.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski
6d8220d27f drivers: gpio: Add shim for nrfx GPIO and GPIOTE drivers
Added shim implementation gpio_nrfx.c which uses nrfx drivers
for GPIO and GPIOTE

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski
e99e363cc0 dts: nrf: Added DTS support for nRF51
DTS for nRF51 was missing, I updated soc and board files to
support DTS properly.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Flavio Ceolin
0866d18d03 irq: Fix irq_lock api usage
irq_lock returns an unsigned int, though, several places was using
signed int. This commit fix this behaviour.

In order to avoid this error happens again, a coccinelle script was
added and can be used to check violations.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-16 19:47:41 -07:00
Nathaniel Graff
218d7a0aa9 riscv: Rename the FE310 SoC to Sifive Freedom
FE310 is the name of one SoC out of a range of products in the SiFive
Freedom line. The FE310 SoC port in Zephyr is compatible with all of
these products, so rename the SoC to SiFive Freedom

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2018-08-16 06:23:01 -07:00
Ulf Magnusson
8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Nathaniel Graff
45d5d5db48 boards: riscv: Convert HiFive1 to DTS
Adds DTS bindings for sifive,pwm0, sifive,uart0, sifive,spi0, and
riscv,plic0.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
2018-08-13 18:35:38 -05:00
Ulf Magnusson
ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Erwan Gouriou
a10d178078 drivers/pinmux: stm32 fix ports_enable array definition
ports_enable array holds port clock information.
It is populated for all SoCs, but ports availability depends on
SoCs. The way it is defined today, location of the port in the
array depends on previous ports definition in SoC CMSIS files.
Though, port index is always the same irrespective of previous
ports availability in the SoC.
This will result in incoherency between port index and clock
information.
Fix this by setting a bogus value if port is not defined.
Return an error if bogus value is read.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-07-31 09:45:39 -05:00
Anas Nashif
a2ad4b2dd1 drivers: qmsi: Fix types and u32_t/uint32_t conflicts
We have been mixing u32_t and uint32_t. Using u32_t when the API expects
something else.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-18 12:32:23 -04:00
Ioannis Glaropoulos
ac81eb0eca drivers: gpio: nrf: remove GPIOTE register structure definition
This commit removes the redundant definition of nRF GPIOTE
register structure that is present in gpio_nrf5.c. The gpiote
driver is adapted to use the register definitions directly
from Nordic MDK header files.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-07-12 18:36:01 +02:00
Ioannis Glaropoulos
5275a73169 drivers: gpio: nrf: remove GPIO register structure definition
This commit removes the redundant definition of nRF GPIO
register structure that is present in gpio_nrf5.c. The gpio
driver is adapted to use the register definitions directly
from Nordic MDK header files.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-07-12 18:36:01 +02:00
Christian Taedcke
9ac99a28c5 drivers: gpio_gecko: Adapt driver for Silabs EFR32 MCUs
The EFR32 does not have DOUTSET and DOUTCLR registeres.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-07-10 12:53:50 -05:00
Vinayak Kariappa Chettimada
505a83414e drivers: gpio: nrf5: Fix GPIOTE channel use overlap
Fixes issues caused in GPIO driver due to overlapping GPIOTE
channel use in nRF5 software PWM driver and in Bluetooth
controller for implementing PA/LNA feature.

The issue is solved by assigning the base and available
channel count for GPIOTE considering whether PWM and/or
PA/LNA feature is selected in the Kconfig.

Fixes #8815.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-07-10 11:25:32 +02:00
qianfan Zhao
6fb7b04461 drivers: stm32-gpio: Provide GPIO driver for stm32f2
Add necessary GPIO defines for the stm32f2 series soc

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-07-05 11:26:07 -05:00
Kumar Gala
44e5b05fb1 drivers: gpio: nrfx: Move device tree selection to driver Kconfig
Move HAS_DTS_GPIO from board to the driver Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-03 18:46:41 -04:00
Ulf Magnusson
f912dfebea drivers: gpio: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Piggyback a missing 'source "drivers/gpio/Kconfig.imx"'. This file
wasn't included anywhere previously.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Yurii Hamann
a229500d23 drivers: gpio: stm32: STM32F7 GPIO support
This patch adds GPIO support for STM32F7 family microcontrollers.

Signed-off-by: Yurii Hamann <yurii@hamann.site>
2018-06-28 08:29:32 -05:00
Marc Reilly
6c60abb03b drivers: gpio: add dts support for nrf52 gpio
This adds basic support for declaring gpio nodes in dts for nrf52.
The dts.fixup provides mapping for the generated defines to the config
defines currently used by the nrf gpio driver.

Existing boards that use nrf52 are updated.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2018-06-14 15:56:39 +02:00
Erwan Gouriou
f27195017a drivers/gpio: stm32 fix gpio device init prio
STM32 GPIO device initialization priority was set to
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT
Following introduction of __ZEPHYR_SUPERVISOR__ macro (#6835),
drivers intialization order have been reordered which blocks
some use cases now.
Increase GPIO init priority to get it initialized before SPI
and avoid a deadlock.

Fixes #7663


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-06-01 03:26:10 -07:00
Maureen Helm
7f4608cc61 gpio: Fix imx driver edge selection when configuring by port
Fixes a copy-paste error found by Coverity.

Coverity-CID: 186028

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-25 10:54:14 -05:00
Tomasz Bursztyka
ed26b95746 drivers/gpio: Removing dts generated options in QMSI Kconfig
Now that all arch using QMSI gpio driver are generating the right
settings through DTS, these options can be removed from Kconfig.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka
bd9706cd9b arch/arc: Use dts to set gpio priorities for quark_se_c1000_ss
Fix the qmsi ss gpio driver accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka
53f91976b1 arch/x86: Use dts to set gpio options for quark_se and quark_d2000
Get the name and irq flags generated through dts as well.
Fix Kconfig for the gpio driver accordingly.

Irq priority is not set by dts for D2000 as it's irq controller does
not support it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Andrew Boie
8345e5ebf0 syscalls: remove policy from handler checks
The various macros to do checks in system call handlers all
implictly would generate a kernel oops if a check failed.
This is undesirable for a few reasons:

* System call handlers that acquire resources in the handler
  have no good recourse for cleanup if a check fails.
* In some cases we may want to propagate a return value back
  to the caller instead of just killing the calling thread,
  even though the base API doesn't do these checks.

These macros now all return a value, if nonzero is returned
the check failed. K_OOPS() now wraps these calls to generate
a kernel oops.

At the moment, the policy for all APIs has not changed. They
still all oops upon a failed check/

The macros now use the Z_ notation for private APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Adithya Baglody
b0db28b512 drivers: Cmake: Add __ZEPHYR_SUPERVISOR__ macro for driver files.
Normally a syscall would check the current privilege level and then
decide to go to _impl_<syscall> directly or go through a
_handler_<syscall>.
__ZEPHYR_SUPERVISOR__ is a compiler optimization flag which will
make all the system calls from the driver files directly link
to the _impl_<syscall>. Thereby reducing the overhead of checking the
privileges.

In the previous implementation all the source files would be compiled
by zephyr_source() rule. This means that zephyr_* is a catchall CMake
library for source files that can be built purely with the include
paths, defines, and other compiler flags that all zephyr source
files uses. This states that adding one extra compiler flag for only
one complete directory would fail.
This limitation can be overcome by using zephyr_libray* APIs. This
creates a library for the required directories and it also supports
directory level properties.
Hence we use zephyr_library* to create a new library with
macro _ZEPHYR_SUPERVISOR_ for the optimization.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Wayne Ren
532e4d22ee dts: optimize and bug fixes the dts of em_starterkit
* add gpio, i2c, spi definitions
* optimize and bug fix the dts.fixup
* optimize and bug fix the em_starterkit related definitions
  in dts folder

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-05-15 09:48:11 +02:00
Kumar Gala
57904102fd gpio: dts: Introduce Kconfig symbols to convey GPIO dts support
Add a set of Kconfig symbols that allow us to set that the GPIO
driver/SoC support DTS (HAS_DTS_GPIO) and that drivers that need/use
GPIO support DTS as well (HAS_DTS_GPIO_DEVICE).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-10 15:43:42 -05:00
Stanislav Poboril
67ba7d8a36 gpio: Add imx gpio driver shim
Adds a shim layer around the imx gpio driver to adapt it to the Zephyr
gpio interface.

For now only the port 4 was tested.

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-05-02 12:48:14 -05:00
Leandro Pereira
c200367b68 drivers: Perform a runtime check if a driver is capable of an operation
Driver APIs might not implement all operations, making it possible for
a user thread to get the kernel to execute a function at 0x00000000.

Perform runtime checks in all the driver handlers, checking if they're
capable of performing the requested operation.

Fixes #6907.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-26 02:57:12 +05:30
Maureen Helm
57e80e5345 ext: mcux: Reorganize imported drivers into soc family subfolders
We have been combining imported mcux drivers into a flattened directory
structure to maximize driver reuse, but the introduction of additional
nxp soc families (lpc and imx) to zephyr has introduced driver naming
conflicts. This caused us to rename and modify imported files, such as
fsl_gpio.c/h, to make them unique across all three nxp soc families.
This makes updating the the mcux drivers complicated, especially for the
lpc family.

Reoganize the mcux drivers into soc family subfolders, so we can just
copy all the drivers from an mcux distribution (which is done on an
soc-basis) into the appropriate soc family folder. Undo all of the
naming changes that occurred when lpc and imx drivers were originally
imported. Undo the accidental squashing of the kinetis watchdog and dcdc
drivers that occurred when the imx drivers were introduced.

The drawback to this approach is that we have duplicate files when the
same hw ip modules exist in multiple soc families, however there are
only few cases where this occurs, such as fsl_lpuart and fsl_trng.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-04-24 07:55:48 -05:00
Maureen Helm
4e8f29f319 gpio: Refactor the mcux gpio driver to use dts
Get the driver name, base address, irq number, and irq priority from
dts.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-04-20 08:54:11 -05:00
Aapo Vienamo
8e1cf7b619 gpio: nrf5: Make the init priority configurable
A Kconfig option is added for setting the initialization priority.

This is done to make the initialization priority requirements in
nrf52_pca20020 board power up sequence clearer.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-04-09 17:09:06 -05:00
Vinayak Kariappa Chettimada
91a27358bd drivers: gpio: nrf5: Use popcount and first_lsb_set functions
Use the Zephyr toolchain and architecture defined popcount
and first_lsb_set functions instead of GCC specific
functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-23 16:40:58 +01:00
Vinayak Kariappa Chettimada
89cb10f151 drivers: gpio: nrf5: Add support for port P1 in nRF52840 SoC
Added support for GPIO Port P1 in nRF52840 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-23 16:40:58 +01:00
Vinayak Kariappa Chettimada
e9fa157245 drivers: gpio: nRF5: Use lowest IRQ priority level as default
Fix the permitted range of IRQ priority to, 0 to 2, as
maximum one priority level is used, for zero latency IRQs
in nRF51, being an ARM Cortex-M0.

Update the Kconfig default GPIOTE IRQ priority level to the
lowest, for nRF51 a level of 2; for nRF52, a level of 5.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-23 16:40:58 +01:00
Carles Cufi
b2016da563 arch: arm: nrf: Rename common header to apply to all nRFx ICs
The existing nrf5_common.h now applies to other Nordic ICs that are not
part of the "5" family. Instead rename this to nrf_common.h to cover the
upcoming ICs that belong to other families.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Carles Cufi
f49150cab6 arch: arm: nrf: Rename nrf5 SoC Family to nrf
Upcoming Nordic ICs that share many of the peripherals and architecture
with the currently supported nRF5x ones are no longer part of the nRF5
family. In order to accomodate that, rename the SoC family from nrf5 to
nrf, so that it can contain all of the members of the wider Nordic
family.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Aapo Vienamo
dd9719bf46 gpio: Add a driver for SX1509B
Adds a driver for SX1509B I2C GPIO chip. This driver only supports the
basic GPIO features and does not currently implement the LED driver and
keypad matrix features.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-13 12:31:16 -05:00
Justin Watson
b9c65e1882 drivers: GPIO Added GPIO for SAM family.
Added GPIO driver for SAM family of SoCs.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-03-10 11:42:25 -06:00
Endre Karlson
ef1d32b8ef drivers: gpio: Provide GPIO driver for stm32l0x
Add necessary GPIO defines for the stm32l0x series soc

Signed-off-by: Endre Karlson <endre.karlson@gmail.com>
2018-03-10 11:42:25 -06:00
c83f0782b6 gpio: sam0: add pull up/pull down support.
Also trim back the headers.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-10 11:42:25 -06:00
Vitor Massaru Iha
e84d1a4f31 drivers: gpio: Nios-II: Fix condition on gpio_nios2_config_oput_port()
(flags & GPIO_DIR_IN) is always zero because GPIO_DIR_IN is 0, then
we have to use GPIO_DIR_MASK.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-19 20:49:20 -05:00
Anas Nashif
8949233390 kconfig: fix more help spacing issues
Fix Kconfig help sections and add spacing to be consistent across all
Kconfig file. In a previous run we missed a few.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-15 23:20:55 -05:00
Shiksha Patel
1dc7e90c03 lpc: Add gpio mcux driver for lpc
Add gpio mcux driver which can be used for lpcxpresso54114 and other lpc
socs. In this driver, CMSIS register access is made for GPIO.

Option for access by GPIO Pin is provided as of now.

Signed-off-by: Shiksha Patel <shiksha.patel@nxp.com>
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-23 09:18:32 -06:00
Yannis Damigos
ef0d77b74e drivers: gpio_stm32: Add defines for ports I, J, K
This patch adds defines for ports I, J, K and
refactors gpio_stm32.h file.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-01-11 14:35:45 -06:00
54c6fbdca7 gpio: add a GPIO driver for the SAM0 family.
Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-04 13:18:25 -05:00
Ramakrishna Pallala
12d614d0b8 drivers: gpio: add support for Altera Nios-II PIO controller
The PIO cores on Altera Nios-II processors can be used
for GPIOs and each PIO core can be configured as Input only,
Output only or as Bidirectional port from the Qsys tool.

The present Nios-II softcpu image on the Zephyr only has the
support for Output only port and the PIOs[0:3] are wired to
LED[0:3] on the Altera MAX10 board.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-12-21 12:02:24 -08:00
Anas Nashif
429c2a4d9d kconfig: fix help syntax and add spaces
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-13 17:43:28 -06:00
Vitor Massaru Iha
c969ddbdd8 drivers: gpio: esp32: Check return value of pinmux_pin_input_enable()
Some gpio pins are only input, and this assert is for check if
they were set as output.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2017-12-11 09:21:53 -05:00
Vitor Massaru Iha
6a513ef65d drivers: gpio: Fix typo on esp32
esp32 has 40 gpio ports but some ranges are wrote 32_63 instead of
32_39.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2017-11-18 07:43:29 -05:00
Maureen Helm
6043c74fd3 gpio: Introduce mcux igpio shim driver
Adds a new gpio driver for the NXP i.MX family of SoCs. Read, write,
configure, and callback API functions are all implemented.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-11-15 09:09:58 -06:00
Sebastian Bøe
0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe
12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Youvedeep Singh
26de2ec1cb gpio: Add APIs for enabling/Disabling GPIOTE interrupts for nrf52 SOC.
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-11-06 09:29:10 -05:00
Youvedeep Singh
affbea7caf gpio: Add support for SENSE configuration for nrf SOC GPIO.
nrf SOCs are capable of waking from Low power state or
Deep Sleep state using sense configuration.
So adding support for this in nrf GPIO driver.

Jira: ZEP-2623

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-11-06 09:29:10 -05:00
Piotr Mienkowski
4487c935fe drivers: gpio: deprecate GPIO_PIN_ENABLE, GPIO_PIN_DISABLE
GPIO_PIN_ENABLE, GPIO_PIN_DISABLE configuration constants overlap
functionality provided by pinmux driver. They usage makes the API
inconsistent. They are almost uniformly ignored by the existing device
drivers. Only few of them take these constants into account.

This commit deprecates usage of the two configuration constants.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-02 18:46:30 -04:00
Anas Nashif
780324b8ed cleanup: rename fiber/task -> thread
We still have many places talking about tasks and threads, replace those
with thread terminology.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-30 18:41:15 -04:00
Andrew Boie
d3ec6654f5 drivers: gpio: add system call handlers
Many APIs had two versions, by port and by pin, which called the same
API with different parameters. This has been reorganized to reduce
the number of system calls.

Callback registration API skipped.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Leandro Pereira
fa92bfe3c1 drivers: gpio: gecko: GPIO driver ignores pull-up/pull-down settings
Fixes #4395.

Coverity-ID: 178059
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-24 08:49:41 +02:00
Maciej Debski
38b5d3c17e drivers: gpio: provide support for stm32f0.
Fixes #3923

Signed-off-by: Maciej Debski <maciej.debski@rndity.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-10-23 12:31:47 +02:00
Christian Taedcke
158b635b57 drivers: gpio_gecko: Add gpio driver for Silabs EXX32 MCUs
Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2017-10-10 11:56:47 -05:00
Leandro Pereira
5f22dab17a esp32: Prefix ROM routines with esp32_rom_
Also provide their prototypes in `soc.h`.  This should help
readability, since some ROM functions, with their names as provided by
Espressif, have sometimes the same prefix as Zephyr APIs.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
Leandro Pereira
095424c416 drivers: gpio: esp32: Configure GPIO drive strength
Configuring an open drain driver is required by the I2C driver,
but the GPIO driver didn't support setting the drive strength.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
Leandro Pereira
fd25931228 drivers: gpio: esp32: Use PIN_FUNC_GPIO definition from ESP-IDF
PINMUX_FUNC_A is set to 0, which coincides with the GPIO function in
many of the ESP32 pins.  Use PIN_FUNC_GPIO by default inside the
GPIO driver, however, so the correct function is always selected.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
Anas Nashif
8920cf127a cleanup: Move #include directives
Move all #include directives at the very top of the file, before any
code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 12:41:07 -04:00
Leandro Pereira
3d48ce8011 drivers: gpio: esp32: Properly convert interrupt triggering mode
Masks for level- and edge-triggering levels are 0, so the following
check will be always true:

    if ((flags & GPIO_INT_ACTIVE_LOW) == GPIO_INT_ACTIVE_LOW)

Invert the evaluation order, by checking the masks that are not 0
first.

Jira: ZEP-2557
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-23 10:28:59 -04:00
Leandro Pereira
b4bfdaa31b drivers: gpio: esp32: Declare data struct only for enabled ports
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-23 10:28:59 -04:00
Leandro Pereira
d52de29fba esp32: Fix redefinition of BIT() macro
Esp-idf defines the BIT macro that is also defined in Zephyr's
misc/util.h.  Fix the issue by including the esp-idf headers first, so
that a check in util.h won't redefine the macro if it's already
defined.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-19 07:50:18 -04:00
Gil Pitney
4f67a6c76d cc3200: Remove TI cc3200 SOC and LaunchXL board support
Per ZEP-1958, Phase 2 of adding CC3220sf LaunchXL support,
was to "deprecate the CC3200 launchxl support in Zephyr
(redundant to the CC3220)."

Effectively, the CC3220 SOC replaces the CC3200.

This patch removes the following:
* the imported CC3200 SDK
* CC3200 SOC, board, DTS files.
* adjusts other files where cc3200 was mentioned.

Also, it fixes explicit references to CC3200 in generic
CC32xx driver files.

Jira: ZEP-1958

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-08-15 11:02:48 -05:00
Leandro Pereira
c0c79a8041 drivers: gpio: esp32: Add ESP32 GPIO driver
This provides basic GPIO support, with interrupts, and the ability to
read and write to ports on a pin-by-pin basis.

Jira: ZEP-2286
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Savinay Dharmappa
0b18f6dd39 drivers: gpio: Fix Coverity static scan issues
patch fix the dead code issue reported by coverity static scan
for gpio driver of cc2650 TI SOC. CC2650_IOC_NO_PULL macro
is defined Zero, bitwise and with any value would result to
zero,because of which only false condition of if is evaluated
but not the true condition.

Jira ZEP-2469.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-08-08 09:42:14 -05:00
Anas Nashif
09bcd8ee74 Kconfig: make all syslog variables depend on SYS_LOG
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-04 14:34:54 -05:00
Leandro Pereira
732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Erwan Gouriou
b452442256 drivers: pinmux: stm32: Clean up after rework
Following rework of pinmux driver for whole stm32 family,
remove call to stm32_get_pin_config which is no more
used.
Include dt-bindings stm32-pinctrl.h file to ensure coherency
between dts files and pinmux driver.
Due to change of "port" from enum to a series of define
(enum not accepted as dt binding), rework gpio_stm32_config
declaration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-07-26 15:16:52 -05:00
Savinay Dharmappa
be55f6644e drivers: gpio: Fix Coverity static scan issues
patch fix the dead code issue reported by coverity static scan
for gpio driver of cc2650 TI SOC. GPIO_DS_DFLT_LOW macro
is defined Zero, bitwise and with any value would result to
zero,because of which only false condition of if is evaluated
but not the true condition.This is a fix for jira ZEP-2355.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-07-20 11:50:51 -05:00
Geoffrey Le Gourriérec
0a89e00080 cc2650: Add GPIO driver.
Signed-off-by: Geoffrey Le Gourriérec <geoffrey.legourrierec@smile.fr>
2017-06-16 16:18:12 -04:00
David B. Kinder
9faa5f2033 doc: spelling fixes in Kconfig files
regular spelling check on Kconfig.* files

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-12 19:40:51 -04:00
Andrew Boie
2d4a36fc1c drivers: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Erwan Gouriou
9413c8ba4d stm32: clean up after completion of transition to ll Clock control
Following migration of stm32f1xx series clock control driver to
STM32Cube LL API, cleanup stm32 code base in order to take into
account that this is the only clock driver available for stm32
family.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-06-02 14:11:13 -04:00
Erwan Gouriou
78d74f4031 drivers: gpio stm32: set the ground for stm32f1x ll clock driver
Before introduction of LL based clock control for stm32f1xx series,
prepare gpio driver to provide useful definition for new API

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-06-02 14:11:13 -04:00
Piotr Mienkowski
ee66ee6c34 arch: sam3x: Use ASF library
This patch converts Atmel sam3x MCU series to use register
header files from Atmel Software Framework (ASF) library.
By using ASF different Atmel SAM MCU series can use common
device drivers.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-05-19 10:06:48 -04:00
Andrew Boie
f21129180d gpio_sch: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Justin Watson
558281b096 arch: sam3x: update Kconfig options after move to SAM SoC family tree
The files for the Arduino Due needed to be updated to use the new
configuration when the SoC moved from the atmel_sam3 directory to
the atmel_sam/sam3x directory.

Jira: ZEP-2067

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-03 13:51:37 -04:00
Erwan Gouriou
242ed389a3 stm32f4: Clean references to stm32f4 specific clock control
Following activation of stm32 common clock driver for stm32f4 series
remove references to stm32f4 specific driver.

Change-Id: I372a0ea046007bcb34944d6b2b8880077583b1d3
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:26:11 -05:00
Erwan Gouriou
fda01e52c2 drivers: clock control: Provide LL based clock control for stm32f4 series
This commit enables STM32Cube LL based driver for stm32f4 series.
This generic driver provides a unified API to clock driver for all
stm32 series.
LL API allows driver to be lightweight and to keep genericity across
stm32 family to ease further devlopment and maintenance.

Change-Id: Ie31ae8f433313787f9c9eda77de41925721d54dd
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:06:41 -05:00
David B. Kinder
93e4d7258d spell: fix Kconfig help typos: /boards /drivers
Fix misspellings in Kconfig help text

Change-Id: I3ae28a5d23d8e266612114bc0eb8a6e158129dc7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 21:31:30 +00:00
Tomasz Bursztyka
d2b5853cd9 drivers/gpio: Use ifdef relevantly in DW drivers
Change-Id: I580ca0aeccd7b2c1117fc71571dac9faa5baf8b0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 16:34:53 +00:00
Kumar Gala
ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Kumar Gala
789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
David B. Kinder
896cf7a00a spell: fix doxygen comment typos: /drivers
Fix doxygen comment typos used to generate API docs

Change-Id: I6fd5051c99bdcc731740c92001e525349c254d85
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-19 10:45:34 -07:00
Gustavo Denardin
4951340829 arm: GPIO driver modifications for MKL25Z soc support
The MKL25Z soc do not support irqs in PORTB, PORTC and PORTE.
This is a patch to not enable irq if such ports are enabled.

Change-Id: I7b0b308504fcea47714fee8f2913baf336c4aa7d
Signed-off-by: Gustavo Denardin <gustavo.denardin@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 05:56:53 -05:00
Carles Cufi
81c52a15d2 drivers: gpio: nrf5: Fix interrupt enable and disable
Correct the way interrupts are enabled and disabled using the INTENSET
and INTENCLR registers, which ignore all 0s written to them and are both
positive registers.

Change-Id: I052548b0255d9d5ae36b2a708ed1968ae3ab1d06
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-14 01:51:43 +00:00
Jon Medhurst
e7391e3068 gpio: Add gpio_mmio32 driver to access basic 32-bit i/o registers
It is envisaged that this will be used by SoC or board code to make
available fixed purpose memory-mapped i/o registers to the rest of the
system which normally expects to use GPIO devices, e.g. for driving chip
select lines, LEDs or reading button states.

As such, the driver code doesn't provide a kconfig based configuration
mechanism, instead SoC/board code can hard-wire the devices it wants
with something simple like:

GPIO_MMIO32_INIT(misc_reg1, "MISC1", 0x12345678, 0xffffffffu)

Then, for example, if bit N of the register at 0x12345678 is wired up as
an SPI device chip select line, the SPI driver could be configured to
use pin N of the "MISC1" GPIO driver and not need any other board
specific code.

Change-Id: Ib02fcbab73fcf9637e25834db060fb3108626f47
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-04 17:55:13 -05:00
Jean-Paul Etienne
bb164f26ea gpio: added support for the SiFive Freedom E310 GPIO driver
Change-Id: If299b6a5b0cd9e6c181d552d78989840d5a2fbe9
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:25 +00:00
Florian Vaussard
87960944d2 gpio: stm32: Add support for ports I to K
Add support for GPIO banks I to K that can be found on some high-density
STM32F4 products.

Change-Id: I2cb65ed4d4a2282f7d17478cb1fcdd65dffe71b0
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-03-27 09:05:57 -05:00
Florian Vaussard
52d663d49d gpio: stm32: Use macro to simplify registration
The registration of each GPIO bank differs by only few details. These
differences can be factorized in order to create a generic registration
macro.

This has several advantages:
- Less code
- Easier to add new banks
- Less work to add support for new STM32 families

The diff stat speaks for it-self: 26 insertions(+), 92 deletions(-)

Change-Id: I674752fda5ee3caefb815ccf070a1b636b16cf85
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-03-27 09:05:57 -05:00
Paul Sokolovsky
203dec3b69 gpio: mcux: Revert to older GPIO device names as were used for Kinetis.
These are more consistent with naming used by other ports (uppercase,
short), and some existing software relies on them to be exactly those.
This change is a follow up to the discussion on the Zephyr mailing
list, calling to establish consistent naming conventions for Zephyr
devices, and is a small step in that direction.

Change-Id: I013b0505b579c6337aeb6fbef2423216ca6cf046
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-02-28 11:18:32 +00:00
Carles Cufi
6a23e82186 drivers: gpio: Set the line to the pull by default
To avoid glitches in the lines, set the line to the pull specified
before actually changing the line's direction (in/out) so that no
unexpected pulses are generated.

Change-id: I4fe133c5b82f2a1bfa473341612c2c7eca9027b8
Signed-off-by: Krzysztof Chruściński <Krzysztof.Chruscinski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-02-27 21:02:19 +00:00
Erwan Gouriou
0aea704462 gpio: enable ports F G (and H) for stm32f1xx (stm32f4xx)
Some GPIO ports activation where missing since not used
on available soc/boards.
Since stm32 family increases, activation of these ports
should be made available.

Jira: ZEP-1551

Change-Id: I612d135b28ef255bc771599e33796671ff81d0ac
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-22 18:09:11 -06:00
Iván Briano
867e61cbf3 drivers gpio: Fix disabling of interrupts for QMSI shims
When a GPIO pin is configured, the shim driver will first read the
current values in the controller registers to keep the other pins from
changing their configuration. After that it sets the bits for the
corresponding pin accordingly.

When the flag to enable interrupts is passed to the function, the
corresponding bits are all set properly, but no changes are made if
interrupts are not requested. This makes it impossible to disable
interrupts for a given pin once they've been enabled.

Fix it by always resetting the interrupt enabled bit when they have not
been requested. Other values can be left untouched as they won't have
any effect.

Jira: ZEP-1717

Change-Id: I30e97bb06d966291e23d0c66ddf39bce615c287b
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2017-02-15 00:25:32 +00:00
Erwan Gouriou
726d4dc437 drivers: stm32: clean up after stm23cube based clock control
After activation of cube based driver support on L4 and F3 series,
this commits performs the clean up of F3 and L4 relative code to
native clock control drivers.
Indirectly, it makes pwm driver supported de facto on F3 series

Change-Id: Idac17103a9b5ef6eab540719343cc8f5865f15fa
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou
375b7171b4 gpio: update stm32 gpio to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update GPIO driver to support it.
Once supported across the whole family, we clean up will be done.

Change-Id: If50cb580cb01dc1d38557e54f19a8260feaa504e
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Juan Solano
ee623d21de drivers: Remove unnecessary CONFIG_SYS_POWER_DEEP_SLEEP
This commit removes unnecessary CONFIG_SYS_POWER_DEEP_SLEEP protection
in shim drivers as QMSI 1.4 has introduced empty context save/restore
functions that can be called in Quark D2000, therefore keeping common
code at the shim driver level for Quark SE and D2000.

Change-Id: Ia2a466327f999668c6511c0193014e9151bff6ae
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
2017-02-10 16:27:32 +00:00
Luiz Augusto von Dentz
2e444cb34c drivers: Convert FOR_EACH macro instances to use CONTAINER
Change-Id: Ifc08d39fe84f522e071d3b9e32479798bbd89c6c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-10 16:16:16 +00:00
Marcus Shawcroft
fd604a3a9a gpio: Error unsupported access_op consistently.
Several GPIO device drivers support only one of the two possible
access_op modes and return an errno error code for the mode they do
not support.  Use the same errno code across all drivers.

Change-Id: Ic01ce9dee7fb2405d254c60cebee22053c803270
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-08 13:31:09 +00:00
Marcus Shawcroft
48831a9d4c gpio: Error pin out of range consistently.
Several GPIO drivers detect an out of range pin number and return an
errno error code.  Use the same errno code across all drivers.

Change-Id: I0e2949432d6845d12c37064c78f9c228b8e8e45a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-08 13:31:08 +00:00
Marcus Shawcroft
c35b90890a gpio: Error GPIO_INT with GPIO_DIR_OUT consistently.
Several gpio drivers consider GPIO_INT with GPIO_DIR_OUT to be illegal
and return an errno code.  Use the same errno code across all drivers.

Change-Id: I1594df0cfdf96194685c83c34dff36261896f2de
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-08 13:31:08 +00:00
Marcus Shawcroft
7803123d3b gpio/nrf5: Implement port read and write
Implement the missing port read and write behaviour.

Change-Id: I0928379eddf81d806a0ae6b75a1ea2993c3a28ff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-06 13:15:50 +00:00
Marcus Shawcroft
142bce58a2 gpio/nrf5: Fix GPIO_ACCESS_BY_PIN behaviour
Adjust the implementation of gpio_pin_read() to return 0 or 1 rather
than 0 or 2^pin.  This ensures consistent behaviour with other gpio
device drivers, and conforms to the behaviour documented in gpio.h by
the previous patch.

Change-Id: Ia02aa68105a406f355d16a3f9b0550f948658483
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-06 13:15:50 +00:00
Marcus Shawcroft
8324e93812 gpio/nrf5: Support drive strength configuration.
Extended the nRF5 GPIO driver to support configurable pin drive
strengths.

Change-Id: I59c42b8a69cc37b594c2388b892d3accd7b19807
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-25 08:47:21 +00:00
Maureen Helm
82eaa7cd5b gpio: serial: Fix NXP copyright
The NXP copyright should not have 'Semiconductors, Inc' in it.

Change-Id: I6e290146d49bf22d1d40b7fa764bb53b6b122303
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:53 -06:00
Michael Scott
fe99cfe630 drivers: gpio: stm32: fix CONFIG_SOC_SERIES_STM32F4X build break
The commit c90e4d063be0ff5f47df45ca8500eff8518c5d25 changed
line 216 in drivers/gpio/gpio_stm32.c:
-elif CONFIG_SOC_SERIES_STM32F4X
+#elif /* CONFIG_SOC_SERIES_STM32F4X */

This causes the following compiler error:
zephyr/drivers/gpio/gpio_stm32.c:218:39: error: #elif with no expression
 #elif /* CONFIG_SOC_SERIES_STM32F4X */
                                       ^

Change-Id: Ie8b124931e333aa7860e6db22f5c259670e29833
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-23 15:15:53 -06:00
Adam Podogrocki
f23492a059 gpio/stm32: provide GPIO driver implementation for STM32F3X family
Implementation includes adding some defines in the pinmux,
adjusting gpio driver to specific defines for STM32F3X family,
adding specific functionality in the F3X SoC definition.

Change-Id: I465c66eb93e7afb43166c4585c852e284b0d6e67
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Kuo-Lang Tseng
faecff7e88 drivers: QMSI GPIO: simplify driver reentrancy code using IS_ENABLED macro
This is one of the series of patches that simplifies the driver
code by using the IS_ENABLED macro. This removes the need of the
const variable and the three wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: I5102e8674663ddbfc65220de72c8b778a9ec726c
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-01-20 01:46:08 +00:00
David B. Kinder
ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Jean-Paul Etienne
67dcd1b0b0 gpio: added support for the pulpino GPIO controller driver
tested with blinky, button and disco apps

Change-Id: I4b520d4f3e42c97e4a723747ce4a6c67ca9f1d18
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:57:03 +00:00
Maureen Helm
7682a0d7ca gpio: Remove the k64 gpio driver
Now that we have a more generic mcux gpio driver that can be used across
multiple Kinetis SoCs, remove the specific k64 gpio driver.

Jira: ZEP-1394
Change-Id: I177f96a75e441b70c523e74e99f1b7a54eac6b0e
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:27 -06:00
Maureen Helm
d71f246855 gpio: Introduce new mcux gpio driver
Adds a new mcux gpio driver that can be used for k64 and other Kinetis
SoCs. This driver uses mcux CMSIS register accesses to the GPIO and PORT
modules. Some of the logic from the k64 gpio driver was reused and
refactored (mainly flag parsing and callback handling).

Jira: ZEP-1394
Change-Id: If5e9390861c181ec555dce6569b14debb729526a
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:27 -06:00
Anas Nashif
f6e039062a kernel: remove dependency on CONFIG_NANO_TIMERS/TIMEOUTS
Remove legacy option and use SYS_CLOCK_EXISTS where appropriate.

Change-Id: I3d524ea2776e638683f0196c0cc342359d5d810f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 18:09:52 +00:00
Qiu Peiyang
ed0e5e6fd5 driver: gpio: remove nano_timer code
drivers/gpio/gpio_pcal9535a.c defines a nano_timer,
but never uses it. So delete it.
gpio_sch.c uses a k_timer, but gpio_sch.h defines a
nano_timer. So change the variable poll_timer to
type k_timer.

Jira: ZEP-1525

Change-Id: I884e4703c1ace61da5be7d9c63e58e7c3bce7f68
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-07 12:16:06 +00:00
Anas Nashif
c1347b4730 kernel: replace all remaining nanokernel occurances
replace include <nanokernel.h> with <kernel.h> everywhere and also fix
any remaining mentions of nanokernel.

Keep the legacy samples/tests as is.

Change-Id: Iac48447bd191e83f21a719c69dc26233216d08dc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 14:34:43 -05:00
Sergio Rodriguez
4b288999b2 drivers: gpio_atmel: Fix erronous if statement
The GPIO_INT_LEVEL value is zero so the mask assignement
is never executed. Using the bit complement GPIO_INT_EDGE
the proper mask is assigned

This issue was reported by Coverity

Coverity-CID: 151966

Change-Id: Iacfeb6466388023bd6123ba86280aa9ca15f34e4
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-24 13:52:51 +00:00
Anas Nashif
3d8e86c12c drivers: eliminate nano/micro kernel usage
Jira: ZEP-1415

Change-Id: I4a009ff57edb799750175aef574a865589f96c14
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-21 18:45:02 +00:00
Sergio Rodriguez
b52080749f drivers: gpio_cmsdk_ahb: Fix erronous if statements
The GPIO_INT_LEVEL and GPIO_INT_ACTIVE_LOW values are  zero so the
statements are never executed then is better use the bit complement
masks

This issue was reported by Coverity

Coverity-CID: 157586

Change-Id: Ic8b20660a991dd3d0c71248f84c917e5ce5c3c7c
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-21 13:49:40 +00:00
Carles Cufi
129a2f0bb6 gpio: nrf5x: Add support for GPIOTE and GPIO callbacks
To support interrupt-based GPIO callbacks in the nRF5x series one needs
to use the GPIOTE module, which has a series of channels that can be
programmed to trigger interrupts on level changes.
This commit adds basic support for the GPIOTE module within the nRF5x
GPIO driver, as well as callback support in order for basic buttons and
switches to work.

Change-Id: I9ae600f894372ad42b09a18cc38a90fc29abb0df
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-20 09:14:49 -06:00
Gil Pitney
f18cced2c1 cc3200: Add a GPIO driver for the TI CC3200 LaunchXL
The pinmux configuration is done during board initialization.

This was validated using the following Zephyr apps:
 - samples/basic/blinky
 - samples/basic/disco
 - samples/basic/button

All 4 GPIO ports are supported.

Change-Id: If8599a23c1d56cfd678a6e2e5339f7e093c6061a
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2016-12-20 09:14:48 -06:00
Anas Nashif
a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Vincenzo Frascino
8ca930a5c0 gpio: Enable clock control in Beetle GPIO driver
This patch enables the clock control interface into the ARM LTD
Beetle GPIO driver.

Jira: ZEP-1300
Change-Id: I576767b68a8e4aa965d34716528df3bb4e837d73
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong
16df88e678 stm32l4: add gpio support for l4
Add the support for all the GPIO port of the L4.

Change-Id: Id365e17223cd5c49443df9fb6b96a3c4f204f523
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:31:45 -06:00
Flavio Santes
b04cdcd6e6 drivers: Remove legacy nanokernel.h include
This commit replaces the nanokernel.h include by kernel.h.

Change-Id: Ib42fbf2d9f77a73c0831f569b3dbbfb342ea2e1d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-04 14:59:37 -06:00
Flavio Santes
290a2aba88 drivers: Remove unused parameter warning
This patch fixes the unused parameter warning found at the
following drivers:

- adc_ti_adc108s102.c
- gpio_dw.c
- gpio_k64.c
- exti_stm32.c
- pinmux_dev_atmel_sam3x.c
- pinmux_dev_k64.c
- pinmux_dev_stm32.c
- uart_atmel_sam3.c

Change-Id: I76a17d19176683130d57e8f48e5195e7785060f3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-03 14:49:08 +00:00
Sergio Rodriguez
6b04e0669a drivers: gpio_dw: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151978

Change-Id: I93ec3319a3f18d564c961a5cbd9dcc9c60efbeb7
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-18 02:04:36 +00:00
Sergio Rodriguez
cd63c74bbd drivers: gpio_atmel: Fix erronous if statement
The GPIO_INT_ACTIVE_LOW value is  zero so the mask assignement is
never executed. Using the bit complement GPIO_INT_ACTIVE_HIGH the
proper mask is assigned

This issue was reported by Coverity

Coverity-CID: 151966

Change-Id: Ibc7d2e4c3ebee249b5ab9719f8177cc14c0d1d33
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-18 02:04:20 +00:00
Sergio Rodriguez
6c393fa393 drivers: gpio: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity (CID 150821).

Change-Id: I6c0e9fe405cbd3e35454a81754fa0b1c721691f0
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:28 +00:00
Sergio Rodriguez
23a0f6c918 drivers: gpio_ss: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151833

Change-Id: Ie952d6f50c0383d5631325b69e8e8b234c67c4b8
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:24 +00:00
Sergio Rodriguez
97c5020079 drivers: gpio_k64: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151834

Change-Id: I033e368b2e91d888f2e8a797490df757513c3906
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:19 +00:00
Vincenzo Frascino
add1b55dca gpio: Cleanup DW gpio driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the gpio_dw_isr declaration.
* Adds guards to the header files.

Change-Id: I1ae70868f0bda97891cbeb494e5efba1bd537aa1
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:01 +00:00
Vincenzo Frascino
0ff548a0e0 gpio: Cleanup Kconfig for K64F
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.

Change-Id: I4c8df0999f92a834d4023ce5856a2a6c39797c00
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:01 +00:00
Vincenzo Frascino
2a8eb46f5c gpio: Cleanup Kconfig dependancy for nRF5X support
This patch removes a redundant "depends on" from the gpio Kconfig for
nRF5X family.

Change-Id: I28ac15b58839e05f47ade81bef66a03a0a44bebd
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:00 +00:00
Vincenzo Frascino
9e7fec0ca4 gpio: Cleanup Atmel SAM3 gpio driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the gpio_sam3_init declaration.

Change-Id: If5c8a1822d6c116ea34d0f220f3e5fa359b6fa18
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:00 +00:00
Anas Nashif
cf054a2665 drivers: gpio_sch: use unified kernel APIS
Use unified kernel APIs and align syntax after function name changes.

Change-Id: I028f4faeaf33e28197d5f705063459188272027d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-13 13:53:52 +00:00
JuanX Solano Menacho
866d9c9c2d gpio_qmsi_ss: Use qm_ss_gpio_save/restore_context APIs
This commit updates the gpio_qmsi_ss driver by adding save/restore
context functionality for power management, using the corresponsing
QMSI APIs.

Jira: ZEP-665

Change-Id: I5d8b6050f5b099678b7e6d9144907ea2ce2dda4b
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-11 23:33:19 +00:00
Vincenzo Frascino
e36c04afe1 gpio: Add ARM CMSDK (Cortex-M System Design Kit) AHB GPIO driver
The driver is currently used only by the ARM Beetle platform.

Jira: ZEP-1245
Change-Id: I6611edd7486a3c6d82d66a9a96c5d4860dad1539
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-11 20:39:52 +00:00
Baohong Liu
180887a305 drivers: gpio: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: Ic638f28555cb9c8a23b365e39368062c37d7716f
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 01:38:53 +00:00
Andrew Boie
0b474eef9c kernel: deprecate old init levels
PRIMARY, SECONDARY, NANOKERNEL, MICROKERNEL init levels are now
deprecated.

New init levels introduced: PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL
to replace them.

Most existing code has instances of PRIMARY replaced with PRE_KERNEL_1,
SECONDARY with POST_KERNEL as SECONDARY has had a longstanding bug
where the documentation specified SECONDARY ran before the kernel started
up, but actually ran afterwards.

Change-Id: I771bc634e9caf7f17dbf214a270bc9967eed7d32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-09 17:59:44 +00:00
Tomasz Bursztyka
3fb51f6f46 drivers: gpio: Remove mmio driver
It's unused anywhere and unlikely to be in the future.

Change-Id: I57926e91da7d31ef6ddda4f86e6dac103dbfa176
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-11-07 07:20:04 -05:00
Marcus Shawcroft
68cf17171d drivers/gpio_stm32: Make driver_api structure const.
Change-Id: Ifdc5e6aabde3f06305f9d8ca2063b09931c126c4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-04 00:51:16 +00:00
JuanX Solano Menacho
356dcdf383 gpio_qmsi: Use qm_gpio_save/restore_context APIs
This commit updates the gpio_qmsi driver by removing the temporary
Zephyr save/restore context implementation and using the new QMSI APIs.

Jira: ZEP-999
Change-Id: Ic7b80a8f86baa7a6be11c93bbdebb18a102b0221
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:09 +00:00
Julien Delayen
bd6285a3f1 gpio_qmsi: Add get_pending_int API
For AON peripherals on Quark SE C1000, an API is needed
to retrieve the interrupt status after wake up.
This enables the application to know the wake source before
enabling again the interrupts.
Add this API to the gpio as this is a wake event
on Quark SE C1000.

Jira: ZEP-1188

Change-Id: Icc4aa6617bf18402b7e5dc3aab779ec2964e1c5b
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-11-03 21:30:11 +00:00
Iván Briano
f028973f43 gpio qmsi: Enable SoC level GPIO to work on ARC too
The GPIO and AON GPIO ports are available to both the x86 and ARC
cores, but the driver always assumed only the x86 at the time of
configuring interrupts.

Use the available macros to set the correct values independently of
which core it's being built for.

Jira: ZEP-1030
Change-Id: I310afcc48780fbe1cac9dc3368a6de11bd797fda
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:56 +00:00
Iván Briano
34cf9773b1 gpio qmsi: Differentiate between the SoC GPIO and SS GPIO
The SoC level peripherals are accesible by both cores, while the SS
ones are only available to the sensor subsystem. Since the ARC core can
make use of both drivers at the same time, we need to be able to
differentiate their configuration values somehow.

Also disable the SoC GPIO for the ARC by default, as it still needs
more changes to be usable.

Jira: ZEP-1030
Change-Id: Ic5415c404ecd32a3e560467b6f5eaa873a515d72
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:52 +00:00
Iván Briano
3139a10017 gpio qmsi: Remove unnecesary callback wrappers
The callback from the QMSI driver now can take a data pointer to pass
to the given function, so use that to pass the device to our callback
instead of defining one function for each supported port.

Change-Id: I82d863314e0443b7c4a12d4a9ad763b9634ca8e2
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:26 +00:00
Iván Briano
0792e417e1 gpio qmsi: Remove stale comments
Change-Id: Ic69343019a619263c3d3b4ba378476504a33bec2
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:26 +00:00
Iván Briano
0094ab228d ext qmsi: Update to QMSI 1.3 release
Update the QMSI drop we maintain in Zephyr, and fix the build where
needed:

- QM_SCSS_INT is renamed to QM_INTERRUPT_ROUTER;
- every member of QM_INTERRUPT_ROUTER was renamed as well;
- QM_IRQ_* renamed too, mostly added _INT at the end;
- some isr functions were renamed to keep their names consistent;
- build for x86 needs to define QM_LAKEMONT, as QM_SENSOR was for ARC.

Change-Id: I459029ca0d373f6c831e2bb8ebd52402a55994d1
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-31 13:26:06 +00:00
Ricardo Salveti
cf59106433 gpio: stm32: add support for STM32F4
Implements MCU-specific GPIO input interrupt integration.  Added
definition of System configuration controller as well as its needed by
the GPIO code.

The SYSCFG controller is used for system-specific configuration such as:
 - remap the type of memory accessible at address 0x00000000
 - manage the external interrupt line connection to GPIOs
 - configure the I/O compensation cell

Change-Id: Id2ebfbd1b21e77be76406d1cd6cd5d4989e9e2fa
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-28 18:58:03 +00:00
Marcus Shawcroft
914432853a driver/gpio/qmsi: Limit name space, add static.
Change-Id: I77133e665cdc4995db83302389ecf64d79b08f35
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:18 +00:00
Marcus Shawcroft
925a46fd6d gpio/sch: Limit name space, add static.
Change-Id: I16563e2162b2cc9de649663d04a813ab765c3253
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:17 +00:00
Marcus Shawcroft
56319c9567 gpio/sch: Make driver_api structure const.
Change-Id: I4866aa02fe6fb8d8a6260bd01fda60c9962e89f8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:17 +00:00
Marcus Shawcroft
f35d0e6ead gpio/pcal9535a: Limit name space, add static.
Change-Id: I474bad1a44efda66cd2e324483742a257fac77e2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:16 +00:00
Marcus Shawcroft
15dbaa8e90 gpio/k64: Fix Kconfig help text formatting.
Change-Id: I8c1e155a152343eaf680be5f8385548058a95c47
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 07:02:20 +01:00
Marcus Shawcroft
7df2727545 gpio/k64: Fix type in GPIO_K64_C_DEV_NAME text.
Change-Id: Ie65c747467890d9f25dc9795c23eaf39175d14ae
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 07:02:12 +01:00
Ricardo Salveti
a9f2061dfb gpio: stm32: introduce alternative function config
STM32F4 requires the alternative function config to be set, so just
initialize that as part of the gpio configure call.

Change-Id: I33a4a8efec59c5ebe7dc3f3580f0dd2bf7ded7f4
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-10-27 14:48:43 +00:00
Marcus Shawcroft
27f4947812 driver/gpio/dw: Limit name space, add static.
Change-Id: I3b1f5497896f683072c2bc473d348cd19aca3c5d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:06 +00:00
Marcus Shawcroft
c8d6ff0474 driver/gpio/sam3: Limit name space, add static.
Change-Id: Ie34094e3ed8041b2b2c44e122f71d5f69a7ce0ad
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:06 +00:00
Marcus Shawcroft
926c553acb drivers/gpio_qmsi_ss: Make driver_api structure const.
Change-Id: Icfd9675c4bd9572d31b62d12e25be92f5c3104d8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:26 +00:00
Marcus Shawcroft
1b54d26a33 drivers/gpio_qmsi: Make driver_api structure const.
Change-Id: Id123c49a387818f795b1c967463a7d14cc880efd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:25 +00:00
Marcus Shawcroft
3385b7a074 drivers/gpio_pcal9535a: Make driver_api structure const.
Change-Id: Ifed95143422537ad82bfaa907874b1e33e782fb5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:25 +00:00
Marcus Shawcroft
ce1406ffbb drivers/gpio_nrf5: Make driver_api structure const.
Change-Id: Ib7d3bbf02ff32972d0e86f0d24649281480603ae
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:25 +00:00
Marcus Shawcroft
e0fed5f219 drivers/gpio_k64: Make driver_api structure const.
Change-Id: I39fd54c0e5daaa40a28a61dba51e22c649608c7b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:24 +00:00
Marcus Shawcroft
19129d6e96 drivers/gpio_dw: Make driver_api structure const.
Change-Id: I17199a0408f4a6bb8d7d647cf4ed54c6b8a91245
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:24 +00:00
Marcus Shawcroft
b592cdf685 drivers/gpio_atmel_sam3: Make driver_api structure const.
Change-Id: I7294efcc0251bfe31add9233f07a2584f2edb49a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:23 +00:00
Ricardo Salveti
f2fb64b075 drivers/gpio/nrf5: change default IRQ_PRI
Make default value compatible with both nRF51 and nRF52.

Change-Id: I65dafbdf8518103becdd7388e9c0195ef1c4460d
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-22 01:25:55 +00:00
Marcus Shawcroft
b33e59dc02 gpio: stm32: Make driver config_info structure const.
Change-Id: I05c844794c29225a6dd6462d512d470a687ac3a5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:49 +00:00
Marcus Shawcroft
c351093177 gpio: sch: Make driver config_info structure const.
Change-Id: I04598162c92991f8e98343746802a82c98f8eb83
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:49 +00:00
Marcus Shawcroft
a40c211ed3 gpio: qmsi_ss: Make driver config_info structure const.
Change-Id: Ibfcb3e7f78f4ac777a72647446cebec1d26a116f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:48 +00:00
Marcus Shawcroft
213988873b gpio: qmsi: Make driver config_info structure const.
Change-Id: Ia2d840685db19493a0d2eee874b81dd968ee93b3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:48 +00:00
Marcus Shawcroft
cbbc1c4da2 gpio: pcal9535a: Make driver config_info structure const.
Change-Id: Id484d8d3fd9212b82f6d623201506268759ccfc8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:48 +00:00
Marcus Shawcroft
4c727dbc10 gpio: nrf5: Make driver config_info structure const.
Change-Id: Ie831403c15f344f6bf83c7b00ca0c73185053f4d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:47 +00:00
Marcus Shawcroft
589a77f57a gpio: dw: Make driver config_info structure const.
Change-Id: Ib80fa277bba38c05e00817e6e6071c0b4db38a66
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:47 +00:00
Marcus Shawcroft
1653d90cbf gpio: sam3: Make driver config_info structure const.
Change-Id: I366a8096e61f2c9f6481fdbb83ba4257c94bddae
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:46 +00:00
Marcus Shawcroft
24fe3a0b3d gpio: k64: Make driver config_info structure const.
Change-Id: Ib471bbe2de7de232331bba97570655b262bdac81
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:44 +00:00
Marcus Shawcroft
8564334254 gpio/dw: Move RW objects in config_info to driver_data
PCI enumeration modifies pci_dev and base_addr at driver
initialization therefore these objects move from config_info to
driver_data in preparation for config_info becoming const.

We drop code that attempts to update irq_num based on PCI enumeration
because the interrupt found by PCI enumeration must always be the same
as the statically configured IRQ number.

Change-Id: Ibfefa851d2836d524b8151ed0108ecf9de2cd3a3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-19 12:10:58 +00:00
Ricardo Salveti
17a62dd268 exti: stm32: fix driver data handling
Since dd5e90ec the device_get_binding call returns NULL unless the
driver_api is set by the driver. Since the exti driver only uses an
internal struct to store the callbacks, remove the need for the device
binding call from other drivers (e.g. gpio).

Change-Id: If0b733c27754108118d87ef02640311f0535ab57
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-10-19 11:56:00 +00:00
Maureen Helm
342e09c463 pinmux: Rename frdm_k64f pinmux driver to k64
The k64 pinmux driver can be used for any k64 board, not just frdm_k64f,
therefore renaming the driver accordingly.

Change-Id: I45e96d4a5ff6aa859d0f57fe098e44a8ae5283d1
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-18 21:42:31 +00:00
Marcus Shawcroft
2d1678c632 gpio/sam3: Move RW data from driver config to runtime.
The callback list within the driver config is updated dynamically
hence the list itself cannot be const.  Create a runtime context
driver data structure and relocate the callback list to the new
structure.

Change-Id: Ied20846e6a78e43967239afa7797456a9abd8548
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:19 +00:00
Marcus Shawcroft
4e81f369c7 gpio/qmsi_ss: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I31abd3d5606b2b750da86d00e938db3988696c7f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:56 +00:00
Anas Nashif
84c9db39e7 gpio: reduce Kconfigs and use consistent name for GPIOs
Using AON for GPIO kconfigs is very specifc to quark se, there
is no need to make this special for this platform. Use the
existing scheme instead.

Change-Id: I946431490380dc0f537d6056277a94c9c9c80fed
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 16:15:07 +00:00
Anas Nashif
706f1b8bd8 drivers: gpio: i2c: make logging depend on SYS_LOG
Change-Id: Ia6af28598cf979f20e04cd2c74f3e75f4ae6630b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 14:15:24 +00:00
Marcus Shawcroft
ca26e7bb13 gpio/k64: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I6562816828734da9c60fdfcd2ce510f55ed70416
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft
f686da5c11 gpio/qmsi: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I61733f055ac16997da93cc56fb46fb7a7436b473
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft
548e848c31 gpio/stm32: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I29d12bd240d9ff3279e5c13852835f2a8cc6abec
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:42 +00:00
Marcus Shawcroft
f8ec3c8d33 gpio/sch: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I0f156346cc7ac5e1c317c3c6d07a53abb0b453a9
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:39 +00:00
Ricardo Salveti
d25d62a0e9 gpio/nrf5: set and clear just the specific gpio pin
Don't use the previous reg value when setting up just one specific pin,
as it can have a side effect on other gpio pins.

Change-Id: I60e69950a72446a6fa7087b13dbcecf6ae4b15e4
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-06 15:50:10 +00:00
Ricardo Salveti
bc1affbfa2 drivers/gpio: nrf5: Use generic GPIO base naming
NRF_GPIO_BASE can be used by both the nrf51 and nrf52 families, as it
gets defined by the nrf5x.h header files.

Change-Id: I8e6b265d9ce94551389ca170f105a53c88d58c68
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-06 04:09:29 +00:00
Anas Nashif
58002193e9 drivers: gpio: reuse gpio Kconfigs for sensor subsystem
No need to create new Kconfig that do exactly the same, just
reuse those from the main QMSI driver.

Change-Id: I965055f36845ac0464e4a383b0d05c3ae35c0015
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 01:00:46 +00:00
amirkapl
c490219d1e power_mgmt: Update sample and drivers according to new pm device API
Update the power sample and drivers with the new device driver power
management API using the existing logic

Jira: ZEP-954
Change-Id: Idd94232e458767635973e94e9fc673c01612c1e2
Signed-off-by: Amir Kaplan <amir.kaplan@intel.com>
2016-09-22 00:23:43 +00:00
Anas Nashif
5363d14a9e boards: rename Quark SE Devboard to Quark SE C1000
This board now has an official name and will be available soon:

http://www.intel.com/content/www/us/en/embedded/products/quark/mcu/se-soc/overview.html

Jira: ZEP-758
Change-Id: Ia16d33722308cf81471321c3063bdc75055a4d50
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:31 +00:00
Anas Nashif
5e4b62c35c boards: rename Quark SE Devboard to Quark SE C1000 (Sensor Subsystem)
Jira: ZEP-758
Change-Id: I8ee5a2f9e4a6ecbd15214e59321bf27a502ef6ee
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:30 +00:00
Tomasz Bursztyka
86d02e01b1 gpio: stm32: Fix bug introduced by removing API 1.0 support
Bug was introduced by a6cf6038e3

Change-Id: I91ceab2ca20c4d2f70a953b56d895152a471125a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-09-14 16:16:07 +02:00
Tomasz Bursztyka
a6cf6038e3 gpio: Remove obsolete API 1.0 callback mechanism
In 1.0 you could set only one callback on the whole gpio controller. It
was impossible for another sub-system to add another callback, without
overwritting an existing one.

Such API has been obsolete for a long time and no one is using it
anymore. Thus removing it entirely.

Change-Id: I6a17fd99373dc6cef1fa2ebb421e992412d5015e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-09-14 10:51:09 +00:00
Ricardo Salveti
2bd12cfd5b gpio/Kconfig.nrf5: cosmetic fixes
Change-Id: I06eb8854cab99d8666e51867d135026a9914648a
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-08-31 00:19:16 -03:00
David B. Kinder
d748577706 doc: Fix terminology in Kconfig files for 'platform'
Completing the terminology change started with change 4008
by updating the Kconfig files processed to produce the
online documentation, plus header files processed by
doxygen.  References to 'platform' are change to 'board'

Change-Id: Id0ed3dc1439a0ea0a4bd19d4904889cf79bec33e
Jira: ZEP-534
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2016-08-18 21:17:29 +00:00
Amit Kucheria
975d92c038 soc: nrf5x: Add support to read and write to gpios
Change-Id: I9bded784c8e635a271b88a551b65b7268ea7e2d3
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-08-02 05:50:50 +00:00
Genaro Saucedo Tejada
93b9196ab9 sys_log: replace old debug macros at pcal9535a driver
pcal9535a driver is now using new system log macros and updated the
Kconfig variable to be a level rather than a bool.

JIRA: ZEP-311

Change-Id: Ic3d6c72630e66ac116c1e8954c32254677c51566
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-30 10:53:21 +00:00
Genaro Saucedo Tejada
d0a588bb5a sys_log: replace old debug macros at GPIO drivers
GPIO drivers are now using new system log macros also updated the
Kconfig variable to be a level rather than a bool.

JIRA: ZEP-311

Change-Id: I9a49626d816080cb8081c2dd445bae31f5dbf409
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-29 23:10:50 +00:00
Amit Kucheria
0017b60fbb soc: nrf5x: Disconnect GPIO input buffer when configured as output
This saves power.

Change-Id: Ie30bd3bffe89bc777d588fca56014634e03c0fe8
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-07-28 20:57:43 +00:00
Dragan Cvetic
021e09251a gpio_qmsi: Add suspend/resume
In order to restore GPIO context after entering
SYS_PM_DEEP_SLEEP, the suspend and resume
functions for GPIO and GPOIO_AON are called. The
following parameters are restored:
- All non-sticky RW registers for the GPIO device.
- The MASK register (interrupt routing register).

Note: No need to sve/resume AON_GPIO registers as
they all are sticky registers.

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: I68e25c9da4bb8ea65f312e3686d9ef090cb775ff
Signed-off-by: Dragan Cvetic <dragan.cvetic@intel.com>
2016-07-28 14:01:30 +00:00
Kumar Gala
254836a716 gpio: nrf5: Fix Kconfig symbol issue
We don't currently have a SOC_NRF5 Kconfig symbol.  Utilize the
SOC_FAMILY_NRF5 Kconfig symbol instead.

Change-Id: I062ecab230e9e7814fad19517d28ddbbae66bccb
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-28 12:18:11 +00:00
Sergio Rodriguez
b4d87a575a qmsi: gpio: Use locking mechanism to guard critical regions.
This will guard the driver API to be safe for concurrent
invocation from fibers or tasks.

The machanism is by default disabled. To enable it, the
following flag needs to be defined:

CONFIG_GPIO_QMSI_API_REENTRANCY

Jira: ZEP-441

Change-Id: Ia3ee738aff2f8e70e4f9a7ec76346138ff6f5031
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-22 23:26:34 +00:00
Sergio Rodriguez
3c5af9ab5b qmsi: gpio: quark_se_ss: Use locking mechanism to guard critical regions.
This will allow the driver API to be safe for concurrent invocation
from fibers and task.

The machanism is by default disabled. To enable it, the following
flag needs to be defined:

CONFIG_GPIO_QMSI_SS_API_REENTRANCY

Jira: ZEP-411

Change-Id: I5b738532f2eefec6d5d78ab6a668790dfe9faaff
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-22 23:25:31 +00:00
Baohong Liu
44f0481979 drivers: gpio: Fix a gpio port read bug
address was passed to QMSi port read function, even though
value is needed.

Change-Id: I6b923fdc56114936fb4a0c55c923d6b37884e07c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-06-03 16:36:25 +00:00
Carles Cufi
7923617c8f drivers: Add basic GPIO and UART support for nRF52
Add basic support for the Nordic Semiconductor's
nRF52832 (nRF52 series) GPIO and UART.

JIRA: ZEP-377
Change-Id: Ie3613956bae57829e26cb1cc20d3f740b5371f65
Signed-off-by: Glenn Ruben Bakke <glenn.ruben.bakke@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Håkon Alseth <haakon.alseth@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-05-27 01:38:21 +00:00
Chuck Jordan
528b04f520 gpio: more TAB cleanup in Kconfig.dw
I notice there are some more places in this file
that can be switched to using tabs.

Change-Id: I7dac2b91f932aa6f167b7eaf93e7c8f571a22d41
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-25 18:11:03 -07:00
Chuck Jordan
c1e4bcf996 gpio: For ARC EM Starterkit, a 4-port GPIO implementation is being added
The file gpio_dw_registers.h already had the 4-port GPIO
registers defined, yet the gpio_dw.c implementation didn't
support it properly. There are 4 ports here, not 2, and only
PORTA can support interrupts and debounce.

On the em_starterkit board, for example, PORTA
has 3 bits for buttons: A, L and R. The other 3 ports should not
be used with interrupts & debounce.

I've re-worked this file to derive the port number from the
base address given. The lower 6 bits are divided by 12 to
derive the port number. From this, the registers EXT_PORTA,
EXT_PORTB, EXT_PORTC or EXT_PORTD can be read.

Also, for those ports that don't support interrupts,
set irq_num to 0, and that code will be avoided. I've verified
that I can access GPIO now correctly on the EM Starterkit. The
em_starterkit board support will be submitted soon but I'm
staging in this change first.

Change-Id: I98dbe083e03e046b40e07b4b14a99a39a6d0f0be
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-26 00:10:42 +00:00
Kumar Gala
9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
Baohong Liu
2ddfe381b8 gpio: quark se: Add QMSI 1.1-based GPIO shim driver
Add QMSI 1.1 based GPIO sub-driver for sensor system.

Origin: Original
Change-Id: Ida5565a5911eb55651a11a4ac0b240c624f8e1ca
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:31:05 +00:00
Anas Nashif
f35d6e04e3 qmsi: update qmsi to 1.1 alpha
Change-Id: Ib35ebcb32954f764ef8e33f6a1c11ad9f63931bc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:30:04 +00:00
uLipe
adaeba2fa6 gpio_k64.c: configure pins as gpio alternate function in gpio_k64_configure()
Change-Id: I653602abeb99d4baf379e6175558c19c05678567
Signed-off-by: uLipe <ryukokki.felipe@gmail.com>
2016-05-17 15:44:35 +00:00
Anas Nashif
82c969c8ae gpio: use consistent names for IRQ priority variables
Change-Id: I35ca4a13bb9dc0fd86298fa4fb17158b275dc9cc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:23 +00:00
Anas Nashif
e1fea59671 gpio: GPIO_DW_BOTHEDGES_SUPPORT unused
Change-Id: I57adb395d308f01e469a2a88e0ad658169ffff72
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:22 +00:00
Chuck Jordan
7e8e620ddf gpio: For EM Starterkit, some additional GPIO register defines are needed
Comparing the Synopsys GPIO driver with the one here in Zephyr revealed
that some register symbols are missing. I am adding them now, and will
be working on getting GPIO working on ARC EM Starterkit board.

Change-Id: Ifccd1e225eb1373a31c6a5c51cf3927e42601d1a
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-09 21:51:54 +00:00
Andre Guedes
d38e2fa35d gpio: Fix returning codes
DEV_* error codes are deprecated and should not be used anymore. This
patch replaces DEV_* occurrences by the corresponding errno.h code,
according to the error code conventions.

Change-Id: I2f38c869b4e00d22145e24375796ba6bf216b084
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-04-26 22:49:48 +00:00
Bogdan Davidoaia
c4878335c8 gpio: pcal9535a: use I2C register access API
Use I2C register access API for writing/reading registers.

Change-Id: Ic35b3e7159f9827f2d202d8cd1ae8f26ee6300f1
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-26 11:06:50 +00:00
Anas Nashif
04e6243aa5 gpio: rename device name for AON GPIO
Change-Id: Iccd3790d3e7adbe790fe78755d297aad0ae97834
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 19:17:05 +00:00
Anas Nashif
5c30367a06 qmsi: gpio: add initialisation priority for driver
Change-Id: I4204d514f95c8e6e264a3cb71a2fa8eec8bab45a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 19:17:04 +00:00
Tomasz Bursztyka
fea1c49ba2 gpio: Improve the public API to handle multi callbacks
Many sub-systems might require to set a callback on different pins.
Thus enabling it via changing the API.

It is also possible to retrieve private-data in the callback handler
using CONTAINER_OF() macro (include/misc/util.h).

Former API is still available, and is emulated through the new one.
Using both should not be a problem as it's using new API calls.
However, it's now better to start using the new API.

Change-Id: Id16594202905976cc524775d1cd3592b54a84514
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 22:15:12 -04:00
Anas Nashif
85b3c2c62a qmsi: gpio: use built-in qmsi driver
Change-Id: I11444bcc146dbc477bb605f6b405bee559716f2a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif
65c06afa58 kinetis: reorganise soc directory using soc family
Add Kinetis SoC family and rename fsl_frdm_k64f to mk64f12.
This will allow adding new SoCs of the same family and the reuse of code
among SoCs of the family and series.

Change-Id: Iea1a663aef7ce0487f147bdd36f668bebe80deb5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Anas Nashif
4b411b34a1 stm32: rename SOC_STM32F1X -> SOC_SERIES_STM32F1X
Use SOC_SERIES_* for naming SoCs with similar features and architectures
with the goal of code reuse. The Series in the config variable should avoid
name collisions and clearly denote the relationships within an SoC family.

Change-Id: I7a98542f96b5d5dc3acc23782c4d45f98cceb599
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Anas Nashif
9bf2da7ef4 stm32: rename CONFIG_SOC_STM32 -> CONFIG_SOC_FAMILY_STM32
Use CONFIG_SOC_FAMILY for the top level SoC family. A family
will have different SoCs or different SoC series with multiple
SoCs.
Adding the Family string to the config variable to avoid confusion
between actual SoCs and families and to prevent name collisions.

Change-Id: Ic99a2c1df7850dee3a45641027af82464dd6fadb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Daniel Leung
9e575ddbe6 gpio/stm32: convert to use DEVICE_AND_API_INIT()
Change-Id: I584c73e7418344e73af0ca7a4fc8f5d745e2ec35
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:15 +00:00
Daniel Leung
4dee91bea9 gpio/atmel_sam3: convert to use DEVICE_AND_API_INIT()
Change-Id: I09cd91737993d30c89073656b8ae95462d5f317d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:14 +00:00
Daniel Leung
9b23654f68 gpio/k64: convert to use DEVICE_AND_API_INIT()
Change-Id: I7fa0aa8f23e6d3b6c0664e211d605a03ae7e150c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:12 +00:00
Daniel Leung
c21e93eeee gpio/dw: convert to use DEVICE_AND_API_INIT()
Note that the failure case can only be reached when PCI is enabled.
Otherwise, the if-block is always false, which reduces code size
for non-PCI platforms.

Change-Id: I1f9def66b2ce7f08fc13b8f03e675ce4cd469e6d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:10 +00:00
Daniel Leung
b8e887a112 gpio/pcal_9535a: move driver_api assignment later
This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: Ibf08cb107885da7c1037c6e7d207530e1a4708f8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Vlad Dogaru
9e563c8769 gpio: dw: add support for D2000 board
The D2000 CRB is similar to the Arduino 101 (at least as GPIO is
concerned).  Add support for using the GPIO controller without QMSI
libraries.

Change-Id: I001da05c9a9d5771b2ec678a9d4a91c44db05289
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-04-08 17:55:44 +00:00
Daniel Leung
8425568a8a gpio/dw: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ib7e0b81b2df1a0225fc244fea3035416d0a4f282
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-02 23:11:07 +00:00
Daniel Leung
5e886b2748 gpio/sch: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ib8158f00a6c6616360ddbcf63981f1a85911c1b9
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-31 23:17:23 +00:00
Tomasz Bursztyka
1de33f4d5f gpio: dw: ISR handler should acknowlegde only current interrupts
Current interrupt status tells which pins triggered this interrupt, thus
the handler should acknowledge only these and not all possible, since we
don't know if other gpio controller interrupts are being taken care of
at the same moment.

Change-Id: I7d3f1bb13bb293f7b7ce9b5a717a37bbdd4e4e42
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-03-30 16:19:39 +00:00
Daniel Leung
9c62a4a01f frdm_k64f: gpio: pinmux: remove base addr and irq from kconfig
The base address and IRQ line are static per SoC, so there is no need
to make them configurable in Kconfig.

Change-Id: Ib78401ff136c29642356f5bda9d6cd3e5c98bece
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-26 20:36:32 -04:00
Daniel Leung
8df10d4584 kconfig: untangle ordering and dependencies
There are two major issues with the kconfig:

() Some of the config options have incorrect dependencies inside help
   under menuconfig. For example, CONFIG_GPIO depends on BOARD_GALILEO.

() Since the SoC and board specific kconfig files are parsed first,
   the help screen would say, for example, CONFIG_SPI is defined at
   arch/arm/soc/fsl_frdm_k64f/Kconfig. This is incorrect because
   the actual config is defined in drivers/spi/Kconfig.

These cause great confusion to users of menuconfig/xconfig.

To fix these, the SoC and board defaults are now to be parsed last.

Note that the position swapping of defaults in this patch is due to
the fact the the default parsed last will be used.

And, spi_test is broken due to the fact that it requires
CONFIG_SPI_INTEL_PORT_1, but never enables it anywhere. This is
bypassed for now.

Origin: refactored and edited from existing files
Change-Id: I2a4b1ae5be4d27e68c960aa47d91ef350f2d500f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-26 20:36:32 -04:00
Ramesh Thomas
4104bbfb08 power_mgmt: Add device power management support
Added device power management hook infrastructure. Added
DEVICE_INIT_PM and SYS_INIT_PM macros that creates device
structures with the supplied device_ops structure containing
the hooks.

Added example support in gpio_dw driver.  Updated the sample
app and tested using LPS and Device Suspend Only policies.

Change-Id: I2fe347f8d8fd1041d8318e02738990deb8c5d68e
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-26 14:35:11 -04:00
Maciek Borzecki
f8c24fb203 gpio/stm32: fix build
Build with GPIO port E failed due to a missing comma.

Change-Id: Ib8fa7f4d03ed4f4c713a3a8a16ad3b37fcf6b0b7
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-25 23:31:36 +00:00
Vinicius Costa Gomes
d872bb173c pinmux: Move STM32 boards to the pinmux model
This moves the STM32 based boards (Nucleo F103RB and STM32 Mini A15) to
the "new" pinmux model.

Change-Id: I190df271a6b83fafeec0b281cd4ee7cf13d7e7db
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes
a12a25ad00 pinmux: Move the Freescale FRDM K64F board to the pinmux model
Change-Id: I50cf5fcf00481a3ebac07ced3aa6f7783765934f
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Tomasz Bursztyka
67196bc0c3 drivers: gpio: Align the style all over the drivers
Fixing:
- indentation
- 80 chars limit
- { } mandatory on relevant statements
- using BIT() macro relevantly

Change-Id: Ib84eb29530b175c8a533c1b361aea2632f0d7917
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-03-24 08:01:52 +00:00
Andre Guedes
300bbdc2f4 gpio: Fix returning code from stm32 driver
This patch fixes gpio_stm32 driver since it was merged with a few
occurrences of DEV_* error code.

Change-Id: I025e4f83d8ca07bc0fed7d3dcb9cce3b9d11c3fc
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-23 15:55:11 +00:00
Yannis Damigos
d7a21260b6 drivers: gpio: Make K64 gpio submenu available only for K64 soc
Makes K64 gpio driver submenu available only if K64 soc is
selected.

Change-Id: I4097006a4dca718ed2da730fa85cd2ad9970f419
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-21 19:41:06 +02:00
Yannis Damigos
3a977ae654 drivers: gpio: Move STM32 gpio driver under its own submenu
Moves STM32 gpio driver under its own submenu, like atmel SAM3
and K64 gpio drivers.

Change-Id: Iebc474af9818a73275f99183d3f4788eea1e6ded
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-21 16:51:43 +00:00
Andre Guedes
3172fca3a0 drivers: qmsi: Fix gpio, i2c and wdt for D2000
This patch fixes the gpio, i2c and watchdog shim drivers so they set the
CLK_PERIPH_CLK bit during driver initialization. Differently from Quark
SE, the peripheral clock gate bit (CLK_PERIPH_CLK) is not enabled by
default in Quark D2000. We have to explicitly set this bit in order to
properly initialize the device.

This issue has been masked so far because the CLK_PERIPH_CLK bit is set
when UART NS16550 driver is enabled. The UART NS16550 driver is enabled
by default for Quark D2000 so gpio, i2c and watchdog sample apps were
working just fine. But if we disable the NS16550 driver, these samples
applications stop working.

The remaining shim drivers already set the CLK_PERIPH_CLK bit during
initialization so there is no need to fix them.

Change-Id: I3f658da564f87e9d52092ce7aac423c7b3e0c890
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-18 23:31:45 +00:00
Maciek Borzecki
1524e713c5 gpio/stm32: GPIO input with interrupts
Add support for interrupts for input GPIO pins on STM32 MCUs. The SoC
support code is expected to provide an implementation of
stm32_gpio_enable_int() call.

Change-Id: I61bae54b8e044be4d7d8eb60c0c67b71f8c59553
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 20:55:21 +00:00
Maciek Borzecki
6461e70b72 gpio/stm32: add common driver for STM32 GPIO
The driver implements a GPIO device interface for STM32 MCUs. Each SoC
must provide implementation of the follwoing calls:
stm32_gpio_flags_to_conf(), stm32_gpio_configure(),
stm32_gpio_set(). Consult gpio_stm32.h header for details on semantics
of these calls.

The driver registers 5 devices, each corresponding to a single GPIO
port. The users can then access individual pins by using values
0-15.

Change-Id: Id236b5b75c9dd091018a50a7be3501c8591cd551
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 16:27:04 +01:00
Daniel Leung
1904ecc0b5 gpio: restructure Kconfig options
() Moves config options for each controllers into their own
   Kconfig files. This keeps drivers/gpio/Kconfig from getting
   too big.
() Options for each controller are moved under their own
   submenus.
() Re-named the device names to standard as "GPIO_0", "GPIO_1",
   etc.
() Adds the missing copyright to Kconfig.atmel_sam3.

Origin: refactored from existing file
Change-Id: I7c531b0109ca5a6840d3abd9daa6bc784f15233d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-17 21:05:12 +00:00
Andre Guedes
136d171588 drivers: Replace DEV_NOT_CONFIG by -EPERM
This patch replaces all occurences of the macro DEV_NOT_CONFIG by
-EPERM at the driver level. This patch is part of the effort to
transition from DEV_* codes to errno.h codes.

Change-Id: I3054c8aa76319a58a2eec089b8a72bf301c85391
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes
aca7cb1efd drivers: Replace DEV_NO_SUPPORT by -ENODEV
This patch replaces all occurences of the macro DEV_NO_SUPPORT by
-ENODEV at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I03007527367b03e6fd72a85004b7d3b81046a6a6
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes
b3cb3a1f68 drivers: Replace DEV_INVALID_CONF by -EINVAL
This patch replaces all occurences of the macro DEV_INVALID_CONF by
-EINVAL at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: Idae0d5af8dd780416977c9261a5fb6188c3aab64
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes
245e140da6 drivers: Replace DEV_INVALID_OP by -ENOTSUP
This patch replaces all occurences of the macro DEV_INVALID_OP by
-ENOTSUP at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I46aec3c65963018c479b01602e4a3eec8650eaff
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes
7c956d2ece drivers: Replace DEV_FAIL by -EIO
This patch replaces all occurences of the macro DEV_FAIL by -EIO
at the driver level. So this patch touch the files under drivers/,
include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I0594ab5dbe667e074c250129e7c13ce512ac940f
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes
024cfe754e drivers: Replace DEV_OK by 0
This patch replaces all occurences of the macro DEV_OK by the actual
value 0 at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I69980ecb9755f2fb026de5668ae9c21a4ae62d1e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Daniel Leung
f8405637f7 drivers/gpio_dw: fix kconfig dependencies
The DesignWare GPIO options should really depend on whether
GPIO_DW is enabled.

Change-Id: I98b2964d6a0afdac89dc66a78342076afa6feec5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-15 21:39:15 -04:00
Jeff Blais
f4c7e6697d arm: Add GPIO interrupt/callback support for K64F
Interrupt and callback function support is added to the K64F GPIO driver.

The implementation is based on the Designware GPIO driver (gpio-dw.*).

Change-Id: Id88d06f748400f8f822ca98e098cb44a53678c38
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 12:54:02 +00:00
Jeff Blais
52b499fd1f arm: Freescale K64/FRDM-K64F Pinmux support
K64 pinmux support is created as a normal driver.

As opposed to the Galileo board, the pin configuration options are
defined by the MCU and are not board-specific.  Separate
platform/board-specific configuration code uses the pinmux driver for
the default pin settings. For FRDM-K64F, only the Arduino pins (22 of a
possible 160) are set up.

Some of the I/O pins routed to the Arduino header are also configured as
JTAG/SWD signals by default and are used by the OpenSDAv2 debug
interface.  Therefore, a PRESERVE_JTAG_IO_PINS config option was created
for the FRDM-K64 platform to prevent the default pin settings from
re-configuring these pins.

The K64 MCU separates pin configuration and control, implemented in the
pinmux driver, from GPIO.  This results in some cross referencing
between the K64 GPIO driver and the K64 pinmux driver due to the
dependencies of one on the other.

This pinmux driver also uses the expanded pinmux function/mode parameter
size to describe pin configuration options with bit fields for the K64,
including up to 8 pin functions, plus interrupt, pullup/down, drive
strength, open-drain and slew rate.

The following GCC warnings in the K64 pinmux driver are prevented when not
compiling with 'no-optimization' (-O0):

warning: 'gpio_dev' may be used uninitialized in this function
[-Wmaybe-uninitialized]

Change-Id: Ie5031d18750143bf895883058b3cd55fd9989fd3
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 11:58:02 +00:00
Jeff Blais
0fd7af2a52 arm: Freescale K64 GPIO driver
Basic driver support for the Freescale K64 GPIO module.

Note that only pin direction, read and write are supported.

Change-Id: I6587bb260197a00497be9ac991002e3dde54718d
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 06:39:16 +00:00
Andre Guedes
55e93f203c gpio: Remove default value from platform-specific options
This patch removes the default value from some platform/SoC specific
options which are declared in drivers/gpio/Kconfig because 1) most of
the time they are not valid values and 2) the correct values are
already set in the SoC Kconfig.

It also moves the interrupt priority definition from the driver's
Kconfig to the platform's Kconfig since it is a platform-specific
configuration.

Change-Id: Id00f7907fa55025011dabce6e282a9623be23831
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-24 17:05:52 +00:00
Andre Guedes
2b608b1e59 gpio: Enable QMSI driver for Quark D2000
This patch fixes the GPIO QMSI shim driver so we are able to use it in
Quark D2000 based platforms. To enable this driver we have to add a few
 #if guards because some macros and functions (e.g. QM_AON_GPIO_0 and
qm_aon_gpio_isr_0) are not defined in QMSI headers from Quark D2000
(this SoC doesn't support the Always-On GPIO controller).

This patch also adds the QMSI driver default options to arch/x86/soc/
quark_d2000/Kconfig.

Change-Id: Ia16a345e1de3008f167ed66f891834607c05f4a2
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-20 13:04:34 +00:00
Vinicius Costa Gomes
11ee779feb gpio: qmsi: Simplify interrupt enabling/disabling
This handling is already done by QMSI, so no need for it to be done in
Zephyr side as well.

Change-Id: Ia5c6206d3d7f04702e0be0e76f2130df8d60b31c
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-20 13:03:44 +00:00
Vinicius Costa Gomes
821212c3df drivers: gpio: Add support for AON GPIO to QMSI driver
This adds support to the AON GPIO controller using the QMSI driver.

In order to enable it, the following configuration options must be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="PATH TO LIBQMSI"
CONFIG_GPIO_QMSI=y
CONFIG_GPIO_QMSI_AON=y

Change-Id: I5a1a232d97741ad7fdbf40d8aea5a835e5b4e724
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-20 13:02:49 +00:00
Dan Kalowsky
4743684e4f struct packing
Looking at all structs as to where we can pack them a little better, and
calling out the padding/stride at the end for future expansion.

Change-Id: I4a651092e950dd3d915af9fa0ee0d7d59803e58f
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-10 16:21:26 +00:00
Jesus Sanchez-Palencia
8d0c9124a0 gpio_qmsi: Use level sensitive interrupts
For QMSI drivers with combined interrupts, we need to use level
triggered interrupts. This is the case of the GPIO controller.

If we keep it configured as EDGE, the user will never be able to
get a pin configured as LEVEL to fire more than 1 interrupt.

Change-Id: I36bffc79183ca97f431c4f5811ed5d56e2fd82e8
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-02-05 20:25:30 -05:00
Daniel Leung
f6a5bfcfa1 gpio: add driver for Atmel SAM3 PIO controllers
The PIO controllers on Atmel SAM3 family processors can be
used for GPIOs, so this is the driver.

Change-Id: I3d5712f3a0a71025b820ca1c08dd767ee1e136d8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:29 -05:00
Andrew Boie
897ffaeb2c irq: rename irq_connect() to IRQ_CONNECT()
It's not a function and requires all its arguments to be build-time
constants. Make this more obvious to the end user to ease confusion.

Change-Id: I64107cf4d9db9f0e853026ce78e477060570fe6f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh
d340d4cb3f device: use DEVICE_INIT everwhere
This is the last step before obsoleting DEVICE_DEFINE() and
DEVICE_INIT_CONFIG_DEFINE().

Change-Id: Ica4257662969048083ab9839872b4b437b8b351b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh
2c1a95aee6 device: rename SYS_GET_DEVICE_NAME/SYS_GET_DEVICE
Rename them to DEVICE_NAME_GET and DEVICE_GET to fit in the 'device'
namespace.

Change-Id: I407a7f284ed4d1c071961b46615eea859c2e825f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh
0303d8cab9 device: rename SYS_DEFINE_DEVICE()
Rename it to DEVICE_DEFINE() so that it fits in the 'device' namespace.

Change-Id: I3af3a39cf9154359b31d22729d0db9f710cd202b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh
bfc27206b2 device: rename DECLARE_DEVICE_INIT_CONFIG()
Rename it to DEVICE_INIT_CONFIG_DEFINE(), because (a) it was not fitting
in any namespace and (b) it is not used to declare, but rather define a
object.

Change-Id: I1da5822f06b85a9fb024b5b184afd0ccc01012ec
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Peter Mitsis
a0e4568760 c++: Add extern "C" { } block to header files
Adds extern "C" { } blocks to header files so that they can be
safely used by C++ source files.

Change-Id: Ia4db0c36a5dac5d3de351184a297d2af0df64532
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:22 -05:00
Jesus Sanchez-Palencia
6504b7e72a gpio: Add QMSI-based implementation
Introduce the GPIO QMSI-based implementation. This is basically a
shim layer that implement's Zephyr's GPIO APIs on top of QMSI drivers.

This is an alternative driver that conflicts with the previous
GPIO_DW implementation. In order to enable it you must set:
- CONFIG_GPIO=n
- CONFIG_GPIO_QMSI=y
- CONFIG_GPIO_0=y
- CONFIG_QMSI_DRIVERS=y
- CONFIG_QMSI_INTALL_PATH="PATH_TO_QMSI"

Note that this driver currently only supports one controller instance,
GPIO_0. It is implemented this way due to a limitation from the current
version of QMSI. QMSI versions later than 1.0 doesn't have this
limitation.

Missing:
- support multiple controller instances (gpio_0, gpio_1, etc);
- enable level triggered interrupts in sync with system clock,
through setting INT_CLOCK_SYNC properly.

Change-Id: Ib61b153dae9741806a9a31d7dc1f82b96d000fbe
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka
7602d34949 gpio: dw: Fixing how interrupt unmasking is done for Quark SE SS
There is no such thing as "IA" in Quark SE SS as it is an ARC core. Plus
for this very specific feature it does not require the ARC aux regs
instruction to read/write in the given mask address.
And fixing also the CONFIG_ option to check.

Change-Id: I1f63348ec85f6e006795f7641c912a30fc003709
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:21 -05:00
Tomasz Bursztyka
bf20dc9cec gpio: dw: Refactor how general interrupt unmasking is proceeded
This is valid only for Quark SE and Quark SE SS, where it requires to
unmask the interrupt for each specific controller. Thus making the
function generic, using the parameter as the specific mask base address.

Change-Id: Iea0a412b8d94a1ab5e1f3e339eaf632eacee5797
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:21 -05:00
Andrew Boie
d9cfbd5a61 interrupts: new static IRQ API
The interrupt API has been redesigned:

- irq_connect() for dynamic interrupts renamed to irq_connect_dynamic().
  It will be used in situations where the new static irq_connect()
  won't work, i.e. the value of arguments can't be computed at build time
- a new API for static interrupts replaces irq_connect(). it is used
  exactly the same way as its dynamic counterpart. The old static irq
  macros will be removed
- Separate stub assembly files are no longer needed as the stubs are now
  generated inline with irq_connect()

ReST documentation updated for the changed API. Some detail about the
IDT in ROM added, and an oblique reference to the internal-only
_irq_handler_set() API removed; we don't talk about internal APIs in
the official documentation.

Change-Id: I280519993da0e0fe671eb537a876f67de33d3cd4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:17 -05:00
Daniel Leung
dff5f6a038 i2c: make i2c_transfer() really generic
Make the i2c_transfer() to transact messages through the I2C bus.

It is useful for I2C storage devices, as now we can send one message
containing the destination byte/block address, then send the data
in another message. There is no need to construct one continuous
data buffer to send both address and data anymore.

The drivers and sample apps have been updated to utilize updated
API when appropriate. For i2c_dw, only master mode has been updated.
Slave mode will be updated once we can adequately test it.

Change-Id: I0a811d60567367817fcc8d15f5454e5c933722e2
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:15 -05:00
Peter Mitsis
d63a4f7bf7 nano_timers: Simplify nano_xxx_timer_test() API family
Simplifies the nanokernel timer API so that the timeout parameter must be
specified when invoking nano_isr_timer_test(), nano_fiber_timer_test(),
nano_task_timer_test() and nano_timer_test().

This obsoletes the following APIs:
	nano_fiber_timer_wait()
	nano_task_timer_wait()
	nano_timer_wait()

Note that even the though the new API requires that the timeout parameter
be specified, there are currentl only two acceptable values:
	TICKS_NONE and TICKS_UNLIMITED

Theoretically, the current implementation would allow one to supply a
finite positive value for the timeout and the system would wait up to
that many ticks for the timer to expire. However, it is thought that
that unnecessarily complicates the nanokernel timer model and so it is
left as an unsupported option.  Should that change, then that feature
could be enabled by updating the documentation.

Change-Id: I8835c5342ab5025d6f70fdfbed54a50add7568d7
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:15 -05:00
Javier B Perez Hernandez
02812f4635 drivers: pci: struct pci_dev_info rename class
Rename class in pci_dev_info struct to allow to use C++ compilers.
Updated drivers to use new struct.

Change-Id: I17b94cb7bc094bccd615c8389a28589bfa90cab8
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz
6a4d1b52de gpio: Fixes interruption connection parameters.
Fixes interruption connection parameters, ISR parameter is not null anymore.
Removes irq_connect call that is a dynamic irq api that should not be
used along static irq api: IRQ_CONNECT_STATIC and IRQ_CONFIG.

Change-Id: I232c8562d2dcda3229776b561e2c1f4608a31cdd
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz
609d1f72a2 gpio: adds interruption masking for quark se ss
The current gpio_dw_initialize implementation masks the interruptions in the line
dw_write(base_addr, INTMASK, ~(0)) to assign api functions and initialize
interrupt vectors and handlers safely. Immediately after this, the driver expects
that gpio_dw_unmask_int(port) unmasks the interrupts. Without this patch that
implementation is empty for the quark se ss board.

Change-Id: Iac84c8807fcadad8c256c3fcaa4ff624b6337bf3
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Anas Nashif
81ed24413e pcal9535a: remove unused function _wait_10ms
Change-Id: Ib89ec98279895f1d25c4232bed6caf3a1ad83b2b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:12 -05:00
Anas Nashif
78a566d3b8 trivial: fix header guard definition
Change-Id: Ia0090ff07a8f2cab8c745b4f6a0d9eeead5518a2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif
6bca3724c1 drivers: set default priority for drivers
Use a default priority to avoid Kconfig blocking when priority
is not set in SoC or Board.

Change-Id: I4edda47b955a7ee834f04dc40d0decbd8dee6305
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif
10bb38c186 Use SoC instead of platform.
Change terminology and use SoC instead of platform. An SoC provides
features and default configurations available with an SoC. A board
implements the SoC and adds more features and IP block specific to the
board to extend the SoC functionality such as sensors and debugging
features.

Change-Id: I15e8d78a6d4ecd5cfb3bc25ced9ba77e5ea1122f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Daniel Leung
5aab5ccbad arc/quark_se_ss: need some magic to enable GPIO interrupts
1. Need to unmask interrupts for the sensor subsystem.
2. The GPIO controllers need their clock enabled before they can
   start sending out interrupts.
3. Setting up ISR on ARC requires usage of irq_connect().

Change-Id: I633b07292f11e5c5e768fc51fabb70769d407609
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:06 -05:00
Daniel Leung
8cb01064f6 gpio/dw: move IOAPIC interrupt trigger flags into driver
Move the common #define for IOAPIC interrupt trigger flags out of
platform board.h and into the driver.

Change-Id: Ia0a069464392714f38037841de52e8d265fa4f49
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:04 -05:00
Anas Nashif
cf81e1ff87 gpio: gpio_dw_registers.h is local to the file including it
Change-Id: I501a6fd2239511d46236fade47fc41d69093471d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:04 -05:00
Dmitriy Korovkin
dcda679c72 gpio, pwm, rgb lcd: Replace polling i2c requests
Now that i2c_transfer/i2c_read/i2c_write are fully synchronous, no need
to use the polling based function.

Change-Id: Ib578cf4a6d72ad0817e1aaeebc7e4dab9f9d293f
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz
bc1a79c4c3 irq: removes priority parameter from IRQ_CONFIG macro
Removes the 'priority' parameter from the IRQ_CONFIG macro.
This parameter was not used anymore in any architecture.
The priority is handled in the IRQ_CONNECT macro.
The documentation is updated as well.

Change-Id: I24a293c5e41bd729d5e759113e0c4a8a6a61e0dd
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz
52e11824ee gpio: Adds io/aux register support for IP configuration.
Adds io/aux register support for IP configuration.
x86 and ARM configure IP through MMIO register access.
ARC architecture configure IP through io/aux register access.

Change-Id: I4d07b91af09d88b7eb6ac1aa02e875dcd626bd26
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz
5e5a45e45e gpio: fixes isr signature for static irq
Static irq api expect to have an isr with signature
void isr(void *arg).

This fixes the warning messages due the difference on
the isr parameter.

Change-Id: I64099ce47ba481b40446d5fb7e35fce0e46a9624
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Tomasz Bursztyka
5aebc6cca7 gpio: dw: Remove already defined macro
BIT() is already defined as a generic utility macro in misc/util.h

Change-Id: Ie74bbfe657de5de980439e30b2dcbb9168b69257
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Tomasz Bursztyka
8e4aff1079 gpio: dw: Support optional clock gating
This is currently valid for quark_se platform. It's used internally to
suspend and/or resume the gpio controller.

Change-Id: I5147568ba6b0450363566b5f9fd2e8aa7e41df49
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Anas Nashif
61d7f11f0f gpio: dw: Support host interrupt mask on Quark SE
Change-Id: Ie58e8611a8fe9edec9ebcb123532a97f396098f4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Tomasz Bursztyka
0d61d584f0 gpio: dw: LS_SYNC is a unique bit for the whole controller
There is no such feature per-pin. LS_SYNC is set or unset for the whole
controller.

Change-Id: Ic67048e29a9cc25a19e6a7bcc11d21dd1e65be61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Anas Nashif
bbe94000e4 quark_se_ss: rename platform and remove arc suffix
This platform if actually a subsystem of the Quark SE SoC and is
not standalone. Use a more descriptive name and remove the architecture
from the platform name.

Change-Id: I16b1ab8dd668441683b07fc4512c219924463441
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif
2dcb70d264 gpio: Fix parameter of macro
Change-Id: Ie8e4cac475b32e6cceb3904ae535c2fb22789ff4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Dmitriy Korovkin
57f2741e4f init: Implement fine-grained initialization policy
Put initialization priorities as device driver Kconfig
parameter.

Initialization priority value for each platform is defined
in the platform Kconfig file.

Drivers and platform code use SYS_DEFINE_DEVICE to add
and initialization function.

Change-Id: I2f4f3c7370dac02408a1b50a0a1bade8b427a282
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif
77ba3c3b8b kconfig: define architecture as a kconfig variable
Do not depend on environment variables and use a kconfig variable
for defining the architecture.

In addition, remove the X86_32 variable, it just duplicates X86 for
not good reason, at least until start supporting MCUs with 64bit.

Change-Id: Ia001db81ed007e6a43f34506fed9be1345b88a4b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:52 -05:00
Tomasz Bursztyka
d47f91893d gpio: dw: Fix build error when configuring dw driver with direct IRQ
SYS_GET_DEVICE() needs the name set in DECLARE_DEVICE_INIT_CONFIG() not
the one in IRQ_CONNECT_STATIC().

Change-Id: Id1ed66953c863531411b34594ffed669ad524ef5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:52 -05:00
Tomasz Bursztyka
8ae3b9d2d4 gpio: dw: Provide IRQ flags for GPIO 1
That fixes a build error. Platfom's board.h have to provide such flags
if they enable dw gpio 1 controller.
Take the opportunity to provide the right isr to IRQ_CONNECT_STATIC.

Change-Id: I16900ea04f7f7c5d3c99b93a92b00c1f651494de
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:52 -05:00
Juan Manuel Cruz
59cb73520a gpio: adds gpio dw register support for ss quark se
Adds the register definition for the DW GPIO hardware block.
This set of registers and offsets are specific for the SS
GPIO hardware block in the Quark SE platform.
In particular, the register BOTHEDGE (offset 0x68 in the
main GPIO block) does not exist on the SS GPIO block.

Change-Id: I4e16ec7c8e89015be1fc8bcdb1b7fa5377890b9d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif
4378eae1d3 gpio: fix inclusion of local header
since we are in the same directory, include the file directly.

Change-Id: I21c959538e4a3d9e3fba99eaa9b09697fffe25b0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Dmitriy Korovkin
f1420515a7 irq: Add flags to IRQ_CONNECT_STATIC() macro and irq_connect() function
Flags allow passing IRQ triggering option for x86 architecture.
Each platform defines flags for a particular device and then
device driver uses them when registers the interrupt handler.

The change in API means that device drivers and sample
applications need to use the new API.

IRQ triggering configuration is now handled by device drivers
by using flags passed to interrupt registering API:
IRQ_CONNECT_STATIC() or irq_connect()

Change-Id: Ibc4312ea2b4032a2efc5b913c6389f780a2a11d1
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
4effd20617 gpio: Add a driver for Intel's SCH controller
Such controller is found in legacy bridge on Intel's platforms. Such as
Poulsbo or Quark x1000.

Change-Id: I30f205f1e73aaa680092e92717fdacbb74046fa3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
72a26b5a38 gpio: mmio: Use i/o port bit operations functions
Now make use of sys_io_clear_bit and sys_io_set_bit

Change-Id: I11ebcd8c31d2a4c6d3dac37a0eca0ffcfacead61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
dc6a584650 gpio: dw: The callback should tell about the GPIO pin
A tiny fix where the pin is the bit position, not its mask.

Change-Id: I4ed8c4b2968ff28b407cab88903351bafe6501ba
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Juan Manuel Cruz
d34b8f62ae gpio: ioapic stubs apply only with IOAPIC
ioapic_mkstub applies only when an IOAPIC is available in the platform.

Change-Id: I40294e4c11ef04739a1ce2146d125f3c5478013d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:42 -05:00
Michael LeMay
2ad663da92 gpio: dw: Fix ISR initialization and add NULL checks
This patch updates the ISR initialization code to reflect recent
changes in the underlying Zephyr ISR infrastructure.  It also adds
assertions to detect failures to lookup device bindings during
initialization.

Change-Id: I4bf1955da44a97f8c2652b96a390804c5cea73e3
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:42 -05:00
Anas Nashif
70ff4c91e5 gpio: fixed struct name causing build failure
bad rebase that somehow passed sanity

Change-Id: I7aa7da44cbcb28b9abe3bb81b1ff8d510d135a24
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:42 -05:00
Anas Nashif
c159380c86 gpio: make function names conform to driver name
use gpio_dw instead of gpio_<function>_dw to be consistent in the
driver itself and with other drivers.

Change-Id: Ifb0e50c230f142197eb4b01c1bb4ce1c16e4753f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
98e0c2cfbc gpio: use BIT macro defined in misc/util.h
We now have BIT defined in a header file globally, so lets use it.

Change-Id: Ie7b87478cb5a9e977ec045efa072d28fab86e78b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Juan Manuel Cruz
faa11b76ee gpio: remove both edge support on dw arc ip
Allows to remove the both edges support from the DW GPIO driver.

Change-Id: I9e39cca320aeac5d10aafe7a83641917ad004fe6
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:41 -05:00
Peter Mitsis
5084b6da56 Fix various default IRQ priorities
Changes the default IRQ priority level from 0 to 2 for the following
kernel configuration options as priorities 0 and 1 are reserved for the
first 32 IDT entries.

	SHARED_IRQ_0_PRI
	SHARED_IRQ_1_PRI
	I2C_DW_0_INT_PRIORITY
	GPIO_DW_0_PRI
	GPIO_DW_1_PRI
	SPI_INTEL_PORT_0_PRI
	SPI_INTEL_PORT_1_PRI

Change-Id: I0fc821c68156eb1e1fe776b2bd4ff5890bba40e8
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:34 -05:00
Michael LeMay
2b5319583f gpio: dw: Fix PCI enumeration support
This patch corrects gpio_dw_setup to use the MMIO base address
determined by PCI enumeration when that enumeration feature is enabled
instead of always using the default base address specified at compile
time.

Change-Id: If139c40ce30275694e01196a4a4aa529cd714f06
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:34 -05:00
Dan Kalowsky
e45956c9a0 checkpatch: warning - leading_space
Change-Id: I34a54230bc4a63c8a4391d03ff530835910c3705
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Anas Nashif
47869287a4 gpio: move static stubs to driver directory
Change-Id: I6077aaeba4d572ddfa9d696014c6aec08abd3d3a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:32 -05:00
Dirk Brandewie
147d6585ae x86: arm: Modify IRQ_CONFIG macro to have same signature as ARC
In order to have drivers that are usable cross architecture the
signature for IRQ_CONFIG needs to be the same to avoid #ifdef hell in
the driver code based on architecture.

Update the macro and it usage for existing drivers

Change-Id: I22e142b21d4e984add231d1dbd97020e4823985f
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
39063598db checkpatch: error - spacing
Change-Id: Ie6e1c43581dd4b0734625b3a4e59a4ca79619e99
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
3bc4039601 checkpatch: error - switch_case_indent_level
Change-Id: I9cbd6ab80b0c0f170626bb1c6b2d07498038fb8f
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
6bf971915f gpio: rename files
The naming convention used in the source is for there to be an
_ and not a - in the file.  Fixing GPIO to be consistent with
the os naming conventions.

Change-Id: Ifc4356c14b52e2cc2411a7445b44c7cb57d2765c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Allan Stephens
7b006066a4 init: Simplify symbol name generated by DECLARE_DEVICE_INIT_CONFIG()
Gets rid of the trailing initialization level character from the
name of the device variable generated by the macro, since it serves
no useful purpose. (The linker scripts place the various initialization
sections in ascending order based on the name of the section, so there
is no need to embed the initialization level in the variable name itself.)

Change-Id: I56bb79a513b8f77fb1f3fbaccec14454c2520772
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:29 -05:00
Javier B Perez Hernandez
f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Daniel Leung
827f6d018b gpio: pcal9535a: use i2c_poll_transfer() for register read
The newly introduced i2c_poll_transfer() is now used for register
read for PCAL9535A GPIO driver. The old write then read does not
work because every read or write ends with STOP. However,
the chip requires RESTART after writing the register address.
So the new generic transfer function is perfect for this.

Change-Id: I56d7ebe08f68cb04731c72138d60645ef124f65e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Dan Kalowsky
a6f526ed1f gpio: Adding copyright to Kconfig
Change-Id: I2abcdf3138de3ae39c6c5d428627d9b2fd6f8a01
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:23 -05:00
Daniel Leung
8c6714e297 gpio: dw: ISR bails early if no interrupts
If using with shared IRQ, this function will be called by
the shared IRQ driver. So we need to check and bail out
early if the interrupt is not coming from the GPIO
controller.

Change-Id: I4ae925f5fb9a5c32d03a180edc8460e978ec0aac
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:22 -05:00
Tomasz Bursztyka
4df5c1cab0 gpio: dw: Verify interrupt status on available bits only
Handle only the pins which have been configured to be present on this
controller. Removing an unused #define as well.

Change-Id: I66d3638333f1fcd49b1b4f70a5c9d11dbc538fd0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung
25c5ceaad1 gpio: dw: add shared IRQ support
On some platforms (e.g. Galileo), the GPIO controller is on PCI bus,
which shares IRQ with other devices (I2C on Galileo). This patch
adds support for utilizing shared IRQ.

Change-Id: I4b44bae15356e4710d54f0343fed1bd27f35e484
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung
32d42f313e gpio: pcal9535a: use polling I2C write instead
The polling I2C write function guarantees the write operation
is completed. Given that the initialization routine goes through
I2C write consecutively, we want to make sure each write
has been committed.

Also adds code to configure the I2C controller before transfer.

Change-Id: I2c8888e940edd1cb9fb01f03234a731ac991dfcf
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung
0502a9a084 gpio: mmio: add access by I/O port
Add I/O port access to MMIO-based GPIO driver, in addition to
the existing direct memory access. This extends the driver,
so that it can address the registers through I/O read/write.

Change-Id: I53c74ad76472ac043764e33bfbb77a2bedc427fe
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung
0daf9dfd19 gpio: pcal9535a requires nano timer
Add a Kconfig option to enable NANO_TIMERS for PCAL9535A.
Without enabling nano timers, compilation may fail.

Change-Id: If96358a17b9522f9323f3480b4716c3dfd82a3de
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Dirk Brandewie
4365f02391 init: rename pure_late_init to pre_kernel_late_init
Change-Id: I9561315a892933370d60fcf36c10d38078d66233
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie
58a534b929 init: add pure_core_init level
There are devices that need are part of the architecture core the need
to be initialized prior to devices that are integrated around a core
to make up a complete SOC. Namely the interrupt controller in the SOC
must be configured in order to allow the integrated IP blocks drivers
to initialize correctly.

Change-Id: I0a91e08f98516a7b7dd402ffc6494a071f1326b2
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie
c48418f2bd init: remove pure_init macro
This macro is legacy from an early implementation of the init system
before the pure level was split into early and late phases remove it
now to avoid confusion going forward.

Change-Id: I6720874c840c9e14888fd6f411a8182e7420ca29
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:19 -05:00
Anas Nashif
31779e736c gpio: fix build issue when init.h is not included
Fixes a build failure in designware gpio driver.

Change-Id: I90a540f56bff17ff56d0315356fde6d6c4d02407
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:19 -05:00
Daniel Leung
b96703b516 gpio: pcal9535a: cache write values to registers
Register values are now being cached in memory, and are being used in
subsequent writes. This is to avoid reading from registers, as
we know what needs to be written to those registers all the time.

Change-Id: I9b344303c0cb9f28e974514ab674135004f68ea0
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:19 -05:00
Daniel Leung
e52e4cdd1d gpio: pcal9535a: fix a logic error
The _has_i2c_master() should return 1 if there is an I2C master.
The logic was incorrectly inverted. So fix it now.

Change-Id: Ic4bf44efc1f68644530a275f0c4e454740a2950a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:19 -05:00
Anas Nashif
55bad6996a gpio: include printk.h for debugging with printk
Change-Id: I877b51e2b9a4cbe5a5b99d9cb6b611127fb83d32
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif
2ae45147a5 gpio: fix gpio Kconfig dependencies and display in menuconfig
Change-Id: I254acb070bcecffe54489e4efe659b488661c043
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif
00cf074796 gpio: Move GPIO option from platform to driver
Change-Id: I136efa8a86314137904e191957bb0922fecdb757
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung
721bb7afb3 gpio: add driver for MMIO-based GPIO ports
This adds a simple driver for MMIO-based GPIO ports.
It does not trigger any interrupts due to pin level at this moment.

Change-Id: I0c439f221988817e4be72653c68257ef6ace5bde
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung
2709050112 gpio: add driver for PCAL9535A GPIO chip
This adds the driver for I2C-based PCAL9535A GPIO chip.
This currently only enables minimal set of features of the chip for
very simple input/output operations, and does not support interrupt
yet.

Change-Id: I32ea07a71a38866280a96e68cff49cb0df12b85d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung
792930172a gpio/dw: Kconfig: put DW selections inside GPIO menu
This change puts the DW GPIO Kconfig selections inside GPIO menu.
This also groups all DW GPIO related selections under GPIO_DW.

Change-Id: I776f3f6b89e1a4dc366648f8290abb27de9eceb8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
586776f961 x86: gpio: Move system binding code to gpio-dw.c
The code fragment to bind the instances of the GPIO driver were being
replicated in every platform_config.c  This code is not platform
specific but is driver specific.

All the information required to bind a driver instance comes from
CONFIG_ variables.  Having the binding code with the driver code
avoids duplicating the code fragments in each platform where the
driver may be used.

Change-Id: Ie07a3d12d25201e82ce7074455e6c036f463851b
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Ricardo de Almeida Gonzaga
0eb46fe0e5 gpio: fix interrupt callback call on gpio-dw
When configured as GPIO_ACCESS_BY_PIN, the callback should
be called only if the pin is enabled and received an interrupt.

Change-Id: I7addeb57c8d46dddc027e9b82a92654cd210ade1
Signed-off-by: Ricardo de Almeida Gonzaga <ricardo.gonzaga@intel.com>
2016-02-05 20:16:17 -05:00
Tomasz Bursztyka
cb1774c548 gpio: Correct the PCI pre-set informations
- Device ID was wrong
- Setting default class id

Change-Id: I9fd1df284eca4067c21beffa7599307a40be5144
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:36 -05:00
Tomasz Bursztyka
26581d1c82 gpio: Remove a useless local variable
A fix for a mistake introduced in commit 1a7357.

Change-Id: I411937c85f29abb934ae5385f4858950f5d76887
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:35 -05:00
Tomasz Bursztyka
eb6ed6bb0d gpio: Enable PCI support for the designware gpio driver
This will enable the possibility to use this driver with Quark X1000.

Change-Id: Ic40b750d608488e97cc7662cad6c6d66dbf428ab
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka
e7c8bf43ac gpio: Make use of sys_io functions in gpio-dw driver
Just to align the code to generic memory mapped registers and bit
operations functions.

Change-Id: I0fe8b3b6687670d0ed0daffe52645ec2c6b4c674
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Anas Nashif
2b6ded2b7f gpio: declare api function struct as static
Change-Id: I04ce07587845a6db555f4033b3a6f2d2c622fe57
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:32 -05:00
Juan Manuel Cruz
5ad14313bc gpio: Fix designware's driver set bit function
This commit fixes the set bit function.
If the value to set is different from zero, then
the indicated bit will be set.

Change-Id: I9c42f683d108b371ca821f446ac5a10541b89b9f
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:15:32 -05:00
Dirk Brandewie
77a78f0827 gpio: Add driver for Synopsys DesignWare GPIO devices
[DL: captilize commit message title; fixed some whitespaces;
     changed the __initconfig_gpio_* from level 0 to level 1,
     which is the level of pure_init; and added include path
     to board.h; ]

Change-Id: I7eea6a6ca9e4b7cf8d1ccabb57f07f786da93ef0
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:32 -05:00