Linux 4.16-rc2
[linux-2.6-block.git] / arch / metag / include / asm / mach / arch.h
CommitLineData
85d9d7a9
JH
1/*
2 * arch/metag/include/asm/mach/arch.h
3 *
4 * Copyright (C) 2012 Imagination Technologies Ltd.
5 *
6 * based on the ARM version:
7 * Copyright (C) 2000 Russell King
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef _METAG_MACH_ARCH_H_
15#define _METAG_MACH_ARCH_H_
16
17#include <linux/stddef.h>
18
a2c5d4ed
JH
19#include <asm/clock.h>
20
85d9d7a9
JH
21/**
22 * struct machine_desc - Describes a board controlled by a Meta.
23 * @name: Board/SoC name.
24 * @dt_compat: Array of device tree 'compatible' strings.
a2c5d4ed 25 * @clocks: Clock callbacks.
85d9d7a9
JH
26 *
27 * @nr_irqs: Maximum number of IRQs.
28 * If 0, defaults to NR_IRQS in asm-generic/irq.h.
29 *
30 * @init_early: Early init callback.
31 * @init_irq: IRQ init callback for setting up IRQ controllers.
32 * @init_machine: Arch init callback for setting up devices.
33 * @init_late: Late init callback.
34 *
35 * This structure is provided by each board which can be controlled by a Meta.
36 * It is chosen by matching the compatible strings in the device tree provided
37 * by the bootloader with the strings in @dt_compat, and sets up any aspects of
38 * the machine that aren't configured with device tree (yet).
39 */
40struct machine_desc {
41 const char *name;
42 const char **dt_compat;
a2c5d4ed 43 struct meta_clock_desc *clocks;
85d9d7a9
JH
44
45 unsigned int nr_irqs;
46
47 void (*init_early)(void);
48 void (*init_irq)(void);
49 void (*init_machine)(void);
50 void (*init_late)(void);
51};
52
53/*
54 * Current machine - only accessible during boot.
55 */
986c494b 56extern const struct machine_desc *machine_desc;
85d9d7a9
JH
57
58/*
59 * Machine type table - also only accessible during boot
60 */
61extern struct machine_desc __arch_info_begin[], __arch_info_end[];
62#define for_each_machine_desc(p) \
63 for (p = __arch_info_begin; p < __arch_info_end; p++)
64
65static inline struct machine_desc *default_machine_desc(void)
66{
67 /* the default machine is the last one linked in */
68 if (__arch_info_end - 1 < __arch_info_begin)
69 return NULL;
70 return __arch_info_end - 1;
71}
72
73/*
74 * Set of macros to define architecture features. This is built into
75 * a table by the linker.
76 */
77#define MACHINE_START(_type, _name) \
78static const struct machine_desc __mach_desc_##_type \
79__used \
80__attribute__((__section__(".arch.info.init"))) = { \
81 .name = _name,
82
83#define MACHINE_END \
84};
85
86#endif /* _METAG_MACH_ARCH_H_ */