162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * This header provides constants for pinctrl bindings for TI's K3 SoC 462306a36Sopenharmony_ci * family. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (C) 2018-2023 Texas Instruments Incorporated - https://www.ti.com/ 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci#ifndef DTS_ARM64_TI_K3_PINCTRL_H 962306a36Sopenharmony_ci#define DTS_ARM64_TI_K3_PINCTRL_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#define PULLUDEN_SHIFT (16) 1262306a36Sopenharmony_ci#define PULLTYPESEL_SHIFT (17) 1362306a36Sopenharmony_ci#define RXACTIVE_SHIFT (18) 1462306a36Sopenharmony_ci#define DEBOUNCE_SHIFT (11) 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#define PULL_DISABLE (1 << PULLUDEN_SHIFT) 1762306a36Sopenharmony_ci#define PULL_ENABLE (0 << PULLUDEN_SHIFT) 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define PULL_UP (1 << PULLTYPESEL_SHIFT | PULL_ENABLE) 2062306a36Sopenharmony_ci#define PULL_DOWN (0 << PULLTYPESEL_SHIFT | PULL_ENABLE) 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#define INPUT_EN (1 << RXACTIVE_SHIFT) 2362306a36Sopenharmony_ci#define INPUT_DISABLE (0 << RXACTIVE_SHIFT) 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* Only these macros are expected be used directly in device tree files */ 2662306a36Sopenharmony_ci#define PIN_OUTPUT (INPUT_DISABLE | PULL_DISABLE) 2762306a36Sopenharmony_ci#define PIN_OUTPUT_PULLUP (INPUT_DISABLE | PULL_UP) 2862306a36Sopenharmony_ci#define PIN_OUTPUT_PULLDOWN (INPUT_DISABLE | PULL_DOWN) 2962306a36Sopenharmony_ci#define PIN_INPUT (INPUT_EN | PULL_DISABLE) 3062306a36Sopenharmony_ci#define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP) 3162306a36Sopenharmony_ci#define PIN_INPUT_PULLDOWN (INPUT_EN | PULL_DOWN) 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define PIN_DEBOUNCE_DISABLE (0 << DEBOUNCE_SHIFT) 3462306a36Sopenharmony_ci#define PIN_DEBOUNCE_CONF1 (1 << DEBOUNCE_SHIFT) 3562306a36Sopenharmony_ci#define PIN_DEBOUNCE_CONF2 (2 << DEBOUNCE_SHIFT) 3662306a36Sopenharmony_ci#define PIN_DEBOUNCE_CONF3 (3 << DEBOUNCE_SHIFT) 3762306a36Sopenharmony_ci#define PIN_DEBOUNCE_CONF4 (4 << DEBOUNCE_SHIFT) 3862306a36Sopenharmony_ci#define PIN_DEBOUNCE_CONF5 (5 << DEBOUNCE_SHIFT) 3962306a36Sopenharmony_ci#define PIN_DEBOUNCE_CONF6 (6 << DEBOUNCE_SHIFT) 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci#define AM62AX_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 4262306a36Sopenharmony_ci#define AM62AX_MCU_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define AM62PX_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 4562306a36Sopenharmony_ci#define AM62PX_MCU_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci#define AM62X_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 4862306a36Sopenharmony_ci#define AM62X_MCU_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define AM64X_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 5162306a36Sopenharmony_ci#define AM64X_MCU_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define AM65X_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 5462306a36Sopenharmony_ci#define AM65X_WKUP_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define J721E_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 5762306a36Sopenharmony_ci#define J721E_WKUP_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define J721S2_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 6062306a36Sopenharmony_ci#define J721S2_WKUP_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define J784S4_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 6362306a36Sopenharmony_ci#define J784S4_WKUP_IOPAD(pa, val, muxmode) (((pa) & 0x1fff)) ((val) | (muxmode)) 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#endif 66