From f81b3e03aca3fcd21477e6a6133a8dd79468a626 Mon Sep 17 00:00:00 2001 From: Evgeniy Paltsev Date: Wed, 4 May 2022 17:25:48 +0400 Subject: [PATCH] ARC: boards: HSDK: ged rid of pinmux usage Pinmux is deprecated (see #39740) so let's get rid of it's usage for HSDK board. As we call pinmux only once at init phase we simply do register setup in platform code instead of pinmux. Signed-off-by: Evgeniy Paltsev Signed-off-by: Eugeniy Paltsev --- boards/arc/hsdk/CMakeLists.txt | 2 +- boards/arc/hsdk/hsdk_2cores_defconfig | 2 -- boards/arc/hsdk/hsdk_defconfig | 2 -- boards/arc/hsdk/pinmux.c | 36 --------------------------- boards/arc/hsdk/platform.c | 22 ++++++++++++++++ dts/arc/synopsys/arc_hsdk.dtsi | 5 ---- 6 files changed, 23 insertions(+), 46 deletions(-) delete mode 100644 boards/arc/hsdk/pinmux.c create mode 100644 boards/arc/hsdk/platform.c diff --git a/boards/arc/hsdk/CMakeLists.txt b/boards/arc/hsdk/CMakeLists.txt index 137efa662a..33bf0acc9d 100644 --- a/boards/arc/hsdk/CMakeLists.txt +++ b/boards/arc/hsdk/CMakeLists.txt @@ -4,4 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -zephyr_sources_ifdef(CONFIG_PINMUX_HSDK pinmux.c) +zephyr_sources(platform.c) diff --git a/boards/arc/hsdk/hsdk_2cores_defconfig b/boards/arc/hsdk/hsdk_2cores_defconfig index 4bf7d594a8..cb53f69f70 100644 --- a/boards/arc/hsdk/hsdk_2cores_defconfig +++ b/boards/arc/hsdk/hsdk_2cores_defconfig @@ -11,8 +11,6 @@ CONFIG_ARCV2_TIMER=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y -CONFIG_PINMUX=y -CONFIG_PINMUX_HSDK=y CONFIG_GPIO=y CONFIG_SPI=y CONFIG_SMP=y diff --git a/boards/arc/hsdk/hsdk_defconfig b/boards/arc/hsdk/hsdk_defconfig index 20963ce6aa..68e455f307 100644 --- a/boards/arc/hsdk/hsdk_defconfig +++ b/boards/arc/hsdk/hsdk_defconfig @@ -11,8 +11,6 @@ CONFIG_ARCV2_TIMER=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y -CONFIG_PINMUX=y -CONFIG_PINMUX_HSDK=y CONFIG_GPIO=y CONFIG_SPI=y CONFIG_SMP=y diff --git a/boards/arc/hsdk/pinmux.c b/boards/arc/hsdk/pinmux.c deleted file mode 100644 index bcd33ed33e..0000000000 --- a/boards/arc/hsdk/pinmux.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2019 Synopsys - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -static int board_pinmux_init(const struct device *dev) -{ - ARG_UNUSED(dev); - - const struct device *pinmux = DEVICE_DT_GET(DT_NODELABEL(pinctrl)); - - __ASSERT_NO_MSG(device_is_ready(pinmux)); - - /* - * to do configuration for each sel, - * please refer the doc for hsdk board. - */ - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL0, HSDK_PINMUX_FUN0); - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL1, HSDK_PINMUX_FUN0); - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL2, HSDK_PINMUX_FUN0); - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL3, HSDK_PINMUX_FUN2); - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL4, HSDK_PINMUX_FUN0); - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL5, HSDK_PINMUX_FUN0); - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL6, HSDK_PINMUX_FUN0); - pinmux_pin_set(pinmux, HSDK_PINMUX_SEL7, HSDK_PINMUX_FUN0); - - return 0; -} - - -SYS_INIT(board_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY); diff --git a/boards/arc/hsdk/platform.c b/boards/arc/hsdk/platform.c new file mode 100644 index 0000000000..eb22f5ed5b --- /dev/null +++ b/boards/arc/hsdk/platform.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Synopsys + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#define HSDK_CREG_GPIO_MUX_REG 0xf0001484 +#define HSDK_CREG_GPIO_MUX_VAL 0x00000400 + +static int hsdk_creg_gpio_mux_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + sys_write32(HSDK_CREG_GPIO_MUX_REG, HSDK_CREG_GPIO_MUX_VAL); + + return 0; +} + +SYS_INIT(hsdk_creg_gpio_mux_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/dts/arc/synopsys/arc_hsdk.dtsi b/dts/arc/synopsys/arc_hsdk.dtsi index 95de7c518c..2d6bbe25b1 100644 --- a/dts/arc/synopsys/arc_hsdk.dtsi +++ b/dts/arc/synopsys/arc_hsdk.dtsi @@ -66,11 +66,6 @@ reg = <0x90000000 0x50000000>; }; - pinctrl: pinctrl@f0001484 { - compatible = "snps,creg-gpio-mux-hsdk"; - reg = <0xf0001484 0x4>; - }; - uart0: uart@f0005000 { compatible = "ns16550"; clock-frequency = <33333333>;