Commit graph

105 commits

Author SHA1 Message Date
Ioannis Glaropoulos 579ac7bd1a dts: atmel: sam0: correct ARM Cortex-m variant in dtsi
Atmel SAM D series SoC variants (present in the tree) all have
an ARM Cortex-M0+ core, not a Cortex-M0, so we correct this in
the .dtsi header.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-20 14:06:10 -05:00
Ioannis Glaropoulos 75f681b0d9 soc: arm: add ARM MPU node info and fixup for Cortex-M7 SoCs
Unlike Cortex-M3 and Cortex-M4, in Cortex-M7 the number of
MPU regions may vary based on the implementation. This commit
adds a DTS node for the ARM MPU peripheral in the device tree
of Cortex-M7 SoCs and updates the fixup files, so we may extract
the number of MPU regions at build time. SoCs:
- nxp_rt
- same70
- stm32f7

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-20 14:06:10 -05:00
Derek Hageman 4462069d74 drivers: gpio: sam0: Add interrupt support
This adds interrupt support to the SAM0 GPIO driver.  This is heavily
inspired by @nzmichaelh work in #5715.  The primary difference
from that implementation is that here the External Interrupt
Controller (EIC) is separated out into an interrupt controller driver
that is less tightly coupled to the GPIO API.  Instead it implements
more of a conversion from the EIC's own odd multiplexing to a more
traditional port and pin mask IRQ-like callback.  Unfortunately,
through the EIC on the SAMD2x are relatively well behaved
in terms of pin to EIC line mappings, other chips that share the
peripheral interface are not.  So the EIC driver implements a
per-line lookup to the pin and port pair using definitions extracted
from the ASF headers.

The EIC driver still makes some assumptions about how it will be used:
mostly it assumes exactly one callback per port.  This should be fine
as the only intended user is the GPIO driver itself.

This has been tested with some simple programs and with
tests/drivers/gpio/gpio_basic_api on a SAMD21 breakout and an
adafruit_trinket_m0 board.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-07 08:43:56 -04:00
Derek Hageman 46730e1f57 drivers: i2c: Add SAM0 I2C driver
This adds a SERCOM I2C driver for SAM0 series chips.

Tested with a SAMD21 chip on a SSD1306 display and a MLX90393
sensor.  Only compile tested for SAMD20 and SAMR21.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-07 08:42:24 -04:00
Derek Hageman 1d64a46501 drivers: adc: Add SAM0 ADC driver
This adds a driver for the SAM0 series ADC.

Tested with /tests/drivers/adc/adc_api on SAMD21.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-07 08:41:27 -04:00
Derek Hageman 4709816a69 soc: sam0: Remove SERCOM defines from dts_fixup.h
Move SERCOM peripherals to use the raw defines generated from DTS
parsing.  This adds aliases to the DTS so that the SERCOM number
can still be used for clocking and pinmux.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-03 08:46:57 -05:00
Derek Hageman 37a6a7ea68 drivers: gpio: sam0: Remove defines from dts_fixup.h
Move SAM0 GPIO to use the raw defines generated from the DTS
parsing.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-03 08:46:57 -05:00
Derek Hageman 6324c8a27a drivers: pinmux: sam0: Remove defines from dts_fixup.h
Move SAM0 pinmux to use the raw defines generated from the DTS
parsing.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-03 08:46:57 -05:00
Michael Hope ba21de582b drivers: dma: Add SAM0 DMAC driver
This adds support for the SAM0 DMA Controller (DMAC).  Chained
transfer are not currently implemented.

Tested with tests/drivers/dma/loop_transfer and custom modifications
to that test using three parallel reloading channels.  Also tested
with a trivial program that did memory->serial.

Signed-off-by: Michael Hope <mlhx@google.com>

[hageman@inthat.cloud: Rebased and updated commit message]
Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-02 19:20:12 -05:00
Benjamin Valentin 770233dd10 soc: atmel: add SAMR21
Adds Atmel SAMR21 soc which is based on SAMD21, but with a AT86RF233
radio connected internally via SPI.

The AT86RF233 is not yet supprted by Zephyr at this point.

This code is very much copy & paste from atmel_sam0/samd21

Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
2019-04-28 13:25:35 -04:00
Benjamin Valentin c43067047c drivers: hwinfo: add driver support for Atmel SAM0 device ID
Add driver support for Atmel SAM0 device ID, which is 16-bytes long.
The device ID can simply be read from memory at a known location, but
the location is only described in the data sheet, not in ASF.

