Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: arduino_due: Added DTS to the Arduino Due. #22

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions arch/arm/soc/atmel_sam/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@
# SPDX-License-Identifier: Apache-2.0
#

config SOC_ATMEL_SAM3
bool
depends on ARM
default n

# Select SoC Part No. and configuration options
source "arch/arm/soc/atmel_sam/*/Kconfig.soc"
2 changes: 1 addition & 1 deletion arch/arm/soc/atmel_sam/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config SOC_FAMILY
default atmel_sam

config WATCHDOG
def_bool y if !SOC_ATMEL_SAM3X8E
def_bool y

endif #SOC_FAMILY_SAM

Expand Down
69 changes: 13 additions & 56 deletions arch/arm/soc/atmel_sam/sam3x/Kconfig.defconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@
# SPDX-License-Identifier: Apache-2.0
#

if SOC_SERIES_SAM3X || SOC_ATMEL_SAM3X8E
if SOC_SERIES_SAM3X

config SOC_SERIES
string
default sam3x

config SOC_PART_NUMBER
string
default sam3x8e if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E

config NUM_IRQ_PRIO_BITS
int
default 3
default sam3x8e if SOC_PART_NUMBER_SAM3X8E

#
# SAM3 family has total 45 peripherals capable of
Expand All @@ -32,6 +28,12 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
int
default 84000000

config NUM_IRQ_PRIO_BITS
int
default 3

if !HAS_DTS

#
# SRAM address depends on the processor.
#
Expand All @@ -42,66 +44,21 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
# to provide one continuous 96K block.
#
config SRAM_SIZE
default 96 if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E
default 96 if SOC_PART_NUMBER_SAM3X8E

config SRAM_BASE_ADDRESS
default 0x20000000 if !SOC_PART_NUMBER_SAM3X8E && !SOC_ATMEL_SAM3X8E
default 0x20070000 if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E
default 0x20000000 if !SOC_PART_NUMBER_SAM3X8E
default 0x20070000 if SOC_PART_NUMBER_SAM3X8E

#
# Atmel SAM3X family has flash starting @ 0x00080000.
#
config FLASH_SIZE
default 512 if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E
default 512 if SOC_PART_NUMBER_SAM3X8E

config FLASH_BASE_ADDRESS
default 0x00080000

if UART_ATMEL_SAM3

config UART_ATMEL_SAM3_BAUD_RATE
default 115200

config UART_ATMEL_SAM3_CLK_FREQ
default 84000000

endif # UART_ATMEL_SAM3

if GPIO

config GPIO_ATMEL_SAM3
def_bool y

config GPIO_ATMEL_SAM3_PORTA
default y

config GPIO_ATMEL_SAM3_PORTB
default y

config GPIO_ATMEL_SAM3_PORTC
default y

config GPIO_ATMEL_SAM3_PORTD
default y

endif # GPIO

if I2C

config I2C_ATMEL_SAM3
def_bool y

config I2C_0
default y
config I2C_0_IRQ_PRI
default 0

config I2C_1
default y

config I2C_1_IRQ_PRI
default 0

endif # I2C
endif # !HAS_DTS

endif # SOC_SERIES_SAM3X
10 changes: 0 additions & 10 deletions arch/arm/soc/atmel_sam/sam3x/Kconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,3 @@ config SOC_SERIES_SAM3X
help
Enable support for Atmel SAM3X Cortex-M3 microcontrollers.
Part No.: SAM3X8E

config SOC_ATMEL_SAM3X8E
bool "Atmel SAM3X8E Processor"
select SOC_PART_NUMBER_SAM3X8E
select CPU_CORTEX_M
select CPU_CORTEX_M3
select SOC_FAMILY_SAM
select SYS_POWER_LOW_POWER_STATE_SUPPORTED
select CPU_HAS_SYSTICK
select SOC_ATMEL_SAM3
2 changes: 1 addition & 1 deletion arch/arm/soc/atmel_sam/sam3x/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ choice
bool "SAM3X8E"
endchoice

