2 * Pinctrl driver for the Wondermedia SoC's
4 * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 #include <linux/gpio.h>
18 /* VT8500 has no enable register in the extgpio bank. */
21 #define WMT_PINCTRL_BANK(__en, __dir, __dout, __din, __pen, __pcfg) \
25 .reg_data_out = __dout, \
26 .reg_data_in = __din, \
27 .reg_pull_en = __pen, \
28 .reg_pull_cfg = __pcfg, \
31 /* Encode/decode the bank/bit pairs into a pin value */
32 #define WMT_PIN(__bank, __offset) ((__bank << 5) | __offset)
33 #define WMT_BANK_FROM_PIN(__pin) (__pin >> 5)
34 #define WMT_BIT_FROM_PIN(__pin) (__pin & 0x1f)
36 #define WMT_GROUP(__name, __data) \
40 .npins = ARRAY_SIZE(__data), \
43 struct wmt_pinctrl_bank_registers
{
53 struct wmt_pinctrl_group
{
55 const unsigned int *pins
;
59 struct wmt_pinctrl_data
{
61 struct pinctrl_dev
*pctl_dev
;
63 /* must be initialized before calling wmt_pinctrl_probe */
65 const struct wmt_pinctrl_bank_registers
*banks
;
66 const struct pinctrl_pin_desc
*pins
;
67 const char * const *groups
;
73 struct gpio_chip gpio_chip
;
74 struct pinctrl_gpio_range gpio_range
;
77 int wmt_pinctrl_probe(struct platform_device
*pdev
,
78 struct wmt_pinctrl_data
*data
);
79 int wmt_pinctrl_remove(struct platform_device
*pdev
);