Skip to content

Commit

Permalink
drivers: pinctrl: add pinctrl driver for ARC emsdp
Browse files Browse the repository at this point in the history
Add Synopsys ARC EMSDP board Pin controller for its Pmod
and Arduino shield interface.

Signed-off-by: Siyuan Cheng <[email protected]>
  • Loading branch information
Siyuan Cheng authored and nashif committed May 29, 2023
1 parent 0ce3e20 commit 4babd54
Show file tree
Hide file tree
Showing 12 changed files with 630 additions and 0 deletions.
27 changes: 27 additions & 0 deletions boards/arc/emsdp/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,30 @@ Note: DW SPI only available on SPI0 and SPI1.
whole flash then write 4 byte data to the flash. Read from the flash and compare the
result with buffer to check functionality.

Pinmux interface
================

The following pinmux peripheral module standards are supported:

* Digilent Pmod (3x)

The ARC EM SDP features three 12-pin Pmod connectors: Pmod_A, Pmod_B, and Pmod_C.
The functionality of the Pmod connectors is programmable and includes GPIO, UART, SPI,
I2C, and PWM (Note: support two type UART Pmod interface: UARTA is newer version).
Multiplexing is controlled by software using the PMOD_MUX_CTRL register.

* Arduino (1x)

The ARC EM SDP provides an Arduino shield interface. Multiplexing is controlled by software
using the ARDUINO_MUX_CTRL register. Note: some IO must be programmed in group and can't be
set individually, for details see Table 9 in `EM Software Development Platform user guide`_.

* MikroBUS (1x)

Note that since the controllers that are mapped to the MikroBUS are shared with the Arduino
controllers, and therefore the MikroBUS functions are only available when the Arduino
multiplexer ARDUINO_MUX_CTRL is in the default mode (GPIO).

Programming and Debugging
*************************

Expand Down Expand Up @@ -252,6 +276,9 @@ References

.. target-notes::

.. _EM Software Development Platform user guide:
https://www.synopsys.com/dw/ipdir.php?ds=arc-em-software-development-platform

.. _Digilent Pmod Modules:
http://store.digilentinc.com/pmod-modules

Expand Down
133 changes: 133 additions & 0 deletions boards/arc/emsdp/emsdp-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/* SPDX-License-Identifier: Apache-2.0 */

#include <zephyr/dt-bindings/pinctrl/emsdp-pinctrl.h>

