blob: 9adf999d3bb6581af3c706bba1c44e54e3f0babd [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Peng Fane2fd36cc2016-02-03 10:06:07 +08002/*
3 * Copyright (C) 2016 Peng Fan <van.freenix@gmail.com>
Peng Fane2fd36cc2016-02-03 10:06:07 +08004 */
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 Fanf70bf2b2017-02-22 16:21:49 +080013 * @mux_mask: Used when SHARE_MUX_CONF_REG flag is added
Peng Fane2fd36cc2016-02-03 10:06:07 +080014 */
15struct imx_pinctrl_soc_info {
16 void __iomem *base;
17 void __iomem *input_sel_base;
18 unsigned int flags;
Peng Fanf70bf2b2017-02-22 16:21:49 +080019 unsigned int mux_mask;
Peng Fane2fd36cc2016-02-03 10:06:07 +080020};
21
22/**
23 * @dev: a pointer back to containing device
24 * @info: the soc info
25 */
26struct imx_pinctrl_priv {
27 struct udevice *dev;
28 struct imx_pinctrl_soc_info *info;
29};
30
Peng Fane2fd36cc2016-02-03 10:06:07 +080031#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 Fane84d11f2018-10-18 14:28:28 +020041/* 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 Fane2fd36cc2016-02-03 10:06:07 +080044#define SHARE_MUX_CONF_REG 0x1
45#define ZERO_OFFSET_VALID 0x2
Tom Rini364d0022023-01-10 11:19:45 -050046#define CFG_IBE_OBE 0x4
Peng Fane84d11f2018-10-18 14:28:28 +020047#define IMX8_USE_SCU 0x8
Peng Fane2fd36cc2016-02-03 10:06:07 +080048
49#define IOMUXC_CONFIG_SION (0x1 << 4)
50
Marek Vasutf19a47f2025-01-24 15:50:54 +010051int imx_pinctrl_probe_common(struct udevice *dev);
52int imx_pinctrl_probe_mmio(struct udevice *dev);
Peng Fane2fd36cc2016-02-03 10:06:07 +080053
Marek Vasuta81f0d62025-01-24 15:50:55 +010054int imx_pinctrl_remove_mmio(struct udevice *dev);
Peng Fane84d11f2018-10-18 14:28:28 +020055
Marek Vasut964d87c2025-01-24 15:50:56 +010056int imx_pinctrl_set_state_common(struct udevice *dev, struct udevice *config,
57 int pin_size, u32 **pin_data, int *npins);
58int imx_pinctrl_set_state_mmio(struct udevice *dev, struct udevice *config);
Peng Fane84d11f2018-10-18 14:28:28 +020059
Peng Fane2fd36cc2016-02-03 10:06:07 +080060#endif /* __DRIVERS_PINCTRL_IMX_H */