Commit graph

273 commits

Author SHA1 Message Date
Yannis Damigos
22912ffcf9 drivers: i2c_ll_stm32_v1: Fix RX for all receptions
This patch fixes the read operation of the I2C driver
for all the receptions (1-byte, 2-bytes, N-bytes when
N > 2)

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Martin Iñaki Malerba <inakimmalerba@gmail.com>
2017-08-10 12:45:44 -05:00
Yannis Damigos
9a9f65fd0c drivers: i2c_ll_stm32_v1: Fix TX if flag I2C_MSG_RESTART is set
In interrupt mode, the drivers entered a forever loop if the
I2C_MSG_RESTART flag was set. This patch fix this issue.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-08-10 12:45:44 -05:00
Yannis Damigos
654b3381aa drivers: i2c_ll_stm32_v1: Disable/enable only Buffer interrupts
The EVENT interrupt is generated when:
– SB = 1
– ADDR = 1
– ADD10= 1
– BTF = 1 with no TxE or RxNE event
– TxE event to 1 if Buffer interrupt enabled
– RxNE event to 1 if Buffer interrupt enabled

We need to disable and enable the Buffer TxE and RxNE interrupt
inside the EVENT ISR. The LL_I2C_{Enable,Disable}IT_TX and
LL_I2C_{Enable,Disable}IT_RX functions, used now, enable and
disable both Buffer and Event interrupt. This patch uses the
LL_I2C_EnableIT_BUF and  LL_I2C_DisableIT_BUF functions to
enable and disable the Buffer interrupt (TxE, RxNE).

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-08-10 12:45:44 -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
Kumar Gala
563f8f1464 i2c: mcux: Convert to supporting device tree
Update the MCUX I2C driver and related platforms to get their I2C
information from the device tree.  We also updated a few of the sensor
drivers found on the FRDM & Hexiwear boards to get their I2C bus name
from the device tree instead of directly from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-19 14:28:08 -05:00
Yannis Damigos
5b3a71a810 i2c: stm32: Update driver to get I2C port base address from DT
Update the STM32 I2C driver to get I2C port base address
from the device tree

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-19 14:28:08 -05:00
Kumar Gala
710807fa1e i2c: Fix missing Kconfig !HAS_I2C_DTS dependencies
As I2C_0 (port 0) isn't used on the STM32 platforms we didn't exclude
the related Kconfig options if DTS was enabled.  However other SoCs
(like NXP) do use I2C_0 so we need to fixup the Kconfig dependencies

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-19 14:28:08 -05:00
Yannis Damigos
1bc2fdc704 dts: arm: STM32 boards use DT to configure I2C
Configure I2C using DT for the following STM32 boards:

disco_l475_iot1
nucleo_f401re
96b_carbon
olimexino_stm32

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-07 10:31:34 -05:00
Kumar Gala
9eddc82be3 i2c: remove I2C Slave Read config
The I2C Slave Read support isn't well defined and not actually supported
by any i2c driver at this point.  We can add this back when slave mode
is more thought out.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-07 10:01:38 -05:00
Kumar Gala
4c233bbc05 i2c: stm32: fix build issue
When building tests/kernel/test_build/test_debug on disco_l475_iot1 we
get the following build error:

drivers/i2c/i2c_ll_stm32_v2.c: In function ‘stm32_i2c_configure_timing’:
ext/hal/st/stm32cube/stm32l4xx/soc/stm32l4xx.h:207:38: error: ‘timing’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
                                      ^
drivers/i2c/i2c_ll_stm32_v2.c:265:8: note: ‘timing’ was declared here
  u32_t timing;
        ^~~~~~

Fix by initializing timing to 0.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-06 09:53:00 -05:00
Jorge Ramirez-Ortiz
21fbc9b07e drivers: i2c: stm32 LL F1/F4 (v1) STM32 F3/L4X (v2)
Supports STM32 F1/F4 (v1 controller) and STM32 F3/L4X (v2
controller)

