Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | 9bc1564 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 7 | #include <malloc.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 8 | #include <asm/global_data.h> |
Simon Glass | 9bc1564 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 9 | #include <dm/device_compat.h> |
Masahiro Yamada | 75f82d0 | 2018-03-05 01:20:11 +0900 | [diff] [blame] | 10 | #include <linux/libfdt.h> |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 11 | #include <linux/err.h> |
| 12 | #include <linux/list.h> |
Simon Glass | 11c89f3 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 13 | #include <dm.h> |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 14 | #include <dm/lists.h> |
| 15 | #include <dm/pinctrl.h> |
Heiko Stübner | 9a2cdca | 2017-02-18 19:46:21 +0100 | [diff] [blame] | 16 | #include <dm/util.h> |
Kever Yang | a589762 | 2018-02-09 10:56:24 +0800 | [diff] [blame] | 17 | #include <dm/of_access.h> |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 18 | |
| 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
| 21 | #if CONFIG_IS_ENABLED(PINCTRL_FULL) |
| 22 | /** |
| 23 | * pinctrl_config_one() - apply pinctrl settings for a single node |
| 24 | * |
| 25 | * @config: pin configuration node |
| 26 | * @return: 0 on success, or negative error code on failure |
| 27 | */ |
| 28 | static int pinctrl_config_one(struct udevice *config) |
| 29 | { |
| 30 | struct udevice *pctldev; |
| 31 | const struct pinctrl_ops *ops; |
| 32 | |
| 33 | pctldev = config; |
| 34 | for (;;) { |
| 35 | pctldev = dev_get_parent(pctldev); |
| 36 | if (!pctldev) { |
| 37 | dev_err(config, "could not find pctldev\n"); |
| 38 | return -EINVAL; |
| 39 | } |
| 40 | if (pctldev->uclass->uc_drv->id == UCLASS_PINCTRL) |
| 41 | break; |
| 42 | } |
| 43 | |
| 44 | ops = pinctrl_get_ops(pctldev); |
| 45 | return ops->set_state(pctldev, config); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * pinctrl_select_state_full() - full implementation of pinctrl_select_state |
| 50 | * |
| 51 | * @dev: peripheral device |
| 52 | * @statename: state name, like "default" |
| 53 | * @return: 0 on success, or negative error code on failure |
| 54 | */ |
| 55 | static int pinctrl_select_state_full(struct udevice *dev, const char *statename) |
| 56 | { |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 57 | char propname[32]; /* long enough */ |
| 58 | const fdt32_t *list; |
| 59 | uint32_t phandle; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 60 | struct udevice *config; |
| 61 | int state, size, i, ret; |
| 62 | |
Kever Yang | a589762 | 2018-02-09 10:56:24 +0800 | [diff] [blame] | 63 | state = dev_read_stringlist_search(dev, "pinctrl-names", statename); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 64 | if (state < 0) { |
| 65 | char *end; |
| 66 | /* |
| 67 | * If statename is not found in "pinctrl-names", |
| 68 | * assume statename is just the integer state ID. |
| 69 | */ |
| 70 | state = simple_strtoul(statename, &end, 10); |
| 71 | if (*end) |
| 72 | return -EINVAL; |
| 73 | } |
| 74 | |
| 75 | snprintf(propname, sizeof(propname), "pinctrl-%d", state); |
Kever Yang | a589762 | 2018-02-09 10:56:24 +0800 | [diff] [blame] | 76 | list = dev_read_prop(dev, propname, &size); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 77 | if (!list) |
| 78 | return -EINVAL; |
| 79 | |
| 80 | size /= sizeof(*list); |
| 81 | for (i = 0; i < size; i++) { |
| 82 | phandle = fdt32_to_cpu(*list++); |
Kever Yang | a589762 | 2018-02-09 10:56:24 +0800 | [diff] [blame] | 83 | ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle, |
| 84 | &config); |
Michael Trimarchi | 990a4c5 | 2019-09-17 22:06:03 +0200 | [diff] [blame] | 85 | if (ret) { |
| 86 | dev_warn(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n", |
| 87 | __func__, ret); |
| 88 | continue; |
| 89 | } |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 90 | |
| 91 | ret = pinctrl_config_one(config); |
Michael Trimarchi | 990a4c5 | 2019-09-17 22:06:03 +0200 | [diff] [blame] | 92 | if (ret) { |
| 93 | dev_warn(dev, "%s: pinctrl_config_one: err=%d\n", |
| 94 | __func__, ret); |
| 95 | continue; |
| 96 | } |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | /** |
Masahiro Yamada | 0cbfe5c | 2016-08-19 18:26:54 +0900 | [diff] [blame] | 103 | * pinconfig_post_bind() - post binding for PINCONFIG uclass |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 104 | * Recursively bind its children as pinconfig devices. |
| 105 | * |
| 106 | * @dev: pinconfig device |
| 107 | * @return: 0 on success, or negative error code on failure |
| 108 | */ |
| 109 | static int pinconfig_post_bind(struct udevice *dev) |
| 110 | { |
Simon Glass | 9cefa47 | 2015-12-29 05:22:52 -0700 | [diff] [blame] | 111 | bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 112 | const char *name; |
Simon Glass | e6dd8da | 2017-05-18 20:09:07 -0600 | [diff] [blame] | 113 | ofnode node; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 114 | int ret; |
| 115 | |
Simon Glass | f1d50f7 | 2020-12-19 10:40:13 -0700 | [diff] [blame] | 116 | if (!dev_has_ofnode(dev)) |
Urja Rannikko | cb484fc | 2019-03-22 19:14:33 +0000 | [diff] [blame] | 117 | return 0; |
| 118 | |
Simon Glass | e6dd8da | 2017-05-18 20:09:07 -0600 | [diff] [blame] | 119 | dev_for_each_subnode(node, dev) { |
Lukasz Majewski | 6fdf272 | 2019-01-09 23:05:02 +0100 | [diff] [blame] | 120 | if (pre_reloc_only && |
| 121 | !ofnode_pre_reloc(node)) |
Simon Glass | 9cefa47 | 2015-12-29 05:22:52 -0700 | [diff] [blame] | 122 | continue; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 123 | /* |
| 124 | * If this node has "compatible" property, this is not |
| 125 | * a pin configuration node, but a normal device. skip. |
| 126 | */ |
Masahiro Yamada | 9cf85cb | 2017-06-22 16:54:05 +0900 | [diff] [blame] | 127 | ofnode_get_property(node, "compatible", &ret); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 128 | if (ret >= 0) |
| 129 | continue; |
Patrick Delaunay | 1408ab3 | 2019-02-25 13:39:56 +0100 | [diff] [blame] | 130 | /* If this node has "gpio-controller" property, skip */ |
| 131 | if (ofnode_read_bool(node, "gpio-controller")) |
| 132 | continue; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 133 | |
| 134 | if (ret != -FDT_ERR_NOTFOUND) |
| 135 | return ret; |
| 136 | |
Simon Glass | e6dd8da | 2017-05-18 20:09:07 -0600 | [diff] [blame] | 137 | name = ofnode_get_name(node); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 138 | if (!name) |
| 139 | return -EINVAL; |
| 140 | ret = device_bind_driver_to_node(dev, "pinconfig", name, |
Simon Glass | e6dd8da | 2017-05-18 20:09:07 -0600 | [diff] [blame] | 141 | node, NULL); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 142 | if (ret) |
| 143 | return ret; |
| 144 | } |
| 145 | |
| 146 | return 0; |
| 147 | } |
| 148 | |
| 149 | UCLASS_DRIVER(pinconfig) = { |
| 150 | .id = UCLASS_PINCONFIG, |
Patrick Delaunay | 2c7526a | 2019-10-21 15:02:40 +0200 | [diff] [blame] | 151 | #if CONFIG_IS_ENABLED(PINCONF_RECURSIVE) |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 152 | .post_bind = pinconfig_post_bind, |
Patrick Delaunay | bcdb104 | 2019-08-02 14:48:00 +0200 | [diff] [blame] | 153 | #endif |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 154 | .name = "pinconfig", |
| 155 | }; |
| 156 | |
| 157 | U_BOOT_DRIVER(pinconfig_generic) = { |
| 158 | .name = "pinconfig", |
| 159 | .id = UCLASS_PINCONFIG, |
| 160 | }; |
| 161 | |
| 162 | #else |
| 163 | static int pinctrl_select_state_full(struct udevice *dev, const char *statename) |
| 164 | { |
| 165 | return -ENODEV; |
| 166 | } |
| 167 | |
| 168 | static int pinconfig_post_bind(struct udevice *dev) |
| 169 | { |
Masahiro Yamada | 7778b03 | 2015-09-06 01:44:50 +0900 | [diff] [blame] | 170 | return 0; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 171 | } |
| 172 | #endif |
| 173 | |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 174 | static int |
| 175 | pinctrl_gpio_get_pinctrl_and_offset(struct udevice *dev, unsigned offset, |
| 176 | struct udevice **pctldev, |
| 177 | unsigned int *pin_selector) |
| 178 | { |
| 179 | struct ofnode_phandle_args args; |
| 180 | unsigned gpio_offset, pfc_base, pfc_pins; |
| 181 | int ret; |
| 182 | |
| 183 | ret = dev_read_phandle_with_args(dev, "gpio-ranges", NULL, 3, |
| 184 | 0, &args); |
| 185 | if (ret) { |
| 186 | dev_dbg(dev, "%s: dev_read_phandle_with_args: err=%d\n", |
| 187 | __func__, ret); |
| 188 | return ret; |
| 189 | } |
| 190 | |
| 191 | ret = uclass_get_device_by_ofnode(UCLASS_PINCTRL, |
| 192 | args.node, pctldev); |
| 193 | if (ret) { |
| 194 | dev_dbg(dev, |
| 195 | "%s: uclass_get_device_by_of_offset failed: err=%d\n", |
| 196 | __func__, ret); |
| 197 | return ret; |
| 198 | } |
| 199 | |
| 200 | gpio_offset = args.args[0]; |
| 201 | pfc_base = args.args[1]; |
| 202 | pfc_pins = args.args[2]; |
| 203 | |
| 204 | if (offset < gpio_offset || offset > gpio_offset + pfc_pins) { |
| 205 | dev_dbg(dev, |
| 206 | "%s: GPIO can not be mapped to pincontrol pin\n", |
| 207 | __func__); |
| 208 | return -EINVAL; |
| 209 | } |
| 210 | |
| 211 | offset -= gpio_offset; |
| 212 | offset += pfc_base; |
| 213 | *pin_selector = offset; |
| 214 | |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * pinctrl_gpio_request() - request a single pin to be used as GPIO |
| 220 | * |
| 221 | * @dev: GPIO peripheral device |
| 222 | * @offset: the GPIO pin offset from the GPIO controller |
| 223 | * @return: 0 on success, or negative error code on failure |
| 224 | */ |
| 225 | int pinctrl_gpio_request(struct udevice *dev, unsigned offset) |
| 226 | { |
| 227 | const struct pinctrl_ops *ops; |
| 228 | struct udevice *pctldev; |
| 229 | unsigned int pin_selector; |
| 230 | int ret; |
| 231 | |
| 232 | ret = pinctrl_gpio_get_pinctrl_and_offset(dev, offset, |
| 233 | &pctldev, &pin_selector); |
| 234 | if (ret) |
| 235 | return ret; |
| 236 | |
| 237 | ops = pinctrl_get_ops(pctldev); |
Simon Glass | 33bf7b8 | 2021-03-25 10:26:11 +1300 | [diff] [blame] | 238 | assert(ops); |
| 239 | if (!ops->gpio_request_enable) |
| 240 | return -ENOSYS; |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 241 | |
| 242 | return ops->gpio_request_enable(pctldev, pin_selector); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * pinctrl_gpio_free() - free a single pin used as GPIO |
| 247 | * |
| 248 | * @dev: GPIO peripheral device |
| 249 | * @offset: the GPIO pin offset from the GPIO controller |
| 250 | * @return: 0 on success, or negative error code on failure |
| 251 | */ |
| 252 | int pinctrl_gpio_free(struct udevice *dev, unsigned offset) |
| 253 | { |
| 254 | const struct pinctrl_ops *ops; |
| 255 | struct udevice *pctldev; |
| 256 | unsigned int pin_selector; |
| 257 | int ret; |
| 258 | |
| 259 | ret = pinctrl_gpio_get_pinctrl_and_offset(dev, offset, |
| 260 | &pctldev, &pin_selector); |
| 261 | if (ret) |
| 262 | return ret; |
| 263 | |
| 264 | ops = pinctrl_get_ops(pctldev); |
Simon Glass | 33bf7b8 | 2021-03-25 10:26:11 +1300 | [diff] [blame] | 265 | assert(ops); |
| 266 | if (!ops->gpio_disable_free) |
| 267 | return -ENOSYS; |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 268 | |
| 269 | return ops->gpio_disable_free(pctldev, pin_selector); |
| 270 | } |
| 271 | |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 272 | /** |
| 273 | * pinctrl_select_state_simple() - simple implementation of pinctrl_select_state |
| 274 | * |
| 275 | * @dev: peripheral device |
| 276 | * @return: 0 on success, or negative error code on failure |
| 277 | */ |
| 278 | static int pinctrl_select_state_simple(struct udevice *dev) |
| 279 | { |
| 280 | struct udevice *pctldev; |
| 281 | struct pinctrl_ops *ops; |
| 282 | int ret; |
| 283 | |
| 284 | /* |
Patrice Chotard | 7411063 | 2019-02-25 13:39:55 +0100 | [diff] [blame] | 285 | * For most system, there is only one pincontroller device. But in |
| 286 | * case of multiple pincontroller devices, probe the one with sequence |
| 287 | * number 0 (defined by alias) to avoid race condition. |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 288 | */ |
Patrice Chotard | 7411063 | 2019-02-25 13:39:55 +0100 | [diff] [blame] | 289 | ret = uclass_get_device_by_seq(UCLASS_PINCTRL, 0, &pctldev); |
| 290 | if (ret) |
| 291 | /* if not found, get the first one */ |
| 292 | ret = uclass_get_device(UCLASS_PINCTRL, 0, &pctldev); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 293 | if (ret) |
| 294 | return ret; |
| 295 | |
| 296 | ops = pinctrl_get_ops(pctldev); |
| 297 | if (!ops->set_state_simple) { |
| 298 | dev_dbg(dev, "set_state_simple op missing\n"); |
| 299 | return -ENOSYS; |
| 300 | } |
| 301 | |
| 302 | return ops->set_state_simple(pctldev, dev); |
| 303 | } |
| 304 | |
| 305 | int pinctrl_select_state(struct udevice *dev, const char *statename) |
| 306 | { |
| 307 | /* |
Kever Yang | 16ed971 | 2018-04-18 17:54:04 +0800 | [diff] [blame] | 308 | * Some device which is logical like mmc.blk, do not have |
| 309 | * a valid ofnode. |
| 310 | */ |
Simon Glass | 07c1777 | 2020-12-19 10:40:12 -0700 | [diff] [blame] | 311 | if (!dev_has_ofnode(dev)) |
Kever Yang | 16ed971 | 2018-04-18 17:54:04 +0800 | [diff] [blame] | 312 | return 0; |
| 313 | /* |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 314 | * Try full-implemented pinctrl first. |
| 315 | * If it fails or is not implemented, try simple one. |
| 316 | */ |
| 317 | if (pinctrl_select_state_full(dev, statename)) |
| 318 | return pinctrl_select_state_simple(dev); |
| 319 | |
| 320 | return 0; |
| 321 | } |
| 322 | |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 323 | int pinctrl_request(struct udevice *dev, int func, int flags) |
| 324 | { |
| 325 | struct pinctrl_ops *ops = pinctrl_get_ops(dev); |
| 326 | |
| 327 | if (!ops->request) |
| 328 | return -ENOSYS; |
| 329 | |
| 330 | return ops->request(dev, func, flags); |
| 331 | } |
| 332 | |
| 333 | int pinctrl_request_noflags(struct udevice *dev, int func) |
| 334 | { |
| 335 | return pinctrl_request(dev, func, 0); |
| 336 | } |
| 337 | |
| 338 | int pinctrl_get_periph_id(struct udevice *dev, struct udevice *periph) |
| 339 | { |
| 340 | struct pinctrl_ops *ops = pinctrl_get_ops(dev); |
| 341 | |
| 342 | if (!ops->get_periph_id) |
| 343 | return -ENOSYS; |
| 344 | |
| 345 | return ops->get_periph_id(dev, periph); |
| 346 | } |
| 347 | |
Simon Glass | 2d4fa3c | 2016-01-21 19:43:56 -0700 | [diff] [blame] | 348 | int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index) |
| 349 | { |
| 350 | struct pinctrl_ops *ops = pinctrl_get_ops(dev); |
| 351 | |
| 352 | if (!ops->get_gpio_mux) |
| 353 | return -ENOSYS; |
| 354 | |
| 355 | return ops->get_gpio_mux(dev, banknum, index); |
| 356 | } |
| 357 | |
Patrice Chotard | fbf8082 | 2018-10-24 14:10:14 +0200 | [diff] [blame] | 358 | int pinctrl_get_pins_count(struct udevice *dev) |
| 359 | { |
| 360 | struct pinctrl_ops *ops = pinctrl_get_ops(dev); |
| 361 | |
| 362 | if (!ops->get_pins_count) |
| 363 | return -ENOSYS; |
| 364 | |
| 365 | return ops->get_pins_count(dev); |
| 366 | } |
| 367 | |
| 368 | int pinctrl_get_pin_name(struct udevice *dev, int selector, char *buf, |
| 369 | int size) |
| 370 | { |
| 371 | struct pinctrl_ops *ops = pinctrl_get_ops(dev); |
| 372 | |
| 373 | if (!ops->get_pin_name) |
| 374 | return -ENOSYS; |
| 375 | |
| 376 | snprintf(buf, size, ops->get_pin_name(dev, selector)); |
| 377 | |
| 378 | return 0; |
| 379 | } |
| 380 | |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 381 | int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf, |
| 382 | int size) |
| 383 | { |
| 384 | struct pinctrl_ops *ops = pinctrl_get_ops(dev); |
| 385 | |
| 386 | if (!ops->get_pin_muxing) |
| 387 | return -ENOSYS; |
| 388 | |
| 389 | return ops->get_pin_muxing(dev, selector, buf, size); |
| 390 | } |
| 391 | |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 392 | /** |
Masahiro Yamada | 0cbfe5c | 2016-08-19 18:26:54 +0900 | [diff] [blame] | 393 | * pinconfig_post_bind() - post binding for PINCTRL uclass |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 394 | * Recursively bind child nodes as pinconfig devices in case of full pinctrl. |
| 395 | * |
| 396 | * @dev: pinctrl device |
| 397 | * @return: 0 on success, or negative error code on failure |
| 398 | */ |
Patrick Delaunay | d23bcf1 | 2019-08-02 14:48:00 +0200 | [diff] [blame] | 399 | static int __maybe_unused pinctrl_post_bind(struct udevice *dev) |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 400 | { |
| 401 | const struct pinctrl_ops *ops = pinctrl_get_ops(dev); |
| 402 | |
| 403 | if (!ops) { |
| 404 | dev_dbg(dev, "ops is not set. Do not bind.\n"); |
| 405 | return -EINVAL; |
| 406 | } |
| 407 | |
| 408 | /* |
Masahiro Yamada | 7778b03 | 2015-09-06 01:44:50 +0900 | [diff] [blame] | 409 | * If set_state callback is set, we assume this pinctrl driver is the |
| 410 | * full implementation. In this case, its child nodes should be bound |
| 411 | * so that peripheral devices can easily search in parent devices |
| 412 | * during later DT-parsing. |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 413 | */ |
Masahiro Yamada | 7778b03 | 2015-09-06 01:44:50 +0900 | [diff] [blame] | 414 | if (ops->set_state) |
| 415 | return pinconfig_post_bind(dev); |
| 416 | |
| 417 | return 0; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 418 | } |
| 419 | |
| 420 | UCLASS_DRIVER(pinctrl) = { |
| 421 | .id = UCLASS_PINCTRL, |
Simon Glass | defcc63 | 2020-12-23 08:11:13 -0700 | [diff] [blame] | 422 | #if !CONFIG_IS_ENABLED(OF_PLATDATA) |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 423 | .post_bind = pinctrl_post_bind, |
Simon Glass | defcc63 | 2020-12-23 08:11:13 -0700 | [diff] [blame] | 424 | #endif |
Thomas Abraham | 87adc64 | 2016-04-23 22:18:07 +0530 | [diff] [blame] | 425 | .flags = DM_UC_FLAG_SEQ_ALIAS, |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 426 | .name = "pinctrl", |
| 427 | }; |