2020-03-17 22:59:40 +08:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
/*
|
2020-03-24 03:48:58 +08:00
|
|
|
* fdt_helper.h - Flat Device Tree parsing helper routines
|
|
|
|
* Implement helper routines to parse FDT nodes on top of
|
|
|
|
* libfdt for OpenSBI usage
|
2020-03-17 22:59:40 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FDT_HELPER_H__
|
|
|
|
#define __FDT_HELPER_H__
|
|
|
|
|
2020-04-24 21:02:10 +08:00
|
|
|
struct fdt_match {
|
|
|
|
const char *compatible;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2020-03-24 03:48:57 +08:00
|
|
|
struct platform_uart_data {
|
|
|
|
unsigned long addr;
|
|
|
|
unsigned long freq;
|
|
|
|
unsigned long baud;
|
2020-04-24 17:51:34 +08:00
|
|
|
unsigned long reg_shift;
|
|
|
|
unsigned long reg_io_width;
|
2020-03-24 03:48:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_plic_data {
|
|
|
|
unsigned long addr;
|
|
|
|
unsigned long num_src;
|
|
|
|
};
|
|
|
|
|
2020-04-24 21:02:10 +08:00
|
|
|
const struct fdt_match *fdt_match_node(void *fdt, int nodeoff,
|
|
|
|
const struct fdt_match *match_table);
|
|
|
|
|
|
|
|
int fdt_find_match(void *fdt, const struct fdt_match *match_table,
|
|
|
|
const struct fdt_match **out_match);
|
|
|
|
|
2020-04-25 21:03:54 +08:00
|
|
|
int fdt_parse_uart8250_node(void *fdt, int nodeoffset,
|
|
|
|
struct platform_uart_data *uart);
|
|
|
|
|
2020-03-24 03:48:57 +08:00
|
|
|
int fdt_parse_uart8250(void *fdt, struct platform_uart_data *uart,
|
|
|
|
const char *compatible);
|
|
|
|
|
|
|
|
int fdt_parse_plic(void *fdt, struct platform_plic_data *plic,
|
|
|
|
const char *compatible);
|
|
|
|
|
2020-04-24 19:11:06 +08:00
|
|
|
int fdt_parse_compat_addr(void *fdt, unsigned long *addr,
|
|
|
|
const char *compatible);
|
2020-03-24 03:48:57 +08:00
|
|
|
|
2020-03-17 22:59:40 +08:00
|
|
|
#endif /* __FDT_HELPER_H__ */
|