18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * arch/arm/plat-orion/include/plat/mpp.h
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Marvell Orion SoC MPP handling.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This file is licensed under the terms of the GNU General Public
78c2ecf20Sopenharmony_ci * License version 2.  This program is licensed "as is" without any
88c2ecf20Sopenharmony_ci * warranty of any kind, whether express or implied.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef __PLAT_MPP_H
128c2ecf20Sopenharmony_ci#define __PLAT_MPP_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define MPP_NUM(x)	((x) & 0xff)
158c2ecf20Sopenharmony_ci#define MPP_SEL(x)	(((x) >> 8) & 0xf)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* This is the generic MPP macro, without any variant information.
188c2ecf20Sopenharmony_ci   Each machine architecture is expected to extend this with further
198c2ecf20Sopenharmony_ci   bit fields indicating which MPP configurations are valid for a
208c2ecf20Sopenharmony_ci   specific variant. */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define GENERIC_MPP(_num, _sel, _in, _out) ( \
238c2ecf20Sopenharmony_ci	/* MPP number */		((_num) & 0xff) | \
248c2ecf20Sopenharmony_ci	/* MPP select value */		(((_sel) & 0xf) << 8) | \
258c2ecf20Sopenharmony_ci	/* may be input signal */	((!!(_in)) << 12) | \
268c2ecf20Sopenharmony_ci	/* may be output signal */	((!!(_out)) << 13))
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define MPP_INPUT_MASK		GENERIC_MPP(0, 0x0, 1, 0)
298c2ecf20Sopenharmony_ci#define MPP_OUTPUT_MASK		GENERIC_MPP(0, 0x0, 0, 1)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_civoid __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask,
328c2ecf20Sopenharmony_ci			   unsigned int mpp_max, void __iomem *dev_bus);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif
35