blob: 6f349dcd2e21a0b026fe281d930edd59fa901854 [file] [log] [blame]
Masahiro Yamada9a9999e2015-09-11 20:17:34 +09001/*
Masahiro Yamadafa1f73f2016-07-19 21:56:13 +09002 * Copyright (C) 2015-2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada9a9999e2015-09-11 20:17:34 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <dm/device.h>
9#include <dm/pinctrl.h>
10
11#include "pinctrl-uniphier.h"
12
Masahiro Yamada8721b512016-04-21 14:43:10 +090013static const struct uniphier_pinctrl_pin uniphier_pro4_pins[] = {
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090014};
15
16static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53};
Masahiro Yamada9447e132016-06-29 19:38:59 +090017static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090018static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47};
Masahiro Yamada9447e132016-06-29 19:38:59 +090019static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
Masahiro Yamadacc94a982016-06-29 19:39:01 +090020static const unsigned ether_mii_pins[] = {160, 161, 162, 163, 164, 165, 166,
21 167, 168, 169, 170, 171, 172, 173,
22 174, 175, 176, 177, 178, 179};
23static const int ether_mii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
24 0, 0, 0, 0, 0, 0, 0};
25static const unsigned ether_rgmii_pins[] = {160, 161, 162, 163, 164, 165, 167,
26 168, 169, 170, 171, 172, 176, 177,
27 178, 179};
28static const int ether_rgmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
29 0, 0, 0, 0};
30static const unsigned ether_rmii_pins[] = {160, 161, 162, 165, 168, 169, 172,
31 173, 176, 177, 178, 179};
32static const int ether_rmii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
33static const unsigned ether_rmiib_pins[] = {161, 162, 165, 167, 168, 169, 172,
34 173, 176, 177, 178, 179};
35static const int ether_rmiib_muxvals[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090036static const unsigned i2c0_pins[] = {142, 143};
Masahiro Yamada9447e132016-06-29 19:38:59 +090037static const int i2c0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090038static const unsigned i2c1_pins[] = {144, 145};
Masahiro Yamada9447e132016-06-29 19:38:59 +090039static const int i2c1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090040static const unsigned i2c2_pins[] = {146, 147};
Masahiro Yamada9447e132016-06-29 19:38:59 +090041static const int i2c2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090042static const unsigned i2c3_pins[] = {148, 149};
Masahiro Yamada9447e132016-06-29 19:38:59 +090043static const int i2c3_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090044static const unsigned i2c6_pins[] = {308, 309};
Masahiro Yamada9447e132016-06-29 19:38:59 +090045static const int i2c6_muxvals[] = {6, 6};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090046static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
47 50, 51, 52, 53, 54};
Masahiro Yamada9447e132016-06-29 19:38:59 +090048static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090049static const unsigned nand_cs1_pins[] = {131, 132};
Masahiro Yamada9447e132016-06-29 19:38:59 +090050static const int nand_cs1_muxvals[] = {1, 1};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090051static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158};
Masahiro Yamada9447e132016-06-29 19:38:59 +090052static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090053static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326,
54 327};
Masahiro Yamada9447e132016-06-29 19:38:59 +090055static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090056static const unsigned uart0_pins[] = {127, 128};
Masahiro Yamada9447e132016-06-29 19:38:59 +090057static const int uart0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090058static const unsigned uart1_pins[] = {129, 130};
Masahiro Yamada9447e132016-06-29 19:38:59 +090059static const int uart1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090060static const unsigned uart2_pins[] = {131, 132};
Masahiro Yamada9447e132016-06-29 19:38:59 +090061static const int uart2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090062static const unsigned uart3_pins[] = {88, 89};
Masahiro Yamada9447e132016-06-29 19:38:59 +090063static const int uart3_muxvals[] = {2, 2};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090064static const unsigned usb0_pins[] = {180, 181};
Masahiro Yamada9447e132016-06-29 19:38:59 +090065static const int usb0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090066static const unsigned usb1_pins[] = {182, 183};
Masahiro Yamada9447e132016-06-29 19:38:59 +090067static const int usb1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090068static const unsigned usb2_pins[] = {184, 185};
Masahiro Yamada9447e132016-06-29 19:38:59 +090069static const int usb2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090070static const unsigned usb3_pins[] = {186, 187};
Masahiro Yamada9447e132016-06-29 19:38:59 +090071static const int usb3_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090072
Masahiro Yamada8721b512016-04-21 14:43:10 +090073static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = {
Masahiro Yamada65ef4f72016-06-29 19:39:00 +090074 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
75 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
Masahiro Yamadacc94a982016-06-29 19:39:01 +090076 UNIPHIER_PINCTRL_GROUP(ether_mii),
77 UNIPHIER_PINCTRL_GROUP(ether_rgmii),
78 UNIPHIER_PINCTRL_GROUP(ether_rmii),
79 UNIPHIER_PINCTRL_GROUP(ether_rmiib),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090080 UNIPHIER_PINCTRL_GROUP(i2c0),
81 UNIPHIER_PINCTRL_GROUP(i2c1),
82 UNIPHIER_PINCTRL_GROUP(i2c2),
83 UNIPHIER_PINCTRL_GROUP(i2c3),
84 UNIPHIER_PINCTRL_GROUP(i2c6),
85 UNIPHIER_PINCTRL_GROUP(nand),
86 UNIPHIER_PINCTRL_GROUP(nand_cs1),
87 UNIPHIER_PINCTRL_GROUP(sd),
88 UNIPHIER_PINCTRL_GROUP(sd1),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +090089 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
90 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
91 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
92 UNIPHIER_PINCTRL_GROUP_SPL(uart3),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090093 UNIPHIER_PINCTRL_GROUP(usb0),
94 UNIPHIER_PINCTRL_GROUP(usb1),
95 UNIPHIER_PINCTRL_GROUP(usb2),
96 UNIPHIER_PINCTRL_GROUP(usb3),
97};
98
Masahiro Yamada8721b512016-04-21 14:43:10 +090099static const char * const uniphier_pro4_functions[] = {
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900100 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
Masahiro Yamadacc94a982016-06-29 19:39:01 +0900101 UNIPHIER_PINMUX_FUNCTION(ether_mii),
102 UNIPHIER_PINMUX_FUNCTION(ether_rgmii),
103 UNIPHIER_PINMUX_FUNCTION(ether_rmii),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900104 UNIPHIER_PINMUX_FUNCTION(i2c0),
105 UNIPHIER_PINMUX_FUNCTION(i2c1),
106 UNIPHIER_PINMUX_FUNCTION(i2c2),
107 UNIPHIER_PINMUX_FUNCTION(i2c3),
108 UNIPHIER_PINMUX_FUNCTION(i2c6),
109 UNIPHIER_PINMUX_FUNCTION(nand),
110 UNIPHIER_PINMUX_FUNCTION(sd),
111 UNIPHIER_PINMUX_FUNCTION(sd1),
112 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
113 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
114 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
115 UNIPHIER_PINMUX_FUNCTION_SPL(uart3),
116 UNIPHIER_PINMUX_FUNCTION(usb0),
117 UNIPHIER_PINMUX_FUNCTION(usb1),
118 UNIPHIER_PINMUX_FUNCTION(usb2),
119 UNIPHIER_PINMUX_FUNCTION(usb3),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900120};
121
Masahiro Yamada8721b512016-04-21 14:43:10 +0900122static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = {
123 .pins = uniphier_pro4_pins,
124 .pins_count = ARRAY_SIZE(uniphier_pro4_pins),
125 .groups = uniphier_pro4_groups,
126 .groups_count = ARRAY_SIZE(uniphier_pro4_groups),
127 .functions = uniphier_pro4_functions,
128 .functions_count = ARRAY_SIZE(uniphier_pro4_functions),
Masahiro Yamada7a629ef2016-03-24 22:32:44 +0900129 .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE,
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900130};
131
Masahiro Yamada8721b512016-04-21 14:43:10 +0900132static int uniphier_pro4_pinctrl_probe(struct udevice *dev)
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900133{
Masahiro Yamada8721b512016-04-21 14:43:10 +0900134 return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata);
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900135}
136
Masahiro Yamada8721b512016-04-21 14:43:10 +0900137static const struct udevice_id uniphier_pro4_pinctrl_match[] = {
Masahiro Yamada13d8ac32016-06-29 19:38:57 +0900138 { .compatible = "socionext,uniphier-pro4-pinctrl" },
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900139 { /* sentinel */ }
140};
141
Masahiro Yamada8721b512016-04-21 14:43:10 +0900142U_BOOT_DRIVER(uniphier_pro4_pinctrl) = {
143 .name = "uniphier-pro4-pinctrl",
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900144 .id = UCLASS_PINCTRL,
Masahiro Yamada8721b512016-04-21 14:43:10 +0900145 .of_match = of_match_ptr(uniphier_pro4_pinctrl_match),
146 .probe = uniphier_pro4_pinctrl_probe,
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900147 .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
148 .ops = &uniphier_pinctrl_ops,
149 .flags = DM_FLAG_PRE_RELOC,
150};