18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_MACH_MFP_H
38c2ecf20Sopenharmony_ci#define __ASM_MACH_MFP_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <plat/mfp.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/*
88c2ecf20Sopenharmony_ci * NOTE: the MFPR register bit definitions on PXA168 processor lines are a
98c2ecf20Sopenharmony_ci * bit different from those on PXA3xx.  Bit [7:10] are now reserved, which
108c2ecf20Sopenharmony_ci * were SLEEP_OE_N, SLEEP_DATA, SLEEP_SEL and the LSB of DRIVE bits.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * To cope with this difference and re-use the pxa3xx mfp code as much as
138c2ecf20Sopenharmony_ci * possible, we make the following compromise:
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * 1. SLEEP_OE_N will always be programmed to '1' (by MFP_LPM_FLOAT)
168c2ecf20Sopenharmony_ci * 2. DRIVE strength definitions redefined to include the reserved bit
178c2ecf20Sopenharmony_ci *    - the reserved bit differs between pxa168 and pxa910, and the
188c2ecf20Sopenharmony_ci *      MFP_DRIVE_* macros are individually defined in mfp-pxa{168,910}.h
198c2ecf20Sopenharmony_ci * 3. Override MFP_CFG() and MFP_CFG_DRV()
208c2ecf20Sopenharmony_ci * 4. Drop the use of MFP_CFG_LPM() and MFP_CFG_X()
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#undef MFP_CFG
248c2ecf20Sopenharmony_ci#undef MFP_CFG_DRV
258c2ecf20Sopenharmony_ci#undef MFP_CFG_LPM
268c2ecf20Sopenharmony_ci#undef MFP_CFG_X
278c2ecf20Sopenharmony_ci#undef MFP_CFG_DEFAULT
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define MFP_CFG(pin, af)		\
308c2ecf20Sopenharmony_ci	(MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_MEDIUM)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define MFP_CFG_DRV(pin, af, drv)	\
338c2ecf20Sopenharmony_ci	(MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_##drv)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_MFP_H */
36