Please sign in to comment.
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 <firstname.lastname@example.org>
- Loading branch information...
Showing with 1,384 additions and 10 deletions.
- +145 −10 drivers/gpio/gpio_sam0.c
- +1 −0 drivers/interrupt_controller/CMakeLists.txt
- +2 −0 drivers/interrupt_controller/Kconfig
- +17 −0 drivers/interrupt_controller/Kconfig.sam0
- +394 −0 drivers/interrupt_controller/sam0_eic.c
- +84 −0 drivers/interrupt_controller/sam0_eic.h
- +700 −0 drivers/interrupt_controller/sam0_eic_priv.h
- +7 −0 dts/arm/atmel/samd.dtsi
- +33 −0 dts/bindings/interrupt-controller/atmel,sam0-eic.yaml
- +1 −0 soc/arm/atmel_sam0/CMakeLists.txt
|@@ -0,0 +1,17 @@|
|# Kconfig - SAM0 EIC configuration|
|# Copyright (c) 2019 Derek Hageman <email@example.com>|
|# SPDX-License-Identifier: Apache-2.0|
|bool "External Interrupt Controller (EIC) Driver for SAM0 series devices"|
|Enable EIC driver for SAM0 series of devices. This is required for|
|GPIO interrupt support.|
|endif # SOC_FAMILY_SAM0|
Oops, something went wrong.