v1 could also support L1X.
v2 could also support F7X.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Reviewed-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-07-01 08:36:51 -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
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
Jon Medhurst
1c1507d4cd i2c: i2c_sbcon: Driver for ARM's SBCon 2-wire serial interface
SBCon is a simple device which allows directly setting and getting the
hardware state of two-bit serial interfaces like I2C. Therefore to be
useable we need to drive the lines with the appropriate protocol under
software control.

Change-Id: If9000bb75f7b0ad7bbb256b1cb38cc70fa6ca8ea
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-05-03 13:51:37 -04:00
Piotr Mienkowski
068766f7be drivers: i2c: clean up Kconfig file
Several minor changes to clean up I2C Kconfig file
- align help text
- remove duplicate dependencies
- use unified naming for I2C port options
- replace outdated references to datasheet in help text
- add comments at the end of 'endif'

Change-Id: I452083feb29f40909e6e38324ff9d9961fc6bd07
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-29 11:48:08 -04:00
Jon Medhurst
5b04bd9aa4 i2c: i2c_gpio: Driver for software driven I2C using GPIO lines
This driver implements an I2C interface by driving two GPIO lines under
software control.

Change-Id: Ie49cc67aed6acb30086ee851041fe2470da241cf
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-28 15:26:40 -05:00
Jon Medhurst
0818564753 i2c: bitbang: Add library for software driven I2C
This library implements the I2C single master protocol in software.
It supports the Standard-mode and Fast-mode speeds and doesn't support
optional protocol feature like 10-bit addresses or clock stretching.

Change-Id: I375d572a83714522421f2967dc414b3bec169e95
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-28 15:26:39 -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
Kumar Gala
cc334c7273 Convert remaining code 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.  This handles the remaining includes and kernel, plus
touching up various points that we skipped because of include
dependancies.  We also convert the PRI printf formatters in the arch
code over to normal formatters.

Jira: ZEP-2051

Change-Id: Iecbb12601a3ee4ea936fd7ddea37788a645b08b0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 11:38:23 -05: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
Piotr Mienkowski
5c83e3817d drivers: Add Atmel SAM family I2C (TWIHS) driver
Added I2C bus (TWIHS) driver for Atmel SAM MCU family. Only
I2C Master Mode with 7 bit addressing is currently supported.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-1866
Change-Id: Ic5aa7b6b21295feccae883d580b38bbeaf2ce291
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-14 05:56:54 -05:00
Erwan Gouriou
b8297e8fb8 drivers: i2c: stm32: fix i2c_2 instance config
Wrong base address has been provided to I2C_2 instance.
Fix this issue for proper behavior

Change-Id: I81e5cb71a5136e742f460db5db39b2adf2f10f2d
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-14 05:56:53 -05:00
Piotr Mienkowski
a8de9ff438 drivers: i2c: rename IRQ SHARED/DIRECT Kconfig options
I2C_SHARED_IRQ, I2C_0_IRQ_SHARED, I2C_0_IRQ_DIRECT Kconfig options
are DW driver specific. Its presence is confusing for a user of any
other I2C driver than DW. This patch renames these options to include
DW string and makes it visible only for DW I2C driver. This is a
similar implementation to that used by ETH DW Ethernet driver.

Change-Id: I795506f9b103c028a22317df9ad632dce5cd1343
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-14 01:58:33 +00:00
Piotr Mienkowski
06685e75ae drivers: i2c: place all I2C Kconfig options in submenu
To follow Zephyr convention this patch is placing all I2C driver
Kconfig options in submenu.

Change-Id: Ibc485305b7effb65ed7f24b933fe35d0fa0afee8
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-08 00:12:30 +00:00
Piotr Mienkowski
f33b277e6f drivers: i2c: rename I2C_CLOCK_SPEED Kconfig option
I2C_CLOCK_SPEED Kconfig option is DW driver specific. It does not
define I2C interface speed but rather the I2C DW module clock speed.
It is confusing for a user of any other I2C driver than DW.
This patch renames this option to I2C_DW_CLOCK_SPEED and makes it
visible only for DW I2C driver.

Change-Id: I97f57332fd5cca644eabdef0968a0b2174b885ff
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-08 00:12:29 +00:00
Roger Lendenmann
5bcc8fa832 arm: spi: spi master support for nrf52 family
* SPIMx support for nrf52 spi interface with easy dma

