pinmux: hsdk: Convert ARC HSDK pinmux to be devicetree based
Add a simple pinctrl node for the CREG GPIO MUX register to be used by the pinmux driver. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
147bb6b9f3
commit
4276d7d247
6 changed files with 29 additions and 16 deletions
|
@ -12,11 +12,10 @@ static int board_pinmux_init(const struct device *device)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(device);
|
ARG_UNUSED(device);
|
||||||
|
|
||||||
const struct device *pinmux = device_get_binding(CONFIG_PINMUX_NAME);
|
const struct device *pinmux = DEVICE_DT_GET(DT_NODELABEL(pinctrl));
|
||||||
|
|
||||||
|
__ASSERT_NO_MSG(device_is_ready(pinmux));
|
||||||
|
|
||||||
if (pinmux == NULL) {
|
|
||||||
return -ENXIO;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* to do configuration for each sel,
|
* to do configuration for each sel,
|
||||||
* please refer the doc for hsdk board.
|
* please refer the doc for hsdk board.
|
||||||
|
|
|
@ -11,12 +11,6 @@ menuconfig PINMUX
|
||||||
|
|
||||||
if PINMUX
|
if PINMUX
|
||||||
|
|
||||||
config PINMUX_NAME
|
|
||||||
string "Pinmux driver name"
|
|
||||||
default "PINMUX"
|
|
||||||
help
|
|
||||||
The name of the pinmux driver.
|
|
||||||
|
|
||||||
config PINMUX_INIT_PRIORITY
|
config PINMUX_INIT_PRIORITY
|
||||||
int "Init priority"
|
int "Init priority"
|
||||||
default 45
|
default 45
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define DT_DRV_COMPAT snps_creg_gpio_mux_hsdk
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <drivers/pinmux.h>
|
#include <drivers/pinmux.h>
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
|
|
||||||
#define creg_gpio_mux_reg (*(volatile uint32_t *)CREG_GPIO_MUX_BASE_ADDR)
|
#define creg_gpio_mux_reg (*(volatile uint32_t *)DT_INST_REG_ADDR(0))
|
||||||
|
|
||||||
void _arc_sync(void)
|
void _arc_sync(void)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +70,7 @@ static const struct pinmux_driver_api pinmux_hsdk_driver_api = {
|
||||||
.input = pinmux_hsdk_input,
|
.input = pinmux_hsdk_input,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_DEFINE(pinmux_hsdk, CONFIG_PINMUX_NAME,
|
DEVICE_DT_INST_DEFINE(0,
|
||||||
&pinmux_hsdk_init, device_pm_control_nop, NULL, NULL,
|
&pinmux_hsdk_init, device_pm_control_nop, NULL, NULL,
|
||||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||||
&pinmux_hsdk_driver_api);
|
&pinmux_hsdk_driver_api);
|
||||||
|
|
|
@ -66,6 +66,11 @@
|
||||||
reg = <0x90000000 0x50000000>;
|
reg = <0x90000000 0x50000000>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pinctrl: pinctrl@f0001484 {
|
||||||
|
compatible = "snps,creg-gpio-mux-hsdk";
|
||||||
|
reg = <0xf0001484 0x4>;
|
||||||
|
};
|
||||||
|
|
||||||
uart0: uart@f0005000 {
|
uart0: uart@f0005000 {
|
||||||
compatible = "ns16550";
|
compatible = "ns16550";
|
||||||
clock-frequency = <33333333>;
|
clock-frequency = <33333333>;
|
||||||
|
|
17
dts/bindings/pinctrl/snps,creg-gpio-mux-hsdk.yaml
Normal file
17
dts/bindings/pinctrl/snps,creg-gpio-mux-hsdk.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# Copyright (c) 2021, Linaro Limited
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
description: |
|
||||||
|
Synopsys CREG HSDK GPIO pin mux
|
||||||
|
|
||||||
|
compatible: "snps,creg-gpio-mux-hsdk"
|
||||||
|
|
||||||
|
include: base.yaml
|
||||||
|
|
||||||
|
properties:
|
||||||
|
reg:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
pinmux-cells:
|
||||||
|
- pin
|
||||||
|
- function
|
|
@ -22,10 +22,6 @@
|
||||||
#define IRQ_TIMER1 17
|
#define IRQ_TIMER1 17
|
||||||
#define IRQ_ICI 19
|
#define IRQ_ICI 19
|
||||||
|
|
||||||
#define BASE_ADDR_SYSCONFIG 0xF0000000
|
|
||||||
|
|
||||||
#define CREG_GPIO_MUX_BASE_ADDR (BASE_ADDR_SYSCONFIG + 0x1484)
|
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue