linux/drivers/pinctrl/pinctrl-at91-pio4.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for the Atmel PIO4 controller
 *
 * Copyright (C) 2015 Atmel,
 *               2015 Ludovic Desroches <[email protected]>
 */

#include <dt-bindings/pinctrl/at91.h>

#include <linux/clk.h>
#include <linux/gpio/driver.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/seq_file.h>
#include <linux/slab.h>

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

#include "core.h"
#include "pinconf.h"
#include "pinctrl-utils.h"

/*
 * Warning:
 * In order to not introduce confusion between Atmel PIO groups and pinctrl
 * framework groups, Atmel PIO groups will be called banks, line is kept to
 * designed the pin id into this bank.
 */

#define ATMEL_PIO_MSKR
#define ATMEL_PIO_CFGR
#define ATMEL_PIO_CFGR_FUNC_MASK
#define ATMEL_PIO_DIR_MASK
#define ATMEL_PIO_PUEN_MASK
#define ATMEL_PIO_PDEN_MASK
#define ATMEL_PIO_SR_MASK
#define ATMEL_PIO_IFEN_MASK
#define ATMEL_PIO_IFSCEN_MASK
#define ATMEL_PIO_OPD_MASK
#define ATMEL_PIO_SCHMITT_MASK
#define ATMEL_PIO_DRVSTR_MASK
#define ATMEL_PIO_DRVSTR_OFFSET
#define ATMEL_PIO_CFGR_EVTSEL_MASK
#define ATMEL_PIO_CFGR_EVTSEL_FALLING
#define ATMEL_PIO_CFGR_EVTSEL_RISING
#define ATMEL_PIO_CFGR_EVTSEL_BOTH
#define ATMEL_PIO_CFGR_EVTSEL_LOW
#define ATMEL_PIO_CFGR_EVTSEL_HIGH
#define ATMEL_PIO_PDSR
#define ATMEL_PIO_LOCKSR
#define ATMEL_PIO_SODR
#define ATMEL_PIO_CODR
#define ATMEL_PIO_ODSR
#define ATMEL_PIO_IER
#define ATMEL_PIO_IDR
#define ATMEL_PIO_IMR
#define ATMEL_PIO_ISR
#define ATMEL_PIO_IOFR

#define ATMEL_PIO_NPINS_PER_BANK
#define ATMEL_PIO_BANK(pin_id)
#define ATMEL_PIO_LINE(pin_id)
#define ATMEL_PIO_BANK_OFFSET

#define ATMEL_GET_PIN_NO(pinfunc)
#define ATMEL_GET_PIN_FUNC(pinfunc)
#define ATMEL_GET_PIN_IOSET(pinfunc)

/* Custom pinconf parameters */
#define ATMEL_PIN_CONFIG_DRIVE_STRENGTH

/**
 * struct atmel_pioctrl_data - Atmel PIO controller (pinmux + gpio) data struct
 * @nbanks: number of PIO banks
 * @last_bank_count: number of lines in the last bank (can be less than
 *	the rest of the banks).
 * @slew_rate_support: slew rate support
 */
struct atmel_pioctrl_data {};

struct atmel_group {};

struct atmel_pin {};

/**
 * struct atmel_pioctrl - Atmel PIO controller (pinmux + gpio)
 * @reg_base: base address of the controller.
 * @clk: clock of the controller.
 * @nbanks: number of PIO groups, it can vary depending on the SoC.
 * @pinctrl_dev: pinctrl device registered.
 * @groups: groups table to provide group name and pin in the group to pinctrl.
 * @group_names: group names table to provide all the group/pin names to
 *     pinctrl or gpio.
 * @pins: pins table used for both pinctrl and gpio. pin_id, bank and line
 *     fields are set at probe time. Other ones are set when parsing dt
 *     pinctrl.
 * @npins: number of pins.
 * @gpio_chip: gpio chip registered.
 * @irq_domain: irq domain for the gpio controller.
 * @irqs: table containing the hw irq number of the bank. The index of the
 *     table is the bank id.
 * @pm_wakeup_sources: bitmap of wakeup sources (lines)
 * @pm_suspend_backup: backup/restore register values on suspend/resume
 * @dev: device entry for the Atmel PIO controller.
 * @node: node of the Atmel PIO controller.
 * @slew_rate_support: slew rate support
 */
struct atmel_pioctrl {};

static const char * const atmel_functions[] =;

static const struct pinconf_generic_params atmel_custom_bindings[] =;

/* --- GPIO --- */
static unsigned int atmel_gpio_read(struct atmel_pioctrl *atmel_pioctrl,
				    unsigned int bank, unsigned int reg)
{}

