162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __ARCH_ORION5X_MPP_H
362306a36Sopenharmony_ci#define __ARCH_ORION5X_MPP_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#define MPP(_num, _sel, _in, _out, _F5181l, _F5182, _F5281) ( \
662306a36Sopenharmony_ci	/* MPP number */		((_num) & 0xff) | \
762306a36Sopenharmony_ci	/* MPP select value */		(((_sel) & 0xf) << 8) | \
862306a36Sopenharmony_ci	/* may be input signal */	((!!(_in)) << 12) | \
962306a36Sopenharmony_ci	/* may be output signal */	((!!(_out)) << 13) | \
1062306a36Sopenharmony_ci	/* available on F5181l */	((!!(_F5181l)) << 14) | \
1162306a36Sopenharmony_ci	/* available on F5182 */	((!!(_F5182)) << 15) | \
1262306a36Sopenharmony_ci	/* available on F5281 */	((!!(_F5281)) << 16))
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci				/* num sel  i  o  5181 5182 5281 */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define MPP_F5181_MASK		MPP(0,  0x0, 0, 0, 1,   0,   0)
1762306a36Sopenharmony_ci#define MPP_F5182_MASK		MPP(0,  0x0, 0, 0, 0,   1,   0)
1862306a36Sopenharmony_ci#define MPP_F5281_MASK		MPP(0,  0x0, 0, 0, 0,   0,   1)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define MPP0_UNUSED	        MPP(0,  0x3, 0, 0, 1,   1,   1)
2162306a36Sopenharmony_ci#define MPP0_GPIO		MPP(0,  0x3, 1, 1, 1,   1,   1)
2262306a36Sopenharmony_ci#define MPP0_PCIE_RST_OUTn	MPP(0,  0x0, 0, 0, 1,   1,   1)
2362306a36Sopenharmony_ci#define MPP0_PCI_ARB            MPP(0,  0x2, 0, 0, 1,   1,   1)
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define MPP1_UNUSED		MPP(1,  0x0, 0, 0, 1,   1,   1)
2662306a36Sopenharmony_ci#define MPP1_GPIO		MPP(1,  0x0, 1, 1, 1,   1,   1)
2762306a36Sopenharmony_ci#define MPP1_PCI_ARB            MPP(1,  0x2, 0, 0, 1,   1,   1)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define MPP2_UNUSED		MPP(2,  0x0, 0, 0, 1,   1,   1)
3062306a36Sopenharmony_ci#define MPP2_GPIO		MPP(2,  0x0, 1, 1, 1,   1,   1)
3162306a36Sopenharmony_ci#define MPP2_PCI_ARB            MPP(2,  0x2, 0, 0, 1,   1,   1)
3262306a36Sopenharmony_ci#define MPP2_PCI_PMEn           MPP(2,  0x3, 0, 0, 1,   1,   1)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define MPP3_UNUSED		MPP(3,  0x0, 0, 0, 1,   1,   1)
3562306a36Sopenharmony_ci#define MPP3_GPIO		MPP(3,  0x0, 1, 1, 1,   1,   1)
3662306a36Sopenharmony_ci#define MPP3_PCI_ARB            MPP(3,  0x2, 0, 0, 1,   1,   1)
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define MPP4_UNUSED		MPP(4,  0x0, 0, 0, 1,   1,   1)
3962306a36Sopenharmony_ci#define MPP4_GPIO		MPP(4,  0x0, 1, 1, 1,   1,   1)
4062306a36Sopenharmony_ci#define MPP4_PCI_ARB            MPP(4,  0x2, 0, 0, 1,   1,   1)
4162306a36Sopenharmony_ci#define MPP4_NAND               MPP(4,  0x4, 0, 0, 0,   1,   1)
4262306a36Sopenharmony_ci#define MPP4_SATA_LED           MPP(4,  0x5, 0, 0, 0,   1,   0)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define MPP5_UNUSED		MPP(5,  0x0, 0, 0, 1,   1,   1)
4562306a36Sopenharmony_ci#define MPP5_GPIO		MPP(5,  0x0, 1, 1, 1,   1,   1)
4662306a36Sopenharmony_ci#define MPP5_PCI_ARB            MPP(5,  0x2, 0, 0, 1,   1,   1)
4762306a36Sopenharmony_ci#define MPP5_NAND               MPP(5,  0x4, 0, 0, 0,   1,   1)
4862306a36Sopenharmony_ci#define MPP5_SATA_LED           MPP(5,  0x5, 0, 0, 0,   1,   0)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define MPP6_UNUSED		MPP(6,  0x0, 0, 0, 1,   1,   1)
5162306a36Sopenharmony_ci#define MPP6_GPIO		MPP(6,  0x0, 1, 1, 1,   1,   1)
5262306a36Sopenharmony_ci#define MPP6_PCI_ARB            MPP(6,  0x2, 0, 0, 1,   1,   1)
5362306a36Sopenharmony_ci#define MPP6_NAND               MPP(6,  0x4, 0, 0, 0,   1,   1)
5462306a36Sopenharmony_ci#define MPP6_PCI_CLK            MPP(6,  0x5, 0, 0, 1,   0,   0)
5562306a36Sopenharmony_ci#define MPP6_SATA_LED           MPP(6,  0x5, 0, 0, 0,   1,   0)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define MPP7_UNUSED		MPP(7,  0x0, 0, 0, 1,   1,   1)
5862306a36Sopenharmony_ci#define MPP7_GPIO		MPP(7,  0x0, 1, 1, 1,   1,   1)
5962306a36Sopenharmony_ci#define MPP7_PCI_ARB            MPP(7,  0x2, 0, 0, 1,   1,   1)
6062306a36Sopenharmony_ci#define MPP7_NAND               MPP(7,  0x4, 0, 0, 0,   1,   1)
6162306a36Sopenharmony_ci#define MPP7_PCI_CLK            MPP(7,  0x5, 0, 0, 1,   0,   0)
6262306a36Sopenharmony_ci#define MPP7_SATA_LED           MPP(7,  0x5, 0, 0, 0,   1,   0)
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci#define MPP8_UNUSED		MPP(8,  0x0, 0, 0, 1,   1,   1)
6562306a36Sopenharmony_ci#define MPP8_GPIO		MPP(8,  0x0, 1, 1, 1,   1,   1)
6662306a36Sopenharmony_ci#define MPP8_GIGE               MPP(8,  0x1, 0, 0, 1,   1,   1)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define MPP9_UNUSED		MPP(9,  0x0, 0, 0, 1,   1,   1)
6962306a36Sopenharmony_ci#define MPP9_GPIO		MPP(9,  0x0, 1, 1, 1,   1,   1)
7062306a36Sopenharmony_ci#define MPP9_GIGE               MPP(9,  0x1, 0, 0, 1,   1,   1)
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#define MPP10_UNUSED		MPP(10, 0x0, 0, 0, 1,   1,   1)
7362306a36Sopenharmony_ci#define MPP10_GPIO		MPP(10, 0x0, 1, 1, 1,   1,   1)
7462306a36Sopenharmony_ci#define MPP10_GIGE              MPP(10, 0x1, 0, 0, 1,   1,   1)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define MPP11_UNUSED		MPP(11, 0x0, 0, 0, 1,   1,   1)
7762306a36Sopenharmony_ci#define MPP11_GPIO		MPP(11, 0x0, 1, 1, 1,   1,   1)
7862306a36Sopenharmony_ci#define MPP11_GIGE              MPP(11, 0x1, 0, 0, 1,   1,   1)
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define MPP12_UNUSED		MPP(12, 0x0, 0, 0, 1,   1,   1)
8162306a36Sopenharmony_ci#define MPP12_GPIO		MPP(12, 0x0, 1, 1, 1,   1,   1)
8262306a36Sopenharmony_ci#define MPP12_GIGE              MPP(12, 0x1, 0, 0, 1,   1,   1)
8362306a36Sopenharmony_ci#define MPP12_NAND              MPP(12, 0x4, 0, 0, 0,   1,   1)
8462306a36Sopenharmony_ci#define MPP12_SATA_LED          MPP(12, 0x5, 0, 0, 0,   1,   0)
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#define MPP13_UNUSED		MPP(13, 0x0, 0, 0, 1,   1,   1)
8762306a36Sopenharmony_ci#define MPP13_GPIO		MPP(13, 0x0, 1, 1, 1,   1,   1)
8862306a36Sopenharmony_ci#define MPP13_GIGE              MPP(13, 0x1, 0, 0, 1,   1,   1)
8962306a36Sopenharmony_ci#define MPP13_NAND              MPP(13, 0x4, 0, 0, 0,   1,   1)
9062306a36Sopenharmony_ci#define MPP13_SATA_LED          MPP(13, 0x5, 0, 0, 0,   1,   0)
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#define MPP14_UNUSED		MPP(14, 0x0, 0, 0, 1,   1,   1)
9362306a36Sopenharmony_ci#define MPP14_GPIO		MPP(14, 0x0, 1, 1, 1,   1,   1)
9462306a36Sopenharmony_ci#define MPP14_GIGE              MPP(14, 0x1, 0, 0, 1,   1,   1)
9562306a36Sopenharmony_ci#define MPP14_NAND              MPP(14, 0x4, 0, 0, 0,   1,   1)
9662306a36Sopenharmony_ci#define MPP14_SATA_LED          MPP(14, 0x5, 0, 0, 0,   1,   0)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci#define MPP15_UNUSED		MPP(15, 0x0, 0, 0, 1,   1,   1)
9962306a36Sopenharmony_ci#define MPP15_GPIO		MPP(15, 0x0, 1, 1, 1,   1,   1)
10062306a36Sopenharmony_ci#define MPP15_GIGE              MPP(15, 0x1, 0, 0, 1,   1,   1)
10162306a36Sopenharmony_ci#define MPP15_NAND              MPP(15, 0x4, 0, 0, 0,   1,   1)
10262306a36Sopenharmony_ci#define MPP15_SATA_LED          MPP(15, 0x5, 0, 0, 0,   1,   0)
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci#define MPP16_UNUSED		MPP(16, 0x0, 0, 0, 1,   1,   1)
10562306a36Sopenharmony_ci#define MPP16_GPIO		MPP(16, 0x5, 1, 1, 0,   1,   0)
10662306a36Sopenharmony_ci#define MPP16_GIGE              MPP(16, 0x1, 0, 0, 1,   1,   1)
10762306a36Sopenharmony_ci#define MPP16_NAND              MPP(16, 0x4, 0, 0, 0,   1,   1)
10862306a36Sopenharmony_ci#define MPP16_UART              MPP(16, 0x0, 0, 0, 0,   1,   1)
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci#define MPP17_UNUSED		MPP(17, 0x0, 0, 0, 1,   1,   1)
11162306a36Sopenharmony_ci#define MPP17_GPIO		MPP(17, 0x5, 1, 1, 0,   1,   0)
11262306a36Sopenharmony_ci#define MPP17_GIGE              MPP(17, 0x1, 0, 0, 1,   1,   1)
11362306a36Sopenharmony_ci#define MPP17_NAND              MPP(17, 0x4, 0, 0, 0,   1,   1)
11462306a36Sopenharmony_ci#define MPP17_UART              MPP(17, 0x0, 0, 0, 0,   1,   1)
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#define MPP18_UNUSED		MPP(18, 0x0, 0, 0, 1,   1,   1)
11762306a36Sopenharmony_ci#define MPP18_GPIO		MPP(18, 0x5, 1, 1, 0,   1,   0)
11862306a36Sopenharmony_ci#define MPP18_GIGE              MPP(18, 0x1, 0, 0, 1,   1,   1)
11962306a36Sopenharmony_ci#define MPP18_UART              MPP(18, 0x0, 0, 0, 0,   1,   1)
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#define MPP19_UNUSED		MPP(19, 0x0, 0, 0, 1,   1,   1)
12262306a36Sopenharmony_ci#define MPP19_GPIO		MPP(19, 0x5, 1, 1, 0,   1,   0)
12362306a36Sopenharmony_ci#define MPP19_GIGE              MPP(19, 0x1, 0, 0, 1,   1,   1)
12462306a36Sopenharmony_ci#define MPP19_UART              MPP(19, 0x0, 0, 0, 0,   1,   1)
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci#define MPP_MAX			19
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_civoid orion5x_mpp_conf(unsigned int *mpp_list);
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#endif
131