1*5639be33Sskrll /* $NetBSD: sun8i_v3s_gpio.c,v 1.1 2022/06/28 05:19:03 skrll Exp $ */ 2*5639be33Sskrll 3*5639be33Sskrll /*- 4*5639be33Sskrll * Copyright (c) 2021 Rui-Xiang Guo 5*5639be33Sskrll * All rights reserved. 6*5639be33Sskrll * 7*5639be33Sskrll * Redistribution and use in source and binary forms, with or without 8*5639be33Sskrll * modification, are permitted provided that the following conditions 9*5639be33Sskrll * are met: 10*5639be33Sskrll * 1. Redistributions of source code must retain the above copyright 11*5639be33Sskrll * notice, this list of conditions and the following disclaimer. 12*5639be33Sskrll * 2. Redistributions in binary form must reproduce the above copyright 13*5639be33Sskrll * notice, this list of conditions and the following disclaimer in the 14*5639be33Sskrll * documentation and/or other materials provided with the distribution. 15*5639be33Sskrll * 16*5639be33Sskrll * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17*5639be33Sskrll * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*5639be33Sskrll * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*5639be33Sskrll * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20*5639be33Sskrll * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*5639be33Sskrll * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*5639be33Sskrll * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*5639be33Sskrll * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*5639be33Sskrll * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*5639be33Sskrll * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*5639be33Sskrll * SUCH DAMAGE. 27*5639be33Sskrll * 28*5639be33Sskrll */ 29*5639be33Sskrll 30*5639be33Sskrll #include <sys/cdefs.h> 31*5639be33Sskrll __KERNEL_RCSID(0, "$NetBSD: sun8i_v3s_gpio.c,v 1.1 2022/06/28 05:19:03 skrll Exp $"); 32*5639be33Sskrll 33*5639be33Sskrll #include <sys/param.h> 34*5639be33Sskrll #include <sys/systm.h> 35*5639be33Sskrll #include <sys/kernel.h> 36*5639be33Sskrll #include <sys/types.h> 37*5639be33Sskrll 38*5639be33Sskrll #include <arm/sunxi/sunxi_gpio.h> 39*5639be33Sskrll 40*5639be33Sskrll static const struct sunxi_gpio_pins v3s_pins[] = { 41*5639be33Sskrll {"PB0", 1, 0, {"gpio_in", "gpio_out", "uart2", NULL, NULL, NULL, "irq", NULL}, 6, 0}, 42*5639be33Sskrll {"PB1", 1, 1, {"gpio_in", "gpio_out", "uart2", NULL, NULL, NULL, "irq", NULL}, 6, 1}, 43*5639be33Sskrll {"PB2", 1, 2, {"gpio_in", "gpio_out", "uart2", NULL, NULL, NULL, "irq", NULL}, 6, 2}, 44*5639be33Sskrll {"PB3", 1, 3, {"gpio_in", "gpio_out", "uart2", NULL, NULL, NULL, "irq", NULL}, 6, 3}, 45*5639be33Sskrll {"PB4", 1, 4, {"gpio_in", "gpio_out", "pwm0", NULL, NULL, NULL, "irq", NULL}, 6, 4}, 46*5639be33Sskrll {"PB5", 1, 5, {"gpio_in", "gpio_out", "pwm1", NULL, NULL, NULL, "irq", NULL}, 6, 5}, 47*5639be33Sskrll {"PB6", 1, 6, {"gpio_in", "gpio_out", "i2c0", NULL, NULL, NULL, "irq", NULL}, 6, 6}, 48*5639be33Sskrll {"PB7", 1, 7, {"gpio_in", "gpio_out", "i2c0", NULL, NULL, NULL, "irq", NULL}, 6, 7}, 49*5639be33Sskrll {"PB8", 1, 8, {"gpio_in", "gpio_out", "i2c1", "uart0", NULL, NULL, "irq", NULL}, 6, 8}, 50*5639be33Sskrll {"PB9", 1, 9, {"gpio_in", "gpio_out", "i2c1", "uart0", NULL, NULL, "irq", NULL}, 6, 9}, 51*5639be33Sskrll 52*5639be33Sskrll {"PC0", 2, 0, {"gpio_in", "gpio_out", "mmc2", "spi0", NULL, NULL, NULL, NULL}}, 53*5639be33Sskrll {"PC1", 2, 1, {"gpio_in", "gpio_out", "mmc2", "spi0", NULL, NULL, NULL, NULL}}, 54*5639be33Sskrll {"PC2", 2, 2, {"gpio_in", "gpio_out", "mmc2", "spi0", NULL, NULL, NULL, NULL}}, 55*5639be33Sskrll {"PC3", 2, 3, {"gpio_in", "gpio_out", "mmc2", "spi0", NULL, NULL, NULL, NULL}}, 56*5639be33Sskrll 57*5639be33Sskrll {"PE0", 4, 0, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 58*5639be33Sskrll {"PE1", 4, 1, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 59*5639be33Sskrll {"PE2", 4, 2, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 60*5639be33Sskrll {"PE3", 4, 3, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 61*5639be33Sskrll {"PE4", 4, 4, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 62*5639be33Sskrll {"PE5", 4, 5, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 63*5639be33Sskrll {"PE6", 4, 6, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 64*5639be33Sskrll {"PE7", 4, 7, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 65*5639be33Sskrll {"PE8", 4, 8, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 66*5639be33Sskrll {"PE9", 4, 9, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 67*5639be33Sskrll {"PE10", 4, 10, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 68*5639be33Sskrll {"PE11", 4, 11, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 69*5639be33Sskrll {"PE12", 4, 12, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 70*5639be33Sskrll {"PE13", 4, 13, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 71*5639be33Sskrll {"PE14", 4, 14, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 72*5639be33Sskrll {"PE15", 4, 15, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 73*5639be33Sskrll {"PE16", 4, 16, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 74*5639be33Sskrll {"PE17", 4, 17, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 75*5639be33Sskrll {"PE18", 4, 18, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 76*5639be33Sskrll {"PE19", 4, 19, {"gpio_in", "gpio_out", "csi", "lcd", NULL, NULL, NULL, NULL}}, 77*5639be33Sskrll {"PE20", 4, 20, {"gpio_in", "gpio_out", "csi", "csi_mipi", NULL, NULL, NULL, NULL}}, 78*5639be33Sskrll {"PE21", 4, 21, {"gpio_in", "gpio_out", "csi", "i2c1", "uart1", NULL, NULL, NULL}}, 79*5639be33Sskrll {"PE22", 4, 22, {"gpio_in", "gpio_out", "csi", "i2c1", "uart1", NULL, NULL, NULL}}, 80*5639be33Sskrll {"PE23", 4, 23, {"gpio_in", "gpio_out", "lcd", "uart1", NULL, NULL, NULL, NULL}}, 81*5639be33Sskrll {"PE24", 4, 24, {"gpio_in", "gpio_out", "lcd", "uart1", NULL, NULL, NULL, NULL}}, 82*5639be33Sskrll 83*5639be33Sskrll {"PF0", 5, 0, {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}}, 84*5639be33Sskrll {"PF1", 5, 1, {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}}, 85*5639be33Sskrll {"PF2", 5, 2, {"gpio_in", "gpio_out", "mmc0", "uart0", NULL, NULL, NULL, NULL}}, 86*5639be33Sskrll {"PF3", 5, 3, {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}}, 87*5639be33Sskrll {"PF4", 5, 4, {"gpio_in", "gpio_out", "mmc0", "uart0", NULL, NULL, NULL, NULL}}, 88*5639be33Sskrll {"PF5", 5, 5, {"gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, NULL, NULL}}, 89*5639be33Sskrll {"PF6", 5, 6, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}}, 90*5639be33Sskrll 91*5639be33Sskrll {"PG0", 6, 0, {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "irq", NULL}, 6, 0}, 92*5639be33Sskrll {"PG1", 6, 1, {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "irq", NULL}, 6, 1}, 93*5639be33Sskrll {"PG2", 6, 2, {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "irq", NULL}, 6, 2}, 94*5639be33Sskrll {"PG3", 6, 3, {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "irq", NULL}, 6, 3}, 95*5639be33Sskrll {"PG4", 6, 4, {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "irq", NULL}, 6, 4}, 96*5639be33Sskrll {"PG5", 6, 5, {"gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "irq", NULL}, 6, 5}, 97*5639be33Sskrll }; 98*5639be33Sskrll 99*5639be33Sskrll const struct sunxi_gpio_padconf sun8i_v3s_padconf = { 100*5639be33Sskrll .npins = __arraycount(v3s_pins), 101*5639be33Sskrll .pins = v3s_pins, 102*5639be33Sskrll }; 103