zephyr/dts/arm/atmel/pinctrl_atmel_sam.h
Kumar Gala bdf58d11f0 dts: atmel sam: Add pinctrl support for SAM UART and USART
Add pinctl support for the SAM UART and SAM USART devices.  We update
the UART and USART bindings to have pinctrl-0 bindings that are expected
to have 2 phandles to the RX & TX pinctrl nodes.

The pinctrl nodes will have an 'atmel,pins' property that describes the
GPIO port, pin and periphal configuration for that pin.

We add sam*-pinctrl.dtsi files with all the various pin ctrl
configuration operations supported by the given SoC family.  These
files are based on data extracted from the Atmel ASF HAL
(in include/sam<FAMILY>/pio/*.h).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-18 17:04:08 -05:00

44 lines
906 B
C

/*
* Copyright (c) 2020 Linaro Limited
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef PINCTRL_ATMEL_SAM_H_
#define PINCTRL_ATMEL_SAM_H_
#define PERIPH_a 0
#define PERIPH_b 1
#define PERIPH_c 2
#define PERIPH_d 3
#define PERIPH_e 4
#define PERIPH_f 5
#define PERIPH_g 6
/* Create a pincfg device tree node:
*
* The node name and nodelabel will be of the form:
*
* NODE = p<port><pin><periph>_<inst>_<signal>
*
* NODE: NODE {
* atmel,pins = < &pio<port> <pin> PERIPH_<perip> >;
* }
*
* So for example:
*
* DT_ATMEL_PIN(uart, urxd, a, 8, a);
*
* Will become:
*
* pa8a_uart_urxd: pa8a_uart_urxd {
* atmel,pins = <&pioa 8 PERIPH_a>;
* }
*
*/
#define DT_ATMEL_PIN(inst, signal, port, pin, periph) \
p##port##pin##periph##_##inst##_##signal: \
p##port##pin##periph##_##inst##_##signal { \
atmel,pins = < &pio##port pin PERIPH_##periph >; }
#endif /* PINCTRL_ATMEL_SAM_H_ */