arm: dts: Modified Atmel SAM family processor's UART to DTS.

The SAM4S, SAM3X, SAME70 all use the uart_sam.c serial
driver. This patch puts the configuration in DTS and
out of Kconfig. The SAME70 uses the USART as well.
USART DTS support for the SAME70 is also in this patch.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
This commit is contained in:
Justin Watson 2017-06-29 16:44:38 -07:00 committed by Kumar Gala
parent 9eddc82be3
commit 0c6883f25a
12 changed files with 257 additions and 129 deletions

View file

@ -19,24 +19,7 @@ config UART_SAM_PORT_0
depends on UART_SAM
default n
help
Configure UART0 at boot depending on the additional options below.
if UART_SAM_PORT_0
config UART_SAM_PORT_0_NAME
string "UART0 Device Name"
default "UART_0"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config UART_SAM_PORT_0_BAUD_RATE
int "UART0 Baud Rate"
default 115200
help
UART0 baud rate to be set at boot.
endif # UART_SAM_PORT_0
Enable UART0 at boot.
# ---------- Port 1 ----------
@ -45,23 +28,10 @@ config UART_SAM_PORT_1
depends on UART_SAM
default n
help
Configure UART1 at boot depending on the additional options below.
Enable UART1 at boot.
if UART_SAM_PORT_1
config UART_SAM_PORT_1_NAME
string "UART1 Device Name"
default "UART_1"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config UART_SAM_PORT_1_BAUD_RATE
int "UART1 Baud Rate"
default 115200
help
UART1 baud rate to be set at boot.
choice UART_SAME70_PORT_1_PIN_TX
prompt "TX pin"
depends on SOC_SERIES_SAME70
@ -85,24 +55,7 @@ config UART_SAM_PORT_2
depends on UART_SAM
default n
help
Configure UART2 at boot depending on the additional options below.
if UART_SAM_PORT_2
config UART_SAM_PORT_2_NAME
string "UART2 Device Name"
default "UART_2"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config UART_SAM_PORT_2_BAUD_RATE
int "UART2 Baud Rate"
default 115200
help
UART2 baud rate to be set at boot.
endif # UART_SAM_PORT_2
Enable UART2 at boot
# ---------- Port 3 ----------
@ -111,23 +64,10 @@ config UART_SAM_PORT_3
depends on UART_SAM
default n
help
Configure UART3 at boot depending on the additional options below.
Enable UART3 at boot
if UART_SAM_PORT_3
config UART_SAM_PORT_3_NAME
string "UART3 Device Name"
default "UART_3"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config UART_SAM_PORT_3_BAUD_RATE
int "UART3 Baud Rate"
default 115200
help
UART3 baud rate to be set at boot.
choice UART_SAME70_PORT_3_PIN_TX
prompt "TX pin"
depends on SOC_SERIES_SAME70
@ -148,23 +88,10 @@ config UART_SAM_PORT_4
depends on UART_SAM
default n
help
Configure UART4 at boot depending on the additional options below.
Enable UART4 at boot
if UART_SAM_PORT_4
config UART_SAM_PORT_4_NAME
string "UART4 Device Name"
default "UART_4"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config UART_SAM_PORT_4_BAUD_RATE
int "UART4 Baud Rate"
default 115200
help
UART4 baud rate to be set at boot.
choice UART_SAME70_PORT_4_PIN_TX
prompt "TX pin"
depends on SOC_SERIES_SAME70

View file

@ -19,22 +19,7 @@ config USART_SAM_PORT_0
depends on USART_SAM
default n
help
Configure USART0 at boot depending on the additional options below.
config USART_SAM_PORT_0_NAME
string "USART0 Device Name"
depends on USART_SAM_PORT_0
default "USART_0"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config USART_SAM_PORT_0_BAUD_RATE
int "USART0 Baud Rate"
depends on USART_SAM_PORT_0
default 115200
help
USART0 baud rate to be set at boot.
Enable USART0 at boot
# ---------- Port 1 ----------
@ -43,22 +28,7 @@ config USART_SAM_PORT_1
depends on USART_SAM
default n
help
Configure USART1 at boot depending on the additional options below.
config USART_SAM_PORT_1_NAME
string "USART1 Device Name"
depends on USART_SAM_PORT_1
default "USART_1"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config USART_SAM_PORT_1_BAUD_RATE
int "USART1 Baud Rate"
depends on USART_SAM_PORT_1
default 115200
help
USART1 baud rate to be set at boot.
Enable USART1 at boot
# ---------- Port 2 ----------
@ -67,19 +37,4 @@ config USART_SAM_PORT_2
depends on USART_SAM
default n
help
Configure USART2 at boot depending on the additional options below.
config USART_SAM_PORT_2_NAME
string "USART2 Device Name"
depends on USART_SAM_PORT_2
default "USART_2"
help
Device name allows user to obtain a handle to the device object
required by all driver API functions. Device name has to be unique.
config USART_SAM_PORT_2_BAUD_RATE
int "USART2 Baud Rate"
depends on USART_SAM_PORT_2
default 115200
help
USART2 baud rate to be set at boot.
Enable USART2 at boot

