162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci// 362306a36Sopenharmony_ci// Copyright (C) 2016 Freescale Semiconductor, Inc. 462306a36Sopenharmony_ci// Copyright (C) 2017 NXP 562306a36Sopenharmony_ci// 662306a36Sopenharmony_ci// Author: Dong Aisheng <aisheng.dong@nxp.com> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <linux/err.h> 962306a36Sopenharmony_ci#include <linux/init.h> 1062306a36Sopenharmony_ci#include <linux/io.h> 1162306a36Sopenharmony_ci#include <linux/mod_devicetable.h> 1262306a36Sopenharmony_ci#include <linux/platform_device.h> 1362306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include "pinctrl-imx.h" 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cienum imx7ulp_pads { 1862306a36Sopenharmony_ci IMX7ULP_PAD_PTC0 = 0, 1962306a36Sopenharmony_ci IMX7ULP_PAD_PTC1, 2062306a36Sopenharmony_ci IMX7ULP_PAD_PTC2, 2162306a36Sopenharmony_ci IMX7ULP_PAD_PTC3, 2262306a36Sopenharmony_ci IMX7ULP_PAD_PTC4, 2362306a36Sopenharmony_ci IMX7ULP_PAD_PTC5, 2462306a36Sopenharmony_ci IMX7ULP_PAD_PTC6, 2562306a36Sopenharmony_ci IMX7ULP_PAD_PTC7, 2662306a36Sopenharmony_ci IMX7ULP_PAD_PTC8, 2762306a36Sopenharmony_ci IMX7ULP_PAD_PTC9, 2862306a36Sopenharmony_ci IMX7ULP_PAD_PTC10, 2962306a36Sopenharmony_ci IMX7ULP_PAD_PTC11, 3062306a36Sopenharmony_ci IMX7ULP_PAD_PTC12, 3162306a36Sopenharmony_ci IMX7ULP_PAD_PTC13, 3262306a36Sopenharmony_ci IMX7ULP_PAD_PTC14, 3362306a36Sopenharmony_ci IMX7ULP_PAD_PTC15, 3462306a36Sopenharmony_ci IMX7ULP_PAD_PTC16, 3562306a36Sopenharmony_ci IMX7ULP_PAD_PTC17, 3662306a36Sopenharmony_ci IMX7ULP_PAD_PTC18, 3762306a36Sopenharmony_ci IMX7ULP_PAD_PTC19, 3862306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE0, 3962306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE1, 4062306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE2, 4162306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE3, 4262306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE4, 4362306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE5, 4462306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE6, 4562306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE7, 4662306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE8, 4762306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE9, 4862306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE10, 4962306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE11, 5062306a36Sopenharmony_ci IMX7ULP_PAD_PTD0, 5162306a36Sopenharmony_ci IMX7ULP_PAD_PTD1, 5262306a36Sopenharmony_ci IMX7ULP_PAD_PTD2, 5362306a36Sopenharmony_ci IMX7ULP_PAD_PTD3, 5462306a36Sopenharmony_ci IMX7ULP_PAD_PTD4, 5562306a36Sopenharmony_ci IMX7ULP_PAD_PTD5, 5662306a36Sopenharmony_ci IMX7ULP_PAD_PTD6, 5762306a36Sopenharmony_ci IMX7ULP_PAD_PTD7, 5862306a36Sopenharmony_ci IMX7ULP_PAD_PTD8, 5962306a36Sopenharmony_ci IMX7ULP_PAD_PTD9, 6062306a36Sopenharmony_ci IMX7ULP_PAD_PTD10, 6162306a36Sopenharmony_ci IMX7ULP_PAD_PTD11, 6262306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE12, 6362306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE13, 6462306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE14, 6562306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE15, 6662306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE16, 6762306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE17, 6862306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE18, 6962306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE19, 7062306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE20, 7162306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE21, 7262306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE22, 7362306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE23, 7462306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE24, 7562306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE25, 7662306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE26, 7762306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE27, 7862306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE28, 7962306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE29, 8062306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE30, 8162306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE31, 8262306a36Sopenharmony_ci IMX7ULP_PAD_PTE0, 8362306a36Sopenharmony_ci IMX7ULP_PAD_PTE1, 8462306a36Sopenharmony_ci IMX7ULP_PAD_PTE2, 8562306a36Sopenharmony_ci IMX7ULP_PAD_PTE3, 8662306a36Sopenharmony_ci IMX7ULP_PAD_PTE4, 8762306a36Sopenharmony_ci IMX7ULP_PAD_PTE5, 8862306a36Sopenharmony_ci IMX7ULP_PAD_PTE6, 8962306a36Sopenharmony_ci IMX7ULP_PAD_PTE7, 9062306a36Sopenharmony_ci IMX7ULP_PAD_PTE8, 9162306a36Sopenharmony_ci IMX7ULP_PAD_PTE9, 9262306a36Sopenharmony_ci IMX7ULP_PAD_PTE10, 9362306a36Sopenharmony_ci IMX7ULP_PAD_PTE11, 9462306a36Sopenharmony_ci IMX7ULP_PAD_PTE12, 9562306a36Sopenharmony_ci IMX7ULP_PAD_PTE13, 9662306a36Sopenharmony_ci IMX7ULP_PAD_PTE14, 9762306a36Sopenharmony_ci IMX7ULP_PAD_PTE15, 9862306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE32, 9962306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE33, 10062306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE34, 10162306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE35, 10262306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE36, 10362306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE37, 10462306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE38, 10562306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE39, 10662306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE40, 10762306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE41, 10862306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE42, 10962306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE43, 11062306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE44, 11162306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE45, 11262306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE46, 11362306a36Sopenharmony_ci IMX7ULP_PAD_RESERVE47, 11462306a36Sopenharmony_ci IMX7ULP_PAD_PTF0, 11562306a36Sopenharmony_ci IMX7ULP_PAD_PTF1, 11662306a36Sopenharmony_ci IMX7ULP_PAD_PTF2, 11762306a36Sopenharmony_ci IMX7ULP_PAD_PTF3, 11862306a36Sopenharmony_ci IMX7ULP_PAD_PTF4, 11962306a36Sopenharmony_ci IMX7ULP_PAD_PTF5, 12062306a36Sopenharmony_ci IMX7ULP_PAD_PTF6, 12162306a36Sopenharmony_ci IMX7ULP_PAD_PTF7, 12262306a36Sopenharmony_ci IMX7ULP_PAD_PTF8, 12362306a36Sopenharmony_ci IMX7ULP_PAD_PTF9, 12462306a36Sopenharmony_ci IMX7ULP_PAD_PTF10, 12562306a36Sopenharmony_ci IMX7ULP_PAD_PTF11, 12662306a36Sopenharmony_ci IMX7ULP_PAD_PTF12, 12762306a36Sopenharmony_ci IMX7ULP_PAD_PTF13, 12862306a36Sopenharmony_ci IMX7ULP_PAD_PTF14, 12962306a36Sopenharmony_ci IMX7ULP_PAD_PTF15, 13062306a36Sopenharmony_ci IMX7ULP_PAD_PTF16, 13162306a36Sopenharmony_ci IMX7ULP_PAD_PTF17, 13262306a36Sopenharmony_ci IMX7ULP_PAD_PTF18, 13362306a36Sopenharmony_ci IMX7ULP_PAD_PTF19, 13462306a36Sopenharmony_ci}; 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci/* Pad names for the pinmux subsystem */ 13762306a36Sopenharmony_cistatic const struct pinctrl_pin_desc imx7ulp_pinctrl_pads[] = { 13862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC0), 13962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC1), 14062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC2), 14162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC3), 14262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC4), 14362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC5), 14462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC6), 14562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC7), 14662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC8), 14762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC9), 14862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC10), 14962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC11), 15062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC12), 15162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC13), 15262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC14), 15362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC15), 15462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC16), 15562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC17), 15662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC18), 15762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTC19), 15862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE0), 15962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE1), 16062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE2), 16162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE3), 16262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE4), 16362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE5), 16462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE6), 16562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE7), 16662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE8), 16762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE9), 16862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE10), 16962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE11), 17062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD0), 17162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD1), 17262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD2), 17362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD3), 17462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD4), 17562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD5), 17662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD6), 17762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD7), 17862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD8), 17962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD9), 18062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD10), 18162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTD11), 18262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE12), 18362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE13), 18462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE14), 18562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE15), 18662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE16), 18762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE17), 18862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE18), 18962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE19), 19062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE20), 19162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE21), 19262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE22), 19362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE23), 19462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE24), 19562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE25), 19662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE26), 19762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE27), 19862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE28), 19962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE29), 20062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE30), 20162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE31), 20262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE0), 20362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE1), 20462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE2), 20562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE3), 20662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE4), 20762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE5), 20862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE6), 20962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE7), 21062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE8), 21162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE9), 21262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE10), 21362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE11), 21462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE12), 21562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE13), 21662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE14), 21762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTE15), 21862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE32), 21962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE33), 22062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE34), 22162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE35), 22262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE36), 22362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE37), 22462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE38), 22562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE39), 22662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE40), 22762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE41), 22862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE42), 22962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE43), 23062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE44), 23162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE45), 23262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE46), 23362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_RESERVE47), 23462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF0), 23562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF1), 23662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF2), 23762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF3), 23862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF4), 23962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF5), 24062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF6), 24162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF7), 24262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF8), 24362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF9), 24462306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF10), 24562306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF11), 24662306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF12), 24762306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF13), 24862306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF14), 24962306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF15), 25062306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF16), 25162306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF17), 25262306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF18), 25362306a36Sopenharmony_ci IMX_PINCTRL_PIN(IMX7ULP_PAD_PTF19), 25462306a36Sopenharmony_ci}; 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci#define BM_OBE_ENABLED BIT(17) 25762306a36Sopenharmony_ci#define BM_IBE_ENABLED BIT(16) 25862306a36Sopenharmony_ci#define BM_MUX_MODE 0xf00 25962306a36Sopenharmony_ci#define BP_MUX_MODE 8 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_cistatic int imx7ulp_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, 26262306a36Sopenharmony_ci struct pinctrl_gpio_range *range, 26362306a36Sopenharmony_ci unsigned offset, bool input) 26462306a36Sopenharmony_ci{ 26562306a36Sopenharmony_ci struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); 26662306a36Sopenharmony_ci const struct imx_pin_reg *pin_reg; 26762306a36Sopenharmony_ci u32 reg; 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci pin_reg = &ipctl->pin_regs[offset]; 27062306a36Sopenharmony_ci if (pin_reg->mux_reg == -1) 27162306a36Sopenharmony_ci return -EINVAL; 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci reg = readl(ipctl->base + pin_reg->mux_reg); 27462306a36Sopenharmony_ci if (input) 27562306a36Sopenharmony_ci reg = (reg & ~BM_OBE_ENABLED) | BM_IBE_ENABLED; 27662306a36Sopenharmony_ci else 27762306a36Sopenharmony_ci reg = (reg & ~BM_IBE_ENABLED) | BM_OBE_ENABLED; 27862306a36Sopenharmony_ci writel(reg, ipctl->base + pin_reg->mux_reg); 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_ci return 0; 28162306a36Sopenharmony_ci} 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_cistatic const struct imx_pinctrl_soc_info imx7ulp_pinctrl_info = { 28462306a36Sopenharmony_ci .pins = imx7ulp_pinctrl_pads, 28562306a36Sopenharmony_ci .npins = ARRAY_SIZE(imx7ulp_pinctrl_pads), 28662306a36Sopenharmony_ci .flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG, 28762306a36Sopenharmony_ci .gpio_set_direction = imx7ulp_pmx_gpio_set_direction, 28862306a36Sopenharmony_ci .mux_mask = BM_MUX_MODE, 28962306a36Sopenharmony_ci .mux_shift = BP_MUX_MODE, 29062306a36Sopenharmony_ci}; 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_cistatic const struct of_device_id imx7ulp_pinctrl_of_match[] = { 29362306a36Sopenharmony_ci { .compatible = "fsl,imx7ulp-iomuxc1", }, 29462306a36Sopenharmony_ci { /* sentinel */ } 29562306a36Sopenharmony_ci}; 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_cistatic int imx7ulp_pinctrl_probe(struct platform_device *pdev) 29862306a36Sopenharmony_ci{ 29962306a36Sopenharmony_ci return imx_pinctrl_probe(pdev, &imx7ulp_pinctrl_info); 30062306a36Sopenharmony_ci} 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_cistatic struct platform_driver imx7ulp_pinctrl_driver = { 30362306a36Sopenharmony_ci .driver = { 30462306a36Sopenharmony_ci .name = "imx7ulp-pinctrl", 30562306a36Sopenharmony_ci .of_match_table = imx7ulp_pinctrl_of_match, 30662306a36Sopenharmony_ci .suppress_bind_attrs = true, 30762306a36Sopenharmony_ci }, 30862306a36Sopenharmony_ci .probe = imx7ulp_pinctrl_probe, 30962306a36Sopenharmony_ci}; 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_cistatic int __init imx7ulp_pinctrl_init(void) 31262306a36Sopenharmony_ci{ 31362306a36Sopenharmony_ci return platform_driver_register(&imx7ulp_pinctrl_driver); 31462306a36Sopenharmony_ci} 31562306a36Sopenharmony_ciarch_initcall(imx7ulp_pinctrl_init); 316