Skip to content

Commit eab63b5

Browse files
committed
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>
1 parent 2f745b9 commit eab63b5

File tree

7 files changed

+86
-95
lines changed

7 files changed

+86
-95
lines changed

arch/arm/soc/ti_lm3s6965/Kconfig.defconfig

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,11 @@ if UART_STELLARIS
2626
config UART_STELLARIS_PORT_0
2727
def_bool y
2828

29-
if UART_STELLARIS_PORT_0
30-
config UART_STELLARIS_PORT_0_IRQ_PRI
31-
default 3
32-
config UART_STELLARIS_PORT_0_BAUD_RATE
33-
default 115200
34-
endif
35-
3629
config UART_STELLARIS_PORT_1
3730
def_bool y
3831

39-
if UART_STELLARIS_PORT_1
40-
config UART_STELLARIS_PORT_1_IRQ_PRI
41-
default 3
42-
config UART_STELLARIS_PORT_1_BAUD_RATE
43-
default 115200
44-
endif
45-
4632
config UART_STELLARIS_PORT_2
4733
def_bool y
48-
if UART_STELLARIS_PORT_2
49-
config UART_STELLARIS_PORT_2_IRQ_PRI
50-
default 3
51-
config UART_STELLARIS_PORT_2_BAUD_RATE
52-
default 115200
53-
endif
5434

5535
endif # UART_STELLARIS
5636