if SOC_SERIES_SAM3X || SOC_ATMEL_SAM3X8E
if SOC_SERIES_SAM3X

config SOC_ATMEL_SAM3X_EXT_SLCK
bool "Atmel SAM3 to use external crystal oscillator for slow clock"
Expand Down
7 changes: 6 additions & 1 deletion boards/arm/arduino_due/Kconfig.board
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Kconfig - Arduino Due Board configuration
#
# Copyright (c) 2017 Justin Watson
# SPDX-License-Identifier: Apache-2.0
#

config BOARD_ARDUINO_DUE
bool "Arduino Due Board"
depends on SOC_ATMEL_SAM3X8E
depends on SOC_PART_NUMBER_SAM3X8E
45 changes: 45 additions & 0 deletions boards/arm/arduino_due/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,59 @@
# Kconfig - Arduino Due Board configuration
#
# Copyright (c) 2017 Justin Watson
# SPDX-License-Identifier: Apache-2.0
#

if BOARD_ARDUINO_DUE

config BOARD
default arduino_due

if UART_ATMEL_SAM3

config UART_ATMEL_SAM3_BAUD_RATE
default 115200

config UART_ATMEL_SAM3_CLK_FREQ
default 84000000

endif # UART_ATMEL_SAM3

if GPIO

config GPIO_ATMEL_SAM3
def_bool y

config GPIO_ATMEL_SAM3_PORTA
default y

config GPIO_ATMEL_SAM3_PORTB
default y

config GPIO_ATMEL_SAM3_PORTC
default y

config GPIO_ATMEL_SAM3_PORTD
default y

endif # GPIO

if I2C

config I2C_ATMEL_SAM3
def_bool y

config I2C_0
default y
config I2C_0_IRQ_PRI
default 0

config I2C_1
default y

config I2C_1_IRQ_PRI
default 0

endif # I2C

endif # BOARD_ARDUINO_DUE
8 changes: 6 additions & 2 deletions boards/arm/arduino_due/arduino_due_defconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
CONFIG_ARM=y
CONFIG_SOC_ATMEL_SAM3X8E=y
CONFIG_SOC_FAMILY_SAM=y
CONFIG_SOC_SERIES_SAM3X=y
CONFIG_SOC_PART_NUMBER_SAM3X8E=y
CONFIG_BOARD_ARDUINO_DUE=y
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_ATMEL_SAM3=y
CONFIG_SOC_ATMEL_SAM3_EXT_MAINCK=y
CONFIG_SOC_ATMEL_SAM3X_EXT_MAINCK=y
CONFIG_PINMUX=y
CONFIG_WATCHDOG=n
CONFIG_HAS_DTS=y
2 changes: 1 addition & 1 deletion drivers/gpio/Kconfig.atmel_sam3
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

menuconfig GPIO_ATMEL_SAM3
bool "Atmel SAM3 PIO Controllers"
depends on GPIO && SOC_ATMEL_SAM3
depends on GPIO && SOC_SERIES_SAM3
default n
help
Enable config options to support the PIO controllers
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ config I2C_QMSI

config I2C_ATMEL_SAM3
bool "Atmel SAM3 I2C Driver"
depends on SOC_ATMEL_SAM3
depends on SOC_SERIES_SAM3X
default n
help
Enable I2C support on the Atmel SAM3 family processor.
Expand Down
2 changes: 1 addition & 1 deletion drivers/pinmux/dev/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ config PINMUX_DEV_NAME

