1*b026402bSDong Aisheng /* 2*b026402bSDong Aisheng * Copyright (C) 2016 Freescale Semiconductor, Inc. 3*b026402bSDong Aisheng * Copyright (C) 2017 NXP 4*b026402bSDong Aisheng * 5*b026402bSDong Aisheng * Author: Dong Aisheng <aisheng.dong@nxp.com> 6*b026402bSDong Aisheng * 7*b026402bSDong Aisheng * This program is free software; you can redistribute it and/or modify 8*b026402bSDong Aisheng * it under the terms of the GNU General Public License version 2 as 9*b026402bSDong Aisheng * published by the Free Software Foundation. 10*b026402bSDong Aisheng * 11*b026402bSDong Aisheng */ 12*b026402bSDong Aisheng 13*b026402bSDong Aisheng #include <linux/err.h> 14*b026402bSDong Aisheng #include <linux/init.h> 15*b026402bSDong Aisheng #include <linux/io.h> 16*b026402bSDong Aisheng #include <linux/module.h> 17*b026402bSDong Aisheng #include <linux/of.h> 18*b026402bSDong Aisheng #include <linux/of_device.h> 19*b026402bSDong Aisheng #include <linux/pinctrl/pinctrl.h> 20*b026402bSDong Aisheng 21*b026402bSDong Aisheng #include "pinctrl-imx.h" 22*b026402bSDong Aisheng 23*b026402bSDong Aisheng enum imx7ulp_pads { 24*b026402bSDong Aisheng IMX7ULP_PAD_PTC0 = 0, 25*b026402bSDong Aisheng IMX7ULP_PAD_PTC1, 26*b026402bSDong Aisheng IMX7ULP_PAD_PTC2, 27*b026402bSDong Aisheng IMX7ULP_PAD_PTC3, 28*b026402bSDong Aisheng IMX7ULP_PAD_PTC4, 29*b026402bSDong Aisheng IMX7ULP_PAD_PTC5, 30*b026402bSDong Aisheng IMX7ULP_PAD_PTC6, 31*b026402bSDong Aisheng IMX7ULP_PAD_PTC7, 32*b026402bSDong Aisheng IMX7ULP_PAD_PTC8, 33*b026402bSDong Aisheng IMX7ULP_PAD_PTC9, 34*b026402bSDong Aisheng IMX7ULP_PAD_PTC10, 35*b026402bSDong Aisheng IMX7ULP_PAD_PTC11, 36*b026402bSDong Aisheng IMX7ULP_PAD_PTC12, 37*b026402bSDong Aisheng IMX7ULP_PAD_PTC13, 38*b026402bSDong Aisheng IMX7ULP_PAD_PTC14, 39*b026402bSDong Aisheng IMX7ULP_PAD_PTC15, 40*b026402bSDong Aisheng IMX7ULP_PAD_PTC16, 41*b026402bSDong Aisheng IMX7ULP_PAD_PTC17, 42*b026402bSDong Aisheng IMX7ULP_PAD_PTC18, 43*b026402bSDong Aisheng IMX7ULP_PAD_PTC19, 44*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE0, 45*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE1, 46*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE2, 47*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE3, 48*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE4, 49*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE5, 50*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE6, 51*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE7, 52*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE8, 53*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE9, 54*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE10, 55*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE11, 56*b026402bSDong Aisheng IMX7ULP_PAD_PTD0, 57*b026402bSDong Aisheng IMX7ULP_PAD_PTD1, 58*b026402bSDong Aisheng IMX7ULP_PAD_PTD2, 59*b026402bSDong Aisheng IMX7ULP_PAD_PTD3, 60*b026402bSDong Aisheng IMX7ULP_PAD_PTD4, 61*b026402bSDong Aisheng IMX7ULP_PAD_PTD5, 62*b026402bSDong Aisheng IMX7ULP_PAD_PTD6, 63*b026402bSDong Aisheng IMX7ULP_PAD_PTD7, 64*b026402bSDong Aisheng IMX7ULP_PAD_PTD8, 65*b026402bSDong Aisheng IMX7ULP_PAD_PTD9, 66*b026402bSDong Aisheng IMX7ULP_PAD_PTD10, 67*b026402bSDong Aisheng IMX7ULP_PAD_PTD11, 68*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE12, 69*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE13, 70*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE14, 71*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE15, 72*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE16, 73*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE17, 74*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE18, 75*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE19, 76*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE20, 77*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE21, 78*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE22, 79*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE23, 80*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE24, 81*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE25, 82*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE26, 83*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE27, 84*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE28, 85*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE29, 86*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE30, 87*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE31, 88*b026402bSDong Aisheng IMX7ULP_PAD_PTE0, 89*b026402bSDong Aisheng IMX7ULP_PAD_PTE1, 90*b026402bSDong Aisheng IMX7ULP_PAD_PTE2, 91*b026402bSDong Aisheng IMX7ULP_PAD_PTE3, 92*b026402bSDong Aisheng IMX7ULP_PAD_PTE4, 93*b026402bSDong Aisheng IMX7ULP_PAD_PTE5, 94*b026402bSDong Aisheng IMX7ULP_PAD_PTE6, 95*b026402bSDong Aisheng IMX7ULP_PAD_PTE7, 96*b026402bSDong Aisheng IMX7ULP_PAD_PTE8, 97*b026402bSDong Aisheng IMX7ULP_PAD_PTE9, 98*b026402bSDong Aisheng IMX7ULP_PAD_PTE10, 99*b026402bSDong Aisheng IMX7ULP_PAD_PTE11, 100*b026402bSDong Aisheng IMX7ULP_PAD_PTE12, 101*b026402bSDong Aisheng IMX7ULP_PAD_PTE13, 102*b026402bSDong Aisheng IMX7ULP_PAD_PTE14, 103*b026402bSDong Aisheng IMX7ULP_PAD_PTE15, 104*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE32, 105*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE33, 106*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE34, 107*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE35, 108*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE36, 109*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE37, 110*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE38, 111*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE39, 112*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE40, 113*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE41, 114*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE42, 115*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE43, 116*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE44, 117*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE45, 118*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE46, 119*b026402bSDong Aisheng IMX7ULP_PAD_RESERVE47, 120*b026402bSDong Aisheng IMX7ULP_PAD_PTF0, 121*b026402bSDong Aisheng IMX7ULP_PAD_PTF1, 122*b026402bSDong Aisheng IMX7ULP_PAD_PTF2, 123*b026402bSDong Aisheng IMX7ULP_PAD_PTF3, 124*b026402bSDong Aisheng IMX7ULP_PAD_PTF4, 125*b026402bSDong Aisheng IMX7ULP_PAD_PTF5, 126*b026402bSDong Aisheng IMX7ULP_PAD_PTF6, 127*b026402bSDong Aisheng IMX7ULP_PAD_PTF7, 128*b026402bSDong Aisheng IMX7ULP_PAD_PTF8, 129*b026402bSDong Aisheng IMX7ULP_PAD_PTF9, 130*b026402bSDong Aisheng IMX7ULP_PAD_PTF10, 131*b026402bSDong Aisheng IMX7ULP_PAD_PTF11, 132*b026402bSDong Aisheng IMX7ULP_PAD_PTF12, 133*b026402bSDong Aisheng IMX7ULP_PAD_PTF13, 134*b026402bSDong Aisheng IMX7ULP_PAD_PTF14, 135*b026402bSDong Aisheng IMX7ULP_PAD_PTF15, 136*b026402bSDong Aisheng IMX7ULP_PAD_PTF16, 137*b026402bSDong Aisheng IMX7ULP_PAD_PTF17, 138*b026402bSDong Aisheng IMX7ULP_PAD_PTF18, 139*b026402bSDong Aisheng IMX7ULP_PAD_PTF19, 140*b026402bSDong Aisheng }; 141*b026402bSDong Aisheng 142*b026402bSDong Aisheng /* Pad names for the pinmux subsystem */ 143*b026402bSDong Aisheng static const struct pinctrl_pin_desc imx7ulp_pinctrl_pads[] = { 144*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC0), 145*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC1), 146*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC2), 147*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC3), 148*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC4), 149*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC5), 150*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC6), 151*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC7), 152*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC8), 153*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC9), 154*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC10), 155*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC11), 156*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC12), 157*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC13), 158*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC14), 159*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC15), 160*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC16), 161*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC17), 162*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC18), 163*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC19), 164*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE0), 165*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE1), 166*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE2), 167*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE3), 168*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE4), 169*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE5), 170*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE6), 171*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE7), 172*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE8), 173*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE9), 174*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE10), 175*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE11), 176*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD0), 177*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD1), 178*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD2), 179*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD3), 180*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD4), 181*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD5), 182*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD6), 183*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD7), 184*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD8), 185*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD9), 186*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD10), 187*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD11), 188*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE12), 189*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE13), 190*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE14), 191*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE15), 192*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE16), 193*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE17), 194*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE18), 195*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE19), 196*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE20), 197*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE21), 198*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE22), 199*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE23), 200*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE24), 201*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE25), 202*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE26), 203*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE27), 204*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE28), 205*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE29), 206*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE30), 207*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE31), 208*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE0), 209*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE1), 210*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE2), 211*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE3), 212*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE4), 213*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE5), 214*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE6), 215*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE7), 216*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE8), 217*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE9), 218*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE10), 219*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE11), 220*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE12), 221*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE13), 222*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE14), 223*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE15), 224*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE32), 225*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE33), 226*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE34), 227*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE35), 228*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE36), 229*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE37), 230*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE38), 231*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE39), 232*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE40), 233*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE41), 234*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE42), 235*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE43), 236*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE44), 237*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE45), 238*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE46), 239*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE47), 240*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF0), 241*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF1), 242*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF2), 243*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF3), 244*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF4), 245*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF5), 246*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF6), 247*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF7), 248*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF8), 249*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF9), 250*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF10), 251*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF11), 252*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF12), 253*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF13), 254*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF14), 255*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF15), 256*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF16), 257*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF17), 258*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF18), 259*b026402bSDong Aisheng IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF19), 260*b026402bSDong Aisheng }; 261*b026402bSDong Aisheng 262*b026402bSDong Aisheng #define BM_LK_ENABLED BIT(15) 263*b026402bSDong Aisheng #define BM_MUX_MODE 0xf00 264*b026402bSDong Aisheng #define BP_MUX_MODE 8 265*b026402bSDong Aisheng #define BM_PULL_ENABLED BIT(1) 266*b026402bSDong Aisheng 267*b026402bSDong Aisheng struct imx_cfg_params_decode imx7ulp_cfg_decodes[] = { 268*b026402bSDong Aisheng IMX_CFG_PARAMS_DECODE(PIN_CONFIG_DRIVE_STRENGTH, BIT(6), 6), 269*b026402bSDong Aisheng IMX_CFG_PARAMS_DECODE(PIN_CONFIG_DRIVE_PUSH_PULL, BIT(5), 5), 270*b026402bSDong Aisheng IMX_CFG_PARAMS_DECODE(PIN_CONFIG_SLEW_RATE, BIT(2), 2), 271*b026402bSDong Aisheng IMX_CFG_PARAMS_DECODE(PIN_CONFIG_BIAS_DISABLE, BIT(1), 1), 272*b026402bSDong Aisheng IMX_CFG_PARAMS_DECODE(PIN_CONFIG_BIAS_PULL_UP, BIT(0), 0), 273*b026402bSDong Aisheng 274*b026402bSDong Aisheng IMX_CFG_PARAMS_DECODE_INVERT(PIN_CONFIG_DRIVE_OPEN_DRAIN, BIT(5), 5), 275*b026402bSDong Aisheng IMX_CFG_PARAMS_DECODE_INVERT(PIN_CONFIG_BIAS_PULL_DOWN, BIT(0), 0), 276*b026402bSDong Aisheng }; 277*b026402bSDong Aisheng 278*b026402bSDong Aisheng static void imx7ulp_cfg_params_fixup(unsigned long *configs, 279*b026402bSDong Aisheng unsigned int num_configs, 280*b026402bSDong Aisheng u32 *raw_config) 281*b026402bSDong Aisheng { 282*b026402bSDong Aisheng enum pin_config_param param; 283*b026402bSDong Aisheng u32 param_val; 284*b026402bSDong Aisheng int i; 285*b026402bSDong Aisheng 286*b026402bSDong Aisheng /* lock field disabled */ 287*b026402bSDong Aisheng *raw_config &= ~BM_LK_ENABLED; 288*b026402bSDong Aisheng 289*b026402bSDong Aisheng for (i = 0; i < num_configs; i++) { 290*b026402bSDong Aisheng param = pinconf_to_config_param(configs[i]); 291*b026402bSDong Aisheng param_val = pinconf_to_config_argument(configs[i]); 292*b026402bSDong Aisheng 293*b026402bSDong Aisheng if ((param == PIN_CONFIG_BIAS_PULL_UP) || 294*b026402bSDong Aisheng (param == PIN_CONFIG_BIAS_PULL_DOWN)) { 295*b026402bSDong Aisheng /* pull enabled */ 296*b026402bSDong Aisheng *raw_config |= BM_PULL_ENABLED; 297*b026402bSDong Aisheng 298*b026402bSDong Aisheng return; 299*b026402bSDong Aisheng } 300*b026402bSDong Aisheng } 301*b026402bSDong Aisheng } 302*b026402bSDong Aisheng 303*b026402bSDong Aisheng static struct imx_pinctrl_soc_info imx7ulp_pinctrl_info = { 304*b026402bSDong Aisheng .pins = imx7ulp_pinctrl_pads, 305*b026402bSDong Aisheng .npins = ARRAY_SIZE(imx7ulp_pinctrl_pads), 306*b026402bSDong Aisheng .flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG, 307*b026402bSDong Aisheng .mux_mask = BM_MUX_MODE, 308*b026402bSDong Aisheng .mux_shift = BP_MUX_MODE, 309*b026402bSDong Aisheng .generic_pinconf = true, 310*b026402bSDong Aisheng .decodes = imx7ulp_cfg_decodes, 311*b026402bSDong Aisheng .num_decodes = ARRAY_SIZE(imx7ulp_cfg_decodes), 312*b026402bSDong Aisheng .fixup = imx7ulp_cfg_params_fixup, 313*b026402bSDong Aisheng }; 314*b026402bSDong Aisheng 315*b026402bSDong Aisheng static const struct of_device_id imx7ulp_pinctrl_of_match[] = { 316*b026402bSDong Aisheng { .compatible = "fsl,imx7ulp-iomuxc1", }, 317*b026402bSDong Aisheng { /* sentinel */ } 318*b026402bSDong Aisheng }; 319*b026402bSDong Aisheng 320*b026402bSDong Aisheng static int imx7ulp_pinctrl_probe(struct platform_device *pdev) 321*b026402bSDong Aisheng { 322*b026402bSDong Aisheng return imx_pinctrl_probe(pdev, &imx7ulp_pinctrl_info); 323*b026402bSDong Aisheng } 324*b026402bSDong Aisheng 325*b026402bSDong Aisheng static struct platform_driver imx7ulp_pinctrl_driver = { 326*b026402bSDong Aisheng .driver = { 327*b026402bSDong Aisheng .name = "imx7ulp-pinctrl", 328*b026402bSDong Aisheng .of_match_table = of_match_ptr(imx7ulp_pinctrl_of_match), 329*b026402bSDong Aisheng .suppress_bind_attrs = true, 330*b026402bSDong Aisheng }, 331*b026402bSDong Aisheng .probe = imx7ulp_pinctrl_probe, 332*b026402bSDong Aisheng }; 333*b026402bSDong Aisheng 334*b026402bSDong Aisheng static int __init imx7ulp_pinctrl_init(void) 335*b026402bSDong Aisheng { 336*b026402bSDong Aisheng return platform_driver_register(&imx7ulp_pinctrl_driver); 337*b026402bSDong Aisheng } 338*b026402bSDong Aisheng arch_initcall(imx7ulp_pinctrl_init); 339