93 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Intel Tangier pinctrl functions4 *5 * Copyright (C) 2016, 2023 Intel Corporation6 *7 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>8 * Raag Jadav <raag.jadav@intel.com>9 */10 11#ifndef PINCTRL_TANGIER_H12#define PINCTRL_TANGIER_H13 14#include <linux/spinlock_types.h>15#include <linux/types.h>16 17#include <linux/pinctrl/pinctrl.h>18 19#include "pinctrl-intel.h"20 21struct device;22struct platform_device;23 24#define TNG_FAMILY_NR 6425#define TNG_FAMILY_LEN 0x40026 27/**28 * struct tng_family - Tangier pin family description29 * @barno: MMIO BAR number where registers for this family reside30 * @pin_base: Starting pin of pins in this family31 * @npins: Number of pins in this family32 * @protected: True if family is protected by access33 * @regs: Family specific common registers34 */35struct tng_family {36 unsigned int barno;37 unsigned int pin_base;38 size_t npins;39 bool protected;40 void __iomem *regs;41};42 43#define TNG_FAMILY(b, s, e) \44 { \45 .barno = (b), \46 .pin_base = (s), \47 .npins = (e) - (s) + 1, \48 }49 50#define TNG_FAMILY_PROTECTED(b, s, e) \51 { \52 .barno = (b), \53 .pin_base = (s), \54 .npins = (e) - (s) + 1, \55 .protected = true, \56 }57 58/**59 * struct tng_pinctrl - Tangier pinctrl private structure60 * @dev: Pointer to the device structure61 * @lock: Lock to serialize register access62 * @pctldesc: Pin controller description63 * @pctldev: Pointer to the pin controller device64 * @families: Array of families this pinctrl handles65 * @nfamilies: Number of families in the array66 * @functions: Array of functions67 * @nfunctions: Number of functions in the array68 * @groups: Array of pin groups69 * @ngroups: Number of groups in the array70 * @pins: Array of pins this pinctrl controls71 * @npins: Number of pins in the array72 */73struct tng_pinctrl {74 struct device *dev;75 raw_spinlock_t lock;76 struct pinctrl_desc pctldesc;77 struct pinctrl_dev *pctldev;78 79 /* Pin controller configuration */80 const struct tng_family *families;81 size_t nfamilies;82 const struct intel_function *functions;83 size_t nfunctions;84 const struct intel_pingroup *groups;85 size_t ngroups;86 const struct pinctrl_pin_desc *pins;87 size_t npins;88};89 90int devm_tng_pinctrl_probe(struct platform_device *pdev);91 92#endif /* PINCTRL_TANGIER_H */93