config PINMUX_DEV_ATMEL_SAM3X
bool "Enable pinmux dev driver for Atmel SAM3X boards"
depends on PINMUX_DEV && SOC_ATMEL_SAM3X8E
depends on PINMUX_DEV && SOC_SERIES_SAM3
help
Enables the pinmux dev driver for boards based on the
Atmel SAM3X family of microcontrollers.
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/Kconfig.atmel_sam3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ menuconfig UART_ATMEL_SAM3
bool "Atmel SAM3 family processor UART driver"
default n
select SERIAL_HAS_DRIVER
depends on SOC_ATMEL_SAM3
depends on SOC_SERIES_SAM3
help
This option enables the UART driver for Atmel SAM3
family processors. Note that there is only one
Expand Down
1 change: 1 addition & 0 deletions dts/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dtb-$(CONFIG_BOARD_NRF51_BLENANO) = nrf51_blenano.dts_compiled
dtb-$(CONFIG_BOARD_NRF51_PCA10028) = nrf51_pca10028.dts_compiled
dtb-$(CONFIG_BOARD_QUARK_SE_C1000_BLE) = quark_se_c1000_ble.dts_compiled
dtb-$(CONFIG_BOARD_QEMU_CORTEX_M3) = qemu_cortex_m3.dts_compiled
dtb-$(CONFIG_BOARD_ARDUINO_DUE) = arduino_due.dts_compiled

always := $(dtb-y)
endif
22 changes: 22 additions & 0 deletions dts/arm/arduino_due.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/dts-v1/;

#include <atmel/sam3x.dtsi>

/ {
model = "Arduino Due with an Atmel SAM3X8E";
compatible = "atmel,sam3x";

aliases {
uart_0 = &uart0;
};

chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};

&uart0 {
status = "ok";
current-speed = <115200>;
};
38 changes: 38 additions & 0 deletions dts/arm/atmel/sam3x.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2017 Justin Watson
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <arm/armv7-m.dtsi>

/ {
cpus {
cpu@0 {
compatible = "arm,cortex-m4";
};
};

sram0: memory {
compatible = "sram";
reg = <0x20070000 0x18000>;
};

flash0: flash {
compatible = "flash";
reg = <0x00080000 0x80000>;
};

soc {
uart0: uart@400E0800 {
compatible = "atmel,sam3x-uart";
reg = <0x400E0800 0x124>;
interrupts = <8 0>;
status = "disabled";
};
};
};

&nvic {
arm,num-irq-priority-bits = <3>;
};
30 changes: 30 additions & 0 deletions dts/arm/yaml/atmel,sam3x-uart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: SAM3X UART
id: atmel,sam3x-uart
version: 0.1

description: >
This binding gives a base representation of the SAM3X UART

inherits:
- !include uart.yaml

properties:
- compatible:
type: string
category: required
description: compatible strings
constraint: "atmel,sam3x-uart"

- reg:
type: array
description: mmio register space
generation: define
category: required

- interrupts:
type: array
category: required
description: required interrupts
generation: define
...
2 changes: 1 addition & 1 deletion samples/drivers/gpio/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
#define GPIO_OUT_PIN 16
#define GPIO_INT_PIN 19
#define GPIO_NAME "GPIO_"
#elif defined(CONFIG_SOC_ATMEL_SAM3)
#elif defined(CONFIG_SOC_PART_NUMBER_SAM3X8E)
#define GPIO_OUT_PIN 25
#define GPIO_INT_PIN 27
#define GPIO_NAME "GPIO_"
Expand Down
4 changes: 2 additions & 2 deletions samples/drivers/lcd_hd44780/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
#include <string.h>


#if defined(CONFIG_GPIO_ATMEL_SAM3)
#if defined(CONFIG_SOC_PART_NUMBER_SAM3X8E)
#define GPIO_DRV_NAME CONFIG_GPIO_ATMEL_SAM3_PORTC_DEV_NAME
#else
#error "Unsupported GPIO driver"
#endif

#if defined(CONFIG_SOC_ATMEL_SAM3)
#if defined(CONFIG_SOC_PART_NUMBER_SAM3X8E)
/* Define GPIO OUT to LCD */
#define GPIO_PIN_PC12_D0 12 /* PC12 - pin 51 */
#define GPIO_PIN_PC13_D1 13 /* PC13 - pin 50 */
Expand Down
Loading