Skip to content

Commit

Permalink
boards: arm: sam: Add pinctrl info for gpio-keys
Browse files Browse the repository at this point in the history
Add pinctrl configuration to enable wake-up sources for gpio-keys
driver. After this the special function for some wake-up source
will be enabled by default and can wake-up device from a power-off
state.

In addition it reorder pinctrl definitions to be ascendent.

Signed-off-by: Gerson Fernando Budke <[email protected]>
  • Loading branch information
nandojve committed Nov 1, 2023
1 parent 8f914d8 commit 598947f
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 58 deletions.
44 changes: 25 additions & 19 deletions boards/arm/sam4e_xpro/sam4e_xpro-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,38 @@
};
};

gpio_keys_default: gpio_keys_default {
group1 {
pinmux = <PA2X_SUPC_WKUP2>;
bias-pull-up;
};
};

hsmci_default: hsmci_default {
group1 {
pinmux = <PA28C_HSMCI_MCCDA>,
<PA29C_HSMCI_MCCK>,
<PA30C_HSMCI_MCDA0>,
<PA31C_HSMCI_MCDA1>,
<PA26C_HSMCI_MCDA2>,
<PA27C_HSMCI_MCDA3>;
};
};

mdio_default: mdio_default {
group1 {
pinmux = <PD8A_GMAC_GMDC>,
<PD9A_GMAC_GMDIO>;
};
};

pwm0_default: pwm0_default {
group1 {
pinmux = <PD20A_PWM_PWMH0>,
<PD24A_PWM_PWML0>;
};
};

spi0_default: spi0_default {
group1 {
pinmux = <PA12A_SPI_MISO>,
Expand Down Expand Up @@ -87,23 +112,4 @@
<PA25A_USART1_CTS>;
};
};

pwm0_default: pwm0_default {
group1 {
pinmux = <PD20A_PWM_PWMH0>,
<PD24A_PWM_PWML0>;
};
};

hsmci_default: hsmci_default {
group1 {
pinmux = <PA28C_HSMCI_MCCDA>,
<PA29C_HSMCI_MCCK>,
<PA30C_HSMCI_MCDA0>,
<PA31C_HSMCI_MCDA1>,
<PA26C_HSMCI_MCDA2>,
<PA27C_HSMCI_MCDA3>;
};
};

};
4 changes: 4 additions & 0 deletions boards/arm/sam4e_xpro/sam4e_xpro.dts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@