Change-Id: I3221b14867924b91a9d809faf689090574f5dc1c
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2017-04-04 17:55:13 -05:00
Erwan Gouriou
8e85600a30 drivers: i2c: stm32lx: Add support for I2C_2
Add support for I2C_2 instance on stm32lx driver

Change-Id: Iaa17305dd21f92954274ca522d30d464e0a53b7b
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-04 17:55:13 -05:00
Erwan Gouriou
40286ec697 driver: i2c: stm32lx: align numbering scheme on data sheet
On stm32 family, IP instance numbering starts from 1.
Update i2c driver to this scheme to minimize user
confusion

Change-Id: I967d5975bbbad59cd8a3a7b6dfc665955d09cc9f
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-04 17:55:13 -05: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
bb2db5dbc5 i2c: update stm32 i2c_lx to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update stm32 i2c_lx driver to support it.
Clean up will be done in a following commit.

Change-Id: Ie5059bf4122d65fab1a663a5b00e0d761850a49d
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou
0a902c345c i2c: stm32: change deprecated constant
Use of SECONDARY in DEVICE_AND_API_INIT is now deprecated and should
be replaced by POST_KERNEL

Change-Id: I543ae70e493527e75b4a4bcb9191475065b49166
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
Kuo-Lang Tseng
23b0074012 ext qmsi: Update to QMSI 1.4 RC2
Update the builtin QMSI code to 1.4 (RC2).
The below shim drivers were updated for API or interface changes:
- aio
- counter
- i2c_ss
- rtc
- wdt.

Also, arch soc specific power management code were updated.

Jira: ZEP-1572

Change-Id: Ibc8fae032a39ffb2c2c997f697835bc0208fd308
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-08 11:59:12 +00:00
Marcus Shawcroft
ec86145adf i2c/dw: Switch from EPERM to EIO
The DW i2c driver chooses to return -EPERM following a PCI error in
driver configuration.  This seems an odd choice.  All of the other I2C
drivers return -EIO for general failures detected during driver
configuration.

Switch the DW driver from EPERM to EIO.

Change-Id: Ia4f96386620319736ae4c09212b0a05ea38169b1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-07 18:32:37 +00:00
Marcus Shawcroft
ccf16c705d i2c/stm32lx: Fix layout.
Change-Id: Ifc474ff703f96e5edd9dfd280533f4d8fe6a6853
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-07 18:32:36 +00:00
Marcus Shawcroft
ddb6b94bd7 i2c: Implement consistent i2c no msgs behaviour
The I2C drivers handle an empty list of I2C messages inconsistenty.
There are two different behaviours, one set of drivers dectects a
requests to transfer zero messages and return -EINVAL while the other
group simple transfer no data and return success.

Adopt the latter behaviour consistently across all drivers.  Update
the i2c.h API documentation to reflect this behaviour.

Change-Id: I427fc1b0e18ddc04b7b59c294e0240b3d6ca4073
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-07 18:32:35 +00:00
Marcus Shawcroft
f5eeaf9527 i2c/nrf5: Remove r/w to POWER register.
The reset code that toggles the POWER register fails to build on
NRF52.  In discussion with the Nordic folks it transpires that we
don't actually need this code.

For future reference there is a related errata here:
http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.Rev1.errata/anomaly_832_89.html?cp=2_2_1_0_1_26

Change-Id: I2ba8c2bb814f8f95ff3f340862c75a8bc437c573
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-01 00:35:35 +00:00
Chuck Jordan
ac34b99af3 i2c: Can pass IRQ vector constant to irq_enable
I found that I was not getting the i2C interrupt.
When CONFIG_I2C_0_IRQ_DIRECT=y, it is acceptable to just
pass the constant to irq_enable.

See ZEP-1651.

Change-Id: I10955e6d6fe5fdd2dda916c92c8bc8a2e871f41a
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2017-01-30 17:52:58 +00:00
Marcus Shawcroft
2dd2dfc3f9 i2c/nrf5: Implement NRF5 I2C driver.
Basic interrupt driven i2c driver for the NRf5 series.

