fdt_pinctrl.c (d899be7d43d8df9cb485af5705e2724165a461c7) fdt_pinctrl.c (c441925e313b448ad5bc7c1ff1995058268888d8)
1/*-
2 * Copyright (c) 2014 Ian Lepore <ian@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

41fdt_pinctrl_configure(device_t client, u_int index)
42{
43 device_t pinctrl;
44 phandle_t *configs;
45 int i, nconfigs;
46 char name[16];
47
48 snprintf(name, sizeof(name), "pinctrl-%u", index);
1/*-
2 * Copyright (c) 2014 Ian Lepore <ian@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

41fdt_pinctrl_configure(device_t client, u_int index)
42{
43 device_t pinctrl;
44 phandle_t *configs;
45 int i, nconfigs;
46 char name[16];
47
48 snprintf(name, sizeof(name), "pinctrl-%u", index);
49 nconfigs = OF_getprop_alloc(ofw_bus_get_node(client), name,
49 nconfigs = OF_getencprop_alloc(ofw_bus_get_node(client), name,
50 sizeof(*configs), (void **)&configs);
51 if (nconfigs < 0)
52 return (ENOENT);
53 if (nconfigs == 0)
54 return (0); /* Empty property is documented as valid. */
55 for (i = 0; i < nconfigs; i++) {
56 if ((pinctrl = OF_device_from_xref(configs[i])) != NULL)
57 FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);

--- 59 unchanged lines hidden (view full) ---

117{
118 phandle_t node, *configs;
119 int i, nconfigs;
120
121 for (node = OF_child(parent); node != 0; node = OF_peer(node)) {
122 if (!fdt_is_enabled(node))
123 continue;
124 pinctrl_configure_children(pinctrl, node);
50 sizeof(*configs), (void **)&configs);
51 if (nconfigs < 0)
52 return (ENOENT);
53 if (nconfigs == 0)
54 return (0); /* Empty property is documented as valid. */
55 for (i = 0; i < nconfigs; i++) {
56 if ((pinctrl = OF_device_from_xref(configs[i])) != NULL)
57 FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);

--- 59 unchanged lines hidden (view full) ---

117{
118 phandle_t node, *configs;
119 int i, nconfigs;
120
121 for (node = OF_child(parent); node != 0; node = OF_peer(node)) {
122 if (!fdt_is_enabled(node))
123 continue;
124 pinctrl_configure_children(pinctrl, node);
125 nconfigs = OF_getencprop_alloc(node, "pinctrl-0",
125 nconfigs = OF_getencprop_alloc(node, "pinctrl-0",
126 sizeof(*configs), (void **)&configs);
127 if (nconfigs <= 0)
128 continue;
129 if (bootverbose) {
126 sizeof(*configs), (void **)&configs);
127 if (nconfigs <= 0)
128 continue;
129 if (bootverbose) {
130 char name[32];
130 char name[32];
131 OF_getprop(node, "name", &name, sizeof(name));
132 printf("Processing %d pin-config node(s) in pinctrl-0 for %s\n",
133 nconfigs, name);
134 }
135 for (i = 0; i < nconfigs; i++) {
136 if (OF_device_from_xref(configs[i]) == pinctrl)
137 FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);
138 }

--- 12 unchanged lines hidden ---
131 OF_getprop(node, "name", &name, sizeof(name));
132 printf("Processing %d pin-config node(s) in pinctrl-0 for %s\n",
133 nconfigs, name);
134 }
135 for (i = 0; i < nconfigs; i++) {
136 if (OF_device_from_xref(configs[i]) == pinctrl)
137 FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);
138 }

--- 12 unchanged lines hidden ---