blob: 19777d9bf7111fcab7f8083104bb15a378c38116 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2013 Juergen Beisert <kernel@pengutronix.de>, Pengutronix
*/
#ifndef FIRMWARE_H
#define FIRMWARE_H
#include <types.h>
#include <driver.h>
struct firmware_handler {
char *id; /* unique identifier for this firmware device */
char *model; /* description for this device */
struct device_d *dev;
/* called once to prepare the firmware's programming cycle */
int (*open)(struct firmware_handler*);
/* called multiple times to program the firmware with the given data */
int (*write)(struct firmware_handler*, const void*, size_t);
/* called once to finish programming cycle */
int (*close)(struct firmware_handler*);
};
struct firmware_mgr;
int firmwaremgr_register(struct firmware_handler *);
struct firmware_mgr *firmwaremgr_find(const char *);
#ifdef CONFIG_FIRMWARE
struct firmware_mgr *firmwaremgr_find_by_node(const struct device_node *np);
#else
static inline struct firmware_mgr *firmwaremgr_find_by_node(const struct device_node *np)
{
return NULL;
}
#endif
void firmwaremgr_list_handlers(void);
#ifdef CONFIG_FIRMWARE
int firmwaremgr_load_file(struct firmware_mgr *, const char *path);
#else
static inline int firmwaremgr_load_file(struct firmware_mgr *mgr, const char *path)
{
return -ENOSYS;
}
#endif
#define get_builtin_firmware(name, start, size) \
{ \
extern char _fw_##name##_start[]; \
extern char _fw_##name##_end[]; \
*start = (typeof(*start)) _fw_##name##_start; \
*size = _fw_##name##_end - _fw_##name##_start; \
}
#endif /* FIRMWARE_H */
|