The NRf5 series hardware imposes a constraint that various peripherals
cannot be used simultaneously.  This driver does not implement mutual
exclusion against SPI, or SPIs drivers (yet).

Change-Id: I308d93bc486eef95db7b95c6b7c9beafc0d7e97f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-25 09:59:27 +00:00
Marcus Shawcroft
df632a7371 i2c: Sort Makefile in alphabetical order.
Change-Id: Id0b39b95a7f378d728ddbe0b92518af054072252
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-25 08:47:22 +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
Baohong Liu
9888bc8b9c drivers: i2c: remove an unnecessary condition check
Remove an unnecessary condition check in Kconfig.
All the config options already depend on I2C.

Change-Id: Ia8876442652df9f105e862d8c2db394699c81f63
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-01-18 17:13:10 -08:00
Maureen Helm
b22bc6e69b i2c: Rename ksdk to mcux
Renames the ksdk i2c shim driver to mcux.

Change-Id: I1bcae2fa30cb698af32d6abc609d77dee42c608d
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:26 -06:00
Qiu Peiyang
e4ad31a231 i2c_qmsi_ss: add device_busy_set() to avoid re-enter deep sleep
When CONFIG_SYS_POWER_DEEP_SLEEP is enabled, i2c_qmsi_ss will
keep entering deep sleep because it needs to wait until the
current transfer completes, which blocks the current thread.
The system keeps entering deep sleep again and again and the
transfer will never complete.

Add device_busy_set() to i2c_qmsi_ss driver to indicate that
the device is busy and block the system from entering deep
sleep during transaction.

Jira: ZEP-1487

Change-Id: Ia681d242349bce5a9867e54df4e65dba09005930
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-12-23 16:49:23 +00:00
Baohong Liu
db09c2905b drivers: i2c_shim: grant arc the access to i2c on I/O fabric
Enable arc to access the i2c controller on I/O fabric.

There are two i2c controllers on quark se SoC. One is attached
to the I/O fabric and the other one is in the sensor system.
X86 cpu is only able to access the i2c controller on the I/O
fabric and the access is supported by existing code. HW allows
arc to access both controllers. But, the existing code only
gives arc access to the controller in the sensor sub-system.
Let's grant arc the access to the controller on I/O fabric as
well by the following changes.

1. Add i2c_qmsi.c into arc compilation.
2. Use the already defined macros to choose interrupt numbers
   and do interrupt unmasking automatically based on the
   compilation targets.
3. Add new symbols in Kconfig including driver names for both
   controllers

Jira: ZEP-1189

Change-Id: I317da6038c50e0c8bd16f446182c1f8bdf6d3ba2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-22 01:22:52 +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
Flavio Santes
501dd224ad drivers: Add the ARG_UNUSED macro
Add the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: Ia62125b5e93671aa0ab0891c92ae9fa06fadb09b
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:52 +00: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
Baohong Liu
fd314e721e drivers: i2c: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: I5662057222aec54f02db9d9cdcd7f4f006c6c530
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:23:34 +00:00
Neil Armstrong
abae57ac30 stm32lx: add i2c driver for the L series
Add the I2C for the STM32Lx series

Change-Id: Id1694aeb3606b4fa9772bfb7a9f60e48a7cc93a8
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
JuanX Solano Menacho
b4b612f1e4 i2c_qmsi_ss: Use qm_ss_i2c_save/restore_context APIs
This commit updates the i2c_qmsi_ss driver by adding save/restore
context functionality for power management, using the corresponsing
QMSI APIs.

Jira: ZEP-666

Change-Id: I36fb18b52edd4dac4c4b6cb98162adbca74800cb
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-11 23:33:20 +00:00
Baohong Liu
82193c59e3 drivers: i2c: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I17cde2f2cf457ac60905824ae581ede495f02709
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 02:00:07 +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
Jesus Sanchez-Palencia
55c00ad721 ext qmsi: Update to 1.3.1 version
Update to QMSI 1.3.1 release.

The only build fix needed was due to the split of the I2C ISR on
qm_isr.h .