For SAMD2x it's 0x0080A00C, 0x0080A040, 0x0080A044 & 0x0080A048.
For SAMD5x it's 0x008061FC, 0x00806010, 0x00806014 & 0x00806018.

This adds a new property to the device tree to define the device ID
registers for this SoC family.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-04-18 17:54:30 -04:00
Derek Hageman a17730da18 soc: sam0: Fix SAMD20 IRQ assignments
SAMD20 does not have the DMA or USB peripherals and as a result
the IRQs for all subsequent lines are shifted down from SAMD21.
This splits the interrupt assignment for the SERCOMs into the
SoC specific DTS file and moves the USB definition to SAMD21 only.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-04-17 10:26:36 -05:00
Aurelien Jarno 2168d80987 drivers: add Atmel SAM PWM driver
This patch adds basic support for the PWM devices available on the Atmel
SAM family. Beside enabling the driver, everything is selected through
the device tree, including enabling the PWM0 and PWM1 devices. Thus
CONFIG_PWM_0 and CONFIG_PWM_1 are ignored.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 06:55:14 -06:00
Martin Benda 9653e15139 drivers: timer: Add RTC-based system timer for Atmel SAM0 series MCU
Add sam0_rtc_driver that implements system timer API on top of the RTC
and can be used as a replacement for the default systick timer.

Signed-off-by: Martin Benda <martin.benda@omsquare.com>
2019-01-29 17:58:05 +01:00
Aurelien Jarno 6194b7676c drivers: flash: add flash driver support for Atmel SAM E70
This patch adds a flash driver for the Atmel SAM E70 SoC. The driver has
been kept simple by considering that the flash is only composed of 8-KiB
blocks. Indeed an area at the beginning of the flash might be erased
with a smaller granularity, and the other blocks can also be erased with
a higher granularity. It also only handles the global read/write
protection, not the 128-KiB lock regions. A write error is returned if
a region is locked.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-20 14:11:07 -05:00
Kumar Gala 5ac0fd35d3 dts: atmel: samd: Fix reg address for NVM flash controller
dtc was producing this warning when we build on SAMD SoCs:
	Warning (simple_bus_reg): /soc/nvmctrl@41004000:
	simple-bus unit address format error, expected "40022000"

The reg addr isn't used by the flash_sam0.c driver so we wouldn't notice
this issue.  Looking at the atmel HAL we see:

	#define NVMCTRL           ((Nvmctrl  *)0x41004000UL)

So that provides confirmation of what the reg addr should be.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 17:49:17 -06:00
Aurelien Jarno 16994088fd drivers: entropy: add Atmel SAM entropy generator driver
Tested on the Atmel SAM E70 Xplained board.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-14 12:58:49 -05:00
Kumar Gala 0eb0e78d67 dts: Fix warnings associated with reg/unit-address not matching
Newer DTC now warns about mismatch between the reg and unit-address.
Most of these cases are due to case not matching, so fix thoses so
everything is lowercase.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-10 09:11:58 -05:00
Aurelien Jarno 6b6e54321a drivers: usb: add usb device driver for Atmel SAM E70 family
This patch adds a USB device driver for the USBHS device that can be
found on Atmel SAM E70 SoC family. Only the FIFO mode is supported
(as opposed to DMA). It supports LS, FS and HS modes, but defaults to
FS mode as Zephyr does not fully support HS mode yet.

Tested examples on an Atmel SMART SAM E70 Xplained Board:
* usb/cdc_acm
* usb/hid-mouse
* usb/mass

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-06 16:32:35 -05:00
Subramanian Meenakshi Sundaram 4e1179bba5 drivers: watchdog: Adding watchdog support for sam SOC
Adding watchdog driver for sam SoC. The current implemntation just
diables the watchdog on device boot.
This PR adds the following support for SAM3X, SAM4S and SAME70
1. Activate processor reset
2. Activate all reset
3. Generate interrupt on watchdog timer expiration.

