boards: arc: Convert boards to use device tree for LEDs & Buttons

Convert over arc based boards to use device tree instead of board.h to
describe buttons & LEDs.  There are a few boards that the button gpio
flags need validation.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2018-10-04 20:00:16 -05:00 committed by Anas Nashif
commit 325a9b3ea4
11 changed files with 146 additions and 68 deletions

View file

@ -15,6 +15,7 @@
compatible = "intel,arduino_101_sss", "intel,quark_se_c1000";
aliases {
led0 = &led0;
uart-0 = &uart0;
uart-1 = &uart1;
};
@ -24,6 +25,14 @@
zephyr,flash = &flash0;
zephyr,console = &uart1;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 8 0>;
label = "LED";
};
};
};
&uart1 {

View file

@ -9,7 +9,4 @@
#include <soc.h>
#define LED0_GPIO_PORT CONFIG_GPIO_QMSI_0_NAME
#define LED0_GPIO_PIN 8
#endif /* __INC_BOARD_H */

View file

@ -0,0 +1,97 @@
/ {
aliases {
led0 = &led0;
led1 = &led1;
led2 = &led2;
led3 = &led3;
led4 = &led4;
led5 = &led5;
led6 = &led6;
led7 = &led7;
led8 = &led8;
sw0 = &button0;
sw1 = &button1;
sw2 = &button2;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio1 0 0>;
label = "LED 0";
};
led1: led_1 {
gpios = <&gpio1 1 0>;
label = "LED 1";
};
led2: led_2 {
gpios = <&gpio1 2 0>;
label = "LED 2";
};
led3: led_3 {
gpios = <&gpio1 3 0>;
label = "LED 3";
};
led4: led_4 {
gpios = <&gpio1 4 0>;
label = "LED 4";
};
led5: led_5 {
gpios = <&gpio1 5 0>;
label = "LED 1";
};
led6: led_6 {
gpios = <&gpio1 6 0>;
label = "LED 2";
};
led7: led_7 {
gpios = <&gpio1 7 0>;
label = "LED 3";
};
led8: led_8 {
gpios = <&gpio1 8 0>;
label = "LED 4";
};
};
buttons {
compatible = "gpio-keys";
button0: button_0 {
/* gpio flags need validation */
gpios = <&gpio0 0 GPIO_INT_ACTIVE_LOW>;
label = "Push button switch 0";
};
button1: button_1 {
/* gpio flags need validation */
gpios = <&gpio0 1 GPIO_INT_ACTIVE_LOW>;
label = "Push button switch 1";
};
button2: button_2 {
/* gpio flags need validation */
gpios = <&gpio0 2 GPIO_INT_ACTIVE_LOW>;
label = "Push button switch 2";
};
switch0: switch_0 {
/* gpio flags need validation */
gpios = <&gpio2 0 GPIO_INT_ACTIVE_LOW>;
label = "DIP SW1 - Switch 1";
};
switch1: switch_1 {
/* gpio flags need validation */
gpios = <&gpio2 1 GPIO_INT_ACTIVE_LOW>;
label = "DIP SW1 - Switch 2";
};
switch2: switch_2 {
/* gpio flags need validation */
gpios = <&gpio2 2 GPIO_INT_ACTIVE_LOW>;
label = "DIP SW1 - Switch 3";
};
switch3: switch_3 {
/* gpio flags need validation */
gpios = <&gpio2 3 GPIO_INT_ACTIVE_LOW>;
label = "DIP SW1 - Switch 4";
};
};
};

View file

