2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
11 #ifndef __MIPS_ASM_MACHINE_H__
12 #define __MIPS_ASM_MACHINE_H__
14 #include <linux/libfdt.h>
18 const struct of_device_id
*matches
;
21 const void *(*fixup_fdt
)(const void *fdt
, const void *match_data
);
22 unsigned int (*measure_hpt_freq
)(void);
25 extern long __mips_machines_start
;
26 extern long __mips_machines_end
;
28 #define MIPS_MACHINE(name) \
29 static const struct mips_machine __mips_mach_##name \
30 __used __section(.mips.machines.init)
32 #define for_each_mips_machine(mach) \
33 for ((mach) = (struct mips_machine *)&__mips_machines_start; \
34 (mach) < (struct mips_machine *)&__mips_machines_end; \
38 * mips_machine_is_compatible() - check if a machine is compatible with an FDT
39 * @mach: the machine struct to check
40 * @fdt: the FDT to check for compatibility with
42 * Check whether the given machine @mach is compatible with the given flattened
43 * device tree @fdt, based upon the compatibility property of the root node.
45 * Return: the device id matched if any, else NULL
47 static inline const struct of_device_id
*
48 mips_machine_is_compatible(const struct mips_machine
*mach
, const void *fdt
)
50 const struct of_device_id
*match
;
55 for (match
= mach
->matches
; match
->compatible
; match
++) {
56 if (fdt_node_check_compatible(fdt
, 0, match
->compatible
) == 0)
63 #endif /* __MIPS_ASM_MACHINE_H__ */