1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2016 Peng Fan <van.freenix@gmail.com>
4  */
5 
6 #include <common.h>
7 #include <dm.h>
8 #include <dm/pinctrl.h>
9 
10 #include "pinctrl-imx.h"
11 
12 static struct imx_pinctrl_soc_info imx7_pinctrl_soc_info;
13 
14 static struct imx_pinctrl_soc_info imx7_lpsr_pinctrl_soc_info = {
15 	.flags = ZERO_OFFSET_VALID,
16 };
17 
18 static int imx7_pinctrl_probe(struct udevice *dev)
19 {
20 	struct imx_pinctrl_soc_info *info =
21 		(struct imx_pinctrl_soc_info *)dev_get_driver_data(dev);
22 
23 	return imx_pinctrl_probe(dev, info);
24 }
25 
26 static const struct udevice_id imx7_pinctrl_match[] = {
27 	{ .compatible = "fsl,imx7d-iomuxc", .data = (ulong)&imx7_pinctrl_soc_info },
28 	{ .compatible = "fsl,imx7d-iomuxc-lpsr", .data = (ulong)&imx7_lpsr_pinctrl_soc_info },
29 	{ /* sentinel */ }
30 };
31 
32 U_BOOT_DRIVER(imx7_pinctrl) = {
33 	.name = "imx7-pinctrl",
34 	.id = UCLASS_PINCTRL,
35 	.of_match = of_match_ptr(imx7_pinctrl_match),
36 	.probe = imx7_pinctrl_probe,
37 	.remove = imx_pinctrl_remove,
38 	.priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv),
39 	.ops = &imx_pinctrl_ops,
40 #if !CONFIG_IS_ENABLED(OF_CONTROL)
41 	.flags = DM_FLAG_PRE_RELOC,
42 #endif
43 };
44