Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | fa1f73f | 2016-07-19 21:56:13 +0900 | [diff] [blame] | 2 | * Copyright (C) 2015-2016 Socionext Inc. |
| 3 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
Simon Glass | 51a3ec3 | 2017-05-17 17:18:07 -0600 | [diff] [blame] | 8 | #include <common.h> |
Simon Glass | 11c89f3 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 9 | #include <dm.h> |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 10 | #include <dm/pinctrl.h> |
| 11 | |
| 12 | #include "pinctrl-uniphier.h" |
| 13 | |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 14 | static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 15 | static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 16 | static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 17 | static const int emmc_dat8_muxvals[] = {1, 1, 1, 1}; |
Masahiro Yamada | cc94a98 | 2016-06-29 19:39:01 +0900 | [diff] [blame] | 18 | static const unsigned ether_mii_pins[] = {160, 161, 162, 163, 164, 165, 166, |
| 19 | 167, 168, 169, 170, 171, 172, 173, |
| 20 | 174, 175, 176, 177, 178, 179}; |
| 21 | static const int ether_mii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 22 | 0, 0, 0, 0, 0, 0, 0}; |
| 23 | static const unsigned ether_rgmii_pins[] = {160, 161, 162, 163, 164, 165, 167, |
| 24 | 168, 169, 170, 171, 172, 176, 177, |
| 25 | 178, 179}; |
| 26 | static const int ether_rgmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 27 | 0, 0, 0, 0}; |
| 28 | static const unsigned ether_rmii_pins[] = {160, 161, 162, 165, 168, 169, 172, |
| 29 | 173, 176, 177, 178, 179}; |
| 30 | static const int ether_rmii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 31 | static const unsigned ether_rmiib_pins[] = {161, 162, 165, 167, 168, 169, 172, |
| 32 | 173, 176, 177, 178, 179}; |
| 33 | static const int ether_rmiib_muxvals[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 34 | static const unsigned i2c0_pins[] = {142, 143}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 35 | static const int i2c0_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 36 | static const unsigned i2c1_pins[] = {144, 145}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 37 | static const int i2c1_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 38 | static const unsigned i2c2_pins[] = {146, 147}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 39 | static const int i2c2_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 40 | static const unsigned i2c3_pins[] = {148, 149}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 41 | static const int i2c3_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 42 | static const unsigned i2c6_pins[] = {308, 309}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 43 | static const int i2c6_muxvals[] = {6, 6}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 44 | static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, |
| 45 | 50, 51, 52, 53, 54}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 46 | static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 47 | static const unsigned nand_cs1_pins[] = {131, 132}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 48 | static const int nand_cs1_muxvals[] = {1, 1}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 49 | static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 50 | static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 51 | static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326, |
| 52 | 327}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 53 | static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; |
Masahiro Yamada | 82a5178 | 2016-09-14 01:06:04 +0900 | [diff] [blame] | 54 | static const unsigned system_bus_pins[] = {25, 26, 27, 28, 29, 30, 31, 32, 33, |
| 55 | 34, 35, 36, 37, 38}; |
| 56 | static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 57 | 0}; |
| 58 | static const unsigned system_bus_cs0_pins[] = {318}; |
| 59 | static const int system_bus_cs0_muxvals[] = {5}; |
| 60 | static const unsigned system_bus_cs1_pins[] = {24}; |
| 61 | static const int system_bus_cs1_muxvals[] = {0}; |
| 62 | static const unsigned system_bus_cs2_pins[] = {315}; |
| 63 | static const int system_bus_cs2_muxvals[] = {5}; |
| 64 | static const unsigned system_bus_cs3_pins[] = {313}; |
| 65 | static const int system_bus_cs3_muxvals[] = {5}; |
| 66 | static const unsigned system_bus_cs4_pins[] = {305}; |
| 67 | static const int system_bus_cs4_muxvals[] = {5}; |
| 68 | static const unsigned system_bus_cs5_pins[] = {303}; |
| 69 | static const int system_bus_cs5_muxvals[] = {6}; |
| 70 | static const unsigned system_bus_cs6_pins[] = {307}; |
| 71 | static const int system_bus_cs6_muxvals[] = {6}; |
| 72 | static const unsigned system_bus_cs7_pins[] = {312}; |
| 73 | static const int system_bus_cs7_muxvals[] = {6}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 74 | static const unsigned uart0_pins[] = {127, 128}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 75 | static const int uart0_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 76 | static const unsigned uart1_pins[] = {129, 130}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 77 | static const int uart1_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 78 | static const unsigned uart2_pins[] = {131, 132}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 79 | static const int uart2_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 80 | static const unsigned uart3_pins[] = {88, 89}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 81 | static const int uart3_muxvals[] = {2, 2}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 82 | static const unsigned usb0_pins[] = {180, 181}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 83 | static const int usb0_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 84 | static const unsigned usb1_pins[] = {182, 183}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 85 | static const int usb1_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 86 | static const unsigned usb2_pins[] = {184, 185}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 87 | static const int usb2_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 88 | static const unsigned usb3_pins[] = {186, 187}; |
Masahiro Yamada | 9447e13 | 2016-06-29 19:38:59 +0900 | [diff] [blame] | 89 | static const int usb3_muxvals[] = {0, 0}; |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 90 | |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 91 | static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = { |
Masahiro Yamada | 65ef4f7 | 2016-06-29 19:39:00 +0900 | [diff] [blame] | 92 | UNIPHIER_PINCTRL_GROUP_SPL(emmc), |
| 93 | UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8), |
Masahiro Yamada | cc94a98 | 2016-06-29 19:39:01 +0900 | [diff] [blame] | 94 | UNIPHIER_PINCTRL_GROUP(ether_mii), |
| 95 | UNIPHIER_PINCTRL_GROUP(ether_rgmii), |
| 96 | UNIPHIER_PINCTRL_GROUP(ether_rmii), |
| 97 | UNIPHIER_PINCTRL_GROUP(ether_rmiib), |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 98 | UNIPHIER_PINCTRL_GROUP(i2c0), |
| 99 | UNIPHIER_PINCTRL_GROUP(i2c1), |
| 100 | UNIPHIER_PINCTRL_GROUP(i2c2), |
| 101 | UNIPHIER_PINCTRL_GROUP(i2c3), |
| 102 | UNIPHIER_PINCTRL_GROUP(i2c6), |
| 103 | UNIPHIER_PINCTRL_GROUP(nand), |
| 104 | UNIPHIER_PINCTRL_GROUP(nand_cs1), |
| 105 | UNIPHIER_PINCTRL_GROUP(sd), |
| 106 | UNIPHIER_PINCTRL_GROUP(sd1), |
Masahiro Yamada | 82a5178 | 2016-09-14 01:06:04 +0900 | [diff] [blame] | 107 | UNIPHIER_PINCTRL_GROUP(system_bus), |
| 108 | UNIPHIER_PINCTRL_GROUP(system_bus_cs0), |
| 109 | UNIPHIER_PINCTRL_GROUP(system_bus_cs1), |
| 110 | UNIPHIER_PINCTRL_GROUP(system_bus_cs2), |
| 111 | UNIPHIER_PINCTRL_GROUP(system_bus_cs3), |
| 112 | UNIPHIER_PINCTRL_GROUP(system_bus_cs4), |
| 113 | UNIPHIER_PINCTRL_GROUP(system_bus_cs5), |
| 114 | UNIPHIER_PINCTRL_GROUP(system_bus_cs6), |
| 115 | UNIPHIER_PINCTRL_GROUP(system_bus_cs7), |
Masahiro Yamada | 65ef4f7 | 2016-06-29 19:39:00 +0900 | [diff] [blame] | 116 | UNIPHIER_PINCTRL_GROUP_SPL(uart0), |
| 117 | UNIPHIER_PINCTRL_GROUP_SPL(uart1), |
| 118 | UNIPHIER_PINCTRL_GROUP_SPL(uart2), |
| 119 | UNIPHIER_PINCTRL_GROUP_SPL(uart3), |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 120 | UNIPHIER_PINCTRL_GROUP(usb0), |
| 121 | UNIPHIER_PINCTRL_GROUP(usb1), |
| 122 | UNIPHIER_PINCTRL_GROUP(usb2), |
| 123 | UNIPHIER_PINCTRL_GROUP(usb3), |
| 124 | }; |
| 125 | |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 126 | static const char * const uniphier_pro4_functions[] = { |
Masahiro Yamada | 65ef4f7 | 2016-06-29 19:39:00 +0900 | [diff] [blame] | 127 | UNIPHIER_PINMUX_FUNCTION_SPL(emmc), |
Masahiro Yamada | cc94a98 | 2016-06-29 19:39:01 +0900 | [diff] [blame] | 128 | UNIPHIER_PINMUX_FUNCTION(ether_mii), |
| 129 | UNIPHIER_PINMUX_FUNCTION(ether_rgmii), |
| 130 | UNIPHIER_PINMUX_FUNCTION(ether_rmii), |
Masahiro Yamada | 65ef4f7 | 2016-06-29 19:39:00 +0900 | [diff] [blame] | 131 | UNIPHIER_PINMUX_FUNCTION(i2c0), |
| 132 | UNIPHIER_PINMUX_FUNCTION(i2c1), |
| 133 | UNIPHIER_PINMUX_FUNCTION(i2c2), |
| 134 | UNIPHIER_PINMUX_FUNCTION(i2c3), |
| 135 | UNIPHIER_PINMUX_FUNCTION(i2c6), |
| 136 | UNIPHIER_PINMUX_FUNCTION(nand), |
| 137 | UNIPHIER_PINMUX_FUNCTION(sd), |
| 138 | UNIPHIER_PINMUX_FUNCTION(sd1), |
Masahiro Yamada | 82a5178 | 2016-09-14 01:06:04 +0900 | [diff] [blame] | 139 | UNIPHIER_PINMUX_FUNCTION(system_bus), |
Masahiro Yamada | 65ef4f7 | 2016-06-29 19:39:00 +0900 | [diff] [blame] | 140 | UNIPHIER_PINMUX_FUNCTION_SPL(uart0), |
| 141 | UNIPHIER_PINMUX_FUNCTION_SPL(uart1), |
| 142 | UNIPHIER_PINMUX_FUNCTION_SPL(uart2), |
| 143 | UNIPHIER_PINMUX_FUNCTION_SPL(uart3), |
| 144 | UNIPHIER_PINMUX_FUNCTION(usb0), |
| 145 | UNIPHIER_PINMUX_FUNCTION(usb1), |
| 146 | UNIPHIER_PINMUX_FUNCTION(usb2), |
| 147 | UNIPHIER_PINMUX_FUNCTION(usb3), |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 148 | }; |
| 149 | |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 150 | static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = { |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 151 | .groups = uniphier_pro4_groups, |
| 152 | .groups_count = ARRAY_SIZE(uniphier_pro4_groups), |
| 153 | .functions = uniphier_pro4_functions, |
| 154 | .functions_count = ARRAY_SIZE(uniphier_pro4_functions), |
Masahiro Yamada | 7a629ef | 2016-03-24 22:32:44 +0900 | [diff] [blame] | 155 | .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE, |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 156 | }; |
| 157 | |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 158 | static int uniphier_pro4_pinctrl_probe(struct udevice *dev) |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 159 | { |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 160 | return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata); |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 161 | } |
| 162 | |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 163 | static const struct udevice_id uniphier_pro4_pinctrl_match[] = { |
Masahiro Yamada | 13d8ac3 | 2016-06-29 19:38:57 +0900 | [diff] [blame] | 164 | { .compatible = "socionext,uniphier-pro4-pinctrl" }, |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 165 | { /* sentinel */ } |
| 166 | }; |
| 167 | |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 168 | U_BOOT_DRIVER(uniphier_pro4_pinctrl) = { |
| 169 | .name = "uniphier-pro4-pinctrl", |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 170 | .id = UCLASS_PINCTRL, |
Masahiro Yamada | 8721b51 | 2016-04-21 14:43:10 +0900 | [diff] [blame] | 171 | .of_match = of_match_ptr(uniphier_pro4_pinctrl_match), |
| 172 | .probe = uniphier_pro4_pinctrl_probe, |
Masahiro Yamada | 9a9999e | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 173 | .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), |
| 174 | .ops = &uniphier_pinctrl_ops, |
| 175 | .flags = DM_FLAG_PRE_RELOC, |
| 176 | }; |