aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-arm/device.h
blob: 9e47ca636262c0e80709bccaec4eae3fc75f1736 (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
#ifndef __ASM_ARM_DEVICE_H
#define __ASM_ARM_DEVICE_H

#include <xen/init.h>
#include <xen/device_tree.h>

enum device_type
{
    DEVICE_SERIAL
};

struct device_desc {
    /* Device name */
    const char *name;
    /* Device type */
    enum device_type type;
    /* Array of device tree 'compatible' strings */
    const char *const *compatible;
    /* Device initialization */
    int (*init)(struct dt_device_node *dev, const void *data);
};

/**
 *  device_init - Initialize a device
 *  @dev: device to initialize
 *  @type: type of the device (serial, network...)
 *  @data: specific data for initializing the device
 *
 *  Return 0 on success.
 */
int __init device_init(struct dt_device_node *dev, enum device_type type,
                       const void *data);

#define DT_DEVICE_START(_name, _namestr, _type)                     \
static const struct device_desc __dev_desc_##_name __used           \
__attribute__((__section__(".dev.info"))) = {                       \
    .name = _namestr,                                               \
    .type = _type,                                                  \

#define DT_DEVICE_END                                               \
};

#endif /* __ASM_ARM_DEVICE_H */

/*
 * Local variables:
 * mode: C
 * c-file-style: "BSD"
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 */