gpio_keys {
compatible = "gpio-keys";

pinctrl-0 = <&gpio_keys_default>;
pinctrl-names = "default";

user_button: button_1 {
label = "User Button";
gpios = <&pioa 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
Expand Down
78 changes: 44 additions & 34 deletions boards/arm/sam4s_xplained/sam4s_xplained-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -1,59 +1,33 @@
/*
* Copyright (c) 2022, Gerson Fernando Budke <[email protected]>
* Copyright (c) 2022-2023, Gerson Fernando Budke <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/pinctrl/sam4sXc-pinctrl.h>

&pinctrl {
spi0_default: spi0_default {
adc0_default: adc0_default {
group1 {
pinmux = <PA12A_SPI_MISO>,
<PA13A_SPI_MOSI>,
<PA14A_SPI_SPCK>,
<PA31A_SPI_NPCS1>,
<PA30B_SPI_NPCS2>;
pinmux = <PB0X_ADC_AD4>,
<PB1X_ADC_AD5>;
};
};

twi0_default: twi0_default {
gpio_keys_default: gpio_keys_default {
group1 {
pinmux = <PA4A_TWI0_TWCK>,
<PA3A_TWI0_TWD>;
pinmux = <PA5X_SUPC_WKUP4>;
bias-pull-up;
};
};

uart0_default: uart0_default {
group1 {
pinmux = <PA9A_UART0_RXD>,
<PA10A_UART0_TXD>;
};
};
uart1_default: uart1_default {
group1 {
pinmux = <PB2A_UART1_RXD>,
<PB3A_UART1_TXD>;
};
};
usart1_default: usart1_default {
group1 {
pinmux = <PA21A_USART1_RXD>,
<PA22A_USART1_TXD>;
};
};
pwm0_default: pwm0_default {
group1 {
pinmux = <PA12B_PWM_PWMH1>,
<PA13B_PWM_PWMH2>,
<PA14B_PWM_PWMH3>;
};
};
adc0_default: adc0_default {
group1 {
pinmux = <PB0X_ADC_AD4>,
<PB1X_ADC_AD5>;
};
};

smc_default: smc_default {
group1 {
pinmux = <PC18A_EBI_A0>,
Expand Down Expand Up @@ -89,4 +63,40 @@
<PC8A_EBI_NWE>;
};
};

spi0_default: spi0_default {
group1 {
pinmux = <PA12A_SPI_MISO>,
<PA13A_SPI_MOSI>,
<PA14A_SPI_SPCK>,
<PA31A_SPI_NPCS1>,
<PA30B_SPI_NPCS2>;
};
};

twi0_default: twi0_default {
group1 {
pinmux = <PA4A_TWI0_TWCK>,
<PA3A_TWI0_TWD>;
};
};

uart0_default: uart0_default {
group1 {
pinmux = <PA9A_UART0_RXD>,
<PA10A_UART0_TXD>;
};
};
uart1_default: uart1_default {
group1 {
pinmux = <PB2A_UART1_RXD>,
<PB3A_UART1_TXD>;
};
};
usart1_default: usart1_default {
group1 {
pinmux = <PA21A_USART1_RXD>,
<PA22A_USART1_TXD>;
};
};
};
6 changes: 6 additions & 0 deletions boards/arm/sam4s_xplained/sam4s_xplained.dts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (c) Justin Watson 2017
* Copyright (c) 2020-2023 Gerson Fernando Budke
*
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -58,6 +60,10 @@

gpio_keys {
compatible = "gpio-keys";

pinctrl-0 = <&gpio_keys_default>;
pinctrl-names = "default";

user_button: button_1 {
label = "User Button";
gpios = <&pioa 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
Expand Down
5 changes: 4 additions & 1 deletion boards/arm/sam_e70_xplained/sam_e70_xplained-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2017 Piotr Mienkowski
* Copyright (c) 2017 Justin Watson
* Copyright (c) 2020 Stephanos Ioannidis <[email protected]>
* Copyright (c) 2020 Gerson Fernando Budke <[email protected]>
* Copyright (c) 2020-2023 Gerson Fernando Budke <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -39,6 +39,9 @@
gpio_keys {
compatible = "gpio-keys";

pinctrl-0 = <&gpio_keys_default>;
pinctrl-names = "default";

/* The switch is labeled SW300 in the schematic, and labeled
* SW0 on the board, and labeld SW1 User Button on docs
*/
Expand Down
10 changes: 8 additions & 2 deletions boards/arm/sam_e70_xplained/sam_e70_xplained-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Gerson Fernando Budke <[email protected]>
* Copyright (c) 2022-2023, Gerson Fernando Budke <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -13,7 +13,6 @@
<PA17X_AFE0_AD6>;
};
};

afec1_default: afec1_default { /* ADCH - J504 */
group1 {
pinmux = <PC31X_AFE1_AD6>;
Expand All @@ -40,6 +39,13 @@
};
};

gpio_keys_default: gpio_keys_default {
group1 {
pinmux = <PA11X_SUPC_WKUP7>;
bias-pull-up;
};
};

mdio_default: mdio_default {
group1 {
pinmux = <PD8A_GMAC_GMDC>,
Expand Down
5 changes: 4 additions & 1 deletion boards/arm/sam_v71_xult/sam_v71_xult-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2017 Piotr Mienkowski
* Copyright (c) 2017 Justin Watson
* Copyright (c) 2020 Stephanos Ioannidis <[email protected]>
* Copyright (c) 2019-2022 Gerson Fernando Budke <[email protected]>
* Copyright (c) 2019-2023 Gerson Fernando Budke <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -54,6 +54,9 @@
gpio_keys {
compatible = "gpio-keys";

pinctrl-0 = <&gpio_keys_default>;
pinctrl-names = "default";

/* The switch is labeled SW300/301 in the schematic, and
* labeled SW0 on the board, and labeled ERASE User Button
* on docs
Expand Down
8 changes: 7 additions & 1 deletion boards/arm/sam_v71_xult/sam_v71_xult-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<PA19X_AFE0_AD8>;
};
};

afec1_default: afec1_default {
group1 {
pinmux = <PC13X_AFE1_AD1>,
Expand Down Expand Up @@ -40,6 +39,13 @@
};
};

gpio_keys_default: gpio_keys_default {
group1 {
pinmux = <PA9X_SUPC_WKUP6>;
bias-pull-up;
};
};

mdio_default: mdio_default {
group1 {
pinmux = <PD8A_GMAC_GMDC>,
Expand Down

0 comments on commit 598947f

Please sign in to comment.