3 * Marvell Semiconductor <www.marvell.com>
4 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
6 * SPDX-License-Identifier: GPL-2.0+
13 * Header file for MultiFunctionPin (MFP) Configururation framework
15 * Processors Supported:
16 * 1. Marvell ARMADA100 Processors
18 * processor to be supported should be added here
22 * MFP configuration is represented by a 32-bit unsigned integer
24 #define MFP(_off, _pull, _pF, _drv, _dF, _edge, _eF, _afn, _aF) ( \
25 /* bits 31..16 - MFP Register Offset */ (((_off) & 0xffff) << 16) | \
26 /* bits 15..13 - Run Mode Pull State */ (((_pull) & 0x7) << 13) | \
27 /* bit 12 - Unused */ \
28 /* bits 11..10 - Driver Strength */ (((_drv) & 0x3) << 10) | \
29 /* bit 09 - Pull State flag */ (((_pF) & 0x1) << 9) | \
30 /* bit 08 - Drv-strength flag */ (((_dF) & 0x1) << 8) | \
31 /* bit 07 - Edge-det flag */ (((_eF) & 0x1) << 7) | \
32 /* bits 06..04 - Edge Detection */ (((_edge) & 0x7) << 4) | \
33 /* bits 03..00 - Alt-fun flag */ (((_aF) & 0x1) << 3) | \
34 /* bits Alternate-fun select */ ((_afn) & 0x7))
37 * to facilitate the definition, the following macros are provided
39 * offset, pull,pF, drv,dF, edge,eF ,afn,aF
41 #define MFP_OFFSET_MASK MFP(0xffff, 0,0, 0,0, 0,0, 0,0)
42 #define MFP_REG(x) MFP(x, 0,0, 0,0, 0,0, 0,0)
43 #define MFP_REG_GET_OFFSET(x) ((x & MFP_OFFSET_MASK) >> 16)
45 #define MFP_AF_FLAG MFP(0x0000, 0,0, 0,0, 0,0, 0,1)
46 #define MFP_DRIVE_FLAG MFP(0x0000, 0,0, 0,1, 0,0, 0,0)
47 #define MFP_EDGE_FLAG MFP(0x0000, 0,0, 0,0, 0,1, 0,0)
48 #define MFP_PULL_FLAG MFP(0x0000, 0,1, 0,0, 0,0, 0,0)
50 #define MFP_AF0 MFP(0x0000, 0,0, 0,0, 0,0, 0,1)
51 #define MFP_AF1 MFP(0x0000, 0,0, 0,0, 0,0, 1,1)
52 #define MFP_AF2 MFP(0x0000, 0,0, 0,0, 0,0, 2,1)
53 #define MFP_AF3 MFP(0x0000, 0,0, 0,0, 0,0, 3,1)
54 #define MFP_AF4 MFP(0x0000, 0,0, 0,0, 0,0, 4,1)
55 #define MFP_AF5 MFP(0x0000, 0,0, 0,0, 0,0, 5,1)
56 #define MFP_AF6 MFP(0x0000, 0,0, 0,0, 0,0, 6,1)
57 #define MFP_AF7 MFP(0x0000, 0,0, 0,0, 0,0, 7,1)
58 #define MFP_AF_MASK MFP(0x0000, 0,0, 0,0, 0,0, 7,0)
60 #define MFP_LPM_EDGE_NONE MFP(0x0000, 0,0, 0,0, 0,1, 0,0)
61 #define MFP_LPM_EDGE_RISE MFP(0x0000, 0,0, 0,0, 1,1, 0,0)
62 #define MFP_LPM_EDGE_FALL MFP(0x0000, 0,0, 0,0, 2,1, 0,0)
63 #define MFP_LPM_EDGE_BOTH MFP(0x0000, 0,0, 0,0, 3,1, 0,0)
64 #define MFP_LPM_EDGE_MASK MFP(0x0000, 0,0, 0,0, 3,0, 0,0)
66 #define MFP_DRIVE_VERY_SLOW MFP(0x0000, 0,0, 0,1, 0,0, 0,0)
67 #define MFP_DRIVE_SLOW MFP(0x0000, 0,0, 1,1, 0,0, 0,0)
68 #define MFP_DRIVE_MEDIUM MFP(0x0000, 0,0, 2,1, 0,0, 0,0)
69 #define MFP_DRIVE_FAST MFP(0x0000, 0,0, 3,1, 0,0, 0,0)
70 #define MFP_DRIVE_MASK MFP(0x0000, 0,0, 3,0, 0,0, 0,0)
72 #define MFP_PULL_NONE MFP(0x0000, 0,1, 0,0, 0,0, 0,0)
73 #define MFP_PULL_LOW MFP(0x0000, 1,1, 0,0, 0,0, 0,0)
74 #define MFP_PULL_HIGH MFP(0x0000, 2,1, 0,0, 0,0, 0,0)
75 #define MFP_PULL_BOTH MFP(0x0000, 3,1, 0,0, 0,0, 0,0)
76 #define MFP_PULL_FLOAT MFP(0x0000, 4,1, 0,0, 0,0, 0,0)
77 #define MFP_PULL_MASK MFP(0x0000, 7,0, 0,0, 0,0, 0,0)
79 #define MFP_EOC 0xffffffff /* indicates end-of-conf */
82 void mfp_config(u32 *mfp_cfgs);
84 #endif /* __MVMFP_H */