2 * Driver header file for pin controller driver
3 * Copyright (C) 2017 Spreadtrum - http://www.spreadtrum.com
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
15 #ifndef __PINCTRL_SPRD_H__
16 #define __PINCTRL_SPRD_H__
18 struct platform_device
;
20 #define NUM_OFFSET (20)
21 #define TYPE_OFFSET (16)
22 #define BIT_OFFSET (8)
23 #define WIDTH_OFFSET (4)
25 #define SPRD_PIN_INFO(num, type, offset, width, reg) \
26 (((num) & 0xFFF) << NUM_OFFSET | \
27 ((type) & 0xF) << TYPE_OFFSET | \
28 ((offset) & 0xFF) << BIT_OFFSET | \
29 ((width) & 0xF) << WIDTH_OFFSET | \
32 #define SPRD_PINCTRL_PIN(pin) SPRD_PINCTRL_PIN_DATA(pin, #pin)
34 #define SPRD_PINCTRL_PIN_DATA(a, b) \
37 .num = (((a) >> NUM_OFFSET) & 0xfff), \
38 .type = (((a) >> TYPE_OFFSET) & 0xf), \
39 .bit_offset = (((a) >> BIT_OFFSET) & 0xff), \
40 .bit_width = ((a) >> WIDTH_OFFSET & 0xf), \
50 struct sprd_pins_info
{
55 /* for global control pins configuration */
56 unsigned long bit_offset
;
57 unsigned long bit_width
;
61 int sprd_pinctrl_core_probe(struct platform_device
*pdev
,
62 struct sprd_pins_info
*sprd_soc_pin_info
,
64 int sprd_pinctrl_remove(struct platform_device
*pdev
);
65 void sprd_pinctrl_shutdown(struct platform_device
*pdev
);
67 #endif /* __PINCTRL_SPRD_H__ */