1 /*
2 * Copyright (c) 2019, Aurelien Jarno
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <init.h>
8
9 #if defined CONFIG_PWM && DT_NODE_HAS_STATUS(DT_INST(0, atmel_sam_pwm), okay)
10 /* PWM on EXT1 connector, pin 7, channel 0, inverted */
11 static const struct soc_gpio_pin pwm_ext1_pin7 = {
12 PIO_PA0A_PWM0_PWMH0, PIOA, ID_PIOA, SOC_GPIO_FUNC_A
13 };
14
15 /* PWM on EXT2 connector, pin 7, channel 2, inverted */
16 static const struct soc_gpio_pin pwm_ext2_pin7 = {
17 PIO_PC19B_PWM0_PWMH2, PIOC, ID_PIOC, SOC_GPIO_FUNC_B
18 };
19
20 /* PWM on EXT2 connector, pin 8, channel 2, non-inverted */
21 static const struct soc_gpio_pin pwm_ext2_pin8 = {
22 PIO_PD26A_PWM0_PWML2, PIOD, ID_PIOD, SOC_GPIO_FUNC_A
23 };
24 #endif
25
sam_e70_xplained_init(const struct device * dev)26 static int sam_e70_xplained_init(const struct device *dev)
27 {
28 ARG_UNUSED(dev);
29
30 #if defined CONFIG_PWM && DT_NODE_HAS_STATUS(DT_INST(0, atmel_sam_pwm), okay)
31 soc_gpio_configure(&pwm_ext1_pin7);
32 soc_gpio_configure(&pwm_ext2_pin7);
33 soc_gpio_configure(&pwm_ext2_pin8);
34 #endif
35
36 return 0;
37 }
38
39 SYS_INIT(sam_e70_xplained_init, PRE_KERNEL_1, 0);
40