Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2017 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
| 9 | #include <fdtdec.h> |
| 10 | #include <fdt_support.h> |
Masahiro Yamada | 75f82d0 | 2018-03-05 01:20:11 +0900 | [diff] [blame] | 11 | #include <linux/libfdt.h> |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 12 | #include <dm/of_access.h> |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 13 | #include <dm/of_addr.h> |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 14 | #include <dm/ofnode.h> |
| 15 | #include <linux/err.h> |
Simon Glass | f7bfcc4 | 2017-07-25 08:29:55 -0600 | [diff] [blame] | 16 | #include <linux/ioport.h> |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 17 | |
| 18 | int ofnode_read_u32(ofnode node, const char *propname, u32 *outp) |
| 19 | { |
| 20 | assert(ofnode_valid(node)); |
| 21 | debug("%s: %s: ", __func__, propname); |
| 22 | |
| 23 | if (ofnode_is_np(node)) { |
| 24 | return of_read_u32(ofnode_to_np(node), propname, outp); |
| 25 | } else { |
Masahiro Yamada | 5c5991e | 2017-06-22 17:57:50 +0900 | [diff] [blame] | 26 | const fdt32_t *cell; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 27 | int len; |
| 28 | |
| 29 | cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), |
| 30 | propname, &len); |
| 31 | if (!cell || len < sizeof(int)) { |
| 32 | debug("(not found)\n"); |
| 33 | return -EINVAL; |
| 34 | } |
| 35 | *outp = fdt32_to_cpu(cell[0]); |
| 36 | } |
| 37 | debug("%#x (%d)\n", *outp, *outp); |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |
Trent Piepho | 5b77541 | 2019-05-10 17:48:20 +0000 | [diff] [blame] | 42 | u32 ofnode_read_u32_default(ofnode node, const char *propname, u32 def) |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 43 | { |
| 44 | assert(ofnode_valid(node)); |
| 45 | ofnode_read_u32(node, propname, &def); |
| 46 | |
| 47 | return def; |
| 48 | } |
| 49 | |
| 50 | int ofnode_read_s32_default(ofnode node, const char *propname, s32 def) |
| 51 | { |
| 52 | assert(ofnode_valid(node)); |
| 53 | ofnode_read_u32(node, propname, (u32 *)&def); |
| 54 | |
| 55 | return def; |
| 56 | } |
| 57 | |
Simon Glass | 9d54a7a | 2018-06-11 13:07:10 -0600 | [diff] [blame] | 58 | int ofnode_read_u64(ofnode node, const char *propname, u64 *outp) |
| 59 | { |
Jean-Jacques Hiblot | 487f917 | 2019-10-22 10:05:22 +0200 | [diff] [blame] | 60 | const unaligned_fdt64_t *cell; |
Simon Glass | 9d54a7a | 2018-06-11 13:07:10 -0600 | [diff] [blame] | 61 | int len; |
| 62 | |
| 63 | assert(ofnode_valid(node)); |
| 64 | debug("%s: %s: ", __func__, propname); |
| 65 | |
| 66 | if (ofnode_is_np(node)) |
| 67 | return of_read_u64(ofnode_to_np(node), propname, outp); |
| 68 | |
| 69 | cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname, |
| 70 | &len); |
| 71 | if (!cell || len < sizeof(*cell)) { |
| 72 | debug("(not found)\n"); |
| 73 | return -EINVAL; |
| 74 | } |
| 75 | *outp = fdt64_to_cpu(cell[0]); |
| 76 | debug("%#llx (%lld)\n", (unsigned long long)*outp, |
| 77 | (unsigned long long)*outp); |
| 78 | |
| 79 | return 0; |
| 80 | } |
| 81 | |
T Karthik Reddy | 478860d | 2019-09-02 16:34:30 +0200 | [diff] [blame] | 82 | u64 ofnode_read_u64_default(ofnode node, const char *propname, u64 def) |
Simon Glass | 9d54a7a | 2018-06-11 13:07:10 -0600 | [diff] [blame] | 83 | { |
| 84 | assert(ofnode_valid(node)); |
| 85 | ofnode_read_u64(node, propname, &def); |
| 86 | |
| 87 | return def; |
| 88 | } |
| 89 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 90 | bool ofnode_read_bool(ofnode node, const char *propname) |
| 91 | { |
Masahiro Yamada | 5d43445 | 2017-06-22 16:54:07 +0900 | [diff] [blame] | 92 | const void *prop; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 93 | |
| 94 | assert(ofnode_valid(node)); |
| 95 | debug("%s: %s: ", __func__, propname); |
| 96 | |
Masahiro Yamada | 5d43445 | 2017-06-22 16:54:07 +0900 | [diff] [blame] | 97 | prop = ofnode_get_property(node, propname, NULL); |
| 98 | |
| 99 | debug("%s\n", prop ? "true" : "false"); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 100 | |
Masahiro Yamada | 5d43445 | 2017-06-22 16:54:07 +0900 | [diff] [blame] | 101 | return prop ? true : false; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | const char *ofnode_read_string(ofnode node, const char *propname) |
| 105 | { |
| 106 | const char *str = NULL; |
| 107 | int len = -1; |
| 108 | |
| 109 | assert(ofnode_valid(node)); |
| 110 | debug("%s: %s: ", __func__, propname); |
| 111 | |
| 112 | if (ofnode_is_np(node)) { |
| 113 | struct property *prop = of_find_property( |
| 114 | ofnode_to_np(node), propname, NULL); |
| 115 | |
| 116 | if (prop) { |
| 117 | str = prop->value; |
| 118 | len = prop->length; |
| 119 | } |
| 120 | } else { |
| 121 | str = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), |
| 122 | propname, &len); |
| 123 | } |
| 124 | if (!str) { |
| 125 | debug("<not found>\n"); |
| 126 | return NULL; |
| 127 | } |
| 128 | if (strnlen(str, len) >= len) { |
| 129 | debug("<invalid>\n"); |
| 130 | return NULL; |
| 131 | } |
| 132 | debug("%s\n", str); |
| 133 | |
| 134 | return str; |
| 135 | } |
| 136 | |
| 137 | ofnode ofnode_find_subnode(ofnode node, const char *subnode_name) |
| 138 | { |
| 139 | ofnode subnode; |
| 140 | |
| 141 | assert(ofnode_valid(node)); |
| 142 | debug("%s: %s: ", __func__, subnode_name); |
| 143 | |
| 144 | if (ofnode_is_np(node)) { |
| 145 | const struct device_node *np = ofnode_to_np(node); |
| 146 | |
| 147 | for (np = np->child; np; np = np->sibling) { |
| 148 | if (!strcmp(subnode_name, np->name)) |
| 149 | break; |
| 150 | } |
| 151 | subnode = np_to_ofnode(np); |
| 152 | } else { |
| 153 | int ooffset = fdt_subnode_offset(gd->fdt_blob, |
| 154 | ofnode_to_offset(node), subnode_name); |
| 155 | subnode = offset_to_ofnode(ooffset); |
| 156 | } |
| 157 | debug("%s\n", ofnode_valid(subnode) ? |
| 158 | ofnode_get_name(subnode) : "<none>"); |
| 159 | |
| 160 | return subnode; |
| 161 | } |
| 162 | |
| 163 | int ofnode_read_u32_array(ofnode node, const char *propname, |
| 164 | u32 *out_values, size_t sz) |
| 165 | { |
| 166 | assert(ofnode_valid(node)); |
| 167 | debug("%s: %s: ", __func__, propname); |
| 168 | |
| 169 | if (ofnode_is_np(node)) { |
| 170 | return of_read_u32_array(ofnode_to_np(node), propname, |
| 171 | out_values, sz); |
| 172 | } else { |
| 173 | return fdtdec_get_int_array(gd->fdt_blob, |
| 174 | ofnode_to_offset(node), propname, |
| 175 | out_values, sz); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | ofnode ofnode_first_subnode(ofnode node) |
| 180 | { |
| 181 | assert(ofnode_valid(node)); |
| 182 | if (ofnode_is_np(node)) |
| 183 | return np_to_ofnode(node.np->child); |
| 184 | |
| 185 | return offset_to_ofnode( |
| 186 | fdt_first_subnode(gd->fdt_blob, ofnode_to_offset(node))); |
| 187 | } |
| 188 | |
| 189 | ofnode ofnode_next_subnode(ofnode node) |
| 190 | { |
| 191 | assert(ofnode_valid(node)); |
| 192 | if (ofnode_is_np(node)) |
| 193 | return np_to_ofnode(node.np->sibling); |
| 194 | |
| 195 | return offset_to_ofnode( |
| 196 | fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node))); |
| 197 | } |
| 198 | |
Philipp Tomsich | 6fce1dd | 2018-02-23 17:38:49 +0100 | [diff] [blame] | 199 | ofnode ofnode_get_parent(ofnode node) |
| 200 | { |
| 201 | ofnode parent; |
| 202 | |
| 203 | assert(ofnode_valid(node)); |
| 204 | if (ofnode_is_np(node)) |
| 205 | parent = np_to_ofnode(of_get_parent(ofnode_to_np(node))); |
| 206 | else |
| 207 | parent.of_offset = fdt_parent_offset(gd->fdt_blob, |
| 208 | ofnode_to_offset(node)); |
| 209 | |
| 210 | return parent; |
| 211 | } |
| 212 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 213 | const char *ofnode_get_name(ofnode node) |
| 214 | { |
Kever Yang | 8d7976d | 2019-07-19 11:23:47 +0800 | [diff] [blame] | 215 | if (!ofnode_valid(node)) { |
| 216 | debug("%s node not valid\n", __func__); |
| 217 | return NULL; |
| 218 | } |
| 219 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 220 | if (ofnode_is_np(node)) |
| 221 | return strrchr(node.np->full_name, '/') + 1; |
| 222 | |
| 223 | return fdt_get_name(gd->fdt_blob, ofnode_to_offset(node), NULL); |
| 224 | } |
| 225 | |
Kever Yang | 37df0e0 | 2018-02-23 17:38:50 +0100 | [diff] [blame] | 226 | ofnode ofnode_get_by_phandle(uint phandle) |
| 227 | { |
| 228 | ofnode node; |
| 229 | |
| 230 | if (of_live_active()) |
| 231 | node = np_to_ofnode(of_find_node_by_phandle(phandle)); |
| 232 | else |
| 233 | node.of_offset = fdt_node_offset_by_phandle(gd->fdt_blob, |
| 234 | phandle); |
| 235 | |
| 236 | return node; |
| 237 | } |
| 238 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 239 | int ofnode_read_size(ofnode node, const char *propname) |
| 240 | { |
| 241 | int len; |
| 242 | |
| 243 | if (ofnode_is_np(node)) { |
| 244 | struct property *prop = of_find_property( |
| 245 | ofnode_to_np(node), propname, NULL); |
| 246 | |
| 247 | if (prop) |
| 248 | return prop->length; |
| 249 | } else { |
| 250 | if (fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname, |
| 251 | &len)) |
| 252 | return len; |
| 253 | } |
| 254 | |
| 255 | return -EINVAL; |
| 256 | } |
| 257 | |
Keerthy | d332e6e | 2019-04-24 17:19:53 +0530 | [diff] [blame] | 258 | fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size) |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 259 | { |
Keerthy | 34222a3 | 2018-11-19 11:44:47 +0530 | [diff] [blame] | 260 | int na, ns; |
Keerthy | 34222a3 | 2018-11-19 11:44:47 +0530 | [diff] [blame] | 261 | |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 262 | if (ofnode_is_np(node)) { |
| 263 | const __be32 *prop_val; |
Simon Glass | 47f85de | 2019-09-25 08:55:50 -0600 | [diff] [blame] | 264 | u64 size64; |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 265 | uint flags; |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 266 | |
Simon Glass | 47f85de | 2019-09-25 08:55:50 -0600 | [diff] [blame] | 267 | prop_val = of_get_address(ofnode_to_np(node), index, &size64, |
| 268 | &flags); |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 269 | if (!prop_val) |
| 270 | return FDT_ADDR_T_NONE; |
Simon Glass | 47f85de | 2019-09-25 08:55:50 -0600 | [diff] [blame] | 271 | if (size) |
| 272 | *size = size64; |
Mario Six | d007ebc | 2017-12-20 09:52:12 +0100 | [diff] [blame] | 273 | |
Mario Six | 35616ef | 2018-03-12 14:53:33 +0100 | [diff] [blame] | 274 | ns = of_n_size_cells(ofnode_to_np(node)); |
| 275 | |
| 276 | if (IS_ENABLED(CONFIG_OF_TRANSLATE) && ns > 0) { |
Mario Six | d007ebc | 2017-12-20 09:52:12 +0100 | [diff] [blame] | 277 | return of_translate_address(ofnode_to_np(node), prop_val); |
| 278 | } else { |
| 279 | na = of_n_addr_cells(ofnode_to_np(node)); |
| 280 | return of_read_number(prop_val, na); |
| 281 | } |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 282 | } else { |
Keerthy | 34222a3 | 2018-11-19 11:44:47 +0530 | [diff] [blame] | 283 | na = ofnode_read_simple_addr_cells(ofnode_get_parent(node)); |
| 284 | ns = ofnode_read_simple_size_cells(ofnode_get_parent(node)); |
| 285 | return fdtdec_get_addr_size_fixed(gd->fdt_blob, |
| 286 | ofnode_to_offset(node), "reg", |
Keerthy | d332e6e | 2019-04-24 17:19:53 +0530 | [diff] [blame] | 287 | index, na, ns, size, true); |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | return FDT_ADDR_T_NONE; |
| 291 | } |
| 292 | |
Keerthy | d332e6e | 2019-04-24 17:19:53 +0530 | [diff] [blame] | 293 | fdt_addr_t ofnode_get_addr_index(ofnode node, int index) |
| 294 | { |
| 295 | fdt_size_t size; |
| 296 | |
| 297 | return ofnode_get_addr_size_index(node, index, &size); |
| 298 | } |
| 299 | |
Simon Glass | 049ae1b | 2017-05-18 20:09:01 -0600 | [diff] [blame] | 300 | fdt_addr_t ofnode_get_addr(ofnode node) |
| 301 | { |
| 302 | return ofnode_get_addr_index(node, 0); |
| 303 | } |
| 304 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 305 | int ofnode_stringlist_search(ofnode node, const char *property, |
| 306 | const char *string) |
| 307 | { |
| 308 | if (ofnode_is_np(node)) { |
| 309 | return of_property_match_string(ofnode_to_np(node), |
| 310 | property, string); |
| 311 | } else { |
| 312 | int ret; |
| 313 | |
| 314 | ret = fdt_stringlist_search(gd->fdt_blob, |
| 315 | ofnode_to_offset(node), property, |
| 316 | string); |
| 317 | if (ret == -FDT_ERR_NOTFOUND) |
| 318 | return -ENODATA; |
| 319 | else if (ret < 0) |
| 320 | return -EINVAL; |
| 321 | |
| 322 | return ret; |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | int ofnode_read_string_index(ofnode node, const char *property, int index, |
| 327 | const char **outp) |
| 328 | { |
| 329 | if (ofnode_is_np(node)) { |
| 330 | return of_property_read_string_index(ofnode_to_np(node), |
| 331 | property, index, outp); |
| 332 | } else { |
| 333 | int len; |
| 334 | |
| 335 | *outp = fdt_stringlist_get(gd->fdt_blob, ofnode_to_offset(node), |
| 336 | property, index, &len); |
| 337 | if (len < 0) |
| 338 | return -EINVAL; |
| 339 | return 0; |
| 340 | } |
| 341 | } |
| 342 | |
Simon Glass | 5fdb005 | 2017-06-12 06:21:28 -0600 | [diff] [blame] | 343 | int ofnode_read_string_count(ofnode node, const char *property) |
| 344 | { |
| 345 | if (ofnode_is_np(node)) { |
| 346 | return of_property_count_strings(ofnode_to_np(node), property); |
| 347 | } else { |
| 348 | return fdt_stringlist_count(gd->fdt_blob, |
| 349 | ofnode_to_offset(node), property); |
| 350 | } |
| 351 | } |
| 352 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 353 | static void ofnode_from_fdtdec_phandle_args(struct fdtdec_phandle_args *in, |
| 354 | struct ofnode_phandle_args *out) |
| 355 | { |
| 356 | assert(OF_MAX_PHANDLE_ARGS == MAX_PHANDLE_ARGS); |
| 357 | out->node = offset_to_ofnode(in->node); |
| 358 | out->args_count = in->args_count; |
| 359 | memcpy(out->args, in->args, sizeof(out->args)); |
| 360 | } |
| 361 | |
| 362 | static void ofnode_from_of_phandle_args(struct of_phandle_args *in, |
| 363 | struct ofnode_phandle_args *out) |
| 364 | { |
| 365 | assert(OF_MAX_PHANDLE_ARGS == MAX_PHANDLE_ARGS); |
| 366 | out->node = np_to_ofnode(in->np); |
| 367 | out->args_count = in->args_count; |
| 368 | memcpy(out->args, in->args, sizeof(out->args)); |
| 369 | } |
| 370 | |
| 371 | int ofnode_parse_phandle_with_args(ofnode node, const char *list_name, |
| 372 | const char *cells_name, int cell_count, |
| 373 | int index, |
| 374 | struct ofnode_phandle_args *out_args) |
| 375 | { |
| 376 | if (ofnode_is_np(node)) { |
| 377 | struct of_phandle_args args; |
| 378 | int ret; |
| 379 | |
| 380 | ret = of_parse_phandle_with_args(ofnode_to_np(node), |
Mario Six | f40d82c | 2018-01-15 11:07:17 +0100 | [diff] [blame] | 381 | list_name, cells_name, index, |
| 382 | &args); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 383 | if (ret) |
| 384 | return ret; |
| 385 | ofnode_from_of_phandle_args(&args, out_args); |
| 386 | } else { |
| 387 | struct fdtdec_phandle_args args; |
| 388 | int ret; |
| 389 | |
| 390 | ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, |
Mario Six | f40d82c | 2018-01-15 11:07:17 +0100 | [diff] [blame] | 391 | ofnode_to_offset(node), |
| 392 | list_name, cells_name, |
| 393 | cell_count, index, &args); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 394 | if (ret) |
| 395 | return ret; |
| 396 | ofnode_from_fdtdec_phandle_args(&args, out_args); |
| 397 | } |
| 398 | |
| 399 | return 0; |
| 400 | } |
| 401 | |
Patrice Chotard | be7dd60 | 2017-07-18 11:57:08 +0200 | [diff] [blame] | 402 | int ofnode_count_phandle_with_args(ofnode node, const char *list_name, |
| 403 | const char *cells_name) |
| 404 | { |
| 405 | if (ofnode_is_np(node)) |
| 406 | return of_count_phandle_with_args(ofnode_to_np(node), |
| 407 | list_name, cells_name); |
| 408 | else |
| 409 | return fdtdec_parse_phandle_with_args(gd->fdt_blob, |
| 410 | ofnode_to_offset(node), list_name, cells_name, |
| 411 | 0, -1, NULL); |
| 412 | } |
| 413 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 414 | ofnode ofnode_path(const char *path) |
| 415 | { |
| 416 | if (of_live_active()) |
| 417 | return np_to_ofnode(of_find_node_by_path(path)); |
| 418 | else |
| 419 | return offset_to_ofnode(fdt_path_offset(gd->fdt_blob, path)); |
| 420 | } |
| 421 | |
| 422 | const char *ofnode_get_chosen_prop(const char *name) |
| 423 | { |
| 424 | ofnode chosen_node; |
| 425 | |
| 426 | chosen_node = ofnode_path("/chosen"); |
| 427 | |
| 428 | return ofnode_read_string(chosen_node, name); |
| 429 | } |
| 430 | |
| 431 | ofnode ofnode_get_chosen_node(const char *name) |
| 432 | { |
| 433 | const char *prop; |
| 434 | |
| 435 | prop = ofnode_get_chosen_prop(name); |
| 436 | if (!prop) |
| 437 | return ofnode_null(); |
| 438 | |
| 439 | return ofnode_path(prop); |
| 440 | } |
| 441 | |
| 442 | static int decode_timing_property(ofnode node, const char *name, |
| 443 | struct timing_entry *result) |
| 444 | { |
| 445 | int length, ret = 0; |
| 446 | |
| 447 | length = ofnode_read_size(node, name); |
| 448 | if (length < 0) { |
| 449 | debug("%s: could not find property %s\n", |
| 450 | ofnode_get_name(node), name); |
| 451 | return length; |
| 452 | } |
| 453 | |
| 454 | if (length == sizeof(u32)) { |
| 455 | result->typ = ofnode_read_u32_default(node, name, 0); |
| 456 | result->min = result->typ; |
| 457 | result->max = result->typ; |
| 458 | } else { |
| 459 | ret = ofnode_read_u32_array(node, name, &result->min, 3); |
| 460 | } |
| 461 | |
| 462 | return ret; |
| 463 | } |
| 464 | |
| 465 | int ofnode_decode_display_timing(ofnode parent, int index, |
| 466 | struct display_timing *dt) |
| 467 | { |
| 468 | int i; |
| 469 | ofnode timings, node; |
| 470 | u32 val = 0; |
| 471 | int ret = 0; |
| 472 | |
| 473 | timings = ofnode_find_subnode(parent, "display-timings"); |
| 474 | if (!ofnode_valid(timings)) |
| 475 | return -EINVAL; |
| 476 | |
Simon Glass | 2852976 | 2017-08-05 15:45:54 -0600 | [diff] [blame] | 477 | i = 0; |
| 478 | ofnode_for_each_subnode(node, timings) { |
| 479 | if (i++ == index) |
| 480 | break; |
| 481 | } |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 482 | |
| 483 | if (!ofnode_valid(node)) |
| 484 | return -EINVAL; |
| 485 | |
| 486 | memset(dt, 0, sizeof(*dt)); |
| 487 | |
| 488 | ret |= decode_timing_property(node, "hback-porch", &dt->hback_porch); |
| 489 | ret |= decode_timing_property(node, "hfront-porch", &dt->hfront_porch); |
| 490 | ret |= decode_timing_property(node, "hactive", &dt->hactive); |
| 491 | ret |= decode_timing_property(node, "hsync-len", &dt->hsync_len); |
| 492 | ret |= decode_timing_property(node, "vback-porch", &dt->vback_porch); |
| 493 | ret |= decode_timing_property(node, "vfront-porch", &dt->vfront_porch); |
| 494 | ret |= decode_timing_property(node, "vactive", &dt->vactive); |
| 495 | ret |= decode_timing_property(node, "vsync-len", &dt->vsync_len); |
| 496 | ret |= decode_timing_property(node, "clock-frequency", &dt->pixelclock); |
| 497 | |
| 498 | dt->flags = 0; |
| 499 | val = ofnode_read_u32_default(node, "vsync-active", -1); |
| 500 | if (val != -1) { |
| 501 | dt->flags |= val ? DISPLAY_FLAGS_VSYNC_HIGH : |
| 502 | DISPLAY_FLAGS_VSYNC_LOW; |
| 503 | } |
| 504 | val = ofnode_read_u32_default(node, "hsync-active", -1); |
| 505 | if (val != -1) { |
| 506 | dt->flags |= val ? DISPLAY_FLAGS_HSYNC_HIGH : |
| 507 | DISPLAY_FLAGS_HSYNC_LOW; |
| 508 | } |
| 509 | val = ofnode_read_u32_default(node, "de-active", -1); |
| 510 | if (val != -1) { |
| 511 | dt->flags |= val ? DISPLAY_FLAGS_DE_HIGH : |
| 512 | DISPLAY_FLAGS_DE_LOW; |
| 513 | } |
| 514 | val = ofnode_read_u32_default(node, "pixelclk-active", -1); |
| 515 | if (val != -1) { |
| 516 | dt->flags |= val ? DISPLAY_FLAGS_PIXDATA_POSEDGE : |
| 517 | DISPLAY_FLAGS_PIXDATA_NEGEDGE; |
| 518 | } |
| 519 | |
| 520 | if (ofnode_read_bool(node, "interlaced")) |
| 521 | dt->flags |= DISPLAY_FLAGS_INTERLACED; |
| 522 | if (ofnode_read_bool(node, "doublescan")) |
| 523 | dt->flags |= DISPLAY_FLAGS_DOUBLESCAN; |
| 524 | if (ofnode_read_bool(node, "doubleclk")) |
| 525 | dt->flags |= DISPLAY_FLAGS_DOUBLECLK; |
| 526 | |
| 527 | return ret; |
| 528 | } |
| 529 | |
Masahiro Yamada | 9cf85cb | 2017-06-22 16:54:05 +0900 | [diff] [blame] | 530 | const void *ofnode_get_property(ofnode node, const char *propname, int *lenp) |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 531 | { |
Masahiro Yamada | 5052f1b | 2017-06-22 16:54:04 +0900 | [diff] [blame] | 532 | if (ofnode_is_np(node)) |
| 533 | return of_get_property(ofnode_to_np(node), propname, lenp); |
| 534 | else |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 535 | return fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), |
| 536 | propname, lenp); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | bool ofnode_is_available(ofnode node) |
| 540 | { |
| 541 | if (ofnode_is_np(node)) |
| 542 | return of_device_is_available(ofnode_to_np(node)); |
| 543 | else |
| 544 | return fdtdec_get_is_enabled(gd->fdt_blob, |
| 545 | ofnode_to_offset(node)); |
| 546 | } |
| 547 | |
| 548 | fdt_addr_t ofnode_get_addr_size(ofnode node, const char *property, |
| 549 | fdt_size_t *sizep) |
| 550 | { |
| 551 | if (ofnode_is_np(node)) { |
| 552 | int na, ns; |
| 553 | int psize; |
| 554 | const struct device_node *np = ofnode_to_np(node); |
Klaus Goger | af4b021 | 2017-09-20 13:50:41 +0200 | [diff] [blame] | 555 | const __be32 *prop = of_get_property(np, property, &psize); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 556 | |
Klaus Goger | af4b021 | 2017-09-20 13:50:41 +0200 | [diff] [blame] | 557 | if (!prop) |
| 558 | return FDT_ADDR_T_NONE; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 559 | na = of_n_addr_cells(np); |
Marek Vasut | 1638c17 | 2018-10-01 12:37:19 +0200 | [diff] [blame] | 560 | ns = of_n_size_cells(np); |
Simon Glass | a67cc63 | 2017-05-18 20:09:27 -0600 | [diff] [blame] | 561 | *sizep = of_read_number(prop + na, ns); |
Marek Vasut | a9dac49 | 2018-10-01 12:37:20 +0200 | [diff] [blame] | 562 | |
Simon Glass | 019f956 | 2019-04-25 21:58:36 -0600 | [diff] [blame] | 563 | if (CONFIG_IS_ENABLED(OF_TRANSLATE) && ns > 0) |
Marek Vasut | a9dac49 | 2018-10-01 12:37:20 +0200 | [diff] [blame] | 564 | return of_translate_address(np, prop); |
| 565 | else |
| 566 | return of_read_number(prop, na); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 567 | } else { |
| 568 | return fdtdec_get_addr_size(gd->fdt_blob, |
| 569 | ofnode_to_offset(node), property, |
| 570 | sizep); |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname, |
| 575 | size_t sz) |
| 576 | { |
| 577 | if (ofnode_is_np(node)) { |
| 578 | const struct device_node *np = ofnode_to_np(node); |
| 579 | int psize; |
| 580 | const __be32 *prop = of_get_property(np, propname, &psize); |
| 581 | |
| 582 | if (!prop || sz != psize) |
| 583 | return NULL; |
| 584 | return (uint8_t *)prop; |
| 585 | |
| 586 | } else { |
| 587 | return fdtdec_locate_byte_array(gd->fdt_blob, |
| 588 | ofnode_to_offset(node), propname, sz); |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, |
| 593 | const char *propname, struct fdt_pci_addr *addr) |
| 594 | { |
Masahiro Yamada | 5c5991e | 2017-06-22 17:57:50 +0900 | [diff] [blame] | 595 | const fdt32_t *cell; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 596 | int len; |
| 597 | int ret = -ENOENT; |
| 598 | |
| 599 | debug("%s: %s: ", __func__, propname); |
| 600 | |
| 601 | /* |
| 602 | * If we follow the pci bus bindings strictly, we should check |
| 603 | * the value of the node's parent node's #address-cells and |
| 604 | * #size-cells. They need to be 3 and 2 accordingly. However, |
| 605 | * for simplicity we skip the check here. |
| 606 | */ |
Masahiro Yamada | 9cf85cb | 2017-06-22 16:54:05 +0900 | [diff] [blame] | 607 | cell = ofnode_get_property(node, propname, &len); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 608 | if (!cell) |
| 609 | goto fail; |
| 610 | |
| 611 | if ((len % FDT_PCI_REG_SIZE) == 0) { |
| 612 | int num = len / FDT_PCI_REG_SIZE; |
| 613 | int i; |
| 614 | |
| 615 | for (i = 0; i < num; i++) { |
| 616 | debug("pci address #%d: %08lx %08lx %08lx\n", i, |
| 617 | (ulong)fdt32_to_cpu(cell[0]), |
| 618 | (ulong)fdt32_to_cpu(cell[1]), |
| 619 | (ulong)fdt32_to_cpu(cell[2])); |
| 620 | if ((fdt32_to_cpu(*cell) & type) == type) { |
| 621 | addr->phys_hi = fdt32_to_cpu(cell[0]); |
| 622 | addr->phys_mid = fdt32_to_cpu(cell[1]); |
Simon Glass | dfd4315 | 2019-09-25 08:55:46 -0600 | [diff] [blame] | 623 | addr->phys_lo = fdt32_to_cpu(cell[2]); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 624 | break; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 625 | } |
Mario Six | f40d82c | 2018-01-15 11:07:17 +0100 | [diff] [blame] | 626 | |
| 627 | cell += (FDT_PCI_ADDR_CELLS + |
| 628 | FDT_PCI_SIZE_CELLS); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 629 | } |
| 630 | |
| 631 | if (i == num) { |
| 632 | ret = -ENXIO; |
| 633 | goto fail; |
| 634 | } |
| 635 | |
| 636 | return 0; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 637 | } |
| 638 | |
Mario Six | f40d82c | 2018-01-15 11:07:17 +0100 | [diff] [blame] | 639 | ret = -EINVAL; |
| 640 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 641 | fail: |
| 642 | debug("(not found)\n"); |
| 643 | return ret; |
| 644 | } |
| 645 | |
Bin Meng | fa15771 | 2018-08-03 01:14:35 -0700 | [diff] [blame] | 646 | int ofnode_read_pci_vendev(ofnode node, u16 *vendor, u16 *device) |
| 647 | { |
| 648 | const char *list, *end; |
| 649 | int len; |
| 650 | |
| 651 | list = ofnode_get_property(node, "compatible", &len); |
| 652 | if (!list) |
| 653 | return -ENOENT; |
| 654 | |
| 655 | end = list + len; |
| 656 | while (list < end) { |
| 657 | len = strlen(list); |
| 658 | if (len >= strlen("pciVVVV,DDDD")) { |
| 659 | char *s = strstr(list, "pci"); |
| 660 | |
| 661 | /* |
| 662 | * check if the string is something like pciVVVV,DDDD.RR |
| 663 | * or just pciVVVV,DDDD |
| 664 | */ |
| 665 | if (s && s[7] == ',' && |
| 666 | (s[12] == '.' || s[12] == 0)) { |
| 667 | s += 3; |
| 668 | *vendor = simple_strtol(s, NULL, 16); |
| 669 | |
| 670 | s += 5; |
| 671 | *device = simple_strtol(s, NULL, 16); |
| 672 | |
| 673 | return 0; |
| 674 | } |
| 675 | } |
| 676 | list += (len + 1); |
| 677 | } |
| 678 | |
| 679 | return -ENOENT; |
| 680 | } |
| 681 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 682 | int ofnode_read_addr_cells(ofnode node) |
| 683 | { |
| 684 | if (ofnode_is_np(node)) |
| 685 | return of_n_addr_cells(ofnode_to_np(node)); |
Simon Glass | 4191dc1 | 2017-06-12 06:21:31 -0600 | [diff] [blame] | 686 | else /* NOTE: this call should walk up the parent stack */ |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 687 | return fdt_address_cells(gd->fdt_blob, ofnode_to_offset(node)); |
| 688 | } |
| 689 | |
| 690 | int ofnode_read_size_cells(ofnode node) |
| 691 | { |
| 692 | if (ofnode_is_np(node)) |
| 693 | return of_n_size_cells(ofnode_to_np(node)); |
Simon Glass | 4191dc1 | 2017-06-12 06:21:31 -0600 | [diff] [blame] | 694 | else /* NOTE: this call should walk up the parent stack */ |
| 695 | return fdt_size_cells(gd->fdt_blob, ofnode_to_offset(node)); |
| 696 | } |
| 697 | |
| 698 | int ofnode_read_simple_addr_cells(ofnode node) |
| 699 | { |
| 700 | if (ofnode_is_np(node)) |
| 701 | return of_simple_addr_cells(ofnode_to_np(node)); |
| 702 | else |
| 703 | return fdt_address_cells(gd->fdt_blob, ofnode_to_offset(node)); |
| 704 | } |
| 705 | |
| 706 | int ofnode_read_simple_size_cells(ofnode node) |
| 707 | { |
| 708 | if (ofnode_is_np(node)) |
| 709 | return of_simple_size_cells(ofnode_to_np(node)); |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 710 | else |
| 711 | return fdt_size_cells(gd->fdt_blob, ofnode_to_offset(node)); |
| 712 | } |
| 713 | |
| 714 | bool ofnode_pre_reloc(ofnode node) |
| 715 | { |
Patrick Delaunay | 0b025b8 | 2019-02-11 12:49:57 +0100 | [diff] [blame] | 716 | #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD) |
| 717 | /* for SPL and TPL the remaining nodes after the fdtgrep 1st pass |
| 718 | * had property dm-pre-reloc or u-boot,dm-spl/tpl. |
| 719 | * They are removed in final dtb (fdtgrep 2nd pass) |
| 720 | */ |
| 721 | return true; |
| 722 | #else |
Masahiro Yamada | 6a61dd9 | 2017-06-22 16:54:03 +0900 | [diff] [blame] | 723 | if (ofnode_read_bool(node, "u-boot,dm-pre-reloc")) |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 724 | return true; |
Simon Glass | 23f2284 | 2018-10-01 12:22:18 -0600 | [diff] [blame] | 725 | if (ofnode_read_bool(node, "u-boot,dm-pre-proper")) |
| 726 | return true; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 727 | |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 728 | /* |
| 729 | * In regular builds individual spl and tpl handling both |
| 730 | * count as handled pre-relocation for later second init. |
| 731 | */ |
Masahiro Yamada | 6a61dd9 | 2017-06-22 16:54:03 +0900 | [diff] [blame] | 732 | if (ofnode_read_bool(node, "u-boot,dm-spl") || |
| 733 | ofnode_read_bool(node, "u-boot,dm-tpl")) |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 734 | return true; |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 735 | |
| 736 | return false; |
Patrick Delaunay | 0b025b8 | 2019-02-11 12:49:57 +0100 | [diff] [blame] | 737 | #endif |
Simon Glass | c4fc562 | 2017-05-18 20:08:58 -0600 | [diff] [blame] | 738 | } |
Simon Glass | f7bfcc4 | 2017-07-25 08:29:55 -0600 | [diff] [blame] | 739 | |
| 740 | int ofnode_read_resource(ofnode node, uint index, struct resource *res) |
| 741 | { |
| 742 | if (ofnode_is_np(node)) { |
| 743 | return of_address_to_resource(ofnode_to_np(node), index, res); |
| 744 | } else { |
| 745 | struct fdt_resource fres; |
| 746 | int ret; |
| 747 | |
| 748 | ret = fdt_get_resource(gd->fdt_blob, ofnode_to_offset(node), |
| 749 | "reg", index, &fres); |
| 750 | if (ret < 0) |
| 751 | return -EINVAL; |
| 752 | memset(res, '\0', sizeof(*res)); |
| 753 | res->start = fres.start; |
| 754 | res->end = fres.end; |
| 755 | |
| 756 | return 0; |
| 757 | } |
| 758 | } |
Masahiro Yamada | 4dada2c | 2017-08-26 01:12:30 +0900 | [diff] [blame] | 759 | |
| 760 | int ofnode_read_resource_byname(ofnode node, const char *name, |
| 761 | struct resource *res) |
| 762 | { |
| 763 | int index; |
| 764 | |
| 765 | index = ofnode_stringlist_search(node, "reg-names", name); |
| 766 | if (index < 0) |
| 767 | return index; |
| 768 | |
| 769 | return ofnode_read_resource(node, index, res); |
| 770 | } |
Mario Six | aefac06 | 2018-01-15 11:07:19 +0100 | [diff] [blame] | 771 | |
| 772 | u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr) |
| 773 | { |
| 774 | if (ofnode_is_np(node)) |
| 775 | return of_translate_address(ofnode_to_np(node), in_addr); |
| 776 | else |
| 777 | return fdt_translate_address(gd->fdt_blob, ofnode_to_offset(node), in_addr); |
| 778 | } |
Masahiro Yamada | 9349bcc | 2018-04-19 12:14:02 +0900 | [diff] [blame] | 779 | |
Fabien Dessenne | 22236e0 | 2019-05-31 15:11:30 +0200 | [diff] [blame] | 780 | u64 ofnode_translate_dma_address(ofnode node, const fdt32_t *in_addr) |
| 781 | { |
| 782 | if (ofnode_is_np(node)) |
| 783 | return of_translate_dma_address(ofnode_to_np(node), in_addr); |
| 784 | else |
| 785 | return fdt_translate_dma_address(gd->fdt_blob, ofnode_to_offset(node), in_addr); |
| 786 | } |
| 787 | |
Masahiro Yamada | 9349bcc | 2018-04-19 12:14:02 +0900 | [diff] [blame] | 788 | int ofnode_device_is_compatible(ofnode node, const char *compat) |
| 789 | { |
| 790 | if (ofnode_is_np(node)) |
| 791 | return of_device_is_compatible(ofnode_to_np(node), compat, |
| 792 | NULL, NULL); |
| 793 | else |
| 794 | return !fdt_node_check_compatible(gd->fdt_blob, |
| 795 | ofnode_to_offset(node), |
| 796 | compat); |
| 797 | } |
Simon Glass | 954eeae | 2018-06-11 13:07:13 -0600 | [diff] [blame] | 798 | |
| 799 | ofnode ofnode_by_compatible(ofnode from, const char *compat) |
| 800 | { |
| 801 | if (of_live_active()) { |
| 802 | return np_to_ofnode(of_find_compatible_node( |
| 803 | (struct device_node *)ofnode_to_np(from), NULL, |
| 804 | compat)); |
| 805 | } else { |
| 806 | return offset_to_ofnode(fdt_node_offset_by_compatible( |
| 807 | gd->fdt_blob, ofnode_to_offset(from), compat)); |
| 808 | } |
| 809 | } |
Jens Wiklander | 7b68dad | 2018-08-20 11:09:58 +0200 | [diff] [blame] | 810 | |
| 811 | ofnode ofnode_by_prop_value(ofnode from, const char *propname, |
| 812 | const void *propval, int proplen) |
| 813 | { |
| 814 | if (of_live_active()) { |
| 815 | return np_to_ofnode(of_find_node_by_prop_value( |
| 816 | (struct device_node *)ofnode_to_np(from), propname, |
| 817 | propval, proplen)); |
| 818 | } else { |
| 819 | return offset_to_ofnode(fdt_node_offset_by_prop_value( |
| 820 | gd->fdt_blob, ofnode_to_offset(from), |
| 821 | propname, propval, proplen)); |
| 822 | } |
| 823 | } |
Mario Six | 047dafc | 2018-06-26 08:46:48 +0200 | [diff] [blame] | 824 | |
| 825 | int ofnode_write_prop(ofnode node, const char *propname, int len, |
| 826 | const void *value) |
| 827 | { |
| 828 | const struct device_node *np = ofnode_to_np(node); |
| 829 | struct property *pp; |
| 830 | struct property *pp_last = NULL; |
| 831 | struct property *new; |
| 832 | |
| 833 | if (!of_live_active()) |
| 834 | return -ENOSYS; |
| 835 | |
| 836 | if (!np) |
| 837 | return -EINVAL; |
| 838 | |
| 839 | for (pp = np->properties; pp; pp = pp->next) { |
| 840 | if (strcmp(pp->name, propname) == 0) { |
| 841 | /* Property exists -> change value */ |
| 842 | pp->value = (void *)value; |
| 843 | pp->length = len; |
| 844 | return 0; |
| 845 | } |
| 846 | pp_last = pp; |
| 847 | } |
| 848 | |
| 849 | if (!pp_last) |
| 850 | return -ENOENT; |
| 851 | |
| 852 | /* Property does not exist -> append new property */ |
| 853 | new = malloc(sizeof(struct property)); |
| 854 | if (!new) |
| 855 | return -ENOMEM; |
| 856 | |
| 857 | new->name = strdup(propname); |
Mario Six | 95e885d | 2018-10-04 09:22:24 +0200 | [diff] [blame] | 858 | if (!new->name) { |
| 859 | free(new); |
Mario Six | 047dafc | 2018-06-26 08:46:48 +0200 | [diff] [blame] | 860 | return -ENOMEM; |
Mario Six | 95e885d | 2018-10-04 09:22:24 +0200 | [diff] [blame] | 861 | } |
Mario Six | 047dafc | 2018-06-26 08:46:48 +0200 | [diff] [blame] | 862 | |
| 863 | new->value = (void *)value; |
| 864 | new->length = len; |
| 865 | new->next = NULL; |
| 866 | |
| 867 | pp_last->next = new; |
| 868 | |
| 869 | return 0; |
| 870 | } |
| 871 | |
| 872 | int ofnode_write_string(ofnode node, const char *propname, const char *value) |
| 873 | { |
| 874 | if (!of_live_active()) |
| 875 | return -ENOSYS; |
| 876 | |
| 877 | assert(ofnode_valid(node)); |
| 878 | |
| 879 | debug("%s: %s = %s", __func__, propname, value); |
| 880 | |
| 881 | return ofnode_write_prop(node, propname, strlen(value) + 1, value); |
| 882 | } |
| 883 | |
| 884 | int ofnode_set_enabled(ofnode node, bool value) |
| 885 | { |
| 886 | if (!of_live_active()) |
| 887 | return -ENOSYS; |
| 888 | |
| 889 | assert(ofnode_valid(node)); |
| 890 | |
| 891 | if (value) |
| 892 | return ofnode_write_string(node, "status", "okay"); |
| 893 | else |
Bin Meng | a9274aa | 2019-07-05 09:23:17 -0700 | [diff] [blame] | 894 | return ofnode_write_string(node, "status", "disabled"); |
Mario Six | 047dafc | 2018-06-26 08:46:48 +0200 | [diff] [blame] | 895 | } |