18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ARCH_ORION5X_MPP_H
38c2ecf20Sopenharmony_ci#define __ARCH_ORION5X_MPP_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define MPP(_num, _sel, _in, _out, _F5181l, _F5182, _F5281) ( \
68c2ecf20Sopenharmony_ci	/* MPP number */		((_num) & 0xff) | \
78c2ecf20Sopenharmony_ci	/* MPP select value */		(((_sel) & 0xf) << 8) | \
88c2ecf20Sopenharmony_ci	/* may be input signal */	((!!(_in)) << 12) | \
98c2ecf20Sopenharmony_ci	/* may be output signal */	((!!(_out)) << 13) | \
108c2ecf20Sopenharmony_ci	/* available on F5181l */	((!!(_F5181l)) << 14) | \
118c2ecf20Sopenharmony_ci	/* available on F5182 */	((!!(_F5182)) << 15) | \
128c2ecf20Sopenharmony_ci	/* available on F5281 */	((!!(_F5281)) << 16))
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci				/* num sel  i  o  5181 5182 5281 */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define MPP_F5181_MASK		MPP(0,  0x0, 0, 0, 1,   0,   0)
178c2ecf20Sopenharmony_ci#define MPP_F5182_MASK		MPP(0,  0x0, 0, 0, 0,   1,   0)
188c2ecf20Sopenharmony_ci#define MPP_F5281_MASK		MPP(0,  0x0, 0, 0, 0,   0,   1)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define MPP0_UNUSED	        MPP(0,  0x3, 0, 0, 1,   1,   1)
218c2ecf20Sopenharmony_ci#define MPP0_GPIO		MPP(0,  0x3, 1, 1, 1,   1,   1)
228c2ecf20Sopenharmony_ci#define MPP0_PCIE_RST_OUTn	MPP(0,  0x0, 0, 0, 1,   1,   1)
238c2ecf20Sopenharmony_ci#define MPP0_PCI_ARB            MPP(0,  0x2, 0, 0, 1,   1,   1)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define MPP1_UNUSED		MPP(1,  0x0, 0, 0, 1,   1,   1)
268c2ecf20Sopenharmony_ci#define MPP1_GPIO		MPP(1,  0x0, 1, 1, 1,   1,   1)
278c2ecf20Sopenharmony_ci#define MPP1_PCI_ARB            MPP(1,  0x2, 0, 0, 1,   1,   1)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define MPP2_UNUSED		MPP(2,  0x0, 0, 0, 1,   1,   1)
308c2ecf20Sopenharmony_ci#define MPP2_GPIO		MPP(2,  0x0, 1, 1, 1,   1,   1)
318c2ecf20Sopenharmony_ci#define MPP2_PCI_ARB            MPP(2,  0x2, 0, 0, 1,   1,   1)
328c2ecf20Sopenharmony_ci#define MPP2_PCI_PMEn           MPP(2,  0x3, 0, 0, 1,   1,   1)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define MPP3_UNUSED		MPP(3,  0x0, 0, 0, 1,   1,   1)
358c2ecf20Sopenharmony_ci#define MPP3_GPIO		MPP(3,  0x0, 1, 1, 1,   1,   1)
368c2ecf20Sopenharmony_ci#define MPP3_PCI_ARB            MPP(3,  0x2, 0, 0, 1,   1,   1)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define MPP4_UNUSED		MPP(4,  0x0, 0, 0, 1,   1,   1)
398c2ecf20Sopenharmony_ci#define MPP4_GPIO		MPP(4,  0x0, 1, 1, 1,   1,   1)
408c2ecf20Sopenharmony_ci#define MPP4_PCI_ARB            MPP(4,  0x2, 0, 0, 1,   1,   1)
418c2ecf20Sopenharmony_ci#define MPP4_NAND               MPP(4,  0x4, 0, 0, 0,   1,   1)
428c2ecf20Sopenharmony_ci#define MPP4_SATA_LED           MPP(4,  0x5, 0, 0, 0,   1,   0)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define MPP5_UNUSED		MPP(5,  0x0, 0, 0, 1,   1,   1)
458c2ecf20Sopenharmony_ci#define MPP5_GPIO		MPP(5,  0x0, 1, 1, 1,   1,   1)
468c2ecf20Sopenharmony_ci#define MPP5_PCI_ARB            MPP(5,  0x2, 0, 0, 1,   1,   1)
478c2ecf20Sopenharmony_ci#define MPP5_NAND               MPP(5,  0x4, 0, 0, 0,   1,   1)
488c2ecf20Sopenharmony_ci#define MPP5_SATA_LED           MPP(5,  0x5, 0, 0, 0,   1,   0)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define MPP6_UNUSED		MPP(6,  0x0, 0, 0, 1,   1,   1)
518c2ecf20Sopenharmony_ci#define MPP6_GPIO		MPP(6,  0x0, 1, 1, 1,   1,   1)
528c2ecf20Sopenharmony_ci#define MPP6_PCI_ARB            MPP(6,  0x2, 0, 0, 1,   1,   1)
538c2ecf20Sopenharmony_ci#define MPP6_NAND               MPP(6,  0x4, 0, 0, 0,   1,   1)
548c2ecf20Sopenharmony_ci#define MPP6_PCI_CLK            MPP(6,  0x5, 0, 0, 1,   0,   0)
558c2ecf20Sopenharmony_ci#define MPP6_SATA_LED           MPP(6,  0x5, 0, 0, 0,   1,   0)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define MPP7_UNUSED		MPP(7,  0x0, 0, 0, 1,   1,   1)
588c2ecf20Sopenharmony_ci#define MPP7_GPIO		MPP(7,  0x0, 1, 1, 1,   1,   1)
598c2ecf20Sopenharmony_ci#define MPP7_PCI_ARB            MPP(7,  0x2, 0, 0, 1,   1,   1)
608c2ecf20Sopenharmony_ci#define MPP7_NAND               MPP(7,  0x4, 0, 0, 0,   1,   1)
618c2ecf20Sopenharmony_ci#define MPP7_PCI_CLK            MPP(7,  0x5, 0, 0, 1,   0,   0)
628c2ecf20Sopenharmony_ci#define MPP7_SATA_LED           MPP(7,  0x5, 0, 0, 0,   1,   0)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define MPP8_UNUSED		MPP(8,  0x0, 0, 0, 1,   1,   1)
658c2ecf20Sopenharmony_ci#define MPP8_GPIO		MPP(8,  0x0, 1, 1, 1,   1,   1)
668c2ecf20Sopenharmony_ci#define MPP8_GIGE               MPP(8,  0x1, 0, 0, 1,   1,   1)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define MPP9_UNUSED		MPP(9,  0x0, 0, 0, 1,   1,   1)
698c2ecf20Sopenharmony_ci#define MPP9_GPIO		MPP(9,  0x0, 1, 1, 1,   1,   1)
708c2ecf20Sopenharmony_ci#define MPP9_GIGE               MPP(9,  0x1, 0, 0, 1,   1,   1)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define MPP10_UNUSED		MPP(10, 0x0, 0, 0, 1,   1,   1)
738c2ecf20Sopenharmony_ci#define MPP10_GPIO		MPP(10, 0x0, 1, 1, 1,   1,   1)
748c2ecf20Sopenharmony_ci#define MPP10_GIGE              MPP(10, 0x1, 0, 0, 1,   1,   1)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define MPP11_UNUSED		MPP(11, 0x0, 0, 0, 1,   1,   1)
778c2ecf20Sopenharmony_ci#define MPP11_GPIO		MPP(11, 0x0, 1, 1, 1,   1,   1)
788c2ecf20Sopenharmony_ci#define MPP11_GIGE              MPP(11, 0x1, 0, 0, 1,   1,   1)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define MPP12_UNUSED		MPP(12, 0x0, 0, 0, 1,   1,   1)
818c2ecf20Sopenharmony_ci#define MPP12_GPIO		MPP(12, 0x0, 1, 1, 1,   1,   1)
828c2ecf20Sopenharmony_ci#define MPP12_GIGE              MPP(12, 0x1, 0, 0, 1,   1,   1)
838c2ecf20Sopenharmony_ci#define MPP12_NAND              MPP(12, 0x4, 0, 0, 0,   1,   1)
848c2ecf20Sopenharmony_ci#define MPP12_SATA_LED          MPP(12, 0x5, 0, 0, 0,   1,   0)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define MPP13_UNUSED		MPP(13, 0x0, 0, 0, 1,   1,   1)
878c2ecf20Sopenharmony_ci#define MPP13_GPIO		MPP(13, 0x0, 1, 1, 1,   1,   1)
888c2ecf20Sopenharmony_ci#define MPP13_GIGE              MPP(13, 0x1, 0, 0, 1,   1,   1)
898c2ecf20Sopenharmony_ci#define MPP13_NAND              MPP(13, 0x4, 0, 0, 0,   1,   1)
908c2ecf20Sopenharmony_ci#define MPP13_SATA_LED          MPP(13, 0x5, 0, 0, 0,   1,   0)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define MPP14_UNUSED		MPP(14, 0x0, 0, 0, 1,   1,   1)
938c2ecf20Sopenharmony_ci#define MPP14_GPIO		MPP(14, 0x0, 1, 1, 1,   1,   1)
948c2ecf20Sopenharmony_ci#define MPP14_GIGE              MPP(14, 0x1, 0, 0, 1,   1,   1)
958c2ecf20Sopenharmony_ci#define MPP14_NAND              MPP(14, 0x4, 0, 0, 0,   1,   1)
968c2ecf20Sopenharmony_ci#define MPP14_SATA_LED          MPP(14, 0x5, 0, 0, 0,   1,   0)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define MPP15_UNUSED		MPP(15, 0x0, 0, 0, 1,   1,   1)
998c2ecf20Sopenharmony_ci#define MPP15_GPIO		MPP(15, 0x0, 1, 1, 1,   1,   1)
1008c2ecf20Sopenharmony_ci#define MPP15_GIGE              MPP(15, 0x1, 0, 0, 1,   1,   1)
1018c2ecf20Sopenharmony_ci#define MPP15_NAND              MPP(15, 0x4, 0, 0, 0,   1,   1)
1028c2ecf20Sopenharmony_ci#define MPP15_SATA_LED          MPP(15, 0x5, 0, 0, 0,   1,   0)
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#define MPP16_UNUSED		MPP(16, 0x0, 0, 0, 1,   1,   1)
1058c2ecf20Sopenharmony_ci#define MPP16_GPIO		MPP(16, 0x5, 1, 1, 0,   1,   0)
1068c2ecf20Sopenharmony_ci#define MPP16_GIGE              MPP(16, 0x1, 0, 0, 1,   1,   1)
1078c2ecf20Sopenharmony_ci#define MPP16_NAND              MPP(16, 0x4, 0, 0, 0,   1,   1)
1088c2ecf20Sopenharmony_ci#define MPP16_UART              MPP(16, 0x0, 0, 0, 0,   1,   1)
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define MPP17_UNUSED		MPP(17, 0x0, 0, 0, 1,   1,   1)
1118c2ecf20Sopenharmony_ci#define MPP17_GPIO		MPP(17, 0x5, 1, 1, 0,   1,   0)
1128c2ecf20Sopenharmony_ci#define MPP17_GIGE              MPP(17, 0x1, 0, 0, 1,   1,   1)
1138c2ecf20Sopenharmony_ci#define MPP17_NAND              MPP(17, 0x4, 0, 0, 0,   1,   1)
1148c2ecf20Sopenharmony_ci#define MPP17_UART              MPP(17, 0x0, 0, 0, 0,   1,   1)
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define MPP18_UNUSED		MPP(18, 0x0, 0, 0, 1,   1,   1)
1178c2ecf20Sopenharmony_ci#define MPP18_GPIO		MPP(18, 0x5, 1, 1, 0,   1,   0)
1188c2ecf20Sopenharmony_ci#define MPP18_GIGE              MPP(18, 0x1, 0, 0, 1,   1,   1)
1198c2ecf20Sopenharmony_ci#define MPP18_UART              MPP(18, 0x0, 0, 0, 0,   1,   1)
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define MPP19_UNUSED		MPP(19, 0x0, 0, 0, 1,   1,   1)
1228c2ecf20Sopenharmony_ci#define MPP19_GPIO		MPP(19, 0x5, 1, 1, 0,   1,   0)
1238c2ecf20Sopenharmony_ci#define MPP19_GIGE              MPP(19, 0x1, 0, 0, 1,   1,   1)
1248c2ecf20Sopenharmony_ci#define MPP19_UART              MPP(19, 0x0, 0, 0, 0,   1,   1)
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci#define MPP_MAX			19
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_civoid orion5x_mpp_conf(unsigned int *mpp_list);
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#endif
131