Change-Id: Ide7a1537572c72981ec3283dc5cf0d543d9ac7d1
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-11-04 23:31:29 +00:00
JuanX Solano Menacho
6f8d48e0cb i2c_qmsi: Use qm_i2c_save/restore_context APIs
This commit updates the i2c_qmsi driver by removing the temporary Zephyr
save/restore context implementation and using the new QMSI APIs.

Jira: ZEP-996
Change-Id: I9fbd563f214b757f3435037b3e24da4bcf08da14
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:10 +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
Marcus Shawcroft
c8a359c039 grove/i2c/dw: Limit name space, add static.
Change-Id: I949d07a962c9dc409de9c458a09a9d829f791496
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:02 +00:00
Marcus Shawcroft
db22d3c8da drivers/i2c_qmsi_ss: Make driver_api structure const.
Change-Id: Id7671da509ce6082f2b85a0349d11ce5424a78a3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:28 +00:00
Marcus Shawcroft
042f5da963 drivers/i2c_qmsi: Make driver_api structure const.
Change-Id: If51f4b6e0c37f5864ad24b433b44629f1195d85a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:28 +00:00
Marcus Shawcroft
8707593b93 drivers/i2c_ksdk: Make driver_api structure const.
Change-Id: If8e674b581b75a31e1aa8ba08acf936fabdd44b3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:27 +00:00
Marcus Shawcroft
a2f7bed768 drivers/i2c_dw: Make driver_api structure const.
Change-Id: I104912a82920fea08bb32cc1838a80c7f952b1a1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:27 +00:00
Marcus Shawcroft
e6cd44fad8 drivers/i2c_atmel_sam3: Make driver_api structure const.
Change-Id: I285e05153beddc15d63ba4437a7d2757c4131e89
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:26 +00:00
Iván Briano
5a76185655 i2c qmsi: Fix enabling of the clock at driver init
Put the clk_perih_enable() call outside of the switch statement so it
actually runs.

Jira: ZEP-1048

Change-Id: Iee8efb4430d37dc74ce48f249bbf58d53125b520
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-21 16:53:42 +00:00
Marcus Shawcroft
ba30e3e59e i2c/qmsi_ss: Make driver config_info structure const.
Change-Id: I3718c34cc4cc7e70256321736b0981c147f319f5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:51 +00:00
Marcus Shawcroft
a4dd8e91d1 i2c/qmsi: Make driver config_info structure const.
Change-Id: Ic31f40c48a71fdc3a1745ee5685cc14fdbb7527b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:51 +00:00
Marcus Shawcroft
49b0face1e i2c/ksdk: Make driver config_info structure const.
Change-Id: I605ab6f33222c11e8f336e1a981615e7b0c6cefa
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:51 +00:00
Marcus Shawcroft
72a70fa224 i2c/dw: Make driver config_info structure const.
Change-Id: I66ac4cf010affc6193d1d74dec8dc25e69454438
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:50 +00:00
Marcus Shawcroft
6919ef179e i2c/sam3: Make driver config_info structure const.
Change-Id: Idf49d5b5663f5e0375b7ea23e056d0465f32abce
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:50 +00:00
Marcus Shawcroft
beb05f8661 i2c/dw: Move RW objects in config_info to driver_data
PCI enumeration modifies pci_dev, base_addaress at driver
initialization therefore this 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: Id5af682dac112ec6dc6e4aa14b655e0047972d38
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-19 12:10:58 +00:00
Marcus Shawcroft
0f1d0d465b i2c/qmsi_ss: Make pointers to config_info const.
Change-Id: I7786f9c65e62eee27395d53b6e923dec6c13f1f4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:22 +00:00
Marcus Shawcroft
3d32b19726 i2c/qmsi: Make pointers to config_info const.
Change-Id: I95e17cda100c068bfd61e66c568b5adb6f58c42c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:22 +00:00
Marcus Shawcroft
389e606b06 i2c/sam3: Make config_info pointers const.
Change-Id: I5e388ff91430d052c84553a8cf9ece12cae29993
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:19 +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
3924f46359 i2c/kdk: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ifdef448b9b6899367d41bda2f492a8e9fbd0d483
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Qiu Peiyang
76549c1b79 I2C: remove obsolete i2c_quark_se_ss driver
i2c_quark_se_ss driver is deprecated and replaced
by i2c_qmsi_ss. So remove i2c_quark_se_ss definition.

