Home | History | Annotate | Line # | Download | only in rockchip
rk3588_iomux.c revision 1.1
      1  1.1  ryo /*	$NetBSD: rk3588_iomux.c,v 1.1 2022/08/23 05:39:06 ryo Exp $	*/
      2  1.1  ryo 
      3  1.1  ryo /*-
      4  1.1  ryo  * Copyright (c) 2022 Ryo Shimizu <ryo (at) nerv.org>
      5  1.1  ryo  * All rights reserved.
      6  1.1  ryo  *
      7  1.1  ryo  * Redistribution and use in source and binary forms, with or without
      8  1.1  ryo  * modification, are permitted provided that the following conditions
      9  1.1  ryo  * are met:
     10  1.1  ryo  * 1. Redistributions of source code must retain the above copyright
     11  1.1  ryo  *    notice, this list of conditions and the following disclaimer.
     12  1.1  ryo  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  ryo  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  ryo  *    documentation and/or other materials provided with the distribution.
     15  1.1  ryo  *
     16  1.1  ryo  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
     17  1.1  ryo  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18  1.1  ryo  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  1.1  ryo  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     20  1.1  ryo  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  1.1  ryo  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  1.1  ryo  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1  ryo  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     24  1.1  ryo  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     25  1.1  ryo  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  ryo  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  ryo  */
     28  1.1  ryo 
     29  1.1  ryo #include <sys/cdefs.h>
     30  1.1  ryo __KERNEL_RCSID(0, "$NetBSD: rk3588_iomux.c,v 1.1 2022/08/23 05:39:06 ryo Exp $");
     31  1.1  ryo 
     32  1.1  ryo #include <sys/param.h>
     33  1.1  ryo #include <sys/device.h>
     34  1.1  ryo 
     35  1.1  ryo #include <dev/fdt/fdtvar.h>
     36  1.1  ryo #include <dev/fdt/syscon.h>
     37  1.1  ryo 
     38  1.1  ryo /* #define RK3588_IOMUX_DEBUG */
     39  1.1  ryo 
     40  1.1  ryo struct rk3588_iomux_softc {
     41  1.1  ryo 	device_t sc_dev;
     42  1.1  ryo 	struct syscon *sc_grf;
     43  1.1  ryo };
     44  1.1  ryo 
     45  1.1  ryo static int rk3588_iomux_match(device_t, cfdata_t, void *);
     46  1.1  ryo static void rk3588_iomux_attach(device_t, device_t, void *);
     47  1.1  ryo 
     48  1.1  ryo CFATTACH_DECL_NEW(rk3588_iomux, sizeof(struct rk3588_iomux_softc),
     49  1.1  ryo     rk3588_iomux_match, rk3588_iomux_attach, NULL, NULL);
     50  1.1  ryo 
     51  1.1  ryo static const struct device_compatible_entry compat_data[] = {
     52  1.1  ryo 	{ .compat = "rockchip,rk3588-pinctrl" },
     53  1.1  ryo 	DEVICE_COMPAT_EOL
     54  1.1  ryo };
     55  1.1  ryo 
     56  1.1  ryo /* GRF offsets */
     57  1.1  ryo #define RK3588_PMU1_IOC_REG		0x00000000
     58  1.1  ryo #define RK3588_PMU2_IOC_REG		0x00004000
     59  1.1  ryo #define RK3588_BUS_IOC_REG		0x00008000
     60  1.1  ryo #define RK3588_VCCIO1_4_IOC_REG		0x00009000
     61  1.1  ryo #define RK3588_VCCIO3_5_IOC_REG		0x0000a000
     62  1.1  ryo #define RK3588_VCCIO2_IOC_REG		0x0000b000
     63  1.1  ryo #define RK3588_VCCIO6_IOC_REG		0x0000c000
     64  1.1  ryo #define RK3588_EMMC_IOC_REG		0x0000d000
     65  1.1  ryo 
     66  1.1  ryo #define NBANKS				5
     67  1.1  ryo #define NPINPERBANK			32
     68  1.1  ryo #define NPINS				(NBANKS * NPINPERBANK)
     69  1.1  ryo 
     70  1.1  ryo #define PIN(bank, idx)			(((bank) * NPINPERBANK) + (idx))
     71  1.1  ryo 
     72  1.1  ryo struct regmask {
     73  1.1  ryo 	bus_size_t reg;
     74  1.1  ryo 	uint32_t mask;
     75  1.1  ryo };
     76  1.1  ryo 
     77  1.1  ryo struct regmaskreg {
     78  1.1  ryo 	bus_size_t reg;
     79  1.1  ryo 	uint32_t mask;
     80  1.1  ryo 	bus_size_t reg0;
     81  1.1  ryo };
     82  1.1  ryo 
     83  1.1  ryo static const struct regmask rk3588_drive_regmap[NBANKS * NPINPERBANK] = {
     84  1.1  ryo 	/* GPIO0_A[0-7] */
     85  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0010,		__BITS(3,0)	},
     86  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0010,		__BITS(7,4)	},
     87  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0010,		__BITS(11,8)	},
     88  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0010,		__BITS(15,12)	},
     89  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0014,		__BITS(3,0)	},
     90  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0014,		__BITS(7,4)	},
     91  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0014,		__BITS(11,8)	},
     92  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0014,		__BITS(15,12)	},
     93  1.1  ryo 	/* GPIO0_B[0-7] */
     94  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0018,		__BITS(3,0)	},
     95  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0018,		__BITS(7,4)	},
     96  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0018,		__BITS(11,8)	},
     97  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0018,		__BITS(15,12)	},
     98  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0014,		__BITS(3,0)	},
     99  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0014,		__BITS(7,4)	},
    100  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0014,		__BITS(11,8)	},
    101  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0014,		__BITS(15,12)	},
    102  1.1  ryo 	/* GPIO0_C[0-7] */
    103  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0018,		__BITS(3,0)	},
    104  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0018,		__BITS(7,4)	},
    105  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0018,		__BITS(11,8)	},
    106  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0018,		__BITS(15,12)	},
    107  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x001c,		__BITS(3,0)	},
    108  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x001c,		__BITS(7,4)	},
    109  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x001c,		__BITS(11,8)	},
    110  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x001c,		__BITS(15,12)	},
    111  1.1  ryo 	/* GPIO0_D[0-7] */
    112  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0020,		__BITS(3,0)	},
    113  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0020,		__BITS(7,4)	},
    114  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0020,		__BITS(11,8)	},
    115  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0020,		__BITS(15,12)	},
    116  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0024,		__BITS(3,0)	},
    117  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0024,		__BITS(7,4)	},
    118  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0024,		__BITS(11,8)	},
    119  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0024,		__BITS(15,12)	},
    120  1.1  ryo 
    121  1.1  ryo 	/* GPIO1_A[0-7] */
    122  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0020,	__BITS(3,0)	},
    123  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0020,	__BITS(7,4)	},
    124  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0020,	__BITS(11,8)	},
    125  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0020,	__BITS(15,12)	},
    126  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0024,	__BITS(3,0)	},
    127  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0024,	__BITS(7,4)	},
    128  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0024,	__BITS(11,8)	},
    129  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0024,	__BITS(15,12)	},
    130  1.1  ryo 	/* GPIO1_B[0-7] */
    131  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0028,	__BITS(3,0)	},
    132  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0028,	__BITS(7,4)	},
    133  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0028,	__BITS(11,8)	},
    134  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0028,	__BITS(15,12)	},
    135  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x002c,	__BITS(3,0)	},
    136  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x002c,	__BITS(7,4)	},
    137  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x002c,	__BITS(11,8)	},
    138  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x002c,	__BITS(15,12)	},
    139  1.1  ryo 	/* GPIO1_C[0-7] */
    140  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0030,	__BITS(3,0)	},
    141  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0030,	__BITS(7,4)	},
    142  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0030,	__BITS(11,8)	},
    143  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0030,	__BITS(15,12)	},
    144  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0034,	__BITS(3,0)	},
    145  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0034,	__BITS(7,4)	},
    146  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0034,	__BITS(11,8)	},
    147  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0034,	__BITS(15,12)	},
    148  1.1  ryo 	/* GPIO1_D[0-7] */
    149  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0038,	__BITS(3,0)	},
    150  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0038,	__BITS(7,4)	},
    151  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0038,	__BITS(11,8)	},
    152  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0038,	__BITS(15,12)	},
    153  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x003c,	__BITS(3,0)	},
    154  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x003c,	__BITS(7,4)	},
    155  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x003c,	__BITS(11,8)	},
    156  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x003c,	__BITS(15,12)	},
    157  1.1  ryo 
    158  1.1  ryo 	/* GPIO2_A[0-7] */
    159  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0040,		__BITS(3,0)	},
    160  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0040,		__BITS(7,4)	},
    161  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0040,		__BITS(11,8)	},
    162  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0040,		__BITS(15,12)	},
    163  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0044,	__BITS(3,0)	},
    164  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0044,	__BITS(7,4)	},
    165  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0044,	__BITS(11,8)	},
    166  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0044,	__BITS(15,12)	},
    167  1.1  ryo 	/* GPIO2_B[0-7] */
    168  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0048,	__BITS(3,0)	},
    169  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0048,	__BITS(7,4)	},
    170  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0048,	__BITS(11,8)	},
    171  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0048,	__BITS(15,12)	},
    172  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x004c,	__BITS(3,0)	},
    173  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x004c,	__BITS(7,4)	},
    174  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x004c,	__BITS(11,8)	},
    175  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x004c,	__BITS(15,12)	},
    176  1.1  ryo 	/* GPIO2_C[0-7] */
    177  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0050,	__BITS(3,0)	},
    178  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0050,	__BITS(7,4)	},
    179  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0050,	__BITS(11,8)	},
    180  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0050,	__BITS(15,12)	},
    181  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0054,	__BITS(3,0)	},
    182  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0054,	__BITS(7,4)	},
    183  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0054,	__BITS(11,8)	},
    184  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0054,	__BITS(15,12)	},
    185  1.1  ryo 	/* GPIO2_D[0-7] */
    186  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0058,		__BITS(3,0)	},
    187  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0058,		__BITS(7,4)	},
    188  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0058,		__BITS(11,8)	},
    189  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0058,		__BITS(15,12)	},
    190  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x005c,		__BITS(3,0)	},
    191  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x005c,		__BITS(7,4)	},
    192  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x005c,		__BITS(11,8)	},
    193  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x005c,		__BITS(15,12)	},
    194  1.1  ryo 
    195  1.1  ryo 	/* GPIO3_A[0-7] */
    196  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0060,	__BITS(3,0)	},
    197  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0060,	__BITS(7,4)	},
    198  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0060,	__BITS(11,8)	},
    199  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0060,	__BITS(15,12)	},
    200  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0064,	__BITS(3,0)	},
    201  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0064,	__BITS(7,4)	},
    202  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0064,	__BITS(11,8)	},
    203  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0064,	__BITS(15,12)	},
    204  1.1  ryo 	/* GPIO3_B[0-7] */
    205  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0068,	__BITS(3,0)	},
    206  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0068,	__BITS(7,4)	},
    207  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0068,	__BITS(11,8)	},
    208  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0068,	__BITS(15,12)	},
    209  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x006c,	__BITS(3,0)	},
    210  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x006c,	__BITS(7,4)	},
    211  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x006c,	__BITS(11,8)	},
    212  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x006c,	__BITS(15,12)	},
    213  1.1  ryo 	/* GPIO3_C[0-7] */
    214  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0070,	__BITS(3,0)	},
    215  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0070,	__BITS(7,4)	},
    216  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0070,	__BITS(11,8)	},
    217  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0070,	__BITS(15,12)	},
    218  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0074,	__BITS(3,0)	},
    219  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0074,	__BITS(7,4)	},
    220  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0074,	__BITS(11,8)	},
    221  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0074,	__BITS(15,12)	},
    222  1.1  ryo 	/* GPIO3_D[0-7] */
    223  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0078,	__BITS(3,0)	},
    224  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0078,	__BITS(7,4)	},
    225  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0078,	__BITS(11,8)	},
    226  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0078,	__BITS(15,12)	},
    227  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x007c,	__BITS(3,0)	},
    228  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x007c,	__BITS(7,4)	},
    229  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x007c,	__BITS(11,8)	},
    230  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x007c,	__BITS(15,12)	},
    231  1.1  ryo 
    232  1.1  ryo 	/* GPIO4_A[0-7] */
    233  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0080,	__BITS(3,0)	},
    234  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0080,	__BITS(7,4)	},
    235  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0080,	__BITS(11,8)	},
    236  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0080,	__BITS(15,12)	},
    237  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0084,	__BITS(3,0)	},
    238  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0084,	__BITS(7,4)	},
    239  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0084,	__BITS(11,8)	},
    240  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0084,	__BITS(15,12)	},
    241  1.1  ryo 	/* GPIO4_B[0-7] */
    242  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0088,	__BITS(3,0)	},
    243  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0088,	__BITS(7,4)	},
    244  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0088,	__BITS(11,8)	},
    245  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0088,	__BITS(15,12)	},
    246  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x008c,	__BITS(3,0)	},
    247  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x008c,	__BITS(7,4)	},
    248  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x008c,	__BITS(11,8)	},
    249  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x008c,	__BITS(15,12)	},
    250  1.1  ryo 	/* GPIO4_C[0-7] */
    251  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0090,	__BITS(3,0)	},
    252  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0090,	__BITS(7,4)	},
    253  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0090,	__BITS(11,8)	},
    254  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0090,	__BITS(15,12)	},
    255  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0094,	__BITS(3,0)	},
    256  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0094,	__BITS(7,4)	},
    257  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0094,	__BITS(11,8)	},
    258  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0094,	__BITS(15,12)	},
    259  1.1  ryo 	/* GPIO4_D[0-7] */
    260  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x0098,	__BITS(3,0)	},
    261  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x0098,	__BITS(7,4)	},
    262  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x0098,	__BITS(11,8)	},
    263  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x0098,	__BITS(15,12)	},
    264  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x009c,	__BITS(3,0)	},
    265  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x009c,	__BITS(7,4)	},
    266  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x009c,	__BITS(11,8)	},
    267  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x009c,	__BITS(15,12)	}
    268  1.1  ryo };
    269  1.1  ryo 
    270  1.1  ryo #define RK3588_GPIO_P_CTL_Z	0
    271  1.1  ryo #define RK3588_GPIO_P_PULLDOWN	1
    272  1.1  ryo #define RK3588_GPIO_P_DISABLE	2
    273  1.1  ryo #define RK3588_GPIO_P_PULLUP	3
    274  1.1  ryo 
    275  1.1  ryo static const struct regmask rk3588_pull_regmap[NBANKS * NPINPERBANK] = {
    276  1.1  ryo 	/* GPIO0_A[0-7] */
    277  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(1,0)	},
    278  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(3,2)	},
    279  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(5,4)	},
    280  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(7,6)	},
    281  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(9,8)	},
    282  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(11,10)	},
    283  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(13,12)	},
    284  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0020,		__BITS(15,14)	},
    285  1.1  ryo 	/* GPIO0_B[0-7] */
    286  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0024,		__BITS(1,0)	},
    287  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0024,		__BITS(3,2)	},
    288  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0024,		__BITS(5,4)	},
    289  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0024,		__BITS(7,6)	},
    290  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0024,		__BITS(9,8)	},
    291  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0028,		__BITS(11,10)	},
    292  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0028,		__BITS(13,12)	},
    293  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0028,		__BITS(15,14)	},
    294  1.1  ryo 	/* GPIO0_C[0-7] */
    295  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(1,0)	},
    296  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(3,2)	},
    297  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(5,4)	},
    298  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(7,6)	},
    299  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(9,8)	},
    300  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(11,10)	},
    301  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(13,12)	},
    302  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x002c,		__BITS(15,14)	},
    303  1.1  ryo 	/* GPIO0_D[0-7] */
    304  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(1,0)	},
    305  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(3,2)	},
    306  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(5,4)	},
    307  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(7,6)	},
    308  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(9,8)	},
    309  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(11,10)	},
    310  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(13,12)	},
    311  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0030,		__BITS(15,14)	},
    312  1.1  ryo 
    313  1.1  ryo 	/* GPIO1_A[0-7] */
    314  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(1,0)	},
    315  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(3,2)	},
    316  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(5,4)	},
    317  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(7,6)	},
    318  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(9,8)	},
    319  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(11,10)	},
    320  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(13,12)	},
    321  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0110,	__BITS(15,14)	},
    322  1.1  ryo 	/* GPIO1_B[0-7] */
    323  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(1,0)	},
    324  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(3,2)	},
    325  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(5,4)	},
    326  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(7,6)	},
    327  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(9,8)	},
    328  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(11,10)	},
    329  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(13,12)	},
    330  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0114,	__BITS(15,14)	},
    331  1.1  ryo 	/* GPIO1_C[0-7] */
    332  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(1,0)	},
    333  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(3,2)	},
    334  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(5,4)	},
    335  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(7,6)	},
    336  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(9,8)	},
    337  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(11,10)	},
    338  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(13,12)	},
    339  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0118,	__BITS(15,14)	},
    340  1.1  ryo 	/* GPIO1_D[0-7] */
    341  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(1,0)	},
    342  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(3,2)	},
    343  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(5,4)	},
    344  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(7,6)	},
    345  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(9,8)	},
    346  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(11,10)	},
    347  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(13,12)	},
    348  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x011c,	__BITS(15,14)	},
    349  1.1  ryo 
    350  1.1  ryo 	/* GPIO2_A[0-7] */
    351  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0120,		__BITS(1,0)	},
    352  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0120,		__BITS(3,2)	},
    353  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0120,		__BITS(5,4)	},
    354  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0120,		__BITS(7,6)	},
    355  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0120,		__BITS(9,8)	},
    356  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0120,		__BITS(11,10)	},
    357  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0120,	__BITS(13,12)	},
    358  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0120,	__BITS(15,14)	},
    359  1.1  ryo 	/* GPIO2_B[0-7] */
    360  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(1,0)	},
    361  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(3,2)	},
    362  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(5,4)	},
    363  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(7,6)	},
    364  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(9,8)	},
    365  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(11,10)	},
    366  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(13,12)	},
    367  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0124,	__BITS(15,14)	},
    368  1.1  ryo 	/* GPIO2_C[0-7] */
    369  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(1,0)	},
    370  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(3,2)	},
    371  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(5,4)	},
    372  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(7,6)	},
    373  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(9,8)	},
    374  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(11,10)	},
    375  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(13,12)	},
    376  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0128,	__BITS(15,14)	},
    377  1.1  ryo 	/* GPIO2_D[0-7] */
    378  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(1,0)	},
    379  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(3,2)	},
    380  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(5,4)	},
    381  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(7,6)	},
    382  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(9,8)	},
    383  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(11,10)	},
    384  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(13,12)	},
    385  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x012c,		__BITS(15,14)	},
    386  1.1  ryo 
    387  1.1  ryo 	/* GPIO3_A[0-7] */
    388  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(1,0)	},
    389  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(3,2)	},
    390  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(5,4)	},
    391  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(7,6)	},
    392  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(9,8)	},
    393  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(11,10)	},
    394  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(13,12)	},
    395  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0130,	__BITS(15,14)	},
    396  1.1  ryo 	/* GPIO3_B[0-7] */
    397  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(1,0)	},
    398  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(3,2)	},
    399  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(5,4)	},
    400  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(7,6)	},
    401  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(9,8)	},
    402  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(11,10)	},
    403  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(13,12)	},
    404  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0134,	__BITS(15,14)	},
    405  1.1  ryo 	/* GPIO3_C[0-7] */
    406  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(1,0)	},
    407  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(3,2)	},
    408  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(5,4)	},
    409  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(7,6)	},
    410  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(9,8)	},
    411  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(11,10)	},
    412  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(13,12)	},
    413  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0138,	__BITS(15,14)	},
    414  1.1  ryo 	/* GPIO3_D[0-7] */
    415  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(1,0)	},
    416  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(3,2)	},
    417  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(5,4)	},
    418  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(7,6)	},
    419  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(9,8)	},
    420  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(11,10)	},
    421  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(13,12)	},
    422  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x013c,	__BITS(15,14)	},
    423  1.1  ryo 
    424  1.1  ryo 	/* GPIO4_A[0-7] */
    425  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(1,0)	},
    426  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(3,2)	},
    427  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(5,4)	},
    428  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(7,6)	},
    429  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(9,8)	},
    430  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(11,10)	},
    431  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(13,12)	},
    432  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0140,	__BITS(15,14)	},
    433  1.1  ryo 	/* GPIO4_B[0-7] */
    434  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(1,0)	},
    435  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(3,2)	},
    436  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(5,4)	},
    437  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(7,6)	},
    438  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(9,8)	},
    439  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(11,10)	},
    440  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(13,12)	},
    441  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0144,	__BITS(15,14)	},
    442  1.1  ryo 	/* GPIO4_C[0-7] */
    443  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0148,	__BITS(1,0)	},
    444  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0148,	__BITS(3,2)	},
    445  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0148,	__BITS(5,4)	},
    446  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0148,	__BITS(7,6)	},
    447  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0148,	__BITS(9,8)	},
    448  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0148,	__BITS(11,10)	},
    449  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0148,	__BITS(13,12)	},
    450  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0148,	__BITS(15,14)	},
    451  1.1  ryo 	/* GPIO4_D[0-7] */
    452  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(1,0)	},
    453  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(3,2)	},
    454  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(5,4)	},
    455  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(7,6)	},
    456  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(9,8)	},
    457  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(11,10)	},
    458  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(13,12)	},
    459  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x014c,	__BITS(15,14)	}
    460  1.1  ryo };
    461  1.1  ryo 
    462  1.1  ryo #if notyet
    463  1.1  ryo static const struct regmask rk3588_schmitt_regmap[NBANKS * NPINPERBANK] = {
    464  1.1  ryo 	/* GPIO0_A[0-7] */
    465  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(0)	},
    466  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(1)	},
    467  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(2)	},
    468  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(3)	},
    469  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(4)	},
    470  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(5)	},
    471  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(6)	},
    472  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0030,		__BIT(7)	},
    473  1.1  ryo 	/* GPIO0_B[0-7] */
    474  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0034,		__BIT(0)	},
    475  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0034,		__BIT(1)	},
    476  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0034,		__BIT(2)	},
    477  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0034,		__BIT(3)	},
    478  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0034,		__BIT(4)	},
    479  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0040,		__BIT(5)	},
    480  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0040,		__BIT(6)	},
    481  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0040,		__BIT(7)	},
    482  1.1  ryo 	/* GPIO0_C[0-7] */
    483  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(0)	},
    484  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(1)	},
    485  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(2)	},
    486  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(3)	},
    487  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(4)	},
    488  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(5)	},
    489  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(6)	},
    490  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0044,		__BIT(7)	},
    491  1.1  ryo 	/* GPIO0_D[0-7] */
    492  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(0)	},
    493  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(1)	},
    494  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(2)	},
    495  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(3)	},
    496  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(4)	},
    497  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(5)	},
    498  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(6)	},
    499  1.1  ryo 	{ RK3588_PMU2_IOC_REG + 0x0048,		__BIT(7)	},
    500  1.1  ryo 
    501  1.1  ryo 	/* GPIO1_A[0-7] */
    502  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(0)	},
    503  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(1)	},
    504  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(2)	},
    505  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(3)	},
    506  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(4)	},
    507  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(5)	},
    508  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(6)	},
    509  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0210,	__BIT(7)	},
    510  1.1  ryo 	/* GPIO1_B[0-7] */
    511  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(0)	},
    512  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(1)	},
    513  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(2)	},
    514  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(3)	},
    515  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(4)	},
    516  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(5)	},
    517  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(6)	},
    518  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0214,	__BIT(7)	},
    519  1.1  ryo 	/* GPIO1_C[0-7] */
    520  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(0)	},
    521  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(1)	},
    522  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(2)	},
    523  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(3)	},
    524  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(4)	},
    525  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(5)	},
    526  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(6)	},
    527  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x0218,	__BIT(7)	},
    528  1.1  ryo 	/* GPIO1_D[0-7] */
    529  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(0)	},
    530  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(1)	},
    531  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(2)	},
    532  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(3)	},
    533  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(4)	},
    534  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(5)	},
    535  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(6)	},
    536  1.1  ryo 	{ RK3588_VCCIO1_4_IOC_REG + 0x021c,	__BIT(7)	},
    537  1.1  ryo 
    538  1.1  ryo 	/* GPIO2_A[0-7] */
    539  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0220,		__BIT(0)	},
    540  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0220,		__BIT(1)	},
    541  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0220,		__BIT(2)	},
    542  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0220,		__BIT(3)	},
    543  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0220,		__BIT(4)	},
    544  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x0220,		__BIT(5)	},
    545  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0220,	__BIT(6)	},
    546  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0220,	__BIT(7)	},
    547  1.1  ryo 	/* GPIO2_B[0-7] */
    548  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(0)	},
    549  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(1)	},
    550  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(2)	},
    551  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(3)	},
    552  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(4)	},
    553  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(5)	},
    554  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(6)	},
    555  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0224,	__BIT(7)	},
    556  1.1  ryo 	/* GPIO2_C[0-7] */
    557  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(0)	},
    558  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(1)	},
    559  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(2)	},
    560  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(3)	},
    561  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(4)	},
    562  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(5)	},
    563  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(6)	},
    564  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0228,	__BIT(7)	},
    565  1.1  ryo 	/* GPIO2_D[0-7] */
    566  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(0)	},
    567  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(1)	},
    568  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(2)	},
    569  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(3)	},
    570  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(4)	},
    571  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(5)	},
    572  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(6)	},
    573  1.1  ryo 	{ RK3588_EMMC_IOC_REG + 0x022c,		__BIT(7)	},
    574  1.1  ryo 
    575  1.1  ryo 	/* GPIO3_A[0-7] */
    576  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(0)	},
    577  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(1)	},
    578  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(2)	},
    579  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(3)	},
    580  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(4)	},
    581  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(5)	},
    582  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(6)	},
    583  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0230,	__BIT(7)	},
    584  1.1  ryo 	/* GPIO3_B[0-7] */
    585  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(0)	},
    586  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(1)	},
    587  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(2)	},
    588  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(3)	},
    589  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(4)	},
    590  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(5)	},
    591  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(6)	},
    592  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0234,	__BIT(7)	},
    593  1.1  ryo 	/* GPIO3_C[0-7] */
    594  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(0)	},
    595  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(1)	},
    596  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(2)	},
    597  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(3)	},
    598  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(4)	},
    599  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(5)	},
    600  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(6)	},
    601  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0238,	__BIT(7)	},
    602  1.1  ryo 	/* GPIO3_D[0-7] */
    603  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(0)	},
    604  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(1)	},
    605  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(2)	},
    606  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(3)	},
    607  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(4)	},
    608  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(5)	},
    609  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(6)	},
    610  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x023c,	__BIT(7)	},
    611  1.1  ryo 
    612  1.1  ryo 	/* GPIO4_A[0-7] */
    613  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(0)	},
    614  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(1)	},
    615  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(2)	},
    616  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(3)	},
    617  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(4)	},
    618  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(5)	},
    619  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(6)	},
    620  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0240,	__BIT(7)	},
    621  1.1  ryo 	/* GPIO4_B[0-7] */
    622  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(0)	},
    623  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(1)	},
    624  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(2)	},
    625  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(3)	},
    626  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(4)	},
    627  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(5)	},
    628  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(6)	},
    629  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0244,	__BIT(7)	},
    630  1.1  ryo 	/* GPIO4_C[0-7] */
    631  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0248,	__BIT(0)	},
    632  1.1  ryo 	{ RK3588_VCCIO6_IOC_REG + 0x0248,	__BIT(1)	},
    633  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0248,	__BIT(2)	},
    634  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0248,	__BIT(3)	},
    635  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0248,	__BIT(4)	},
    636  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0248,	__BIT(5)	},
    637  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0248,	__BIT(6)	},
    638  1.1  ryo 	{ RK3588_VCCIO3_5_IOC_REG + 0x0248,	__BIT(7)	},
    639  1.1  ryo 	/* GPIO4_D[0-7] */
    640  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(0)	},
    641  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(1)	},
    642  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(2)	},
    643  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(3)	},
    644  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(4)	},
    645  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(5)	},
    646  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(6)	},
    647  1.1  ryo 	{ RK3588_VCCIO2_IOC_REG + 0x024c,	__BIT(7)	}
    648  1.1  ryo };
    649  1.1  ryo #endif
    650  1.1  ryo 
    651  1.1  ryo static const struct regmaskreg rk3588_iomux_regmap[NBANKS * NPINPERBANK] = {
    652  1.1  ryo 	/* GPIO0_A[0-7] */
    653  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0000,	__BITS(3,0)	},
    654  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0000,	__BITS(7,4)	},
    655  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0000,	__BITS(11,8)	},
    656  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0000,	__BITS(15,12)	},
    657  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0004,	__BITS(3,0)	},
    658  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0004,	__BITS(7,4)	},
    659  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0004,	__BITS(11,8)	},
    660  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0004,	__BITS(15,12)	},
    661  1.1  ryo 	/* GPIO0_B[0-7] */
    662  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0008,	__BITS(3,0)	},
    663  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0008,	__BITS(7,4)	},
    664  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0008,	__BITS(11,8)	},
    665  1.1  ryo 	{ RK3588_PMU1_IOC_REG + 0x0008,	__BITS(15,12)	},
    666  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x000c,	__BITS(3,0),	RK3588_PMU2_IOC_REG + 0x0000 },
    667  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x000c,	__BITS(7,4),	RK3588_PMU2_IOC_REG + 0x0000 },
    668  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x000c,	__BITS(11,8),	RK3588_PMU2_IOC_REG + 0x0000 },
    669  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x000c,	__BITS(15,12),	RK3588_PMU2_IOC_REG + 0x0000 },
    670  1.1  ryo 	/* GPIO0_C[0-7] */
    671  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0010,	__BITS(3,0),	RK3588_PMU2_IOC_REG + 0x0004 },
    672  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0010,	__BITS(7,4),	RK3588_PMU2_IOC_REG + 0x0004 },
    673  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0010,	__BITS(11,8),	RK3588_PMU2_IOC_REG + 0x0004 },
    674  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0010,	__BITS(15,12),	RK3588_PMU2_IOC_REG + 0x0004 },
    675  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0014,	__BITS(3,0),	RK3588_PMU2_IOC_REG + 0x0008 },
    676  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0014,	__BITS(7,4),	RK3588_PMU2_IOC_REG + 0x0008 },
    677  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0014,	__BITS(11,8),	RK3588_PMU2_IOC_REG + 0x0008 },
    678  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0014,	__BITS(15,12),	RK3588_PMU2_IOC_REG + 0x0008 },
    679  1.1  ryo 	/* GPIO0_D[0-7] */
    680  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0018,	__BITS(3,0),	RK3588_PMU2_IOC_REG + 0x000c },
    681  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0018,	__BITS(7,4),	RK3588_PMU2_IOC_REG + 0x000c },
    682  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0018,	__BITS(11,8),	RK3588_PMU2_IOC_REG + 0x000c },
    683  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0018,	__BITS(15,12),	RK3588_PMU2_IOC_REG + 0x000c },
    684  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x001c,	__BITS(3,0),	RK3588_PMU2_IOC_REG + 0x0010 },
    685  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x001c,	__BITS(7,4),	RK3588_PMU2_IOC_REG + 0x0010 },
    686  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x001c,	__BITS(11,8),	RK3588_PMU2_IOC_REG + 0x0010 },
    687  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x001c,	__BITS(15,12),	RK3588_PMU2_IOC_REG + 0x0010 },
    688  1.1  ryo 
    689  1.1  ryo 	/* GPIO1_A[0-7] */
    690  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0020,	__BITS(3,0)	},
    691  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0020,	__BITS(7,4)	},
    692  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0020,	__BITS(11,8)	},
    693  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0020,	__BITS(15,12)	},
    694  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0024,	__BITS(3,0)	},
    695  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0024,	__BITS(7,4)	},
    696  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0024,	__BITS(11,8)	},
    697  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0024,	__BITS(15,12)	},
    698  1.1  ryo 	/* GPIO1_B[0-7] */
    699  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0028,	__BITS(3,0)	},
    700  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0028,	__BITS(7,4)	},
    701  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0028,	__BITS(11,8)	},
    702  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0028,	__BITS(15,12)	},
    703  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x002c,	__BITS(3,0)	},
    704  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x002c,	__BITS(7,4)	},
    705  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x002c,	__BITS(11,8)	},
    706  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x002c,	__BITS(15,12)	},
    707  1.1  ryo 	/* GPIO1_C[0-7] */
    708  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0030,	__BITS(3,0)	},
    709  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0030,	__BITS(7,4)	},
    710  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0030,	__BITS(11,8)	},
    711  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0030,	__BITS(15,12)	},
    712  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0034,	__BITS(3,0)	},
    713  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0034,	__BITS(7,4)	},
    714  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0034,	__BITS(11,8)	},
    715  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0034,	__BITS(15,12)	},
    716  1.1  ryo 	/* GPIO1_D[0-7] */
    717  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0038,	__BITS(3,0)	},
    718  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0038,	__BITS(7,4)	},
    719  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0038,	__BITS(11,8)	},
    720  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0038,	__BITS(15,12)	},
    721  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x003c,	__BITS(3,0)	},
    722  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x003c,	__BITS(7,4)	},
    723  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x003c,	__BITS(11,8)	},
    724  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x003c,	__BITS(15,12)	},
    725  1.1  ryo 
    726  1.1  ryo 	/* GPIO2_A[0-7] */
    727  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0040,	__BITS(3,0)	},
    728  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0040,	__BITS(7,4)	},
    729  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0040,	__BITS(11,8)	},
    730  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0040,	__BITS(15,12)	},
    731  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0044,	__BITS(3,0)	},
    732  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0044,	__BITS(7,4)	},
    733  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0044,	__BITS(11,8)	},
    734  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0044,	__BITS(15,12)	},
    735  1.1  ryo 	/* GPIO2_B[0-7] */
    736  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0048,	__BITS(3,0)	},
    737  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0048,	__BITS(7,4)	},
    738  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0048,	__BITS(11,8)	},
    739  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0048,	__BITS(15,12)	},
    740  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x004c,	__BITS(3,0)	},
    741  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x004c,	__BITS(7,4)	},
    742  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x004c,	__BITS(11,8)	},
    743  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x004c,	__BITS(15,12)	},
    744  1.1  ryo 	/* GPIO2_C[0-7] */
    745  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0050,	__BITS(3,0)	},
    746  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0050,	__BITS(7,4)	},
    747  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0050,	__BITS(11,8)	},
    748  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0050,	__BITS(15,12)	},
    749  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0054,	__BITS(3,0)	},
    750  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0054,	__BITS(7,4)	},
    751  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0054,	__BITS(11,8)	},
    752  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0054,	__BITS(15,12)	},
    753  1.1  ryo 	/* GPIO2_D[0-7] */
    754  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0058,	__BITS(3,0)	},
    755  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0058,	__BITS(7,4)	},
    756  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0058,	__BITS(11,8)	},
    757  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0058,	__BITS(15,12)	},
    758  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x005c,	__BITS(3,0)	},
    759  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x005c,	__BITS(7,4)	},
    760  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x005c,	__BITS(11,8)	},
    761  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x005c,	__BITS(15,12)	},
    762  1.1  ryo 
    763  1.1  ryo 	/* GPIO3_A[0-7] */
    764  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0060,	__BITS(3,0)	},
    765  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0060,	__BITS(7,4)	},
    766  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0060,	__BITS(11,8)	},
    767  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0060,	__BITS(15,12)	},
    768  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0064,	__BITS(3,0)	},
    769  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0064,	__BITS(7,4)	},
    770  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0064,	__BITS(11,8)	},
    771  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0064,	__BITS(15,12)	},
    772  1.1  ryo 	/* GPIO3_B[0-7] */
    773  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0068,	__BITS(3,0)	},
    774  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0068,	__BITS(7,4)	},
    775  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0068,	__BITS(11,8)	},
    776  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0068,	__BITS(15,12)	},
    777  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x006c,	__BITS(3,0)	},
    778  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x006c,	__BITS(7,4)	},
    779  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x006c,	__BITS(11,8)	},
    780  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x006c,	__BITS(15,12)	},
    781  1.1  ryo 	/* GPIO3_C[0-7] */
    782  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0070,	__BITS(3,0)	},
    783  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0070,	__BITS(7,4)	},
    784  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0070,	__BITS(11,8)	},
    785  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0070,	__BITS(15,12)	},
    786  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0074,	__BITS(3,0)	},
    787  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0074,	__BITS(7,4)	},
    788  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0074,	__BITS(11,8)	},
    789  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0074,	__BITS(15,12)	},
    790  1.1  ryo 	/* GPIO3_D[0-7] */
    791  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0078,	__BITS(3,0)	},
    792  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0078,	__BITS(7,4)	},
    793  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0078,	__BITS(11,8)	},
    794  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0078,	__BITS(15,12)	},
    795  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x007c,	__BITS(3,0)	},
    796  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x007c,	__BITS(7,4)	},
    797  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x007c,	__BITS(11,8)	},
    798  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x007c,	__BITS(15,12)	},
    799  1.1  ryo 
    800  1.1  ryo 	/* GPIO4_A[0-7] */
    801  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0080,	__BITS(3,0)	},
    802  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0080,	__BITS(7,4)	},
    803  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0080,	__BITS(11,8)	},
    804  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0080,	__BITS(15,12)	},
    805  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0084,	__BITS(3,0)	},
    806  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0084,	__BITS(7,4)	},
    807  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0084,	__BITS(11,8)	},
    808  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0084,	__BITS(15,12)	},
    809  1.1  ryo 	/* GPIO4_B[0-7] */
    810  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0088,	__BITS(3,0)	},
    811  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0088,	__BITS(7,4)	},
    812  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0088,	__BITS(11,8)	},
    813  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0088,	__BITS(15,12)	},
    814  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x008c,	__BITS(3,0)	},
    815  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x008c,	__BITS(7,4)	},
    816  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x008c,	__BITS(11,8)	},
    817  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x008c,	__BITS(15,12)	},
    818  1.1  ryo 	/* GPIO4_C[0-7] */
    819  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0090,	__BITS(3,0)	},
    820  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0090,	__BITS(7,4)	},
    821  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0090,	__BITS(11,8)	},
    822  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0090,	__BITS(15,12)	},
    823  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0094,	__BITS(3,0)	},
    824  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0094,	__BITS(7,4)	},
    825  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0094,	__BITS(11,8)	},
    826  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0094,	__BITS(15,12)	},
    827  1.1  ryo 	/* GPIO4_D[0-7] */
    828  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0098,	__BITS(3,0)	},
    829  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0098,	__BITS(7,4)	},
    830  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0098,	__BITS(11,8)	},
    831  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x0098,	__BITS(15,12)	},
    832  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x009c,	__BITS(3,0)	},
    833  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x009c,	__BITS(7,4)	},
    834  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x009c,	__BITS(11,8)	},
    835  1.1  ryo 	{ RK3588_BUS_IOC_REG + 0x009c,	__BITS(15,12)	}
    836  1.1  ryo };
    837  1.1  ryo 
    838  1.1  ryo #ifdef RK3588_IOMUX_DEBUG
    839  1.1  ryo static char *
    840  1.1  ryo rk3588_iomux_pinname(int pin)
    841  1.1  ryo {
    842  1.1  ryo 	static char buf[16];
    843  1.1  ryo 
    844  1.1  ryo 	int bank = pin / 32;
    845  1.1  ryo 	int group = (pin / 8) & 3;
    846  1.1  ryo 	int idx = pin & 7;
    847  1.1  ryo 	snprintf(buf, sizeof(buf), "%d=[%d-RK_P%c%d]",
    848  1.1  ryo 	    pin, bank, 'A' + group, idx);
    849  1.1  ryo 	return buf;
    850  1.1  ryo }
    851  1.1  ryo #endif
    852  1.1  ryo 
    853  1.1  ryo static void
    854  1.1  ryo rk3588_iomux_set_bias(struct rk3588_iomux_softc *sc, int pin, int bias)
    855  1.1  ryo {
    856  1.1  ryo 	uint32_t val;
    857  1.1  ryo 
    858  1.1  ryo 	switch (bias) {
    859  1.1  ryo 	case 0:
    860  1.1  ryo 		val = RK3588_GPIO_P_CTL_Z;
    861  1.1  ryo 		break;
    862  1.1  ryo 	case GPIO_PIN_PULLUP:
    863  1.1  ryo 		val = RK3588_GPIO_P_PULLUP;
    864  1.1  ryo 		break;
    865  1.1  ryo 	case GPIO_PIN_PULLDOWN:
    866  1.1  ryo 		val = RK3588_GPIO_P_PULLDOWN;
    867  1.1  ryo 		break;
    868  1.1  ryo 	default:
    869  1.1  ryo 		return;
    870  1.1  ryo 	}
    871  1.1  ryo 
    872  1.1  ryo 	bus_size_t reg = rk3588_pull_regmap[pin].reg;
    873  1.1  ryo 	uint32_t mask = rk3588_pull_regmap[pin].mask;
    874  1.1  ryo 	val = (mask << 16) | __SHIFTIN(val, mask);
    875  1.1  ryo 
    876  1.1  ryo 	syscon_write_4(sc->sc_grf, reg, val);
    877  1.1  ryo 
    878  1.1  ryo #ifdef RK3588_IOMUX_DEBUG
    879  1.1  ryo 	printf("%s: pin=%s bias %s (reg:%08lx -> %08x)\n", __func__,
    880  1.1  ryo 	    rk3588_iomux_pinname(pin), (bias == 0) ? "Z" :
    881  1.1  ryo 	    (bias == GPIO_PIN_PULLUP) ? "PULLUP" : "PULLDOWN",
    882  1.1  ryo 	    reg, val);
    883  1.1  ryo #endif
    884  1.1  ryo }
    885  1.1  ryo 
    886  1.1  ryo static void
    887  1.1  ryo rk3588_iomux_set_drive_strength(struct rk3588_iomux_softc *sc, int pin, int drv)
    888  1.1  ryo {
    889  1.1  ryo 	if (drv < 0 || drv > 15)
    890  1.1  ryo 		return;
    891  1.1  ryo 
    892  1.1  ryo 	/* Amperage (mA) corresponds directly to register values 0-15 */
    893  1.1  ryo 	bus_size_t reg = rk3588_drive_regmap[pin].reg;
    894  1.1  ryo 	uint32_t mask = rk3588_drive_regmap[pin].mask;
    895  1.1  ryo 	uint32_t val = (mask << 16) | __SHIFTIN(drv, mask);
    896  1.1  ryo 
    897  1.1  ryo 	syscon_write_4(sc->sc_grf, reg, val);
    898  1.1  ryo 
    899  1.1  ryo #ifdef RK3588_IOMUX_DEBUG
    900  1.1  ryo 	printf("%s: pin=%s strength %d (reg:%08lx -> %08x)\n", __func__,
    901  1.1  ryo 	    rk3588_iomux_pinname(pin), drv, reg, val);
    902  1.1  ryo #endif
    903  1.1  ryo }
    904  1.1  ryo 
    905  1.1  ryo static void
    906  1.1  ryo rk3588_iomux_set_mux(struct rk3588_iomux_softc *sc, int pin, u_int mux)
    907  1.1  ryo {
    908  1.1  ryo 	bus_size_t reg = rk3588_iomux_regmap[pin].reg;
    909  1.1  ryo 	bus_size_t reg0 = rk3588_iomux_regmap[pin].reg0;
    910  1.1  ryo 	uint32_t mask = rk3588_iomux_regmap[pin].mask;
    911  1.1  ryo 	uint32_t val;
    912  1.1  ryo 
    913  1.1  ryo 	if (reg0 != 0) {
    914  1.1  ryo 		val = (mask << 16) | __SHIFTIN(__BIT(3), mask);
    915  1.1  ryo 		syscon_write_4(sc->sc_grf, reg0, val);
    916  1.1  ryo 	}
    917  1.1  ryo 
    918  1.1  ryo 	val = (mask << 16) | __SHIFTIN(mux, mask);
    919  1.1  ryo 	syscon_write_4(sc->sc_grf, reg, val);
    920  1.1  ryo 
    921  1.1  ryo #ifdef RK3588_IOMUX_DEBUG
    922  1.1  ryo 	printf("%s: pin=%s mux %d (reg:%08lx -> %08x)\n", __func__,
    923  1.1  ryo 	    rk3588_iomux_pinname(pin), mux, reg, val);
    924  1.1  ryo #endif
    925  1.1  ryo }
    926  1.1  ryo 
    927  1.1  ryo static void
    928  1.1  ryo rk3588_iomux_set_direction(struct rk3588_iomux_softc *sc, int pin, int dir,
    929  1.1  ryo     int value)
    930  1.1  ryo {
    931  1.1  ryo 	/* XXX: notyet */
    932  1.1  ryo 	panic("%s:%d: pin=%d, dir=%d: not supported\n", __func__, __LINE__, pin, dir);
    933  1.1  ryo 
    934  1.1  ryo #ifdef RK3588_IOMUX_DEBUG
    935  1.1  ryo 	printf("%s: pin=%s dir %d, value %08x\n", __func__,
    936  1.1  ryo 	    rk3588_iomux_pinname(pin), dir, value);
    937  1.1  ryo #endif
    938  1.1  ryo }
    939  1.1  ryo 
    940  1.1  ryo static int
    941  1.1  ryo rk3588_iomux_config(struct rk3588_iomux_softc *sc, const int phandle,
    942  1.1  ryo     u_int bank, u_int idx, u_int mux)
    943  1.1  ryo {
    944  1.1  ryo 	const int pin = PIN(bank, idx);
    945  1.1  ryo 
    946  1.1  ryo 	if (pin < 0 || pin >= NPINS)
    947  1.1  ryo 		return EINVAL;
    948  1.1  ryo 
    949  1.1  ryo 	int bias = fdtbus_pinctrl_parse_bias(phandle, NULL);
    950  1.1  ryo 	if (bias != -1)
    951  1.1  ryo 		rk3588_iomux_set_bias(sc, pin, bias);
    952  1.1  ryo 
    953  1.1  ryo 	int drv = fdtbus_pinctrl_parse_drive_strength(phandle);
    954  1.1  ryo 	if (drv != -1)
    955  1.1  ryo 		rk3588_iomux_set_drive_strength(sc, pin, drv);
    956  1.1  ryo 
    957  1.1  ryo 	int output_value;
    958  1.1  ryo 	int dir = fdtbus_pinctrl_parse_input_output(phandle, &output_value);
    959  1.1  ryo 	if (dir != -1)
    960  1.1  ryo 		rk3588_iomux_set_direction(sc, pin, dir, output_value);
    961  1.1  ryo 
    962  1.1  ryo 	rk3588_iomux_set_mux(sc, pin, mux);
    963  1.1  ryo 
    964  1.1  ryo 	return 0;
    965  1.1  ryo }
    966  1.1  ryo 
    967  1.1  ryo static int
    968  1.1  ryo rk3588_iomux_pinctrl_set_config(device_t dev, const void *data, size_t len)
    969  1.1  ryo {
    970  1.1  ryo 	struct rk3588_iomux_softc * const sc = device_private(dev);
    971  1.1  ryo 	int pins_len = 0;
    972  1.1  ryo 
    973  1.1  ryo 	if (len != 4)
    974  1.1  ryo 		return -1;
    975  1.1  ryo 
    976  1.1  ryo 	const int phandle = fdtbus_get_phandle_from_native(be32dec(data));
    977  1.1  ryo 	const u_int *pins = fdtbus_get_prop(phandle, "rockchip,pins",
    978  1.1  ryo 	    &pins_len);
    979  1.1  ryo 
    980  1.1  ryo 	for (; pins_len >= 16; pins_len -= 16, pins += 4) {
    981  1.1  ryo 		const u_int bank = be32toh(pins[0]);
    982  1.1  ryo 		const u_int idx = be32toh(pins[1]);
    983  1.1  ryo 		const u_int mux = be32toh(pins[2]);
    984  1.1  ryo 		const int cfg =
    985  1.1  ryo 		    fdtbus_get_phandle_from_native(be32toh(pins[3]));
    986  1.1  ryo 
    987  1.1  ryo 		syscon_lock(sc->sc_grf);
    988  1.1  ryo 		rk3588_iomux_config(sc, cfg, bank, idx, mux);
    989  1.1  ryo 		syscon_unlock(sc->sc_grf);
    990  1.1  ryo 	}
    991  1.1  ryo 
    992  1.1  ryo 	return 0;
    993  1.1  ryo }
    994  1.1  ryo 
    995  1.1  ryo static struct fdtbus_pinctrl_controller_func rk3588_iomux_pinctrl_funcs = {
    996  1.1  ryo 	.set_config = rk3588_iomux_pinctrl_set_config
    997  1.1  ryo };
    998  1.1  ryo 
    999  1.1  ryo static int
   1000  1.1  ryo rk3588_iomux_match(device_t parent, cfdata_t cf, void *aux)
   1001  1.1  ryo {
   1002  1.1  ryo 	struct fdt_attach_args * const faa = aux;
   1003  1.1  ryo 	return of_compatible_match(faa->faa_phandle, compat_data);
   1004  1.1  ryo }
   1005  1.1  ryo 
   1006  1.1  ryo static void
   1007  1.1  ryo rk3588_iomux_attach(device_t parent, device_t self, void *aux)
   1008  1.1  ryo {
   1009  1.1  ryo 	struct rk3588_iomux_softc * const sc = device_private(self);
   1010  1.1  ryo 	struct fdt_attach_args * const faa = aux;
   1011  1.1  ryo 	const int phandle = faa->faa_phandle;
   1012  1.1  ryo 
   1013  1.1  ryo 	sc->sc_dev = self;
   1014  1.1  ryo 	sc->sc_grf = fdtbus_syscon_acquire(phandle, "rockchip,grf");
   1015  1.1  ryo 	if (sc->sc_grf == NULL) {
   1016  1.1  ryo 		aprint_error(": couldn't acquire grf syscon\n");
   1017  1.1  ryo 		return;
   1018  1.1  ryo 	}
   1019  1.1  ryo 
   1020  1.1  ryo 	aprint_naive("\n");
   1021  1.1  ryo 	aprint_normal(": RK3588 IOMUX control\n");
   1022  1.1  ryo 
   1023  1.1  ryo 	for (int child = OF_child(phandle); child; child = OF_peer(child)) {
   1024  1.1  ryo 		for (int sub = OF_child(child); sub; sub = OF_peer(sub)) {
   1025  1.1  ryo 			if (!of_hasprop(sub, "rockchip,pins"))
   1026  1.1  ryo 				continue;
   1027  1.1  ryo 			fdtbus_register_pinctrl_config(self, sub,
   1028  1.1  ryo 			    &rk3588_iomux_pinctrl_funcs);
   1029  1.1  ryo 		}
   1030  1.1  ryo 	}
   1031  1.1  ryo 
   1032  1.1  ryo 	for (int child = OF_child(phandle); child; child = OF_peer(child)) {
   1033  1.1  ryo 		struct fdt_attach_args cfaa = *faa;
   1034  1.1  ryo 		cfaa.faa_phandle = child;
   1035  1.1  ryo 		cfaa.faa_name = fdtbus_get_string(child, "name");
   1036  1.1  ryo 		cfaa.faa_quiet = false;
   1037  1.1  ryo 
   1038  1.1  ryo 		config_found(self, &cfaa, NULL, CFARGS_NONE);
   1039  1.1  ryo 	}
   1040  1.1  ryo }
   1041