Skip to content

Commit

Permalink
dts: Add support for Nordic QDEC
Browse files Browse the repository at this point in the history
Add QDEC binding and entry in Nordic SoC DTSI files.

This closes issue #9364

Jira:DESK-259

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
  • Loading branch information
pdunaj authored and MaureenHelm committed Oct 17, 2018
1 parent cb01d09 commit ecae736
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dts/Kconfig
Expand Up @@ -32,6 +32,13 @@ config HAS_DTS_SPI
This option specifies that the target platform supports device tree
configuration for SPI.

config HAS_DTS_QDEC
bool
depends on HAS_DTS
help
This option specifies that the target platform supports device tree
configuration for QDEC.

config HAS_DTS_USB
bool
depends on HAS_DTS
Expand Down
8 changes: 8 additions & 0 deletions dts/arm/nordic/nrf51822.dtsi
Expand Up @@ -93,6 +93,14 @@
label = "I2C_1";
};

qdec: qdec@40012000 {
compatible = "nordic,nrf-qdec";
reg = <0x40012000 0x1000>;
interrupts = <18 1>;
status = "disabled";
label = "QDEC";
};

spi0: spi@40003000 {
compatible = "nordic,nrf-spi";
#address-cells = <1>;
Expand Down
8 changes: 8 additions & 0 deletions dts/arm/nordic/nrf52810.dtsi
Expand Up @@ -82,6 +82,14 @@
label = "I2C_0";
};

qdec: qdec@40012000 {
compatible = "nordic,nrf-qdec";
reg = <0x40012000 0x1000>;
interrupts = <18 1>;
status = "disabled";
label = "QDEC";
};

spi0: spi@40004000 {
compatible = "nordic,nrf-spi";
#address-cells = <1>;
Expand Down
8 changes: 8 additions & 0 deletions dts/arm/nordic/nrf52832.dtsi
Expand Up @@ -95,6 +95,14 @@
label = "I2C_1";
};

qdec: qdec@40012000 {
compatible = "nordic,nrf-qdec";
reg = <0x40012000 0x1000>;
interrupts = <18 1>;
status = "disabled";
label = "QDEC";
};

spi0: spi@40003000 {
compatible = "nordic,nrf-spi";
#address-cells = <1>;
Expand Down
8 changes: 8 additions & 0 deletions dts/arm/nordic/nrf52840.dtsi
Expand Up @@ -113,6 +113,14 @@
label = "I2C_1";
};

qdec: qdec@40012000 {
compatible = "nordic,nrf-qdec";
reg = <0x40012000 0x1000>;
interrupts = <18 1>;
status = "disabled";
label = "QDEC";
};

