arm: dts: ti_lm3s6965: Add device tree support for Stellaris UART

Converted Stellaris UART driver over to utilize device tree generated
defines.  Added a yaml description for the uart, and converted over the
ti_lm3s6965 SoC & qemu_cortex_m3 board port over to utilize it.

Change-Id: Ie20844eb63d2c68eb59ad4160f7f5b5a35e2943b
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2017-04-28 11:34:06 -05:00
commit ac0bb050dd
7 changed files with 86 additions and 95 deletions

View file

@ -26,31 +26,11 @@ if UART_STELLARIS
config UART_STELLARIS_PORT_0 config UART_STELLARIS_PORT_0
def_bool y def_bool y
if UART_STELLARIS_PORT_0
config UART_STELLARIS_PORT_0_IRQ_PRI
default 3
config UART_STELLARIS_PORT_0_BAUD_RATE
default 115200
endif
config UART_STELLARIS_PORT_1 config UART_STELLARIS_PORT_1
def_bool y def_bool y
if UART_STELLARIS_PORT_1
config UART_STELLARIS_PORT_1_IRQ_PRI
default 3
config UART_STELLARIS_PORT_1_BAUD_RATE
default 115200
endif
config UART_STELLARIS_PORT_2 config UART_STELLARIS_PORT_2
def_bool y def_bool y
if UART_STELLARIS_PORT_2
config UART_STELLARIS_PORT_2_IRQ_PRI
default 3
config UART_STELLARIS_PORT_2_BAUD_RATE
default 115200
endif
endif # UART_STELLARIS endif # UART_STELLARIS

View file