static void atmel_gpio_write(struct atmel_pioctrl *atmel_pioctrl,
			     unsigned int bank, unsigned int reg,
			     unsigned int val)
{}

static void atmel_gpio_irq_ack(struct irq_data *d)
{}

static int atmel_gpio_irq_set_type(struct irq_data *d, unsigned int type)
{}

static void atmel_gpio_irq_mask(struct irq_data *d)
{}

static void atmel_gpio_irq_unmask(struct irq_data *d)
{}

static int atmel_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
{}

static struct irq_chip atmel_gpio_irq_chip =;

static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
{}

static void atmel_gpio_irq_handler(struct irq_desc *desc)
{}

static int atmel_gpio_direction_input(struct gpio_chip *chip,
				      unsigned int offset)
{}

static int atmel_gpio_get(struct gpio_chip *chip, unsigned int offset)
{}

static int atmel_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask,
				   unsigned long *bits)
{}

static int atmel_gpio_direction_output(struct gpio_chip *chip,
				       unsigned int offset,
				       int value)
{}

static void atmel_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
{}

static void atmel_gpio_set_multiple(struct gpio_chip *chip, unsigned long *mask,
				    unsigned long *bits)
{}

static struct gpio_chip atmel_gpio_chip =;

/* --- PINCTRL --- */
static unsigned int atmel_pin_config_read(struct pinctrl_dev *pctldev,
					  unsigned int pin_id)
{}

static void atmel_pin_config_write(struct pinctrl_dev *pctldev,
				   unsigned int pin_id, u32 conf)
{}

static int atmel_pctl_get_groups_count(struct pinctrl_dev *pctldev)
{}

static const char *atmel_pctl_get_group_name(struct pinctrl_dev *pctldev,
					     unsigned int selector)
{}

static int atmel_pctl_get_group_pins(struct pinctrl_dev *pctldev,
				     unsigned int selector,
				     const unsigned int **pins,
				     unsigned int *num_pins)
{}

static struct atmel_group *
atmel_pctl_find_group_by_pin(struct pinctrl_dev *pctldev, unsigned int pin)
{}

static int atmel_pctl_xlate_pinfunc(struct pinctrl_dev *pctldev,
				    struct device_node *np,
				    u32 pinfunc, const char **grp_name,
				    const char **func_name)
{}

static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
					struct device_node *np,
					struct pinctrl_map **map,
					unsigned int *reserved_maps,
					unsigned int *num_maps)
{}

static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
				     struct device_node *np_config,
				     struct pinctrl_map **map,
				     unsigned int *num_maps)
{}

static const struct pinctrl_ops atmel_pctlops =;

static int atmel_pmx_get_functions_count(struct pinctrl_dev *pctldev)
{}

static const char *atmel_pmx_get_function_name(struct pinctrl_dev *pctldev,
					       unsigned int selector)
{}

static int atmel_pmx_get_function_groups(struct pinctrl_dev *pctldev,
					 unsigned int selector,
					 const char * const **groups,
					 unsigned * const num_groups)
{}

static int atmel_pmx_set_mux(struct pinctrl_dev *pctldev,
			     unsigned int function,
			     unsigned int group)
{}

static const struct pinmux_ops atmel_pmxops =;

static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
					   unsigned int group,
					   unsigned long *config)
{}

static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
					   unsigned int group,
					   unsigned long *configs,
					   unsigned int num_configs)
{}

static int atmel_conf_pin_config_set(struct pinctrl_dev *pctldev,
				     unsigned pin,
				     unsigned long *configs,
				     unsigned num_configs)
{}

static int atmel_conf_pin_config_get(struct pinctrl_dev *pctldev,
				     unsigned pin,
				     unsigned long *configs)
{}

static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
					   struct seq_file *s,
					   unsigned int pin_id)
{}

static const struct pinconf_ops atmel_confops =;

static struct pinctrl_desc atmel_pinctrl_desc =;

static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
{}

static int __maybe_unused atmel_pctrl_resume(struct device *dev)
{}

static const struct dev_pm_ops atmel_pctrl_pm_ops =;

/*
 * The number of banks can be different from a SoC to another one.
 * We can have up to 16 banks.
 */
static const struct atmel_pioctrl_data atmel_sama5d2_pioctrl_data =;

static const struct atmel_pioctrl_data microchip_sama7g5_pioctrl_data =;

static const struct of_device_id atmel_pctrl_of_match[] =;

/*
 * This lock class allows to tell lockdep that parent IRQ and children IRQ do
 * not share the same class so it does not raise false positive
 */
static struct lock_class_key atmel_lock_key;
static struct lock_class_key atmel_request_key;

static int atmel_pinctrl_probe(struct platform_device *pdev)
{}

static struct platform_driver atmel_pinctrl_driver =;
builtin_platform_driver();