spi0: spi@40003000 {
compatible = "nordic,nrf-spi";
#address-cells = <1>;
Expand Down
73 changes: 73 additions & 0 deletions dts/bindings/sensor/nordic,nrf-qdec.yaml
@@ -0,0 +1,73 @@
#
# Copyright (c) 2018, Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
---
title: Nordic nRF Family QDEC node
version: 0.1

description: >
This is a representation of the Nordic nRF QDEC node
properties:
compatible:
type: string
category: required
description: compatible strings
constraint: "nordic,nrf-qdec"

reg:
type: array
description: mmio register space
generation: define
category: required

interrupts:
type: array
category: required
description: required interrupts
generation: define

a-pin:
type: int
description: A pin
generation: define
category: required

b-pin:
type: int
description: B pin
generation: define
category: required

led-pin:
type: int
description: LED pin for light based QDEC device
generation: define
category: optional

enable-pin:
type: int
description: Enables connected QDEC device
generation: define
category: optional

led-pre:
type: int
description: Time LED is enabled prior to sampling event (in us)
generation: define
category: required

steps:
type: int
description: Number of steps on the rotating wheel
generation: define
category: required

label:
type: string
category: required
description: Human readable string describing the device (used by Zephyr for API name)
generation: define
...
15 changes: 15 additions & 0 deletions soc/arm/nordic_nrf/nrf51/dts_fixup.h
Expand Up @@ -42,6 +42,21 @@
#define CONFIG_I2C_1_SDA_PIN NORDIC_NRF_I2C_40004000_SDA_PIN
#define CONFIG_I2C_1_SCL_PIN NORDIC_NRF_I2C_40004000_SCL_PIN

#define CONFIG_QDEC_BASE_ADDR NORDIC_NRF_QDEC_40012000_BASE_ADDRESS
#define CONFIG_QDEC_NAME NORDIC_NRF_QDEC_40012000_LABEL
#define CONFIG_QDEC_IRQ_PRI NORDIC_NRF_QDEC_40012000_IRQ_0_PRIORITY
#define CONFIG_QDEC_IRQ NORDIC_NRF_QDEC_40012000_IRQ_0
#define CONFIG_QDEC_A_PIN NORDIC_NRF_QDEC_40012000_A_PIN
#define CONFIG_QDEC_B_PIN NORDIC_NRF_QDEC_40012000_B_PIN
#if defined(NORDIC_NRF_QDEC_40012000_LED_PIN)
#define CONFIG_QDEC_LED_PIN NORDIC_NRF_QDEC_40012000_LED_PIN
#endif
#if defined(NORDIC_NRF_QDEC_40012000_ENABLE_PIN)
#define CONFIG_QDEC_ENABLE_PIN NORDIC_NRF_QDEC_40012000_ENABLE_PIN
#endif
#define CONFIG_QDEC_LED_PRE NORDIC_NRF_QDEC_40012000_LED_PRE
#define CONFIG_QDEC_STEPS NORDIC_NRF_QDEC_40012000_STEPS

#define CONFIG_SPI_0_BASE_ADDRESS NORDIC_NRF_SPI_40003000_BASE_ADDRESS
#define CONFIG_SPI_0_NAME NORDIC_NRF_SPI_40003000_LABEL
#define CONFIG_SPI_0_IRQ_PRI NORDIC_NRF_SPI_40003000_IRQ_0_PRIORITY
Expand Down
15 changes: 15 additions & 0 deletions soc/arm/nordic_nrf/nrf52/dts_fixup.h
Expand Up @@ -75,6 +75,21 @@
#define CONFIG_I2C_1_SDA_PIN NORDIC_NRF_I2C_40004000_SDA_PIN
#define CONFIG_I2C_1_SCL_PIN NORDIC_NRF_I2C_40004000_SCL_PIN

#define CONFIG_QDEC_BASE_ADDR NORDIC_NRF_QDEC_40012000_BASE_ADDRESS
#define CONFIG_QDEC_NAME NORDIC_NRF_QDEC_40012000_LABEL
#define CONFIG_QDEC_IRQ_PRI NORDIC_NRF_QDEC_40012000_IRQ_0_PRIORITY
#define CONFIG_QDEC_IRQ NORDIC_NRF_QDEC_40012000_IRQ_0
#define CONFIG_QDEC_A_PIN NORDIC_NRF_QDEC_40012000_A_PIN
#define CONFIG_QDEC_B_PIN NORDIC_NRF_QDEC_40012000_B_PIN
#if defined(NORDIC_NRF_QDEC_40012000_LED_PIN)
#define CONFIG_QDEC_LED_PIN NORDIC_NRF_QDEC_40012000_LED_PIN
#endif
#if defined(NORDIC_NRF_QDEC_40012000_ENABLE_PIN)
#define CONFIG_QDEC_ENABLE_PIN NORDIC_NRF_QDEC_40012000_ENABLE_PIN
#endif
#define CONFIG_QDEC_LED_PRE NORDIC_NRF_QDEC_40012000_LED_PRE
#define CONFIG_QDEC_STEPS NORDIC_NRF_QDEC_40012000_STEPS

#define CONFIG_SPI_0_BASE_ADDRESS NORDIC_NRF_SPI_40003000_BASE_ADDRESS
#define CONFIG_SPI_0_NAME NORDIC_NRF_SPI_40003000_LABEL
#define CONFIG_SPI_0_IRQ_PRI NORDIC_NRF_SPI_40003000_IRQ_0_PRIORITY
Expand Down

0 comments on commit ecae736

Please sign in to comment.