blob: f87a2c6dd72cd462eddcdd2d6e68869e91b251e2 [file] [log] [blame]
Masahiro Yamadaa3438122015-09-11 20:17:34 +09001/*
2 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <dm/device.h>
8#include <dm/pinctrl.h>
9
10#include "pinctrl-uniphier.h"
11
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090012static const struct uniphier_pinctrl_pin uniphier_pro4_pins[] = {
Masahiro Yamadaa3438122015-09-11 20:17:34 +090013};
14
15static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090016static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090017static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090018static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090019static const unsigned i2c0_pins[] = {142, 143};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090020static const int i2c0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090021static const unsigned i2c1_pins[] = {144, 145};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090022static const int i2c1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090023static const unsigned i2c2_pins[] = {146, 147};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090024static const int i2c2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090025static const unsigned i2c3_pins[] = {148, 149};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090026static const int i2c3_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090027static const unsigned i2c6_pins[] = {308, 309};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090028static const int i2c6_muxvals[] = {6, 6};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090029static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
30 50, 51, 52, 53, 54};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090031static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090032static const unsigned nand_cs1_pins[] = {131, 132};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090033static const int nand_cs1_muxvals[] = {1, 1};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090034static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090035static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090036static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326,
37 327};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090038static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090039static const unsigned uart0_pins[] = {127, 128};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090040static const int uart0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090041static const unsigned uart1_pins[] = {129, 130};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090042static const int uart1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090043static const unsigned uart2_pins[] = {131, 132};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090044static const int uart2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090045static const unsigned uart3_pins[] = {88, 89};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090046static const int uart3_muxvals[] = {2, 2};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090047static const unsigned usb0_pins[] = {180, 181};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090048static const int usb0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090049static const unsigned usb1_pins[] = {182, 183};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090050static const int usb1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090051static const unsigned usb2_pins[] = {184, 185};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090052static const int usb2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090053static const unsigned usb3_pins[] = {186, 187};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090054static const int usb3_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090055
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090056static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = {
Masahiro Yamada64c1cc42016-06-29 19:39:00 +090057 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
58 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
Masahiro Yamadaa3438122015-09-11 20:17:34 +090059 UNIPHIER_PINCTRL_GROUP(i2c0),
60 UNIPHIER_PINCTRL_GROUP(i2c1),
61 UNIPHIER_PINCTRL_GROUP(i2c2),
62 UNIPHIER_PINCTRL_GROUP(i2c3),
63 UNIPHIER_PINCTRL_GROUP(i2c6),
64 UNIPHIER_PINCTRL_GROUP(nand),
65 UNIPHIER_PINCTRL_GROUP(nand_cs1),
66 UNIPHIER_PINCTRL_GROUP(sd),
67 UNIPHIER_PINCTRL_GROUP(sd1),
Masahiro Yamada64c1cc42016-06-29 19:39:00 +090068 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
69 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
70 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
71 UNIPHIER_PINCTRL_GROUP_SPL(uart3),
Masahiro Yamadaa3438122015-09-11 20:17:34 +090072 UNIPHIER_PINCTRL_GROUP(usb0),
73 UNIPHIER_PINCTRL_GROUP(usb1),
74 UNIPHIER_PINCTRL_GROUP(usb2),
75 UNIPHIER_PINCTRL_GROUP(usb3),
76};
77
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090078static const char * const uniphier_pro4_functions[] = {
Masahiro Yamada64c1cc42016-06-29 19:39:00 +090079 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
80 UNIPHIER_PINMUX_FUNCTION(i2c0),
81 UNIPHIER_PINMUX_FUNCTION(i2c1),
82 UNIPHIER_PINMUX_FUNCTION(i2c2),
83 UNIPHIER_PINMUX_FUNCTION(i2c3),
84 UNIPHIER_PINMUX_FUNCTION(i2c6),
85 UNIPHIER_PINMUX_FUNCTION(nand),
86 UNIPHIER_PINMUX_FUNCTION(sd),
87 UNIPHIER_PINMUX_FUNCTION(sd1),
88 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
89 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
90 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
91 UNIPHIER_PINMUX_FUNCTION_SPL(uart3),
92 UNIPHIER_PINMUX_FUNCTION(usb0),
93 UNIPHIER_PINMUX_FUNCTION(usb1),
94 UNIPHIER_PINMUX_FUNCTION(usb2),
95 UNIPHIER_PINMUX_FUNCTION(usb3),
Masahiro Yamadaa3438122015-09-11 20:17:34 +090096};
97
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090098static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = {
99 .pins = uniphier_pro4_pins,
100 .pins_count = ARRAY_SIZE(uniphier_pro4_pins),
101 .groups = uniphier_pro4_groups,
102 .groups_count = ARRAY_SIZE(uniphier_pro4_groups),
103 .functions = uniphier_pro4_functions,
104 .functions_count = ARRAY_SIZE(uniphier_pro4_functions),
Masahiro Yamada8cc92b92016-03-24 22:32:44 +0900105 .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE,
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900106};
107
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900108static int uniphier_pro4_pinctrl_probe(struct udevice *dev)
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900109{
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900110 return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata);
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900111}
112
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900113static const struct udevice_id uniphier_pro4_pinctrl_match[] = {
Masahiro Yamada186c1332016-06-29 19:38:57 +0900114 { .compatible = "socionext,uniphier-pro4-pinctrl" },
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900115 { /* sentinel */ }
116};
117
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900118U_BOOT_DRIVER(uniphier_pro4_pinctrl) = {
119 .name = "uniphier-pro4-pinctrl",
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900120 .id = UCLASS_PINCTRL,
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900121 .of_match = of_match_ptr(uniphier_pro4_pinctrl_match),
122 .probe = uniphier_pro4_pinctrl_probe,
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900123 .remove = uniphier_pinctrl_remove,
124 .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
125 .ops = &uniphier_pinctrl_ops,
126 .flags = DM_FLAG_PRE_RELOC,
127};