arch/arm/soc/ti_lm3s6965/soc.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ extern "C" {
3232
#define IRQ_GPIO_PORTC 2
3333
#define IRQ_GPIO_PORTD 3
3434
#define IRQ_GPIO_PORTE 4
35-
#define IRQ_UART0 5
36-
#define IRQ_UART1 6
3735
#define IRQ_SSI0 7
3836
#define IRQ_I2C0 8
3937
#define IRQ_PWM_FAULT 9
@@ -60,7 +58,6 @@ extern "C" {
6058
#define IRQ_GPIO_PORTF 30
6159
#define IRQ_GPIO_PORTG 31
6260
#define IRQ_RESERVED1 32
63-
#define IRQ_UART2 33
6461
#define IRQ_RESERVED2 34
6562
#define IRQ_TIMER3A 35
6663
#define IRQ_TIMER3B 36
@@ -83,15 +80,6 @@ extern "C" {
8380

8481
#define UART_IRQ_FLAGS 0
8582

86-
#define UART_STELLARIS_PORT_0_BASE_ADDR 0x4000C000
87-
#define UART_STELLARIS_PORT_0_IRQ IRQ_UART0
88-
89-
#define UART_STELLARIS_PORT_1_BASE_ADDR 0x4000D000
90-
#define UART_STELLARIS_PORT_1_IRQ IRQ_UART1
91-
92-
#define UART_STELLARIS_PORT_2_BASE_ADDR 0x4000E000
93-
#define UART_STELLARIS_PORT_2_IRQ IRQ_UART2
94-
9583
#define UART_STELLARIS_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
9684

9785
#endif /* CONFIG_UART_STELLARIS */

drivers/serial/Kconfig.stellaris

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ config UART_STELLARIS_PORT_0_NAME
2525
This is the device name for UART, and is included in the device
2626
struct.
2727

28-
config UART_STELLARIS_PORT_0_IRQ_PRI
29-
int "Port 0 Interrupt Priority"
30-
default 0
31-
depends on UART_STELLARIS_PORT_0
32-
help
33-
The interrupt priority for UART port.
34-
35-
config UART_STELLARIS_PORT_0_BAUD_RATE
36-
int "Port 0 Baud Rate"
37-
default 0
38-
depends on UART_STELLARIS_PORT_0
39-
help
40-
The baud rate for UART port to be set to at boot.
41-
42-
Leave at 0 to skip initialization.
43-
4428
# ---------- Port 1 ----------
4529

4630
menuconfig UART_STELLARIS_PORT_1
@@ -59,22 +43,6 @@ config UART_STELLARIS_PORT_1_NAME
5943
This is the device name for UART, and is included in the device
6044
struct.
6145

62-
config UART_STELLARIS_PORT_1_IRQ_PRI
63-
int "Port 1 Interrupt Priority"
64-
default 0
65-
depends on UART_STELLARIS_PORT_1
66-
help
67-
The interrupt priority for UART port.
68-
69-
config UART_STELLARIS_PORT_1_BAUD_RATE
70-
int "Port 1 Baud Rate"
71-
default 0
72-
depends on UART_STELLARIS_PORT_1
73-
help
74-
The baud rate for UART port to be set to at boot.
75-
76-
Leave at 0 to skip initialization.
77-
7846
# ---------- Port 2 ----------
7947

8048
menuconfig UART_STELLARIS_PORT_2
@@ -92,19 +60,3 @@ config UART_STELLARIS_PORT_2_NAME
9260
help
9361
This is the device name for UART, and is included in the device
9462
struct.
95-
96-
config UART_STELLARIS_PORT_2_IRQ_PRI
97-
int "Port 2 Interrupt Priority"
98-
default 0
99-
depends on UART_STELLARIS_PORT_2
100-
help
101-
The interrupt priority for UART port.
102-
103-
config UART_STELLARIS_PORT_2_BAUD_RATE
104-
int "Port 2 Baud Rate"
105-
default 0
106-
depends on UART_STELLARIS_PORT_2
107-
help
108-
The baud rate for UART port to be set to at boot.
109-
110-
Leave at 0 to skip initialization.

drivers/serial/uart_stellaris.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static void irq_config_func_0(struct device *port);
630630
#endif
631631

632632
static const struct uart_device_config uart_stellaris_dev_cfg_0 = {
633-
.base = (u8_t *)UART_STELLARIS_PORT_0_BASE_ADDR,
633+
.base = (u8_t *)TI_STELLARIS_UART_4000C000_BASE_ADDRESS,
634634
.sys_clk_freq = UART_STELLARIS_CLK_FREQ,
635635

636636
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
@@ -639,7 +639,7 @@ static const struct uart_device_config uart_stellaris_dev_cfg_0 = {
639639
};
640640

641641
static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_0 = {
642-
.baud_rate = CONFIG_UART_STELLARIS_PORT_0_BAUD_RATE,
642+
.baud_rate = TI_STELLARIS_UART_4000C000_CURRENT_SPEED,
643643
};
644644

645645
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
650650
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
651651
static void irq_config_func_0(struct device *dev)
652652
{
653-
IRQ_CONNECT(UART_STELLARIS_PORT_0_IRQ,
654-
CONFIG_UART_STELLARIS_PORT_0_IRQ_PRI,
653+
IRQ_CONNECT(TI_STELLARIS_UART_4000C000_IRQ_0,
654+
TI_STELLARIS_UART_4000C000_IRQ_0_PRIORITY,
655655
uart_stellaris_isr, DEVICE_GET(uart_stellaris0),
656656
UART_IRQ_FLAGS);
657-
irq_enable(UART_STELLARIS_PORT_0_IRQ);
657+
irq_enable(TI_STELLARIS_UART_4000C000_IRQ_0);
658658
}
659659
#endif
660660

@@ -667,7 +667,7 @@ static void irq_config_func_1(struct device *port);
667667
#endif
668668

669669
static struct uart_device_config uart_stellaris_dev_cfg_1 = {
670-
.base = (u8_t *)UART_STELLARIS_PORT_1_BASE_ADDR,
670+
.base = (u8_t *)TI_STELLARIS_UART_4000D000_BASE_ADDRESS,
671671
.sys_clk_freq = UART_STELLARIS_CLK_FREQ,
672672

673673
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
@@ -676,7 +676,7 @@ static struct uart_device_config uart_stellaris_dev_cfg_1 = {
676676
};
677677

678678
static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_1 = {
679-
.baud_rate = CONFIG_UART_STELLARIS_PORT_1_BAUD_RATE,
679+
.baud_rate = TI_STELLARIS_UART_4000D000_CURRENT_SPEED,
680680
};
681681

682682
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
687687
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
688688
static void irq_config_func_1(struct device *dev)
689689
{
690-
IRQ_CONNECT(UART_STELLARIS_PORT_1_IRQ,
691-
CONFIG_UART_STELLARIS_PORT_1_IRQ_PRI,
690+
IRQ_CONNECT(TI_STELLARIS_UART_4000D000_IRQ_0,
691+
TI_STELLARIS_UART_4000D000_IRQ_0_PRIORITY,
692692
uart_stellaris_isr, DEVICE_GET(uart_stellaris1),
693693
UART_IRQ_FLAGS);
694-
irq_enable(UART_STELLARIS_PORT_1_IRQ);
694+
irq_enable(TI_STELLARIS_UART_4000D000_IRQ_0);
695695
}
696696
#endif
697697

@@ -704,7 +704,7 @@ static void irq_config_func_2(struct device *port);
704704
#endif
705705

706706
static const struct uart_device_config uart_stellaris_dev_cfg_2 = {
707-
.base = (u8_t *)UART_STELLARIS_PORT_2_BASE_ADDR,
707+
.base = (u8_t *)TI_STELLARIS_UART_4000E000_BASE_ADDRESS,
708708
.sys_clk_freq = UART_STELLARIS_CLK_FREQ,
709709

710710
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
@@ -713,7 +713,7 @@ static const struct uart_device_config uart_stellaris_dev_cfg_2 = {
713713
};
714714

715715
static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_2 = {
716-
.baud_rate = CONFIG_UART_STELLARIS_PORT_2_BAUD_RATE,
716+
.baud_rate = TI_STELLARIS_UART_4000E000_CURRENT_SPEED,
717717
};
718718

719719
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
724724
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
725725
static void irq_config_func_2(struct device *dev)
726726
{
727-
IRQ_CONNECT(UART_STELLARIS_PORT_2_IRQ,
728-
CONFIG_UART_STELLARIS_PORT_2_IRQ_PRI,
727+
IRQ_CONNECT(TI_STELLARIS_UART_4000E000_IRQ_0,
728+
TI_STELLARIS_UART_4000E000_IRQ_0_PRIORITY,
729729
uart_stellaris_isr, DEVICE_GET(uart_stellaris2),
730730
UART_IRQ_FLAGS);
731-
irq_enable(UART_STELLARIS_PORT_2_IRQ);
731+
irq_enable(TI_STELLARIS_UART_4000E000_IRQ_0);
732732
}
733733
#endif
734734

dts/arm/qemu_cortex_m3.dts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,29 @@
66
model = "QEMU Cortex-M3";
77
compatible = "ti,lm3s6965evb-qemu", "ti,lm3s6965";
88

9+
aliases {
10+
uart_0 = &uart0;
11+
uart_1 = &uart1;
12+
uart_2 = &uart2;
13+
};
14+
915
chosen {
1016
zephyr,sram = &sram0;
1117
zephyr,flash = &flash0;
1218
};
1319
};
20+
21+
&uart0 {
22+
status = "ok";
23+
current-speed = <115200>;
24+
};
25+
26+
&uart1 {
27+
status = "ok";
28+
current-speed = <115200>;
29+
};
30+
31+
&uart2 {
32+
status = "ok";
33+
current-speed = <115200>;
34+
};

dts/arm/ti/lm3s6965.dtsi

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@
1717
};
1818

1919
soc {
20+
uart0: uart@4000C000 {
21+
compatible = "ti,stellaris-uart";
22+
reg = <0x4000C000 0x4c>;
23+
interrupts = <5 3>;
24+
status = "disabled";
25+
};
26+
27+
uart1: uart@4000D000 {
28+
compatible = "ti,stellaris-uart";
29+
reg = <0x4000D000 0x4c>;
30+
interrupts = <6 3>;
31+
status = "disabled";
32+
};
33+
34+
uart2: uart@4000E000 {
35+
compatible = "ti,stellaris-uart";
36+
reg = <0x4000E000 0x4c>;
37+
interrupts = <33 3>;
38+
status = "disabled";
39+
};
2040
};
2141
};
2242

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: TI Stellaris UART
3+
id: ti,stellaris-uart
4+
version: 0.1
5+
6+
description: >
7+
This binding gives a base representation of the TI Stellaris UART
8+
9+
inherits:
10+
- !include uart.yaml
11+
12+
properties:
13+
- compatible:
14+
type: string
15+
category: required
16+
description: compatible strings
17+
constraint: "ti,stellaris-uart"
18+
19+
- reg:
20+
type: array
21+
description: mmio register space
22+
generation: define
23+
category: required
24+
25+
- interrupts:
26+
type: array
27+
category: required
28+
description: required interrupts
29+
generation: define
30+
...

0 commit comments

Comments
 (0)