Commit f6b7dd09 authored by Kumar Gala's avatar Kumar Gala Committed by Anas Nashif
Browse files

pinmux: sifive: Convert SiFive pinmux to be devicetree based



Add a simple pinctrl node for the IOF registers under the GPIO
controller node to be used by the pinmux driver.

Signed-off-by: default avatarKumar Gala <kumar.gala@linaro.org>
parent d6b4995d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -12,7 +12,9 @@ static int hifive1_pinmux_init(const struct device *dev)
{
	ARG_UNUSED(dev);

	const struct device *p = device_get_binding(CONFIG_PINMUX_SIFIVE_0_NAME);
	const struct device *p = DEVICE_DT_GET(DT_NODELABEL(pinctrl));

	__ASSERT_NO_MSG(device_is_ready(p));

	/* UART0 RX */
	pinmux_pin_set(p, 16, SIFIVE_PINMUX_IOF0);
+3 −1
Original line number Diff line number Diff line
@@ -12,7 +12,9 @@ static int hifive1_revb_pinmux_init(const struct device *dev)
{
	ARG_UNUSED(dev);

	const struct device *p = device_get_binding(CONFIG_PINMUX_SIFIVE_0_NAME);
	const struct device *p = DEVICE_DT_GET(DT_NODELABEL(pinctrl));

	__ASSERT_NO_MSG(device_is_ready(p));

#ifdef CONFIG_UART_SIFIVE
#ifdef CONFIG_UART_SIFIVE_PORT_0
+1 −6
Original line number Diff line number Diff line
@@ -3,13 +3,8 @@
# Copyright (c) 2017 Jean-Paul Etienne <fractalclone@gmail.com>
# SPDX-License-Identifier: Apache-2.0

menuconfig PINMUX_SIFIVE
config PINMUX_SIFIVE
	bool "SiFive Freedom SOC pinmux driver"
	depends on SOC_SERIES_RISCV_SIFIVE_FREEDOM
	help
	  Enable driver for the SiFive Freedom SOC pinmux driver

config PINMUX_SIFIVE_0_NAME
	string "SIFIVE pinmux 0 driver name"
	default "pinmux0"
	depends on PINMUX_SIFIVE
+4 −2
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@
 * SPDX-License-Identifier: Apache-2.0
 */

#define DT_DRV_COMPAT sifive_iof

/**
 * @brief PINMUX driver for the SiFive Freedom Processor
 */
@@ -94,10 +96,10 @@ static const struct pinmux_driver_api pinmux_sifive_driver_api = {
};

static const struct pinmux_sifive_config pinmux_sifive_0_config = {
	.base = SIFIVE_PINMUX_0_BASE_ADDR,
	.base = DT_INST_REG_ADDR(0),
};

DEVICE_DEFINE(pinmux_sifive_0, CONFIG_PINMUX_SIFIVE_0_NAME,
DEVICE_DT_INST_DEFINE(0,
		    &pinmux_sifive_init, device_pm_control_nop, NULL,
		    &pinmux_sifive_0_config,
		    PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
+19 −0
Original line number Diff line number Diff line
# Copyright (c) 2021, Linaro Limited
# SPDX-License-Identifier: Apache-2.0

description: |
  SiFive FE310 IO Function (iof)
  Binding covers the IOF_EN/IOF_SEL registers that are a subset of the GPIO
  controller.

compatible: "sifive,iof"

include: base.yaml

properties:
    reg:
      required: true

pinmux-cells:
  - pin
  - function
Loading