Zephyr Project API
3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mchp-xec-pinctrl.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Microchip Technology Inc.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_MCHP_XEC_PINCTRL_H_
8
#define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_MCHP_XEC_PINCTRL_H_
9
10
#include <
zephyr/dt-bindings/dt-util.h
>
11
12
#define MCHP_GPIO 0x0
13
#define MCHP_AF0 0x0
14
#define MCHP_AF1 0x1
15
#define MCHP_AF2 0x2
16
#define MCHP_AF3 0x3
17
#define MCHP_AF4 0x4
18
#define MCHP_AF5 0x5
19
#define MCHP_AF6 0x6
20
#define MCHP_AF7 0x7
21
#define MCHP_AFMAX 0x8
22
23
#define MCHP_XEC_NO_PUD_POS 12
24
#define MCHP_XEC_PD_POS 13
25
#define MCHP_XEC_PU_POS 14
26
#define MCHP_XEC_PUSH_PULL_POS 15
27
#define MCHP_XEC_OPEN_DRAIN_POS 16
28
#define MCHP_XEC_OUT_DIS_POS 17
29
#define MCHP_XEC_OUT_EN_POS 18
30
#define MCHP_XEC_OUT_HI_POS 19
31
#define MCHP_XEC_OUT_LO_POS 20
32
/* bit[21] unused */
33
#define MCHP_XEC_SLEW_RATE_POS 22
34
#define MCHP_XEC_SLEW_RATE_MSK0 0x3
35
#define MCHP_XEC_SLEW_RATE_SLOW0 0x1
36
#define MCHP_XEC_SLEW_RATE_FAST0 0x2
37
#define MCHP_XEC_DRV_STR_POS 24
38
#define MCHP_XEC_DRV_STR_MSK0 0x7
39
#define MCHP_XEC_DRV_STR0_1X 0x1
/* 2 or 4(PIO-24) mA */
40
#define MCHP_XEC_DRV_STR0_2X 0x2
/* 4 or 8(PIO-24) mA */
41
#define MCHP_XEC_DRV_STR0_4X 0x3
/* 8 or 16(PIO-24) mA */
42
#define MCHP_XEC_DRV_STR0_6X 0x4
/* 12 or 24(PIO-24) mA */
43
#define MCHP_XEC_PIN_LOW_POWER_POS 27
44
#define MCHP_XEC_FUNC_INV_POS 29
45
46
#define MCHP_XEC_PINMUX_PORT_POS 0
47
#define MCHP_XEC_PINMUX_PORT_MSK 0xf
48
#define MCHP_XEC_PINMUX_PIN_POS 4
49
#define MCHP_XEC_PINMUX_PIN_MSK 0x1f
50
#define MCHP_XEC_PINMUX_FUNC_POS 9
51
#define MCHP_XEC_PINMUX_FUNC_MSK 0x7
52
53
/* n is octal pin number or equivalent in another base.
54
* MCHP XEC documentation specifies pin numbers in octal.
55
* f is function number
56
* b[3:0] = pin bank
57
* b[8:4] = pin position in bank
58
* b[11:9] = function
59
*/
60
#define MCHP_XEC_PINMUX(n, f) \
61
(((((n) >> 5) & MCHP_XEC_PINMUX_PORT_MSK) << MCHP_XEC_PINMUX_PORT_POS) | \
62
(((n) & MCHP_XEC_PINMUX_PIN_MSK) << MCHP_XEC_PINMUX_PIN_POS) | \
63
(((f) & MCHP_XEC_PINMUX_FUNC_MSK) << MCHP_XEC_PINMUX_FUNC_POS))
64
65
66
#define MCHP_XEC_PINMUX_PORT(p) \
67
(((p) >> MCHP_XEC_PINMUX_PORT_POS) & MCHP_XEC_PINMUX_PORT_MSK)
68
69
#define MCHP_XEC_PINMUX_PIN(p) \
70
(((p) >> MCHP_XEC_PINMUX_PIN_POS) & MCHP_XEC_PINMUX_PIN_MSK)
71
72
#define MCHP_XEC_PINMUX_FUNC(p) \
73
(((p) >> MCHP_XEC_PINMUX_FUNC_POS) & MCHP_XEC_PINMUX_FUNC_MSK)
74
75
#define MEC_XEC_PINMUX_PORT_PIN(p) \
76
((p) & ((MCHP_XEC_PINMUX_PORT_MSK << MCHP_XEC_PINMUX_PORT_POS) | \
77
(MCHP_XEC_PINMUX_PIN_MSK << MCHP_XEC_PINMUX_PIN_POS)))
78
79
#endif
/* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_MCHP_XEC_PINCTRL_H_ */
dt-util.h
include
zephyr
dt-bindings
pinctrl
mchp-xec-pinctrl.h
Generated on Sun Sep 15 2024 17:01:30 for Zephyr Project API by
1.9.8