2024-09-26 12:27:12 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Board files registration framework
|
|
|
|
* Copyright (c) 2024, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
|
|
|
*/
|
|
|
|
#ifndef BOARD_H_ /* Include guard */
|
|
|
|
#define BOARD_H_
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Well, well, well. We come back to this style again.
|
|
|
|
* TODO: Implement libfdt once we have C libs all sorted out.
|
|
|
|
*
|
2024-10-08 18:17:10 +00:00
|
|
|
* BOARD_OP_INIT -> initialization as soon as we hit C
|
|
|
|
* BOARD_OP_LATE_INIT -> late initialization
|
|
|
|
* BOARD_OP_DRIVER_SETUP -> drivers setup
|
|
|
|
* BOARD_OP_EXIT -> the last op, currently unused
|
2024-09-26 12:27:12 +00:00
|
|
|
*/
|
2024-10-08 18:17:10 +00:00
|
|
|
enum board_ops {
|
|
|
|
BOARD_OP_INIT,
|
|
|
|
BOARD_OP_LATE_INIT,
|
|
|
|
BOARD_OP_DRIVER_SETUP,
|
|
|
|
BOARD_OP_EXIT
|
|
|
|
};
|
|
|
|
|
|
|
|
// Hold board data WITHOUT POINTERS
|
2024-09-26 12:27:12 +00:00
|
|
|
struct board_data {
|
|
|
|
const char *name;
|
2024-10-08 18:17:10 +00:00
|
|
|
int ops[BOARD_OP_EXIT];
|
2024-09-26 12:27:12 +00:00
|
|
|
};
|
|
|
|
|
2024-10-08 18:17:10 +00:00
|
|
|
extern void init_board_funcs(void *board);
|
2024-09-26 12:27:12 +00:00
|
|
|
|
2024-10-08 18:17:10 +00:00
|
|
|
extern int board_driver_setup(void);
|
|
|
|
extern int board_init(void);
|
|
|
|
extern int board_late_init(void);
|
2024-09-26 12:27:12 +00:00
|
|
|
|
2024-10-08 18:17:10 +00:00
|
|
|
// Macro definitions for board operations
|
|
|
|
#define EXECUTE_BOARD_OP(op_id) \
|
|
|
|
do { \
|
|
|
|
switch (op_id) { \
|
|
|
|
case BOARD_OP_INIT: \
|
|
|
|
board_init(); \
|
|
|
|
break; \
|
|
|
|
case BOARD_OP_LATE_INIT: \
|
|
|
|
board_late_init(); \
|
|
|
|
break; \
|
|
|
|
case BOARD_OP_DRIVER_SETUP: \
|
|
|
|
board_driver_setup(); \
|
|
|
|
break; \
|
|
|
|
default: \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2024-09-26 12:27:12 +00:00
|
|
|
|
|
|
|
#endif // BOARD_H_
|