18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This header provides constants for pinctrl bindings for TI's K3 SoC
48c2ecf20Sopenharmony_ci * family.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef _DT_BINDINGS_PINCTRL_TI_K3_H
98c2ecf20Sopenharmony_ci#define _DT_BINDINGS_PINCTRL_TI_K3_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define PULLUDEN_SHIFT		(16)
128c2ecf20Sopenharmony_ci#define PULLTYPESEL_SHIFT	(17)
138c2ecf20Sopenharmony_ci#define RXACTIVE_SHIFT		(18)
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define PULL_DISABLE		(1 << PULLUDEN_SHIFT)
168c2ecf20Sopenharmony_ci#define PULL_ENABLE		(0 << PULLUDEN_SHIFT)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define PULL_UP			(1 << PULLTYPESEL_SHIFT | PULL_ENABLE)
198c2ecf20Sopenharmony_ci#define PULL_DOWN		(0 << PULLTYPESEL_SHIFT | PULL_ENABLE)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define INPUT_EN		(1 << RXACTIVE_SHIFT)
228c2ecf20Sopenharmony_ci#define INPUT_DISABLE		(0 << RXACTIVE_SHIFT)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* Only these macros are expected be used directly in device tree files */
258c2ecf20Sopenharmony_ci#define PIN_OUTPUT		(INPUT_DISABLE | PULL_DISABLE)
268c2ecf20Sopenharmony_ci#define PIN_OUTPUT_PULLUP	(INPUT_DISABLE | PULL_UP)
278c2ecf20Sopenharmony_ci#define PIN_OUTPUT_PULLDOWN	(INPUT_DISABLE | PULL_DOWN)
288c2ecf20Sopenharmony_ci#define PIN_INPUT		(INPUT_EN | PULL_DISABLE)
298c2ecf20Sopenharmony_ci#define PIN_INPUT_PULLUP	(INPUT_EN | PULL_UP)
308c2ecf20Sopenharmony_ci#define PIN_INPUT_PULLDOWN	(INPUT_EN | PULL_DOWN)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define AM65X_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
338c2ecf20Sopenharmony_ci#define AM65X_WKUP_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define J721E_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
368c2ecf20Sopenharmony_ci#define J721E_WKUP_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#endif
39