linux-stable/drivers/pinctrl/vt8500/pinctrl-wmt.h
Thomas Gleixner 2025cf9e19 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms and conditions of the gnu general public license
  version 2 as published by the free software foundation this program
  is distributed in the hope it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 263 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:36:37 +02:00

70 lines
1.5 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Pinctrl driver for the Wondermedia SoC's
*
* Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz>
*/
#include <linux/gpio/driver.h>
/* VT8500 has no enable register in the extgpio bank. */
#define NO_REG 0xFFFF
#define WMT_PINCTRL_BANK(__en, __dir, __dout, __din, __pen, __pcfg) \
{ \
.reg_en = __en, \
.reg_dir = __dir, \
.reg_data_out = __dout, \
.reg_data_in = __din, \
.reg_pull_en = __pen, \
.reg_pull_cfg = __pcfg, \
}
/* Encode/decode the bank/bit pairs into a pin value */
#define WMT_PIN(__bank, __offset) ((__bank << 5) | __offset)
#define WMT_BANK_FROM_PIN(__pin) (__pin >> 5)
#define WMT_BIT_FROM_PIN(__pin) (__pin & 0x1f)
#define WMT_GROUP(__name, __data) \
{ \
.name = __name, \
.pins = __data, \
.npins = ARRAY_SIZE(__data), \
}
struct wmt_pinctrl_bank_registers {
u32 reg_en;
u32 reg_dir;
u32 reg_data_out;
u32 reg_data_in;
u32 reg_pull_en;
u32 reg_pull_cfg;
};
struct wmt_pinctrl_group {
const char *name;
const unsigned int *pins;
const unsigned npins;
};
struct wmt_pinctrl_data {
struct device *dev;
struct pinctrl_dev *pctl_dev;
/* must be initialized before calling wmt_pinctrl_probe */
void __iomem *base;
const struct wmt_pinctrl_bank_registers *banks;
const struct pinctrl_pin_desc *pins;
const char * const *groups;
u32 nbanks;
u32 npins;
u32 ngroups;
struct gpio_chip gpio_chip;
struct pinctrl_gpio_range gpio_range;
};
int wmt_pinctrl_probe(struct platform_device *pdev,
struct wmt_pinctrl_data *data);