@ -32,8 +32,6 @@ extern "C" {
#define IRQ_GPIO_PORTC 2 #define IRQ_GPIO_PORTC 2
#define IRQ_GPIO_PORTD 3 #define IRQ_GPIO_PORTD 3
#define IRQ_GPIO_PORTE 4 #define IRQ_GPIO_PORTE 4
#define IRQ_UART0 5
#define IRQ_UART1 6
#define IRQ_SSI0 7 #define IRQ_SSI0 7
#define IRQ_I2C0 8 #define IRQ_I2C0 8
#define IRQ_PWM_FAULT 9 #define IRQ_PWM_FAULT 9
@ -60,7 +58,6 @@ extern "C" {
#define IRQ_GPIO_PORTF 30 #define IRQ_GPIO_PORTF 30
#define IRQ_GPIO_PORTG 31 #define IRQ_GPIO_PORTG 31
#define IRQ_RESERVED1 32 #define IRQ_RESERVED1 32
#define IRQ_UART2 33
#define IRQ_RESERVED2 34 #define IRQ_RESERVED2 34
#define IRQ_TIMER3A 35 #define IRQ_TIMER3A 35
#define IRQ_TIMER3B 36 #define IRQ_TIMER3B 36
@ -83,15 +80,6 @@ extern "C" {
#define UART_IRQ_FLAGS 0 #define UART_IRQ_FLAGS 0
#define UART_STELLARIS_PORT_0_BASE_ADDR 0x4000C000
#define UART_STELLARIS_PORT_0_IRQ IRQ_UART0
#define UART_STELLARIS_PORT_1_BASE_ADDR 0x4000D000
#define UART_STELLARIS_PORT_1_IRQ IRQ_UART1
#define UART_STELLARIS_PORT_2_BASE_ADDR 0x4000E000
#define UART_STELLARIS_PORT_2_IRQ IRQ_UART2
#define UART_STELLARIS_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ #define UART_STELLARIS_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
#endif /* CONFIG_UART_STELLARIS */ #endif /* CONFIG_UART_STELLARIS */

View file

@ -25,22 +25,6 @@ config UART_STELLARIS_PORT_0_NAME
This is the device name for UART, and is included in the device This is the device name for UART, and is included in the device
struct. struct.
config UART_STELLARIS_PORT_0_IRQ_PRI
int "Port 0 Interrupt Priority"
default 0
depends on UART_STELLARIS_PORT_0
help
The interrupt priority for UART port.
config UART_STELLARIS_PORT_0_BAUD_RATE
int "Port 0 Baud Rate"
default 0
depends on UART_STELLARIS_PORT_0
help
The baud rate for UART port to be set to at boot.
Leave at 0 to skip initialization.
# ---------- Port 1 ---------- # ---------- Port 1 ----------
menuconfig UART_STELLARIS_PORT_1 menuconfig UART_STELLARIS_PORT_1
@ -59,22 +43,6 @@ config UART_STELLARIS_PORT_1_NAME
This is the device name for UART, and is included in the device This is the device name for UART, and is included in the device
struct. struct.
config UART_STELLARIS_PORT_1_IRQ_PRI
int "Port 1 Interrupt Priority"
default 0
depends on UART_STELLARIS_PORT_1
help
The interrupt priority for UART port.
config UART_STELLARIS_PORT_1_BAUD_RATE
int "Port 1 Baud Rate"
default 0
depends on UART_STELLARIS_PORT_1
help
The baud rate for UART port to be set to at boot.
Leave at 0 to skip initialization.
# ---------- Port 2 ---------- # ---------- Port 2 ----------
menuconfig UART_STELLARIS_PORT_2 menuconfig UART_STELLARIS_PORT_2
@ -92,19 +60,3 @@ config UART_STELLARIS_PORT_2_NAME
help help
This is the device name for UART, and is included in the device This is the device name for UART, and is included in the device
struct. struct.
config UART_STELLARIS_PORT_2_IRQ_PRI
int "Port 2 Interrupt Priority"
default 0
depends on UART_STELLARIS_PORT_2
help
The interrupt priority for UART port.
config UART_STELLARIS_PORT_2_BAUD_RATE
int "Port 2 Baud Rate"
default 0
depends on UART_STELLARIS_PORT_2
help
The baud rate for UART port to be set to at boot.
Leave at 0 to skip initialization.

View file

@ -630,7 +630,7 @@ static void irq_config_func_0(struct device *port);
#endif #endif
static const struct uart_device_config uart_stellaris_dev_cfg_0 = { static const struct uart_device_config uart_stellaris_dev_cfg_0 = {
.base = (u8_t *)UART_STELLARIS_PORT_0_BASE_ADDR, .base = (u8_t *)TI_STELLARIS_UART_4000C000_BASE_ADDRESS,
.sys_clk_freq = UART_STELLARIS_CLK_FREQ, .sys_clk_freq = UART_STELLARIS_CLK_FREQ,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
@ -639,7 +639,7 @@ static const struct uart_device_config uart_stellaris_dev_cfg_0 = {
}; };
static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_0 = { static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_0 = {
.baud_rate = CONFIG_UART_STELLARIS_PORT_0_BAUD_RATE, .baud_rate = TI_STELLARIS_UART_4000C000_CURRENT_SPEED,
}; };
DEVICE_AND_API_INIT(uart_stellaris0, CONFIG_UART_STELLARIS_PORT_0_NAME, &uart_stellaris_init, DEVICE_AND_API_INIT(uart_stellaris0, CONFIG_UART_STELLARIS_PORT_0_NAME, &uart_stellaris_init,
@ -650,11 +650,11 @@ DEVICE_AND_API_INIT(uart_stellaris0, CONFIG_UART_STELLARIS_PORT_0_NAME, &uart_st
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void irq_config_func_0(struct device *dev) static void irq_config_func_0(struct device *dev)
{ {
IRQ_CONNECT(UART_STELLARIS_PORT_0_IRQ, IRQ_CONNECT(TI_STELLARIS_UART_4000C000_IRQ_0,
CONFIG_UART_STELLARIS_PORT_0_IRQ_PRI, TI_STELLARIS_UART_4000C000_IRQ_0_PRIORITY,
uart_stellaris_isr, DEVICE_GET(uart_stellaris0), uart_stellaris_isr, DEVICE_GET(uart_stellaris0),
UART_IRQ_FLAGS); UART_IRQ_FLAGS);
irq_enable(UART_STELLARIS_PORT_0_IRQ); irq_enable(TI_STELLARIS_UART_4000C000_IRQ_0);
} }
#endif #endif
@ -667,7 +667,7 @@ static void irq_config_func_1(struct device *port);
#endif #endif
static struct uart_device_config uart_stellaris_dev_cfg_1 = { static struct uart_device_config uart_stellaris_dev_cfg_1 = {
.base = (u8_t *)UART_STELLARIS_PORT_1_BASE_ADDR, .base = (u8_t *)TI_STELLARIS_UART_4000D000_BASE_ADDRESS,
.sys_clk_freq = UART_STELLARIS_CLK_FREQ, .sys_clk_freq = UART_STELLARIS_CLK_FREQ,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
@ -676,7 +676,7 @@ static struct uart_device_config uart_stellaris_dev_cfg_1 = {
}; };
static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_1 = { static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_1 = {
.baud_rate = CONFIG_UART_STELLARIS_PORT_1_BAUD_RATE, .baud_rate = TI_STELLARIS_UART_4000D000_CURRENT_SPEED,
}; };
DEVICE_AND_API_INIT(uart_stellaris1, CONFIG_UART_STELLARIS_PORT_1_NAME, &uart_stellaris_init, DEVICE_AND_API_INIT(uart_stellaris1, CONFIG_UART_STELLARIS_PORT_1_NAME, &uart_stellaris_init,
@ -687,11 +687,11 @@ DEVICE_AND_API_INIT(uart_stellaris1, CONFIG_UART_STELLARIS_PORT_1_NAME, &uart_st
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void irq_config_func_1(struct device *dev) static void irq_config_func_1(struct device *dev)
{ {
IRQ_CONNECT(UART_STELLARIS_PORT_1_IRQ, IRQ_CONNECT(TI_STELLARIS_UART_4000D000_IRQ_0,
CONFIG_UART_STELLARIS_PORT_1_IRQ_PRI, TI_STELLARIS_UART_4000D000_IRQ_0_PRIORITY,
uart_stellaris_isr, DEVICE_GET(uart_stellaris1), uart_stellaris_isr, DEVICE_GET(uart_stellaris1),
UART_IRQ_FLAGS); UART_IRQ_FLAGS);
irq_enable(UART_STELLARIS_PORT_1_IRQ); irq_enable(TI_STELLARIS_UART_4000D000_IRQ_0);
} }
#endif #endif
@ -704,7 +704,7 @@ static void irq_config_func_2(struct device *port);
#endif #endif
static const struct uart_device_config uart_stellaris_dev_cfg_2 = { static const struct uart_device_config uart_stellaris_dev_cfg_2 = {
.base = (u8_t *)UART_STELLARIS_PORT_2_BASE_ADDR, .base = (u8_t *)TI_STELLARIS_UART_4000E000_BASE_ADDRESS,
.sys_clk_freq = UART_STELLARIS_CLK_FREQ, .sys_clk_freq = UART_STELLARIS_CLK_FREQ,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
@ -713,7 +713,7 @@ static const struct uart_device_config uart_stellaris_dev_cfg_2 = {
}; };
static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_2 = { static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_2 = {
.baud_rate = CONFIG_UART_STELLARIS_PORT_2_BAUD_RATE, .baud_rate = TI_STELLARIS_UART_4000E000_CURRENT_SPEED,
}; };
DEVICE_AND_API_INIT(uart_stellaris2, CONFIG_UART_STELLARIS_PORT_2_NAME, &uart_stellaris_init, DEVICE_AND_API_INIT(uart_stellaris2, CONFIG_UART_STELLARIS_PORT_2_NAME, &uart_stellaris_init,
@ -724,11 +724,11 @@ DEVICE_AND_API_INIT(uart_stellaris2, CONFIG_UART_STELLARIS_PORT_2_NAME, &uart_st
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void irq_config_func_2(struct device *dev) static void irq_config_func_2(struct device *dev)
{ {
IRQ_CONNECT(UART_STELLARIS_PORT_2_IRQ, IRQ_CONNECT(TI_STELLARIS_UART_4000E000_IRQ_0,
CONFIG_UART_STELLARIS_PORT_2_IRQ_PRI, TI_STELLARIS_UART_4000E000_IRQ_0_PRIORITY,
uart_stellaris_isr, DEVICE_GET(uart_stellaris2), uart_stellaris_isr, DEVICE_GET(uart_stellaris2),
UART_IRQ_FLAGS); UART_IRQ_FLAGS);
irq_enable(UART_STELLARIS_PORT_2_IRQ); irq_enable(TI_STELLARIS_UART_4000E000_IRQ_0);
} }
#endif #endif

View file

@ -6,8 +6,29 @@
model = "QEMU Cortex-M3"; model = "QEMU Cortex-M3";
compatible = "ti,lm3s6965evb-qemu", "ti,lm3s6965"; compatible = "ti,lm3s6965evb-qemu", "ti,lm3s6965";
aliases {
uart_0 = &uart0;
uart_1 = &uart1;
uart_2 = &uart2;
};
chosen { chosen {
zephyr,sram = &sram0; zephyr,sram = &sram0;
zephyr,flash = &flash0; zephyr,flash = &flash0;
}; };
}; };
&uart0 {
status = "ok";
current-speed = <115200>;
};
&uart1 {
status = "ok";
current-speed = <115200>;
};
&uart2 {
status = "ok";
current-speed = <115200>;
};

View file

@ -17,6 +17,26 @@
}; };
soc { soc {
uart0: uart@4000C000 {
compatible = "ti,stellaris-uart";
reg = <0x4000C000 0x4c>;
interrupts = <5 3>;
status = "disabled";
};
uart1: uart@4000D000 {
compatible = "ti,stellaris-uart";
reg = <0x4000D000 0x4c>;
interrupts = <6 3>;
status = "disabled";
};
uart2: uart@4000E000 {
compatible = "ti,stellaris-uart";
reg = <0x4000E000 0x4c>;
interrupts = <33 3>;
status = "disabled";
};
}; };
}; };

View file

@ -0,0 +1,30 @@
---
title: TI Stellaris UART
id: ti,stellaris-uart
version: 0.1
description: >
This binding gives a base representation of the TI Stellaris UART
inherits:
- !include uart.yaml
properties:
- compatible:
type: string
category: required
description: compatible strings
constraint: "ti,stellaris-uart"
- reg:
type: array
description: mmio register space
generation: define
category: required
- interrupts:
type: array
category: required
description: required interrupts
generation: define
...