Skip to content

Commit

Permalink
pinctrl: add NXP S32 SoC family support
Browse files Browse the repository at this point in the history
Add the pinctrl driver for NXP S32G SoC family. This driver is mainly based
on NXP's downstream implementation on CodeAurora[1].

[1] https://source.codeaurora.org/external/autobsps32/linux/tree/drivers/pinctrl/freescale?h=bsp34.0-5.10.120-rt

Signed-off-by: Matthew Nunez <matthew.nunez@nxp.com>
Signed-off-by: Phu Luu An <phu.luuan@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@nxp.com>
Signed-off-by: Andrei Stefanescu <andrei.stefanescu@nxp.com>
Signed-off-by: Radu Pirea <radu-nicolae.pirea@nxp.com>
Signed-off-by: Chester Lin <clin@suse.com>
  • Loading branch information
chesterlintw committed Oct 19, 2022
1 parent e20dbff commit de5d8ed
Show file tree
Hide file tree
Showing 5 changed files with 1,902 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/pinctrl/freescale/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,19 @@ config PINCTRL_IMXRT1170
select PINCTRL_IMX
help
Say Y here to enable the imxrt1170 pinctrl driver

config PINCTRL_S32CC
bool "NXP S32 Common Chassis pinctrl driver core"
depends on ARCH_S32 && OF
select GENERIC_PINCTRL_GROUPS
select GENERIC_PINMUX_FUNCTIONS
select GENERIC_PINCONF
help
Say Y here to enable the NXP S32CC pinctrl driver core

config PINCTRL_S32G
depends on ARCH_S32 && OF
bool "NXP S32G pinctrl driver"
select PINCTRL_S32CC
help
Say Y here to enable the pinctrl driver for NXP 32G family SoCs
2 changes: 2 additions & 0 deletions drivers/pinctrl/freescale/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o
obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o
obj-$(CONFIG_PINCTRL_IMXRT1050) += pinctrl-imxrt1050.o
obj-$(CONFIG_PINCTRL_IMXRT1170) += pinctrl-imxrt1170.o
obj-$(CONFIG_PINCTRL_S32CC) += pinctrl-s32cc.o
obj-$(CONFIG_PINCTRL_S32G) += pinctrl-s32g.o
65 changes: 65 additions & 0 deletions drivers/pinctrl/freescale/pinctrl-s32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
*
* S32 pinmux core definitions
*
* Copyright 2016-2020,2022 NXP
* Copyright (C) 2012 Linaro Ltd.
*/

#ifndef __DRIVERS_PINCTRL_S32_H
#define __DRIVERS_PINCTRL_S32_H

struct platform_device;

/**
* struct s32_pin_group - describes an S32 pin group
* @name: the name of this specific pin group
* @npins: the number of pins in this group array, i.e. the number of
* elements in .pins so we can iterate over that array
* @pin_ids: an array of pin_ids in this group.
* @@pin_sss: an array of source signal select configs paired with pin_ids.
*/
struct s32_pin_group {
const char *name;
unsigned int npins;
unsigned int *pin_ids;
unsigned int *pin_sss;
};

/**
* struct s32_pmx_func - describes S32 pinmux functions
* @name: the name of this specific function
* @groups: corresponding pin groups
* @num_groups: the number of groups
*/
struct s32_pmx_func {
const char *name;
const char **groups;
unsigned int num_groups;
};


struct s32_pinctrl_soc_info {
struct device *dev;
const struct pinctrl_pin_desc *pins;
unsigned int npins;
struct s32_pin_group *groups;
unsigned int ngroups;
struct s32_pmx_func *functions;
unsigned int nfunctions;
unsigned int grp_index;
unsigned int mem_regions;
};

#define S32_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
#define S32_MSCR_OFFSET (0x240)
#define S32_PAD_CONFIG(idx) ((idx) * 4)

int s32_pinctrl_probe(struct platform_device *pdev,
struct s32_pinctrl_soc_info *info);
int s32_pinctrl_remove(struct platform_device *pdev);
#ifdef CONFIG_PM_SLEEP
int s32_pinctrl_resume(struct device *dev);
int s32_pinctrl_suspend(struct device *dev);
#endif
#endif /* __DRIVERS_PINCTRL_S32_H */
Loading

0 comments on commit de5d8ed

Please sign in to comment.