xref: /freebsd/sys/arm/allwinner/h3/h3_padconf.c (revision fdafd315ad0d0f28a11b9fb4476a9ab059c62b92)
10aa4b813SEmmanuel Vadot /*-
234b8ef3dSEmmanuel Vadot  * Copyright (c) 2016-2017 Emmanuel Vadot <manu@freebsd.org>
30aa4b813SEmmanuel Vadot  *
40aa4b813SEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
50aa4b813SEmmanuel Vadot  * modification, are permitted provided that the following conditions
60aa4b813SEmmanuel Vadot  * are met:
70aa4b813SEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
80aa4b813SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer.
90aa4b813SEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
100aa4b813SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in the
110aa4b813SEmmanuel Vadot  *    documentation and/or other materials provided with the distribution.
120aa4b813SEmmanuel Vadot  *
130aa4b813SEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
140aa4b813SEmmanuel Vadot  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
150aa4b813SEmmanuel Vadot  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
160aa4b813SEmmanuel Vadot  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
170aa4b813SEmmanuel Vadot  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
180aa4b813SEmmanuel Vadot  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
190aa4b813SEmmanuel Vadot  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
200aa4b813SEmmanuel Vadot  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
210aa4b813SEmmanuel Vadot  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
220aa4b813SEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
230aa4b813SEmmanuel Vadot  * SUCH DAMAGE.
240aa4b813SEmmanuel Vadot  *
250aa4b813SEmmanuel Vadot  */
260aa4b813SEmmanuel Vadot 
270aa4b813SEmmanuel Vadot #include <sys/param.h>
280aa4b813SEmmanuel Vadot #include <sys/systm.h>
290aa4b813SEmmanuel Vadot #include <sys/kernel.h>
300aa4b813SEmmanuel Vadot #include <sys/types.h>
310aa4b813SEmmanuel Vadot 
3234b8ef3dSEmmanuel Vadot #if defined(__aarch64__)
3334b8ef3dSEmmanuel Vadot #include "opt_soc.h"
3434b8ef3dSEmmanuel Vadot #endif
3534b8ef3dSEmmanuel Vadot 
360aa4b813SEmmanuel Vadot #include <arm/allwinner/allwinner_pinctrl.h>
370aa4b813SEmmanuel Vadot 
3834b8ef3dSEmmanuel Vadot #if defined(SOC_ALLWINNER_H3) || defined(SOC_ALLWINNER_H5)
390aa4b813SEmmanuel Vadot 
400aa4b813SEmmanuel Vadot const static struct allwinner_pins h3_pins[] = {
4115b2342cSEmmanuel Vadot 	{"PA0",  0, 0,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, "pa_eint0", NULL}, 6, 0},
4215b2342cSEmmanuel Vadot 	{"PA1",  0, 1,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, "pa_eint1", NULL}, 6, 1},
4315b2342cSEmmanuel Vadot 	{"PA2",  0, 2,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, "pa_eint2", NULL}, 6, 2},
4415b2342cSEmmanuel Vadot 	{"PA3",  0, 3,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, "pa_eint3", NULL}, 6, 3},
4515b2342cSEmmanuel Vadot 	{"PA4",  0, 4,  {"gpio_in", "gpio_out", "uart0", NULL, NULL, NULL, "pa_eint4", NULL}, 6, 4},
4615b2342cSEmmanuel Vadot 	{"PA5",  0, 5,  {"gpio_in", "gpio_out", "uart0", "pwm0", NULL, NULL, "pa_eint5", NULL}, 6, 5},
4715b2342cSEmmanuel Vadot 	{"PA6",  0, 6,  {"gpio_in", "gpio_out", "sim", NULL, NULL, NULL, "pa_eint6", NULL}, 6, 6},
4815b2342cSEmmanuel Vadot 	{"PA7",  0, 7,  {"gpio_in", "gpio_out", "sim", NULL, NULL, NULL, "pa_eint7", NULL}, 6, 7},
4915b2342cSEmmanuel Vadot 	{"PA8",  0, 8,  {"gpio_in", "gpio_out", "sim", NULL, NULL, NULL, "pa_eint8", NULL}, 6, 8},
5015b2342cSEmmanuel Vadot 	{"PA9",  0, 9,  {"gpio_in", "gpio_out", "sim", NULL, NULL, NULL, "pa_eint9", NULL}, 6, 9},
5115b2342cSEmmanuel Vadot 	{"PA10", 0, 10, {"gpio_in", "gpio_out", "sim", NULL, NULL, NULL, "pa_eint10", NULL}, 6, 10},
5215b2342cSEmmanuel Vadot 	{"PA11", 0, 11, {"gpio_in", "gpio_out", "i2c0", "di", NULL, NULL, "pa_eint11", NULL}, 6, 11},
5315b2342cSEmmanuel Vadot 	{"PA12", 0, 12, {"gpio_in", "gpio_out", "i2c0", "di", NULL, NULL, "pa_eint12", NULL}, 6, 12},
5415b2342cSEmmanuel Vadot 	{"PA13", 0, 13, {"gpio_in", "gpio_out", "spi1", "uart3", NULL, NULL, "pa_eint13", NULL}, 6, 13},
5515b2342cSEmmanuel Vadot 	{"PA14", 0, 14, {"gpio_in", "gpio_out", "spi1", "uart3", NULL, NULL, "pa_eint14", NULL}, 6, 14},
5615b2342cSEmmanuel Vadot 	{"PA15", 0, 15, {"gpio_in", "gpio_out", "spi1", "uart3", NULL, NULL, "pa_eint15", NULL}, 6, 15},
5715b2342cSEmmanuel Vadot 	{"PA16", 0, 16, {"gpio_in", "gpio_out", "spi1", "uart3", NULL, NULL, "pa_eint16", NULL}, 6, 16},
5815b2342cSEmmanuel Vadot 	{"PA17", 0, 17, {"gpio_in", "gpio_out", "spdif", NULL, NULL, NULL, "pa_eint17", NULL}, 6, 17},
5915b2342cSEmmanuel Vadot 	{"PA18", 0, 18, {"gpio_in", "gpio_out", "i2s0", "i2c1", NULL, NULL, "pa_eint18", NULL}, 6, 18},
6015b2342cSEmmanuel Vadot 	{"PA19", 0, 19, {"gpio_in", "gpio_out", "i2s0", "i2c1", NULL, NULL, "pa_eint19", NULL}, 6, 19},
6115b2342cSEmmanuel Vadot 	{"PA20", 0, 20, {"gpio_in", "gpio_out", "i2s0", "sim", NULL, NULL, "pa_eint20", NULL}, 6, 20},
6215b2342cSEmmanuel Vadot 	{"PA21", 0, 21, {"gpio_in", "gpio_out", "i2s0", "sim", NULL, NULL, "pa_eint21", NULL}, 6, 21},
630aa4b813SEmmanuel Vadot 
640aa4b813SEmmanuel Vadot 	{"PC0",  2, 0,  {"gpio_in", "gpio_out", "nand", "spi0", NULL, NULL, NULL, NULL}},
650aa4b813SEmmanuel Vadot 	{"PC1",  2, 1,  {"gpio_in", "gpio_out", "nand", "spi0", NULL, NULL, NULL, NULL}},
660aa4b813SEmmanuel Vadot 	{"PC2",  2, 2,  {"gpio_in", "gpio_out", "nand", "spi0", NULL, NULL, NULL, NULL}},
670aa4b813SEmmanuel Vadot 	{"PC3",  2, 3,  {"gpio_in", "gpio_out", "nand", "spi0", NULL, NULL, NULL, NULL}},
680aa4b813SEmmanuel Vadot 	{"PC4",  2, 4,  {"gpio_in", "gpio_out", "nand", NULL, NULL, NULL, NULL, NULL}},
690aa4b813SEmmanuel Vadot 	{"PC5",  2, 5,  {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
700aa4b813SEmmanuel Vadot 	{"PC6",  2, 6,  {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
710aa4b813SEmmanuel Vadot 	{"PC7",  2, 7,  {"gpio_in", "gpio_out", "nand", NULL, NULL, NULL, NULL, NULL}},
720aa4b813SEmmanuel Vadot 	{"PC8",  2, 8,  {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
730aa4b813SEmmanuel Vadot 	{"PC9",  2, 9,  {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
740aa4b813SEmmanuel Vadot 	{"PC10", 2, 10, {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
750aa4b813SEmmanuel Vadot 	{"PC11", 2, 11, {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
760aa4b813SEmmanuel Vadot 	{"PC12", 2, 12, {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
770aa4b813SEmmanuel Vadot 	{"PC13", 2, 13, {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
780aa4b813SEmmanuel Vadot 	{"PC14", 2, 14, {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
790aa4b813SEmmanuel Vadot 	{"PC15", 2, 15, {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
800aa4b813SEmmanuel Vadot 	{"PC16", 2, 16, {"gpio_in", "gpio_out", "nand", "mmc2", NULL, NULL, NULL, NULL}},
810aa4b813SEmmanuel Vadot 
820aa4b813SEmmanuel Vadot 	{"PD0",  3, 0,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
830aa4b813SEmmanuel Vadot 	{"PD1",  3, 1,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
840aa4b813SEmmanuel Vadot 	{"PD2",  3, 2,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
850aa4b813SEmmanuel Vadot 	{"PD3",  3, 3,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
860aa4b813SEmmanuel Vadot 	{"PD4",  3, 4,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
870aa4b813SEmmanuel Vadot 	{"PD5",  3, 5,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
880aa4b813SEmmanuel Vadot 	{"PD6",  3, 6,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
890aa4b813SEmmanuel Vadot 	{"PD7",  3, 7,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
900aa4b813SEmmanuel Vadot 	{"PD8",  3, 8,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
910aa4b813SEmmanuel Vadot 	{"PD9",  3, 9,  {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
920aa4b813SEmmanuel Vadot 	{"PD10", 3, 10, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
930aa4b813SEmmanuel Vadot 	{"PD11", 3, 11, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
940aa4b813SEmmanuel Vadot 	{"PD12", 3, 12, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
950aa4b813SEmmanuel Vadot 	{"PD13", 3, 13, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
960aa4b813SEmmanuel Vadot 	{"PD14", 3, 14, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
970aa4b813SEmmanuel Vadot 	{"PD15", 3, 15, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
980aa4b813SEmmanuel Vadot 	{"PD16", 3, 16, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
990aa4b813SEmmanuel Vadot 	{"PD17", 3, 17, {"gpio_in", "gpio_out", "emac", NULL, NULL, NULL, NULL, NULL}},
1000aa4b813SEmmanuel Vadot 
1010aa4b813SEmmanuel Vadot 	{"PE0",  4, 0,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1020aa4b813SEmmanuel Vadot 	{"PE1",  4, 1,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1030aa4b813SEmmanuel Vadot 	{"PE2",  4, 2,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1040aa4b813SEmmanuel Vadot 	{"PE3",  4, 3,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1050aa4b813SEmmanuel Vadot 	{"PE4",  4, 4,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1060aa4b813SEmmanuel Vadot 	{"PE5",  4, 5,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1070aa4b813SEmmanuel Vadot 	{"PE6",  4, 6,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1080aa4b813SEmmanuel Vadot 	{"PE7",  4, 7,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1090aa4b813SEmmanuel Vadot 	{"PE8",  4, 8,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1100aa4b813SEmmanuel Vadot 	{"PE9",  4, 9,  {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1110aa4b813SEmmanuel Vadot 	{"PE10", 4, 10, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1120aa4b813SEmmanuel Vadot 	{"PE11", 4, 11, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}},
1130aa4b813SEmmanuel Vadot 	{"PE12", 4, 12, {"gpio_in", "gpio_out", "csi", "i2c2", NULL, NULL, NULL, NULL}},
1140aa4b813SEmmanuel Vadot 	{"PE13", 4, 13, {"gpio_in", "gpio_out", "csi", "i2c2", NULL, NULL, NULL, NULL}},
1150aa4b813SEmmanuel Vadot 	{"PE14", 4, 14, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}},
1160aa4b813SEmmanuel Vadot 	{"PE15", 4, 15, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}},
1170aa4b813SEmmanuel Vadot 
1180aa4b813SEmmanuel Vadot 	{"PF0",  5, 0,  {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}},
1190aa4b813SEmmanuel Vadot 	{"PF1",  5, 1,  {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}},
1200aa4b813SEmmanuel Vadot 	{"PF2",  5, 2,  {"gpio_in", "gpio_out", "mmc0", "uart0", NULL, NULL, NULL, NULL}},
1210aa4b813SEmmanuel Vadot 	{"PF3",  5, 3,  {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}},
1220aa4b813SEmmanuel Vadot 	{"PF4",  5, 4,  {"gpio_in", "gpio_out", "mmc0", "uart0", NULL, NULL, NULL, NULL}},
1230aa4b813SEmmanuel Vadot 	{"PF5",  5, 5,  {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}},
1240aa4b813SEmmanuel Vadot 	{"PF6",  5, 6,  {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}},
1250aa4b813SEmmanuel Vadot 
126*d07cc22bSEmmanuel Vadot 	{"PG0",  6, 0,  {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint0", NULL}, 6, 0, 1},
127*d07cc22bSEmmanuel Vadot 	{"PG1",  6, 1,  {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint1", NULL}, 6, 1, 1},
128*d07cc22bSEmmanuel Vadot 	{"PG2",  6, 2,  {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint2", NULL}, 6, 2, 1},
129*d07cc22bSEmmanuel Vadot 	{"PG3",  6, 3,  {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint3", NULL}, 6, 3, 1},
130*d07cc22bSEmmanuel Vadot 	{"PG4",  6, 4,  {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint4", NULL}, 6, 4, 1},
131*d07cc22bSEmmanuel Vadot 	{"PG5",  6, 5,  {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint5", NULL}, 6, 5, 1},
132*d07cc22bSEmmanuel Vadot 	{"PG6",  6, 6,  {"gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "pg_eint6", NULL}, 6, 6, 1},
133*d07cc22bSEmmanuel Vadot 	{"PG7",  6, 7,  {"gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "pg_eint7", NULL}, 6, 7, 1},
134*d07cc22bSEmmanuel Vadot 	{"PG8",  6, 8,  {"gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "pg_eint8", NULL}, 6, 8, 1},
135*d07cc22bSEmmanuel Vadot 	{"PG9",  6, 9,  {"gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "pg_eint9", NULL}, 6, 9, 1},
136*d07cc22bSEmmanuel Vadot 	{"PG10", 6, 10, {"gpio_in", "gpio_out", "i2s1", NULL, NULL, NULL, "pg_eint10", NULL}, 6, 10, 1},
137*d07cc22bSEmmanuel Vadot 	{"PG11", 6, 11, {"gpio_in", "gpio_out", "i2s1", NULL, NULL, NULL, "pg_eint11", NULL}, 6, 11, 1},
138*d07cc22bSEmmanuel Vadot 	{"PG12", 6, 12, {"gpio_in", "gpio_out", "i2s1", NULL, NULL, NULL, "pg_eint12", NULL}, 6, 12, 1},
139*d07cc22bSEmmanuel Vadot 	{"PG13", 6, 13, {"gpio_in", "gpio_out", "i2s1", NULL, NULL, NULL, "pg_eint13", NULL}, 6, 13, 1},
1400aa4b813SEmmanuel Vadot };
1410aa4b813SEmmanuel Vadot 
1420aa4b813SEmmanuel Vadot const struct allwinner_padconf h3_padconf = {
1430aa4b813SEmmanuel Vadot 	.npins = nitems(h3_pins),
1440aa4b813SEmmanuel Vadot 	.pins = h3_pins,
1450aa4b813SEmmanuel Vadot };
1460aa4b813SEmmanuel Vadot 
1470aa4b813SEmmanuel Vadot #endif /* SOC_ALLWINNER_H3 */
148