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>
This commit is contained in:
Kumar Gala 2018-09-28 14:05:49 -05:00 committed by Kumar Gala
commit db2ca70a23
6 changed files with 66 additions and 7 deletions

View file

@ -14,6 +14,7 @@
aliases {
uart-0 = &uart0;
gpio-0 = &gpio0;
};
chosen {
@ -26,3 +27,6 @@
current-speed = <115200>;
};
&gpio0 {
status = "ok";
};

View file

@ -8,6 +8,7 @@
menuconfig GPIO_PULPINO
bool "Pulpino GPIO controller driver"
depends on GPIO && SOC_RISCV32_PULPINO
select HAS_DTS_GPIO
help
Enable driver for the Pulpino GPIO controller.

View file

@ -258,7 +258,7 @@ static int gpio_pulpino_init(struct device *dev)
static void gpio_pulpino_cfg_0(void);
static const struct gpio_pulpino_config gpio_pulpino_config0 = {
.gpio_base_addr = PULP_GPIO_0_BASE,
.gpio_base_addr = GPIO_0_BASE_ADDRESS,
.gpio_cfg_func = gpio_pulpino_cfg_0,
};
@ -271,10 +271,10 @@ DEVICE_AND_API_INIT(gpio_pulpino_0, "gpio0", gpio_pulpino_init,
static void gpio_pulpino_cfg_0(void)
{
IRQ_CONNECT(PULP_GPIO_0_IRQ,
IRQ_CONNECT(GPIO_0_IRQ,
0,
gpio_pulpino_irq_handler,
DEVICE_GET(gpio_pulpino_0),
0);
irq_enable(PULP_GPIO_0_IRQ);
irq_enable(GPIO_0_IRQ);
}

View file

@ -0,0 +1,45 @@
#
# Copyright (c) 2018, Linaro Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
---
title: PULPINO GPIO Controller
id: pulp,pulpino-gpio
version: 0.1
description: >
This is a representation of the Pulpino GPIO node
properties:
compatible:
type: string
category: required
description: compatible strings
constraint: "pulp,pulpino-gpio"
generation: define
reg:
type: int
description: mmio register space
generation: define
category: required
interrupts:
type: compound
category: required
description: required interrupts
generation: define
label:
type: string
category: required
description: Human readable string describing the device (used by Zephyr for API name)
generation: define
cell_string: GPIO
"#cells":
- pin
- flags
...

View file

@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/gpio/gpio.h>
/ {
#address-cells = <1>;
#size-cells = <1>;
@ -44,6 +46,17 @@
status = "disabled";
};
gpio0: gpio@1a101000 {
compatible = "pulp,pulpino-gpio";
gpio-controller;
reg = <0x1a101000 0x1000>;
interrupts = <25>;
interrupt-parent = <&intc>;
label = "GPIO";
status = "disabled";
#gpio-cells = <2>;
};
intc: interrupt-controller@1a104000 {
#interrupt-cells = <1>;
compatible = "pulp,pulpino-event-unit";

View file

@ -22,7 +22,6 @@
/* IRQ numbers */
#define PULP_I2C_0_IRQ 23 /* I2C Controller */
#define PULP_GPIO_0_IRQ 25 /* GPIO Controller */
#define PULP_SPI_0_IRQ 26 /* SPI Controller #0 */
#define PULP_SPI_1_IRQ 27 /* SPI Controller #1 */
#define PULP_TIMER_A_OVERFLOW_IRQ 28 /* Timer Overflow A */
@ -61,9 +60,6 @@
#define CONFIG_UART_NS16550_PORT_0_IRQ_PRI 0
#define CONFIG_UART_NS16550_PORT_0_IRQ_FLAGS 0
/* GPIO configuration */
#define PULP_GPIO_0_BASE 0x1A101000
/* PAD configuration */
#define PULP_PAD_BASE 0x1A107000