2 * Exynos7420 pinctrl driver.
3 * Copyright (C) 2016 Samsung Electronics
4 * Thomas Abraham <thomas.ab@samsung.com>
6 * SPDX-License-Identifier: GPL-2.0+
13 #include <dm/pinctrl.h>
16 #include <asm/arch/pinmux.h>
17 #include "pinctrl-exynos.h"
19 #define GPD1_OFFSET 0xc0
21 static struct exynos_pinctrl_config_data serial2_conf[] = {
23 .offset = GPD1_OFFSET + PIN_CON,
27 .offset = GPD1_OFFSET + PIN_PUD,
33 static int exynos7420_pinctrl_request(struct udevice *dev, int peripheral,
36 struct exynos_pinctrl_priv *priv = dev_get_priv(dev);
37 unsigned long base = priv->base;
39 switch (PERIPH_ID_UART2) {
41 exynos_pinctrl_setup_peri(serial2_conf,
42 ARRAY_SIZE(serial2_conf), base);
51 static struct pinctrl_ops exynos7420_pinctrl_ops = {
52 .set_state = exynos_pinctrl_set_state,
53 .request = exynos7420_pinctrl_request,
56 /* pin banks of Exynos7420 pin-controller - BUS0 */
57 static const struct samsung_pin_bank_data exynos7420_pin_banks0[] = {
58 EXYNOS_PIN_BANK(5, 0x000, "gpb0"),
59 EXYNOS_PIN_BANK(8, 0x020, "gpc0"),
60 EXYNOS_PIN_BANK(2, 0x040, "gpc1"),
61 EXYNOS_PIN_BANK(6, 0x060, "gpc2"),
62 EXYNOS_PIN_BANK(8, 0x080, "gpc3"),
63 EXYNOS_PIN_BANK(4, 0x0a0, "gpd0"),
64 EXYNOS_PIN_BANK(6, 0x0c0, "gpd1"),
65 EXYNOS_PIN_BANK(8, 0x0e0, "gpd2"),
66 EXYNOS_PIN_BANK(5, 0x100, "gpd4"),
67 EXYNOS_PIN_BANK(4, 0x120, "gpd5"),
68 EXYNOS_PIN_BANK(6, 0x140, "gpd6"),
69 EXYNOS_PIN_BANK(3, 0x160, "gpd7"),
70 EXYNOS_PIN_BANK(2, 0x180, "gpd8"),
71 EXYNOS_PIN_BANK(2, 0x1a0, "gpg0"),
72 EXYNOS_PIN_BANK(4, 0x1c0, "gpg3"),
75 /* pin banks of Exynos7420 pin-controller - FSYS0 */
76 static const struct samsung_pin_bank_data exynos7420_pin_banks1[] = {
77 EXYNOS_PIN_BANK(7, 0x000, "gpr4"),
80 /* pin banks of Exynos7420 pin-controller - FSYS1 */
81 static const struct samsung_pin_bank_data exynos7420_pin_banks2[] = {
82 EXYNOS_PIN_BANK(4, 0x000, "gpr0"),
83 EXYNOS_PIN_BANK(8, 0x020, "gpr1"),
84 EXYNOS_PIN_BANK(5, 0x040, "gpr2"),
85 EXYNOS_PIN_BANK(8, 0x060, "gpr3"),
88 const struct samsung_pin_ctrl exynos7420_pin_ctrl[] = {
90 /* pin-controller instance BUS0 data */
91 .pin_banks = exynos7420_pin_banks0,
92 .nr_banks = ARRAY_SIZE(exynos7420_pin_banks0),
94 /* pin-controller instance FSYS0 data */
95 .pin_banks = exynos7420_pin_banks1,
96 .nr_banks = ARRAY_SIZE(exynos7420_pin_banks1),
98 /* pin-controller instance FSYS1 data */
99 .pin_banks = exynos7420_pin_banks2,
100 .nr_banks = ARRAY_SIZE(exynos7420_pin_banks2),
104 static const struct udevice_id exynos7420_pinctrl_ids[] = {
105 { .compatible = "samsung,exynos7420-pinctrl",
106 .data = (ulong)exynos7420_pin_ctrl },
110 U_BOOT_DRIVER(pinctrl_exynos7420) = {
111 .name = "pinctrl_exynos7420",
112 .id = UCLASS_PINCTRL,
113 .of_match = exynos7420_pinctrl_ids,
114 .priv_auto_alloc_size = sizeof(struct exynos_pinctrl_priv),
115 .ops = &exynos7420_pinctrl_ops,
116 .probe = exynos_pinctrl_probe,
117 .flags = DM_FLAG_PRE_RELOC