uboot/include/syscon.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2015 Google, Inc
   3 * Written by Simon Glass <sjg@chromium.org>
   4 *
   5 * SPDX-License-Identifier:     GPL-2.0+
   6 */
   7
   8#ifndef __SYSCON_H
   9#define __SYSCON_H
  10
  11/**
  12 * struct syscon_uc_info - Information stored by the syscon UCLASS_UCLASS
  13 *
  14 * @regmap:     Register map for this controller
  15 */
  16struct syscon_uc_info {
  17        struct regmap *regmap;
  18};
  19
  20/* So far there are no ops so this is a placeholder */
  21struct syscon_ops {
  22};
  23
  24#define syscon_get_ops(dev)        ((struct syscon_ops *)(dev)->driver->ops)
  25
  26/**
  27 * syscon_get_regmap() - Get access to a register map
  28 *
  29 * @dev:        Device to check (UCLASS_SCON)
  30 * @info:       Returns regmap for the device
  31 * @return 0 if OK, -ve on error
  32 */
  33struct regmap *syscon_get_regmap(struct udevice *dev);
  34
  35/**
  36 * syscon_get_regmap_by_driver_data() - Look up a controller by its ID
  37 *
  38 * Each system controller can be accessed by its driver data, which is
  39 * assumed to be unique through the scope of all system controllers that
  40 * are in use. This function looks up the controller given this driver data.
  41 *
  42 * @driver_data:        Driver data value to look up
  43 * @devp:               Returns the controller correponding to @driver_data
  44 * @return 0 on success, -ENODEV if the ID was not found, or other -ve error
  45 *         code
  46 */
  47int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp);
  48
  49/**
  50 * syscon_get_regmap_by_driver_data() - Look up a controller by its ID
  51 *
  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 regmap given this driver data.
  55 *
  56 * @driver_data:        Driver data value to look up
  57 * @return register map correponding to @driver_data, or -ve error code
  58 */
  59struct regmap *syscon_get_regmap_by_driver_data(ulong driver_data);
  60
  61/**
  62 * syscon_get_first_range() - get the first memory range from a syscon regmap
  63 *
  64 * @driver_data:        Driver data value to look up
  65 * @return first region of register map correponding to @driver_data, or
  66 *                      -ve error code
  67 */
  68void *syscon_get_first_range(ulong driver_data);
  69
  70#endif
  71