&pinctrl {
/* PMOD_A */
pmodA_gpio: pmodA_gpio {
pinmux = <PMOD_A PMOD_GPIO>;
};
pmodA_uarta: pmodA_uarta {
pinmux = <PMOD_A PMOD_UARTA>;
};
pmodA_uartb: pmodA_uartb {
pinmux = <PMOD_A PMOD_UARTB>;
};
pmodA_spi1_cs0: pmodA_spi1_cs0 {
pinmux = <PMOD_A PMOD_SPI>;
};
pmodA_i2c2: pmodA_i2c2 {
pinmux = <PMOD_A PMOD_I2C>;
};
pmodA_pwm1: pmodA_pwm1 {
pinmux = <PMOD_A PMOD_PWM_MODE1>;
};
pmodA_pwm2: pmodA_pwm2 {
pinmux = <PMOD_A PMOD_PWM_MODE2>;
};

/* PMOD_B */
pmodB_gpio: pmodB_gpio {
pinmux = <PMOD_B PMOD_GPIO>;
};
pmodB_uarta: pmodB_uarta {
pinmux = <PMOD_B PMOD_UARTA>;
};
pmodB_uartb: pmodB_uartb {
pinmux = <PMOD_B PMOD_UARTB>;
};
pmodB_spi1_cs1: pmodB_spi1_cs1 {
pinmux = <PMOD_B PMOD_SPI>;
};
pmodB_i2c2: pmodB_i2c2 {
pinmux = <PMOD_B PMOD_I2C>;
};
pmodB_pwm1: pmodB_pwm1 {
pinmux = <PMOD_B PMOD_PWM_MODE1>;
};
pmodB_pwm2: pmodB_pwm2 {
pinmux = <PMOD_B PMOD_PWM_MODE2>;
};

/* PMOD_C */
pmodC_gpio: pmodC_gpio {
pinmux = <PMOD_C PMOD_GPIO>;
};
pmodC_uarta: pmodC_uarta {
pinmux = <PMOD_C PMOD_UARTA>;
};
pmodC_uartb: pmodC_uartb {
pinmux = <PMOD_C PMOD_UARTB>;
};
pmodC_spi1_cs2: pmodC_spi1_cs2 {
pinmux = <PMOD_C PMOD_SPI>;
};
pmodC_i2c2: pmodC_i2c2 {
pinmux = <PMOD_C PMOD_I2C>;
};
pmodC_pwm1: pmodC_pwm1 {
pinmux = <PMOD_C PMOD_PWM_MODE1>;
};
pmodC_pwm2: pmodC_pwm2 {
pinmux = <PMOD_C PMOD_PWM_MODE2>;
};

/* ARDUINO_PIN_1 */
arduino_CFG0_gpio: arduino_CFG0_gpio {
pinmux = <ARDUINO_PIN_1 ARDUINO_GPIO>;
};
arduino_CFG0_uart: arduino_CFG0_uart {
pinmux = <ARDUINO_PIN_1 ARDUINO_UART>;
};

/* ARDUINO_PIN_3 */
arduino_CFG1_gpio: arduino_CFG1_gpio {
pinmux = <ARDUINO_PIN_3 ARDUINO_GPIO>;
};
arduino_CFG1_pwm: arduino_CFG1_pwm{
pinmux = <ARDUINO_PIN_3 ARDUINO_PWM>;
};

/* ARDUINO_PIN_5 */
arduino_CFG2_gpio: arduino_CFG2_gpio {
pinmux = <ARDUINO_PIN_5 ARDUINO_GPIO>;
};
arduino_CFG2_pwm: arduino_CFG2_pwm {
pinmux = <ARDUINO_PIN_5 ARDUINO_PWM>;
};

/* ARDUINO_PIN_7 */
arduino_CFG3_gpio: arduino_CFG3_gpio {
pinmux = <ARDUINO_PIN_7 ARDUINO_GPIO>;
};
arduino_CFG3_pwm: arduino_CFG3_pwm {
pinmux = <ARDUINO_PIN_7 ARDUINO_PWM>;
};

/* ARDUINO_PIN_9 */
arduino_CFG4_gpio: arduino_CFG4_gpio {
pinmux = <ARDUINO_PIN_9 ARDUINO_GPIO>;
};
arduino_CFG4_pwm: arduino_CFG4_pwm {
pinmux = <ARDUINO_PIN_9 ARDUINO_PWM>;
};

/* ARDUINO_PIN_13 */
arduino_CFG5_gpio: arduino_CFG5_gpio {
pinmux = <ARDUINO_PIN_13 ARDUINO_GPIO>;
};
arduino_CFG5_spi: arduino_CFG5_spi {
pinmux = <ARDUINO_PIN_13 ARDUINO_SPI>;
};
arduino_CFG5_pwm: arduino_CFG5_pwm {
pinmux = <ARDUINO_PIN_13 ARDUINO_PWM>;
};

/* ARDUINO_PIN_AD5 */
arduino_CFG6_gpio: arduino_CFG6_gpio {
pinmux = <ARDUINO_PIN_AD5 ARDUINO_GPIO>;
};
arduino_CFG6_i2c: arduino_CFG6_i2c {
pinmux = <ARDUINO_PIN_AD5 ARDUINO_I2C>;
};
};
13 changes: 13 additions & 0 deletions boards/arc/emsdp/emsdp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <synopsys/emsdp.dtsi>
#include <mem.h>
#include "board.dtsi"
#include "emsdp-pinctrl.dtsi"

/ {
model = "emsdp";
Expand Down Expand Up @@ -49,5 +50,17 @@
spi@f1000000 {
interrupts = <84 1>;
};

spi@80010000 {
interrupts = <63 2>, <64 2>, <65 2>;
pinctrl-0 = <&arduino_CFG5_spi>;
pinctrl-names = "default";
};

spi@80010100 {
interrupts = <67 2>, <68 2>, <69 2>;
pinctrl-0 = <&pmodA_spi1_cs0>;
pinctrl-names = "default";
};
};
};
1 change: 1 addition & 0 deletions boards/arc/emsdp/emsdp_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_ARC_MPU_ENABLE=y
CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_PINCTRL=y
1 change: 1 addition & 0 deletions drivers/pinctrl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ zephyr_library_sources_ifdef(CONFIG_PINCTRL_XMC4XXX pinctrl_xmc4xxx.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_NXP_S32 pinctrl_nxp_s32.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_GECKO pinctrl_gecko.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_TI_K3 pinctrl_ti_k3.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_EMSDP pinctrl_emsdp.c)
1 change: 1 addition & 0 deletions drivers/pinctrl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ source "drivers/pinctrl/Kconfig.xmc4xxx"
source "drivers/pinctrl/Kconfig.nxp_s32"
source "drivers/pinctrl/Kconfig.gecko"
source "drivers/pinctrl/Kconfig.ti_k3"
source "drivers/pinctrl/Kconfig.emsdp"

endif # PINCTRL
9 changes: 9 additions & 0 deletions drivers/pinctrl/Kconfig.emsdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023 Synopsys
# SPDX-License-Identifier: Apache-2.0

config PINCTRL_EMSDP
bool "EMSDP pinmux driver"
default y
depends on DT_HAS_SNPS_EMSDP_PINCTRL_ENABLED
help
Enable driver for the synopsys ARC EMSDP pinctrl driver
Loading

0 comments on commit 4babd54

Please sign in to comment.