18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Joshua Henderson <joshua.henderson@microchip.com>
48c2ecf20Sopenharmony_ci * Copyright (C) 2015 Microchip Technology Inc.  All rights reserved.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef _PIC32MZDA_EARLY_PIN_H
78c2ecf20Sopenharmony_ci#define _PIC32MZDA_EARLY_PIN_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/*
108c2ecf20Sopenharmony_ci * This is a complete, yet overly simplistic and unoptimized, PIC32MZDA PPS
118c2ecf20Sopenharmony_ci * configuration only useful before we have full pinctrl initialized.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* Input PPS Functions */
158c2ecf20Sopenharmony_cienum {
168c2ecf20Sopenharmony_ci	IN_FUNC_INT3,
178c2ecf20Sopenharmony_ci	IN_FUNC_T2CK,
188c2ecf20Sopenharmony_ci	IN_FUNC_T6CK,
198c2ecf20Sopenharmony_ci	IN_FUNC_IC3,
208c2ecf20Sopenharmony_ci	IN_FUNC_IC7,
218c2ecf20Sopenharmony_ci	IN_FUNC_U1RX,
228c2ecf20Sopenharmony_ci	IN_FUNC_U2CTS,
238c2ecf20Sopenharmony_ci	IN_FUNC_U5RX,
248c2ecf20Sopenharmony_ci	IN_FUNC_U6CTS,
258c2ecf20Sopenharmony_ci	IN_FUNC_SDI1,
268c2ecf20Sopenharmony_ci	IN_FUNC_SDI3,
278c2ecf20Sopenharmony_ci	IN_FUNC_SDI5,
288c2ecf20Sopenharmony_ci	IN_FUNC_SS6,
298c2ecf20Sopenharmony_ci	IN_FUNC_REFCLKI1,
308c2ecf20Sopenharmony_ci	IN_FUNC_INT4,
318c2ecf20Sopenharmony_ci	IN_FUNC_T5CK,
328c2ecf20Sopenharmony_ci	IN_FUNC_T7CK,
338c2ecf20Sopenharmony_ci	IN_FUNC_IC4,
348c2ecf20Sopenharmony_ci	IN_FUNC_IC8,
358c2ecf20Sopenharmony_ci	IN_FUNC_U3RX,
368c2ecf20Sopenharmony_ci	IN_FUNC_U4CTS,
378c2ecf20Sopenharmony_ci	IN_FUNC_SDI2,
388c2ecf20Sopenharmony_ci	IN_FUNC_SDI4,
398c2ecf20Sopenharmony_ci	IN_FUNC_C1RX,
408c2ecf20Sopenharmony_ci	IN_FUNC_REFCLKI4,
418c2ecf20Sopenharmony_ci	IN_FUNC_INT2,
428c2ecf20Sopenharmony_ci	IN_FUNC_T3CK,
438c2ecf20Sopenharmony_ci	IN_FUNC_T8CK,
448c2ecf20Sopenharmony_ci	IN_FUNC_IC2,
458c2ecf20Sopenharmony_ci	IN_FUNC_IC5,
468c2ecf20Sopenharmony_ci	IN_FUNC_IC9,
478c2ecf20Sopenharmony_ci	IN_FUNC_U1CTS,
488c2ecf20Sopenharmony_ci	IN_FUNC_U2RX,
498c2ecf20Sopenharmony_ci	IN_FUNC_U5CTS,
508c2ecf20Sopenharmony_ci	IN_FUNC_SS1,
518c2ecf20Sopenharmony_ci	IN_FUNC_SS3,
528c2ecf20Sopenharmony_ci	IN_FUNC_SS4,
538c2ecf20Sopenharmony_ci	IN_FUNC_SS5,
548c2ecf20Sopenharmony_ci	IN_FUNC_C2RX,
558c2ecf20Sopenharmony_ci	IN_FUNC_INT1,
568c2ecf20Sopenharmony_ci	IN_FUNC_T4CK,
578c2ecf20Sopenharmony_ci	IN_FUNC_T9CK,
588c2ecf20Sopenharmony_ci	IN_FUNC_IC1,
598c2ecf20Sopenharmony_ci	IN_FUNC_IC6,
608c2ecf20Sopenharmony_ci	IN_FUNC_U3CTS,
618c2ecf20Sopenharmony_ci	IN_FUNC_U4RX,
628c2ecf20Sopenharmony_ci	IN_FUNC_U6RX,
638c2ecf20Sopenharmony_ci	IN_FUNC_SS2,
648c2ecf20Sopenharmony_ci	IN_FUNC_SDI6,
658c2ecf20Sopenharmony_ci	IN_FUNC_OCFA,
668c2ecf20Sopenharmony_ci	IN_FUNC_REFCLKI3,
678c2ecf20Sopenharmony_ci};
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* Input PPS Pins */
708c2ecf20Sopenharmony_ci#define IN_RPD2 0x00
718c2ecf20Sopenharmony_ci#define IN_RPG8 0x01
728c2ecf20Sopenharmony_ci#define IN_RPF4 0x02
738c2ecf20Sopenharmony_ci#define IN_RPD10 0x03
748c2ecf20Sopenharmony_ci#define IN_RPF1 0x04
758c2ecf20Sopenharmony_ci#define IN_RPB9 0x05
768c2ecf20Sopenharmony_ci#define IN_RPB10 0x06
778c2ecf20Sopenharmony_ci#define IN_RPC14 0x07
788c2ecf20Sopenharmony_ci#define IN_RPB5 0x08
798c2ecf20Sopenharmony_ci#define IN_RPC1 0x0A
808c2ecf20Sopenharmony_ci#define IN_RPD14 0x0B
818c2ecf20Sopenharmony_ci#define IN_RPG1 0x0C
828c2ecf20Sopenharmony_ci#define IN_RPA14 0x0D
838c2ecf20Sopenharmony_ci#define IN_RPD6 0x0E
848c2ecf20Sopenharmony_ci#define IN_RPD3 0x00
858c2ecf20Sopenharmony_ci#define IN_RPG7 0x01
868c2ecf20Sopenharmony_ci#define IN_RPF5 0x02
878c2ecf20Sopenharmony_ci#define IN_RPD11 0x03
888c2ecf20Sopenharmony_ci#define IN_RPF0 0x04
898c2ecf20Sopenharmony_ci#define IN_RPB1 0x05
908c2ecf20Sopenharmony_ci#define IN_RPE5 0x06
918c2ecf20Sopenharmony_ci#define IN_RPC13 0x07
928c2ecf20Sopenharmony_ci#define IN_RPB3 0x08
938c2ecf20Sopenharmony_ci#define IN_RPC4 0x0A
948c2ecf20Sopenharmony_ci#define IN_RPD15 0x0B
958c2ecf20Sopenharmony_ci#define IN_RPG0 0x0C
968c2ecf20Sopenharmony_ci#define IN_RPA15 0x0D
978c2ecf20Sopenharmony_ci#define IN_RPD7 0x0E
988c2ecf20Sopenharmony_ci#define IN_RPD9 0x00
998c2ecf20Sopenharmony_ci#define IN_RPG6 0x01
1008c2ecf20Sopenharmony_ci#define IN_RPB8 0x02
1018c2ecf20Sopenharmony_ci#define IN_RPB15 0x03
1028c2ecf20Sopenharmony_ci#define IN_RPD4 0x04
1038c2ecf20Sopenharmony_ci#define IN_RPB0 0x05
1048c2ecf20Sopenharmony_ci#define IN_RPE3 0x06
1058c2ecf20Sopenharmony_ci#define IN_RPB7 0x07
1068c2ecf20Sopenharmony_ci#define IN_RPF12 0x09
1078c2ecf20Sopenharmony_ci#define IN_RPD12 0x0A
1088c2ecf20Sopenharmony_ci#define IN_RPF8 0x0B
1098c2ecf20Sopenharmony_ci#define IN_RPC3 0x0C
1108c2ecf20Sopenharmony_ci#define IN_RPE9 0x0D
1118c2ecf20Sopenharmony_ci#define IN_RPD1 0x00
1128c2ecf20Sopenharmony_ci#define IN_RPG9 0x01
1138c2ecf20Sopenharmony_ci#define IN_RPB14 0x02
1148c2ecf20Sopenharmony_ci#define IN_RPD0 0x03
1158c2ecf20Sopenharmony_ci#define IN_RPB6 0x05
1168c2ecf20Sopenharmony_ci#define IN_RPD5 0x06
1178c2ecf20Sopenharmony_ci#define IN_RPB2 0x07
1188c2ecf20Sopenharmony_ci#define IN_RPF3 0x08
1198c2ecf20Sopenharmony_ci#define IN_RPF13 0x09
1208c2ecf20Sopenharmony_ci#define IN_RPF2 0x0B
1218c2ecf20Sopenharmony_ci#define IN_RPC2 0x0C
1228c2ecf20Sopenharmony_ci#define IN_RPE8 0x0D
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/* Output PPS Pins */
1258c2ecf20Sopenharmony_cienum {
1268c2ecf20Sopenharmony_ci	OUT_RPD2,
1278c2ecf20Sopenharmony_ci	OUT_RPG8,
1288c2ecf20Sopenharmony_ci	OUT_RPF4,
1298c2ecf20Sopenharmony_ci	OUT_RPD10,
1308c2ecf20Sopenharmony_ci	OUT_RPF1,
1318c2ecf20Sopenharmony_ci	OUT_RPB9,
1328c2ecf20Sopenharmony_ci	OUT_RPB10,
1338c2ecf20Sopenharmony_ci	OUT_RPC14,
1348c2ecf20Sopenharmony_ci	OUT_RPB5,
1358c2ecf20Sopenharmony_ci	OUT_RPC1,
1368c2ecf20Sopenharmony_ci	OUT_RPD14,
1378c2ecf20Sopenharmony_ci	OUT_RPG1,
1388c2ecf20Sopenharmony_ci	OUT_RPA14,
1398c2ecf20Sopenharmony_ci	OUT_RPD6,
1408c2ecf20Sopenharmony_ci	OUT_RPD3,
1418c2ecf20Sopenharmony_ci	OUT_RPG7,
1428c2ecf20Sopenharmony_ci	OUT_RPF5,
1438c2ecf20Sopenharmony_ci	OUT_RPD11,
1448c2ecf20Sopenharmony_ci	OUT_RPF0,
1458c2ecf20Sopenharmony_ci	OUT_RPB1,
1468c2ecf20Sopenharmony_ci	OUT_RPE5,
1478c2ecf20Sopenharmony_ci	OUT_RPC13,
1488c2ecf20Sopenharmony_ci	OUT_RPB3,
1498c2ecf20Sopenharmony_ci	OUT_RPC4,
1508c2ecf20Sopenharmony_ci	OUT_RPD15,
1518c2ecf20Sopenharmony_ci	OUT_RPG0,
1528c2ecf20Sopenharmony_ci	OUT_RPA15,
1538c2ecf20Sopenharmony_ci	OUT_RPD7,
1548c2ecf20Sopenharmony_ci	OUT_RPD9,
1558c2ecf20Sopenharmony_ci	OUT_RPG6,
1568c2ecf20Sopenharmony_ci	OUT_RPB8,
1578c2ecf20Sopenharmony_ci	OUT_RPB15,
1588c2ecf20Sopenharmony_ci	OUT_RPD4,
1598c2ecf20Sopenharmony_ci	OUT_RPB0,
1608c2ecf20Sopenharmony_ci	OUT_RPE3,
1618c2ecf20Sopenharmony_ci	OUT_RPB7,
1628c2ecf20Sopenharmony_ci	OUT_RPF12,
1638c2ecf20Sopenharmony_ci	OUT_RPD12,
1648c2ecf20Sopenharmony_ci	OUT_RPF8,
1658c2ecf20Sopenharmony_ci	OUT_RPC3,
1668c2ecf20Sopenharmony_ci	OUT_RPE9,
1678c2ecf20Sopenharmony_ci	OUT_RPD1,
1688c2ecf20Sopenharmony_ci	OUT_RPG9,
1698c2ecf20Sopenharmony_ci	OUT_RPB14,
1708c2ecf20Sopenharmony_ci	OUT_RPD0,
1718c2ecf20Sopenharmony_ci	OUT_RPB6,
1728c2ecf20Sopenharmony_ci	OUT_RPD5,
1738c2ecf20Sopenharmony_ci	OUT_RPB2,
1748c2ecf20Sopenharmony_ci	OUT_RPF3,
1758c2ecf20Sopenharmony_ci	OUT_RPF13,
1768c2ecf20Sopenharmony_ci	OUT_RPC2,
1778c2ecf20Sopenharmony_ci	OUT_RPE8,
1788c2ecf20Sopenharmony_ci	OUT_RPF2,
1798c2ecf20Sopenharmony_ci};
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* Output PPS Functions */
1828c2ecf20Sopenharmony_ci#define OUT_FUNC_U3TX 0x01
1838c2ecf20Sopenharmony_ci#define OUT_FUNC_U4RTS 0x02
1848c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO1 0x05
1858c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO2 0x06
1868c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO3 0x07
1878c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO5 0x09
1888c2ecf20Sopenharmony_ci#define OUT_FUNC_SS6 0x0A
1898c2ecf20Sopenharmony_ci#define OUT_FUNC_OC3 0x0B
1908c2ecf20Sopenharmony_ci#define OUT_FUNC_OC6 0x0C
1918c2ecf20Sopenharmony_ci#define OUT_FUNC_REFCLKO4 0x0D
1928c2ecf20Sopenharmony_ci#define OUT_FUNC_C2OUT 0x0E
1938c2ecf20Sopenharmony_ci#define OUT_FUNC_C1TX 0x0F
1948c2ecf20Sopenharmony_ci#define OUT_FUNC_U1TX 0x01
1958c2ecf20Sopenharmony_ci#define OUT_FUNC_U2RTS 0x02
1968c2ecf20Sopenharmony_ci#define OUT_FUNC_U5TX 0x03
1978c2ecf20Sopenharmony_ci#define OUT_FUNC_U6RTS 0x04
1988c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO1 0x05
1998c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO2 0x06
2008c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO3 0x07
2018c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO4 0x08
2028c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO5 0x09
2038c2ecf20Sopenharmony_ci#define OUT_FUNC_OC4 0x0B
2048c2ecf20Sopenharmony_ci#define OUT_FUNC_OC7 0x0C
2058c2ecf20Sopenharmony_ci#define OUT_FUNC_REFCLKO1 0x0F
2068c2ecf20Sopenharmony_ci#define OUT_FUNC_U3RTS 0x01
2078c2ecf20Sopenharmony_ci#define OUT_FUNC_U4TX 0x02
2088c2ecf20Sopenharmony_ci#define OUT_FUNC_U6TX 0x04
2098c2ecf20Sopenharmony_ci#define OUT_FUNC_SS1 0x05
2108c2ecf20Sopenharmony_ci#define OUT_FUNC_SS3 0x07
2118c2ecf20Sopenharmony_ci#define OUT_FUNC_SS4 0x08
2128c2ecf20Sopenharmony_ci#define OUT_FUNC_SS5 0x09
2138c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO6 0x0A
2148c2ecf20Sopenharmony_ci#define OUT_FUNC_OC5 0x0B
2158c2ecf20Sopenharmony_ci#define OUT_FUNC_OC8 0x0C
2168c2ecf20Sopenharmony_ci#define OUT_FUNC_C1OUT 0x0E
2178c2ecf20Sopenharmony_ci#define OUT_FUNC_REFCLKO3 0x0F
2188c2ecf20Sopenharmony_ci#define OUT_FUNC_U1RTS 0x01
2198c2ecf20Sopenharmony_ci#define OUT_FUNC_U2TX 0x02
2208c2ecf20Sopenharmony_ci#define OUT_FUNC_U5RTS 0x03
2218c2ecf20Sopenharmony_ci#define OUT_FUNC_U6TX 0x04
2228c2ecf20Sopenharmony_ci#define OUT_FUNC_SS2 0x06
2238c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO4 0x08
2248c2ecf20Sopenharmony_ci#define OUT_FUNC_SDO6 0x0A
2258c2ecf20Sopenharmony_ci#define OUT_FUNC_OC2 0x0B
2268c2ecf20Sopenharmony_ci#define OUT_FUNC_OC1 0x0C
2278c2ecf20Sopenharmony_ci#define OUT_FUNC_OC9 0x0D
2288c2ecf20Sopenharmony_ci#define OUT_FUNC_C2TX 0x0F
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_civoid pic32_pps_input(int function, int pin);
2318c2ecf20Sopenharmony_civoid pic32_pps_output(int function, int pin);
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci#endif
234