View file

@ -4,6 +4,16 @@
* generated data matches the driver definitions.
*/
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_UART_ATMEL_SAM3_NAME ATMEL_SAM3X_UART_400E0800_LABEL
#define CONFIG_UART_ATMEL_SAM3_NAME ATMEL_SAM_UART_400E0800_LABEL
#define CONFIG_UART_SAM_PORT_0_NAME ATMEL_SAM_UART_400E0800_LABEL
#define CONFIG_UART_SAM_PORT_0_BAUD_RATE ATMEL_SAM_UART_400E0800_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_0_NAME ATMEL_SAM_USART_40098000_LABEL
#define CONFIG_USART_SAM_PORT_0_BAUD_RATE ATMEL_SAM_USART_40098000_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_1_NAME ATMEL_SAM_USART_4009C000_LABEL
#define CONFIG_USART_SAM_PORT_1_BAUD_RATE ATMEL_SAM_USART_4009C000_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_2_NAME ATMEL_SAM_USART_400A0000_LABEL
#define CONFIG_USART_SAM_PORT_2_BAUD_RATE ATMEL_SAM_USART_400A0000_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_3_NAME ATMEL_SAM_USART_400A4000_LABEL
#define CONFIG_USART_SAM_PORT_3_BAUD_RATE ATMEL_SAM_USART_400A4000_CURRENT_SPEED

View file

@ -25,12 +25,44 @@
soc {
uart0: uart@400E0800 {
compatible = "atmel,sam3x-uart";
compatible = "atmel,sam-uart";
reg = <0x400E0800 0x124>;
interrupts = <8 0>;
status = "disabled";
label = "UART_0";
};
usart0: usart@40098000 {
compatible = "atmel,sam-usart";
reg = <0x40098000 0x130>;
interrupts = <17 0>;
status = "disabled";
label = "USART_0";
};
usart1: usart@4009C000 {
compatible = "atmel,sam-usart";
reg = <0x4009C000 0x130>;
interrupts = <18 0>;
status = "disabled";
label = "USART_1";
};
usart2: usart@400A0000 {
compatible = "atmel,sam-usart";
reg = <0x400A0000 0x130>;
interrupts = <18 0>;
status = "disabled";
label = "USART_2";
};
usart3: usart@400A4000 {
compatible = "atmel,sam-usart";
reg = <0x400A4000 0x130>;
interrupts = <20 0>;
status = "disabled";
label = "USART_3";
};
};
};

View file