Change-Id: Idcc6a7f01ffae626ae7d5f9966eac67be78599af
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-10-05 10:07:30 +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
Julien Delayen
859a367d9c i2c_qmsi: Implement suspend and resume functions
In order to restore i2c context after entering
SYS_PM_DEEP_SLEEP, suspend and resume functions
are called.

The following parameters are restored:
 - All registers for the I2C device.
 - I2C clocks.

I2C depends on the DMA which is enabled separately.

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: I22ca2fb9884109f7b5ca75af572811187a531403
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-09-12 00:30:28 +00:00
Baohong Liu
b0c28f2d00 drivers: i2c: fix a compilation dependency issue
Fix a compilation warning. Compilation of the i2c driver
requires QMSI dma object file. As a solution, the current
code has "selects DMA_QMSI" in i2c Kconfig. This results
in a compilation warning since "select DMA" is also
required. Adding "select DMA" and "select DMA_QMSI"
together in i2c Kconfig can solve the compilation issue.
But, this will cause the dma driver be unnecessarily
enabled. So, the solution is to fix the issue in the QMSI
part instead of in the shim driver.

Jira: ZEP-777 ZEP-778

Change-Id: Id4c1f749bf71eece1e70583bd586a69b596768b2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-09-10 11:29:49 +00:00
Baohong Liu
20d85fefe9 i2c: qmsi_shim: change some i2c config parameters to SoC specific
Change the signal ramp up/down config parameters in i2c driver
module to SoC specific.

Jira: ZEP-753

Change-Id: Ie01f1d890a7133d30ea53eee07f60354734a8571
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-09-08 11:57:41 +00:00
Maureen Helm
e4067638b7 i2c: ksdk: Add shim driver
Add a shim layer around the ksdk I2C driver to adapt it to the Zephyr
I2C interface. Currently only supports master mode.

Jira: ZEP-717
Change-Id: I704b8c38e22e456bb9fa4325682b2a354a27a7ba
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-09-07 14:40:20 +00:00
Baohong Liu
1010927ba9 drivers: i2c_shim: fix i2c fast plus mode failure
Fix i2c failure seen on fast plus mode. With higher data
rate, signal ramp time becomes longer. The ramp time
required by the controller needs to be loosened.

Jira: ZEP-711

Change-Id: Icffa334ec3f059564e333d3b0759a11d1bebc5e4
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-08-30 21:09:49 +00: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
Baohong Liu
e8a852325f drivers: i2c: Fix i2c failure on multiple slaves
Fix i2c failure while multiple slaves are connected to the
same i2c interface. Higher load on the i2c bus makes i2c
signal less nice. The requirement for signal ramp up and
ramp down time needs to be loosened.

Jira: ZEP-646

Change-Id: If698d7ba741788857694f166ecc602c2a94cb12e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-08-12 20:35:25 +00:00
Iván Briano
4be7d42db8 i2c: Remove suspend and resume hooks from i2c_driver_api
Drivers that implement power management should use the preferred
device_pm_ops method instead.

Change-Id: I9ae06e26b77325265bbe46bdee82ba39dedb6b79
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-29 23:10:10 +00:00
Jani Pajarinen
485dde19da i2c: Fixed i2c_dw spamming when logs are enabled
Added CONFIG_SYS_LOG_I2C_LEVEL define, so that DW I2C driver will
not print traces unless requested with CONFIG_SYS_LOG_I2C_LEVEL.
Currently it doesn't obey it, so DW I2C spams DBG traces when
logging is enabled.

Change-Id: I87dc1d922ba61d39f26945627602864c75d9bf33
Signed-off-by: Jani Pajarinen <jani.pajarinen@intel.com>
2016-07-28 15:43:00 +00:00
Baohong Liu
db17939c8a drivers: i2c: remove i2c master idle check
The idle status check before a i2c transfer is not a reliable
way to check whether i2c master is ready to transfer data. If
the data transfer for the previous API call is done, but, a
stop condition is not sent by the previous API, the i2c master
is not idle, but, it can start new data transfer.