Signed-off-by: Subramanian Meenakshi Sundaram <subbu147@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-02 15:09:22 -05:00
qianfan Zhao 5a07a1215d dts: Add spi node for atmel sam series soc
Add SPI1 and SPI2 support

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-10 11:29:49 -05:00
Kumar Gala f331cc5c09 dts: atmel: Add missing GPIO properties
The gpio controllers on SAM4S, SAME70, and SAMD were missing properties
related to GPIO pin generation.  Add the missing details into the yaml
and dts files to allow boards to specific gpio pins.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-04 07:49:03 -05:00
Vincent van der Locht b941561e74 soc: sam4s: added missing devices in sam4s range
added sam4s16b, sam4s8c, sam4s8b, sam4s4c, sam4s4b,
sam4s4a, sam4s2c, sam4s2b and sam4s2a.
Used the same order as in the data sheet and code structure
equal to same70. Updated the sam4s_xplained board to match
the altered .dtsi location of the specific SoC.

Signed-off-by: Vincent van der Locht <vincent@vlotech.nl>
2018-10-02 16:17:54 -05:00
Kumar Gala 846121761f dts: arm: atmel_same70: Remove use of CONFIG_SOC_* from Atmel dts files
To move forward and remove use of Kconfig in dts files lets just create
SoC specific dtsi files that the boards can include.  This lets us
remove:

CONFIG_SOC_PART_NUMBER_SAME70*

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-09-15 15:33:43 -05:00
Kumar Gala 6e240da26f dts: Use new DT_SIZE_{K,M} macros
Now that we have a common DT_SIZE_K macro use it instead of defining
__SIZE_K eveywhere.  We also have DT_SIZE_M, so use that in a few
places as well.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-09-15 09:23:07 -05:00
Sean Nyekjaer 781a2f0275 arch: add support SAMD20 used in the SAMD20 Xplained Pro Board
This add basic support the SAMD20 inkl. SPI and UART

Signed-off-by: Sean Nyekjaer <sean@nyekjaer.dk>
2018-07-10 12:56:44 -05:00
Sean Nyekjaer 5a1bcc756c dts: arm: sam0: move contents samd21 to samd
samd21.dtsi includes now the same content need for SAMD20,
move it to samd.dtsi and include it from samd21.dtsi.
Then later USB support can be added to the samd21.dtsi seperatly
from the samd20 etc.

Signed-off-by: Sean Nyekjaer <sean@nyekjaer.dk>
2018-07-10 12:56:44 -05:00
Kumar Gala 3b78d937e5 usb: ateml: samd21: enable usb controller in board dts not soc
Since not all boards enable all devices, we typically have the SoC dtsi
file have a device marked with status = "disabled" and have the
board.dts explicitly enable with status = "ok".  Update it so USB on
Atmel SAMD21 work this way.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-11 21:53:20 -05:00
Justin Watson b9c65e1882 drivers: GPIO Added GPIO for SAM family.
Added GPIO driver for SAM family of SoCs.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-03-10 11:42:25 -06:00
Michael Hope a8a36a23fc spi: sam0: use Device Tree for configuration.
Switch the SoC device tree to define a single entry per SERCOM instead
of one per mode.

Define a Device Tree binding for the SAM0 SPI and use it instead of
Kconfig for enabling / disabaling instances

Switch the Arduino Zero, Adafruit Feather M0 Basic Proto, and
Trinket M0 to use the new defintion.

Add the APA102 LED that's on the Trinket as a test.

Signed-off-by: Michael Hope <mlhx@google.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-10 11:42:25 -06:00
Michael Hope f2651d0cc7 usb: sam0: add a USB device driver.
Implements a USB device driver for the SAM0 series.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-10 08:41:39 -05:00
Justin Watson c1ce290d45 serial: sam: add support for interrupt driven serial
Implements interrupt driven UART for the serial driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-02-21 11:26:20 -06:00
Michael Hope 0a5725e858 pinmux: sam0: add a pinmux driver for the SAM0 series.
Pin multiplexing is a function of the PORT peripheral.  This change
defines a separate pinmux device at the same address as the PORTs
themselves.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-05 06:31:35 -08:00
Kumar Gala 2dfee62a5e drivers: flash: atmel sam0: Convert to use device tree
Convert Atmel SAM0 flash driver to use device tree to get the flash
controller name and base address.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-27 21:09:28 -06:00
Kumar Gala 37d72bf0d6 dts: Update soc-nv-flash nodes
Where missing add compatible = "soc-nv-flash".  Also added a label for
all the soc-nv-flash that we might use in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-23 12:16:53 -06:00
Michael Hope 73d045e281 spi: add a SPI driver for the SAM0 series.
Impleentation is master only and uses polling to read and write.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-13 07:39:05 -05:00
Michael Hope cd92dd139b flash: add a driver for the internal flash on the SAM0 series.
The SAM0 has a 64 byte page (the programing unit) with 4 pages to a
row (the erase unit).  This driver implements a read/modify/write to
emulate the byte level writes used by NFFS.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-11 19:03:52 -05:00
Michael Hope b69c452e6f arch: add support for the SAMD21G18A used in the Arduino Zero.
Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-04 13:18:25 -05:00
Piotr Mienkowski 8bfcfe5545 drivers: i2c: Add DTS support for i2c_sam_twihs driver
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-15 11:13:08 -06:00
Piotr Mienkowski 26ba99e972 drivers: Add Atmel SAM family I2C (TWI) driver
Added I2C bus (TWI) driver for Atmel SAM MCU family. Only
I2C Master Mode with 7 bit addressing is currently supported.

