diff --git a/drivers/serial/Kconfig.uart_sam b/drivers/serial/Kconfig.uart_sam index 7e8c152200..050dce70c1 100644 --- a/drivers/serial/Kconfig.uart_sam +++ b/drivers/serial/Kconfig.uart_sam @@ -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 diff --git a/drivers/serial/Kconfig.usart_sam b/drivers/serial/Kconfig.usart_sam index b74ffeef01..07bce6e5db 100644 --- a/drivers/serial/Kconfig.usart_sam +++ b/drivers/serial/Kconfig.usart_sam @@ -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 diff --git a/dts/arm/arduino_due.fixup b/dts/arm/arduino_due.fixup index 8df0b1c7b9..bb2f999f47 100644 --- a/dts/arm/arduino_due.fixup +++ b/dts/arm/arduino_due.fixup @@ -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 diff --git a/dts/arm/atmel/sam3x.dtsi b/dts/arm/atmel/sam3x.dtsi index 81fc9acacf..c5955ec379 100644 --- a/dts/arm/atmel/sam3x.dtsi +++ b/dts/arm/atmel/sam3x.dtsi @@ -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"; + }; }; }; diff --git a/dts/arm/atmel/sam4s.dtsi b/dts/arm/atmel/sam4s.dtsi index b871d87767..ec3c5b8da1 100644 --- a/dts/arm/atmel/sam4s.dtsi +++ b/dts/arm/atmel/sam4s.dtsi @@ -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 { diff --git a/dts/arm/atmel/same70.dtsi b/dts/arm/atmel/same70.dtsi index 2d032b5edb..3227eb0f0f 100644 --- a/dts/arm/atmel/same70.dtsi +++ b/dts/arm/atmel/same70.dtsi @@ -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 { diff --git a/dts/arm/sam4s_xplained.dts b/dts/arm/sam4s_xplained.dts index 7831e55989..f65cd52c64 100644 --- a/dts/arm/sam4s_xplained.dts +++ b/dts/arm/sam4s_xplained.dts @@ -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"; +}; diff --git a/dts/arm/sam4s_xplained.fixup b/dts/arm/sam4s_xplained.fixup index 1a411fa78f..053e09d780 100644 --- a/dts/arm/sam4s_xplained.fixup +++ b/dts/arm/sam4s_xplained.fixup @@ -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 diff --git a/dts/arm/sam_e70_xplained.dts b/dts/arm/sam_e70_xplained.dts index 8433c52090..7142edc293 100644 --- a/dts/arm/sam_e70_xplained.dts +++ b/dts/arm/sam_e70_xplained.dts @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2017 Piotr Mienkowski + * Copyright (c) 2017 Justin Watson + * + * SPDX-License-Identifier: Apache-2.0 + */ + /dts-v1/; #include @@ -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"; +}; diff --git a/dts/arm/sam_e70_xplained.fixup b/dts/arm/sam_e70_xplained.fixup index 5957fbd61d..c634b6c444 100644 --- a/dts/arm/sam_e70_xplained.fixup +++ b/dts/arm/sam_e70_xplained.fixup @@ -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 diff --git a/dts/arm/yaml/atmel,sam-uart.yaml b/dts/arm/yaml/atmel,sam-uart.yaml new file mode 100644 index 0000000000..6ef634aa71 --- /dev/null +++ b/dts/arm/yaml/atmel,sam-uart.yaml @@ -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 +... diff --git a/dts/arm/yaml/atmel,sam-usart.yaml b/dts/arm/yaml/atmel,sam-usart.yaml new file mode 100644 index 0000000000..b02f90e18d --- /dev/null +++ b/dts/arm/yaml/atmel,sam-usart.yaml @@ -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 + +...