Change-Id: I93dbf46cef6272f3da69a0d67fb737c9b480791f
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-27 14:44:54 +00:00
Genaro Saucedo Tejada
89e46d431a sys_log: replace old debug macros at i2c
Designware, Amtel and Quark SE i2c drivers are now using new system
log macros. also update the Kconfig variable to be a level rather than
a bool.
JIRA: ZEP-311

Change-Id: Iac009b20fb74deb8ce72098378651bbec3b2ef17
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-08 18:20:28 +00:00
Baohong Liu
5846bb6d65 drivers: i2c: qmsi shim driver bug fix
Fix a bug in i2c_qmsi_transfer function in the shim driver.
The function did not wait for the completion of a msg transfer
before starting another msg transfer. Similar issue exists in
the i2c sensor shim driver. It is also fixed.

Change-Id: I1f8ad2281fa185d85db25a4682ed596c02ea322e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-06 17:43:49 +00:00
Jesus Sanchez-Palencia
abd7496225 ext qmsi: Update to QMSI 1.1-Beta
QMSI 1.1 Beta is available on Github:
https://github.com/01org/qmsi/releases/tag/v1.1.0-beta

Update the QMSI drop we maintain in Zephyr and
keep the modification to qm_soc_regs.h introduced on commit
6b88a6b945 "ext qmsi: Add USB base and interrupt defines" since
that patch hasn't made into the QMSI 1.1-Beta release in time.

Also, fix the build where needed:
- add hard dependency from qm_i2c to qm_dma
- fix spi_qmsi_ss.c due to new parameter naming
- fix adc_qmsi.c and adc_qmsi_ss.c due to a new parameter

Change-Id: I01388c787f5ee6ee97fece2e42b24a717522207f
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-01 13:43:02 -07:00
Bogdan Davidoaia
44ef3c182b i2c: qmsi: remove duplicate I2C_QMSI_SS Kconfig option
Remove duplicate I2C_QMSI_SS option from Kconfig file, as there is no
reason to have it twice.

Change-Id: I602677676419c3f9581a606e8e3ebb889b439eb7
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-09 12:26:38 +03:00
Anas Nashif
1cb62d0372 i2c: qmsi: use I2C_SPEED_FAST_PLUS from API
Do not use the QMSI specfic define, use the one define in the
i2c API instead.

Change-Id: I979673e35060d041cb97f4de178069e2bdfd2c7b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-02 13:46:44 -04:00
Sergio Rodriguez
ab833c74c5 i2c: quark_se ss: Use locking mechanism to guard critical regions.
This will allow the driver to be safe from fibers and task

Jira: ZEP-411

Change-Id: I714f22c8df7002c45bed981c493e11af91c70d93
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-06-01 00:42:11 +00:00
Sergio Rodriguez
10e33ff779 i2c: Bug fix for the semaphore locking mechanism for i2c
The locking and synch mechanisms were configured after the interrupts
for the I2C controller are enabled, now the configuration is done before
the enabling of the interrupts.
Jira: ZEP-419
Change-Id: Ia1b0e790b9f5f8e7560cc3556b7a0f394048d171
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-05-31 22:54:55 +00:00
Sergio Rodriguez
bf45b0bd87 i2c: Use locking mechanism to guard critical regions.
This will allow the driver to be safe from fibers and task

Change-Id: I6c4c4fc387cf334f0287b8a02982be1941a311fd
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-05-26 21:40:21 +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
Chuck Jordan
0fc41677b2 i2c: fix some spelling errors/grammar in comments
Some minor fixes to some comments

Change-Id: I0244d70c31b59ba189673e44c3919710414e9810
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-24 10:14:10 -07:00
Sergio Rodriguez
92e9ffe481 i2c: quark se: Add QMSI 1.1-based I2C shim driver
Add I2C QMSI shim driver for sensor system based on QMSI 1.1

Origin: Original
Change-Id: I9c8efe49e8e9b7a5f8496fa49beb68e409148be7
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:31:27 +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