@ -9,55 +9,4 @@
#include <soc.h>
/* Switches */
#define SW0_GPIO_PIN 0
#define SW0_GPIO_NAME CONFIG_GPIO_DW_2_NAME
#define SW1_GPIO_PIN 1
#define SW1_GPIO_NAME CONFIG_GPIO_DW_2_NAME
#define SW2_GPIO_PIN 2
#define SW2_GPIO_NAME CONFIG_GPIO_DW_2_NAME
#define SW3_GPIO_PIN 3
#define SW3_GPIO_NAME CONFIG_GPIO_DW_2_NAME
/* Buttons */
#define BTN0_GPIO_PIN 0
#define BTN0_GPIO_NAME CONFIG_GPIO_DW_0_NAME
#define BTN1_GPIO_PIN 1
#define BTN1_GPIO_NAME CONFIG_GPIO_DW_0_NAME
#define BTN2_GPIO_PIN 2
#define BTN2_GPIO_NAME CONFIG_GPIO_DW_0_NAME
/* Onboard LEDs */
#define LED0_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED0_GPIO_PIN 0
#define LED1_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED1_GPIO_PIN 1
#define LED2_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED2_GPIO_PIN 2
#define LED3_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED3_GPIO_PIN 3
#define LED4_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED4_GPIO_PIN 4
#define LED5_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED5_GPIO_PIN 5
#define LED6_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED6_GPIO_PIN 6
#define LED7_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED7_GPIO_PIN 7
#define LED8_GPIO_PORT CONFIG_GPIO_DW_1_NAME
#define LED8_GPIO_PIN 8
#endif /* __INC_BOARD_H */

View file

@ -7,7 +7,7 @@
/dts-v1/;
#include <emsk.dtsi>
#include "board.dtsi"
/ {
model = "em_starterkit-em9d";

View file

@ -7,6 +7,7 @@
/dts-v1/;
#include <emsk.dtsi>
#include "board.dtsi"
/ {
model = "em_starterkit-em11d";

View file

@ -7,6 +7,7 @@
/dts-v1/;
#include <emsk.dtsi>
#include "board.dtsi"
/ {
model = "em_starterkit-em7d";

View file

@ -9,17 +9,4 @@
#include <soc.h>
/* Push button switch 0 */
#define SW0_GPIO_PIN 4
#define SW0_GPIO_NAME CONFIG_GPIO_QMSI_1_NAME
/* Push button switch 1 */
#define SW1_GPIO_PIN 5
#define SW1_GPIO_NAME CONFIG_GPIO_QMSI_0_NAME
/* Onboard LED */
#define LED0_GPIO_PORT CONFIG_GPIO_QMSI_0_NAME
#define LED0_GPIO_PIN 25
#endif /* __INC_BOARD_H */

View file

@ -15,6 +15,9 @@
compatible = "intel,quark_se_c1000_ss_devboard", "intel,quark_se_c1000";
aliases {
led0 = &led0;
sw0 = &button0;
sw1 = &button1;
uart-0 = &uart0;
uart-1 = &uart1;
};
@ -24,6 +27,30 @@
zephyr,flash = &flash0;
zephyr,console = &uart1;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 25 0>;
label = "LED";
};
};
buttons {
/* Push button switch 0 KEY1 */
compatible = "gpio-keys";
button0: button_0 {
/* gpio flags need validation */
gpios = <&gpio1 4 GPIO_INT_ACTIVE_LOW>;
label = "Push button switch 0";
};
button1: button_1 {
/* gpio flags need validation */
gpios = <&gpio0 5 GPIO_INT_ACTIVE_LOW>;
label = "Push button switch 1";
};
};
};
&uart1 {

View file

@ -7,6 +7,7 @@
#include "skeleton.dtsi"
#include <arc/emsk_dt.h>
#include <dt-bindings/i2c/i2c.h>
#include <dt-bindings/gpio/gpio.h>
/ {
@ -111,6 +112,8 @@
interrupts = <DT_GPIO0_INTNO 1>;
interrupt-parent = <&intc>;
gpio-controller;
#gpio-cells = <2>;
};
gpio1: gpio@f000200C {
@ -121,6 +124,8 @@
interrupts = <DT_GPIO1_INTNO 1>;
interrupt-parent = <&intc>;
gpio-controller;
#gpio-cells = <2>;
};
gpio2: gpio@f0002018 {
@ -132,6 +137,8 @@
interrupts = <DT_GPIO2_INTNO 1>;
interrupt-parent = <&intc>;
gpio-controller;
#gpio-cells = <2>;
};
gpio3: gpio@f0002024 {
@ -143,6 +150,8 @@
interrupts = <DT_GPIO3_INTNO 1>;
interrupt-parent = <&intc>;
gpio-controller;
#gpio-cells = <2>;
};
spi0: spi@f0006000 {

View file

@ -7,6 +7,7 @@
#include "skeleton.dtsi"
#include <dt-bindings/i2c/i2c.h>
#include <dt-bindings/gpio/gpio.h>
/ {
cpus {