162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Sunplus dt-bindings Pinctrl header file
462306a36Sopenharmony_ci * Copyright (C) Sunplus Tech / Tibbo Tech.
562306a36Sopenharmony_ci * Author: Dvorkin Dmitry <dvorkin@tibbo.com>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __DT_BINDINGS_PINCTRL_SPPCTL_H__
962306a36Sopenharmony_ci#define __DT_BINDINGS_PINCTRL_SPPCTL_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define IOP_G_MASTE		(0x01 << 0)
1262306a36Sopenharmony_ci#define IOP_G_FIRST		(0x01 << 1)
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define SPPCTL_PCTL_G_PMUX	(0x00        | IOP_G_MASTE)
1562306a36Sopenharmony_ci#define SPPCTL_PCTL_G_GPIO	(IOP_G_FIRST | IOP_G_MASTE)
1662306a36Sopenharmony_ci#define SPPCTL_PCTL_G_IOPP	(IOP_G_FIRST | 0x00)
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define SPPCTL_PCTL_L_OUT	(0x01 << 0)	/* Output LOW        */
1962306a36Sopenharmony_ci#define SPPCTL_PCTL_L_OU1	(0x01 << 1)	/* Output HIGH       */
2062306a36Sopenharmony_ci#define SPPCTL_PCTL_L_INV	(0x01 << 2)	/* Input Invert      */
2162306a36Sopenharmony_ci#define SPPCTL_PCTL_L_ONV	(0x01 << 3)	/* Output Invert     */
2262306a36Sopenharmony_ci#define SPPCTL_PCTL_L_ODR	(0x01 << 4)	/* Output Open Drain */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/*
2562306a36Sopenharmony_ci * pack into 32-bit value:
2662306a36Sopenharmony_ci * pin# (8bit), typ (8bit), function (8bit), flag (8bit)
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_ci#define SPPCTL_IOPAD(pin, typ, fun, flg)	(((pin) << 24) | ((typ) << 16) | \
2962306a36Sopenharmony_ci						((fun) << 8) | (flg))
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#endif
32