1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
13 * struct syscon_uc_info - Information stored by the syscon UCLASS_UCLASS
15 * @regmap: Register map for this controller
17 struct syscon_uc_info {
18 struct regmap *regmap;
21 /* So far there are no ops so this is a placeholder */
25 #define syscon_get_ops(dev) ((struct syscon_ops *)(dev)->driver->ops)
27 #if CONFIG_IS_ENABLED(OF_PLATDATA)
29 * We don't support 64-bit machines. If they are so resource-contrained that
30 * they need to use OF_PLATDATA, something is horribly wrong with the
31 * education of our hardware engineers.
33 * Update: 64-bit is now supported and we have an education crisis.
35 struct syscon_base_platdata {
41 * syscon_get_regmap() - Get access to a register map
43 * @dev: Device to check (UCLASS_SCON)
44 * @info: Returns regmap for the device
45 * @return 0 if OK, -ve on error
47 struct regmap *syscon_get_regmap(struct udevice *dev);
50 * syscon_get_regmap_by_driver_data() - Look up a controller by its ID
52 * Each system controller can be accessed by its driver data, which is
53 * assumed to be unique through the scope of all system controllers that
54 * are in use. This function looks up the controller given this driver data.
56 * @driver_data: Driver data value to look up
57 * @devp: Returns the controller correponding to @driver_data
58 * @return 0 on success, -ENODEV if the ID was not found, or other -ve error
61 int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp);
64 * syscon_get_regmap_by_driver_data() - Look up a controller by its ID
66 * Each system controller can be accessed by its driver data, which is
67 * assumed to be unique through the scope of all system controllers that
68 * are in use. This function looks up the regmap given this driver data.
70 * @driver_data: Driver data value to look up
71 * @return register map correponding to @driver_data, or -ve error code
73 struct regmap *syscon_get_regmap_by_driver_data(ulong driver_data);
76 * syscon_get_first_range() - get the first memory range from a syscon regmap
78 * @driver_data: Driver data value to look up
79 * @return first region of register map correponding to @driver_data, or
82 void *syscon_get_first_range(ulong driver_data);