Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016 Peng Fan <van.freenix@gmail.com> |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __DRIVERS_PINCTRL_IMX_H |
| 7 | #define __DRIVERS_PINCTRL_IMX_H |
| 8 | |
| 9 | /** |
| 10 | * @base: the address to the controller in virtual memory |
| 11 | * @input_sel_base: the address of the select input in virtual memory. |
| 12 | * @flags: flags specific for each soc |
Peng Fan | f70bf2b | 2017-02-22 16:21:49 +0800 | [diff] [blame] | 13 | * @mux_mask: Used when SHARE_MUX_CONF_REG flag is added |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 14 | */ |
| 15 | struct imx_pinctrl_soc_info { |
| 16 | void __iomem *base; |
| 17 | void __iomem *input_sel_base; |
| 18 | unsigned int flags; |
Peng Fan | f70bf2b | 2017-02-22 16:21:49 +0800 | [diff] [blame] | 19 | unsigned int mux_mask; |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 20 | }; |
| 21 | |
| 22 | /** |
| 23 | * @dev: a pointer back to containing device |
| 24 | * @info: the soc info |
| 25 | */ |
| 26 | struct imx_pinctrl_priv { |
| 27 | struct udevice *dev; |
| 28 | struct imx_pinctrl_soc_info *info; |
| 29 | }; |
| 30 | |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 31 | #define IMX_NO_PAD_CTL 0x80000000 /* no pin config need */ |
| 32 | #define IMX_PAD_SION 0x40000000 /* set SION */ |
| 33 | |
| 34 | /* |
| 35 | * Each pin represented in fsl,pins consists of 5 u32 PIN_FUNC_ID and |
| 36 | * 1 u32 CONFIG, so 24 types in total for each pin. |
| 37 | */ |
| 38 | #define FSL_PIN_SIZE 24 |
| 39 | #define SHARE_FSL_PIN_SIZE 20 |
| 40 | |
Peng Fan | e84d11f | 2018-10-18 14:28:28 +0200 | [diff] [blame] | 41 | /* Each pin on imx8qm/qxp consists of 2 u32 PIN_FUNC_ID and 1 u32 CONFIG */ |
| 42 | #define SHARE_IMX8_PIN_SIZE 12 |
| 43 | |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 44 | #define SHARE_MUX_CONF_REG 0x1 |
| 45 | #define ZERO_OFFSET_VALID 0x2 |
Tom Rini | 364d002 | 2023-01-10 11:19:45 -0500 | [diff] [blame] | 46 | #define CFG_IBE_OBE 0x4 |
Peng Fan | e84d11f | 2018-10-18 14:28:28 +0200 | [diff] [blame] | 47 | #define IMX8_USE_SCU 0x8 |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 48 | |
| 49 | #define IOMUXC_CONFIG_SION (0x1 << 4) |
| 50 | |
Marek Vasut | f19a47f | 2025-01-24 15:50:54 +0100 | [diff] [blame] | 51 | int imx_pinctrl_probe_common(struct udevice *dev); |
| 52 | int imx_pinctrl_probe_mmio(struct udevice *dev); |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 53 | |
Marek Vasut | a81f0d6 | 2025-01-24 15:50:55 +0100 | [diff] [blame] | 54 | int imx_pinctrl_remove_mmio(struct udevice *dev); |
Peng Fan | e84d11f | 2018-10-18 14:28:28 +0200 | [diff] [blame] | 55 | |
Marek Vasut | 964d87c | 2025-01-24 15:50:56 +0100 | [diff] [blame] | 56 | int imx_pinctrl_set_state_common(struct udevice *dev, struct udevice *config, |
| 57 | int pin_size, u32 **pin_data, int *npins); |
| 58 | int imx_pinctrl_set_state_mmio(struct udevice *dev, struct udevice *config); |
Peng Fan | e84d11f | 2018-10-18 14:28:28 +0200 | [diff] [blame] | 59 | |
Peng Fan | e2fd36cc | 2016-02-03 10:06:07 +0800 | [diff] [blame] | 60 | #endif /* __DRIVERS_PINCTRL_IMX_H */ |