Commit f805e356 authored by Jacky Huang's avatar Jacky Huang Committed by Linus Walleij
Browse files

pinctrl: nuvoton: Add ma35d1 pinctrl and GPIO driver



Add common pinctrl and GPIO driver for Nuvoton MA35 series SoC, and
add support for ma35d1 pinctrl.

Signed-off-by: default avatarJacky Huang <ychuang3@nuvoton.com>
Link: https://lore.kernel.org/r/20240521012447.42211-4-ychuang570808@gmail.com


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 63f1f9da
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -45,3 +45,22 @@ config PINCTRL_NPCM8XX
	  Say Y or M here to enable pin controller and GPIO support for
	  the Nuvoton NPCM8XX SoC. This is strongly recommended when
	  building a kernel that will run on this chip.

config PINCTRL_MA35
	bool
	depends on (ARCH_MA35 || COMPILE_TEST) && OF
	select GENERIC_PINCTRL_GROUPS
	select GENERIC_PINMUX_FUNCTIONS
	select GENERIC_PINCONF
	select GPIOLIB
	select GPIO_GENERIC
	select GPIOLIB_IRQCHIP
	select MFD_SYSCON

config PINCTRL_MA35D1
	bool "Pinctrl and GPIO driver for Nuvoton MA35D1"
	depends on (ARCH_MA35 || COMPILE_TEST) && OF
	select PINCTRL_MA35
	help
	  Say Y here to enable pin controller and GPIO support
	  for Nuvoton MA35D1 SoC.
+2 −0
Original line number Diff line number Diff line
@@ -4,3 +4,5 @@
obj-$(CONFIG_PINCTRL_WPCM450)	+= pinctrl-wpcm450.o
obj-$(CONFIG_PINCTRL_NPCM7XX)	+= pinctrl-npcm7xx.o
obj-$(CONFIG_PINCTRL_NPCM8XX)	+= pinctrl-npcm8xx.o
obj-$(CONFIG_PINCTRL_MA35)	+= pinctrl-ma35.o
obj-$(CONFIG_PINCTRL_MA35D1)	+= pinctrl-ma35d1.o
+1187 −0

File added.

Preview size limit exceeded, changes collapsed.

+52 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2024 Nuvoton Technology Corp.
 *
 * Author: Shan-Chun Hung <schung@nuvoton.com>
 * *       Jacky Huang <ychuang3@nuvoton.com>
 */
#ifndef __PINCTRL_MA35_H
#define __PINCTRL_MA35_H

#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/platform_device.h>

struct ma35_mux_desc {
	const char *name;
	u32 muxval;
};

struct ma35_pin_data {
	u32 offset;
	u32 shift;
	struct ma35_mux_desc *muxes;
};

struct ma35_pinctrl_soc_info {
	const struct pinctrl_pin_desc *pins;
	unsigned int npins;
	int (*get_pin_num)(int offset, int shift);
};

#define MA35_PIN(num, n, o, s, ...) {			\
	.number = num,					\
	.name = #n,					\
	.drv_data = &(struct ma35_pin_data) {		\
		.offset = o,				\
		.shift = s,				\
		.muxes = (struct ma35_mux_desc[]) {	\
			 __VA_ARGS__, { } },		\
	},						\
}

#define MA35_MUX(_val, _name) {				\
	.name = _name,					\
	.muxval = _val,					\
}

int ma35_pinctrl_probe(struct platform_device *pdev, const struct ma35_pinctrl_soc_info *info);
int ma35_pinctrl_suspend(struct device *dev);
int ma35_pinctrl_resume(struct device *dev);

#endif /* __PINCTRL_MA35_H */
+1799 −0

File added.

Preview size limit exceeded, changes collapsed.