@ -22,6 +22,40 @@
compatible = "flash";
reg = <0x00400000 0x100000>;
};
soc {
uart0: uart@400E0600 {
compatible = "atmel,sam-uart";
reg = <0x400E0600 0x200>;
interrupts = <8 0>;
status = "disabled";
label = "UART_0";
};
uart1: uart@400E0800 {
compatible = "atmel,sam-uart";
reg = <0x400E0800 0x200>;
interrupts = <9 0>;
status = "disabled";
label = "UART_1";
};
usart0: usart@40024000 {
compatible = "atmel,sam-usart";
reg = <0x40024000 0x130>;
interrupts = <14 0>;
status = "disabled";
label = "USART_0";
};
usart1: usart@40028000 {
compatible = "atmel,sam-usart";
reg = <0x40028000 0x130>;
interrupts = <15 0>;
status = "disabled";
label = "USART_1";
};
};
};
&nvic {

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2017 Piotr Mienkowski
* Copyright (c) 2017 Justin Watson
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -23,6 +24,72 @@
compatible = "sram";
reg = <0x20400000 DT_SRAM_SIZE>;
};
soc {
uart0: uart@400E0800 {
compatible = "atmel,sam-uart";
reg = <0x400E0800 0x100>;
interrupts = <7 0>;
status = "disabled";
label = "UART_0";
};
uart1: uart@400E0A00 {
compatible = "atmel,sam-uart";
reg = <0x400E0A00 0x100>;
interrupts = <8 0>;
status = "disabled";
label = "UART_1";
};
uart2: uart@400E1A00 {
compatible = "atmel,sam-uart";
reg = <0x400E1A00 0x100>;
interrupts = <44 0>;
status = "disabled";
label = "UART_2";
};
uart3: uart@400E1C00 {
compatible = "atmel,sam-uart";
reg = <0x400E1C00 0x100>;
interrupts = <45 0>;
status = "disabled";
label = "UART_3";
};
uart4: uart@400E1E00 {
compatible = "atmel,sam-uart";
reg = <0x400E1E00 0x100>;
interrupts = <46 0>;
status = "disabled";
label = "UART_4";
};
usart0: usart@40024000 {
compatible = "atmel,sam-usart";
reg = <0x40024000 0x100>;
interrupts = <13 0>;
status = "disabled";
label = "USART_0";
};
usart1: usart@40028000 {
compatible = "atmel,sam-usart";
reg = <0x40028000 0x100>;
interrupts = <14 0>;
status = "disabled";
label = "USART_1";
};
usart2: usart@4002C000 {
compatible = "atmel,sam-usart";
reg = <0x4002C000 0x100>;
interrupts = <15 0>;
status = "disabled";
label = "USART_2";
};
};
};
&nvic {

View file

@ -12,7 +12,13 @@
compatible = "atmel,sam4s_xplained", "atmel,sam4s16c", "atmel,sam4s";
chosen {
zephyr,console = &uart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
&uart1 {
current-speed = <115200>;
status = "ok";
};

View file

@ -6,3 +6,11 @@
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_UART_SAM_PORT_0_NAME ATMEL_SAM_UART_400E0600_LABEL
#define CONFIG_UART_SAM_PORT_0_BAUD_RATE ATMEL_SAM_UART_400E0600_CURRENT_SPEED
#define CONFIG_UART_SAM_PORT_1_NAME ATMEL_SAM_UART_400E0800_LABEL
#define CONFIG_UART_SAM_PORT_1_BAUD_RATE ATMEL_SAM_UART_400E0800_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_0_NAME ATMEL_SAM_USART_40024000_LABEL
#define CONFIG_USART_SAM_PORT_0_BAUD_RATE ATMEL_SAM_USART_40024000_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_1_NAME ATMEL_SAM_USART_40028000_LABEL
#define CONFIG_USART_SAM_PORT_1_BAUD_RATE ATMEL_SAM_USART_40028000_CURRENT_SPEED

View file

@ -1,3 +1,10 @@
/*
* Copyright (c) 2017 Piotr Mienkowski
* Copyright (c) 2017 Justin Watson
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <atmel/same70.dtsi>
@ -7,7 +14,13 @@
compatible = "atmel,sam_e70_xplained", "atmel,same70q21", "atmel,same70";
chosen {
zephyr,console = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
&usart1 {
current-speed = <115200>;
status = "ok";
};

View file

@ -5,3 +5,18 @@
*/
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_UART_SAM_PORT_0_NAME ATMEL_SAM_UART_400E0800_LABEL
#define CONFIG_UART_SAM_PORT_0_BAUD_RATE ATMEL_SAM_UART_400E0800_CURRENT_SPEED
#define CONFIG_UART_SAM_PORT_1_NAME ATMEL_SAM_UART_400E0A00_LABEL
#define CONFIG_UART_SAM_PORT_1_BAUD_RATE ATMEL_SAM_UART_400E0A00_CURRENT_SPEED
#define CONFIG_UART_SAM_PORT_2_NAME ATMEL_SAM_UART_400E1A00 _LABEL
#define CONFIG_UART_SAM_PORT_2_BAUD_RATE ATMEL_SAM_UART_400E1A00_CURRENT_SPEED
#define CONFIG_UART_SAM_PORT_3_NAME ATMEL_SAM_UART_400E1C00_LABEL
#define CONFIG_UART_SAM_PORT_3_BAUD_RATE ATMEL_SAM_UART_400E1C00_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_0_NAME ATMEL_SAM_USART_40024000_LABEL
#define CONFIG_USART_SAM_PORT_0_BAUD_RATE ATMEL_SAM_USART_40024000_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_1_NAME ATMEL_SAM_USART_40028000_LABEL
#define CONFIG_USART_SAM_PORT_1_BAUD_RATE ATMEL_SAM_USART_40028000_CURRENT_SPEED
#define CONFIG_USART_SAM_PORT_2_NAME ATMEL_SAM_USART_4002C000_LABEL
#define CONFIG_USART_SAM_PORT_2_BAUD_RATE ATMEL_SAM_USART_4002C000_CURRENT_SPEED

View file

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

View file

@ -0,0 +1,31 @@
---
title: Atmel SAM Family USART
id: atmel,sam-usart
version: 0.1
description: >
This binding gives a base representation of the Atmel SAM USART
inherits:
- !include uart.yaml
properties:
- compatible:
type: string
category: required
description: compatible strings
constraint: "atmel,sam-usart"
- reg:
type: array
description: mmio register space
generation: define
category: required
- interrupts:
type: array
category: required
description: required interrupts
generation: define
...