mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00

Since the FDT is not modified during driver initialization, node offsets are just as suitable as phandles for use as identifiers: they are stable and unique. With this change, it is no longer necessary to pass the phandle to the driver init functions, so these init functions now use the same prototype as other kinds of drivers. This matches what is already done for I2C adapters. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
32 lines
751 B
C
32 lines
751 B
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2023 Ventana Micro Systems Inc.
|
|
*
|
|
* Authors:
|
|
* Anup Patel <apatel@ventanamicro.com>
|
|
*/
|
|
|
|
#ifndef __FDT_REGMAP_H__
|
|
#define __FDT_REGMAP_H__
|
|
|
|
#include <sbi_utils/regmap/regmap.h>
|
|
|
|
struct fdt_phandle_args;
|
|
|
|
/** FDT based regmap driver */
|
|
struct fdt_regmap {
|
|
const struct fdt_match *match_table;
|
|
int (*init)(const void *fdt, int nodeoff,
|
|
const struct fdt_match *match);
|
|
};
|
|
|
|
/** Get regmap instance based on phandle */
|
|
int fdt_regmap_get_by_phandle(const void *fdt, u32 phandle,
|
|
struct regmap **out_rmap);
|
|
|
|
/** Get regmap instance based on "regmap" property of the specified DT node */
|
|
int fdt_regmap_get(const void *fdt, int nodeoff, struct regmap **out_rmap);
|
|
|
|
#endif
|