forked from Mirrors/opensbi

We add a simple FDT based regmap framework which is built on top of generic regmap library. The phandle of FDT regmap DT node is treated as unique regmap ID. The FDT based regmap drivers will be probed on-demand from fdt_regmap_get_by_phandle() and fdt_regmap_get() called by the regmap client drivers. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com>
32 lines
746 B
C
32 lines
746 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)(void *fdt, int nodeoff, u32 phandle,
|
|
const struct fdt_match *match);
|
|
};
|
|
|
|
/** Get regmap instance based on phandle */
|
|
int fdt_regmap_get_by_phandle(void *fdt, u32 phandle,
|
|
struct regmap **out_rmap);
|
|
|
|
/** Get regmap instance based on "regmap' property of the specified DT node */
|
|
int fdt_regmap_get(void *fdt, int nodeoff, struct regmap **out_rmap);
|
|
|
|
#endif
|