Tested on Arduino Due board.

Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-10-23 10:18:08 +02:00
Piotr Mienkowski 39e1497f1d dts: Add Peripheral ID field to Atmel SAM drivers
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-10-23 10:18:08 +02:00
Piotr Mienkowski 7e68430bcf dts: sam3x: fix incorrect usart2 IRQ number
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-10-23 10:18:08 +02:00
Jonas Pfaff b62a353551 drivers: adc: Add SAM ADC driver
Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-2507

Signed-off-by: Jonas Pfaff <jonas.pfaff@gmail.com>
2017-10-10 11:56:47 -05:00
Yannis Damigos 1a652e3ef1 dts: Remove memory node from skeleton dtsi file
Remove memory node from skeleton dtsi and add device_type
property in every memory node in soc dtsi files

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-21 12:20:49 -05:00
Yannis Damigos 399a6bec0f dts: arm: Add unit-address component to memory and flash nodes
This patch add the unit-address component to memory and flash
nodes. According to the DT specification, the unit-address of
a node must match the first address specified in the reg
property of the node.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-21 12:20:49 -05:00
Kumar Gala 4cace27c82 dts: cleanup usage of "flash" and "sram" compatible
Remove compatible = "flash" from any node that has it as this doesn't
have any well defined meaning right now.  Also update any compatible =
"sram" to be "mmio-sram" (as there's a binding in linux for this).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-20 09:56:41 -05:00
Yannis Damigos 941ffb017b dts: Add cpus and cpu nodes missing properties
This patch adds #address-cell, #size-cell properties to
cpus container node and device_type, reg properties to
cpu node.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-19 14:28:08 -05:00
Justin Watson 0c6883f25a 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>
2017-07-07 10:31:34 -05:00
Anas Nashif d5add81561 sam4x: report correct number of IRQ priority bits
The Sam4x HAL defines __NVIC_PRIO_BITS to 4.  Fixes an issue where
interrupt priorities and masking were not being done correctly.

Issue: ZEP-2243
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 08:07:52 -04:00
Andrew Boie 639a10e30d sam3x: report correct number of IRQ priority bits
The Sam3x HAL defines __NVIC_PRIO_BITS to 4.
Fixes an issue where interrupt priorities and masking
were not being done correctly.

Issue: ZEP-2243
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 12:23:37 -05:00
Anas Nashif 3405607d9e license: add missing licenses and copyright
We were missing license boilerplate in many files, add them

Jira: ZEP-1464

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-08 10:41:56 -04:00
Kumar Gala 983e6a56fb arm: atmel: sam3: dts: use label to generate Atmel SAM3 uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the Atmel SAM3 UART out of the device
tree instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
fallrisk 20f41814de arch: Add Atmel SAM4S SoC support
Added support for Atmel SAM4S (Cortex-M4) MCU:
- Kconfig files
- Devicetree files

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-08 15:03:15 -04:00
fallrisk 44c421b4a3 boards: arduino_due: Added DTS to the Arduino Due.
Change-Id: I006f9d4080a1351534ede5cc601e43526c39aa83
Origin: Original
Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-08 15:03:15 -04:00
Piotr Mienkowski 38d8c863d4 arm: dts: Add DTS support for SAME70 SoC
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-05-05 16:44:41 -05:00