| 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | /* |
| 3 | * Copyright (C) 2016 Imagination Technologies |
| 4 | * Author: Paul Burton <paul.burton@mips.com> |
| 5 | */ |
| 6 | |
| 7 | #include <linux/of.h> |
| 8 | |
| 9 | #include <asm/bootinfo.h> |
| 10 | |
| 11 | char *system_type; |
| 12 | |
| 13 | const char *get_system_type(void) |
| 14 | { |
| 15 | const char *str; |
| 16 | int err; |
| 17 | |
| 18 | if (system_type) |
| 19 | return system_type; |
| 20 | |
| 21 | err = of_property_read_string(np: of_root, propname: "model" , out_string: &str); |
| 22 | if (!err) |
| 23 | return str; |
| 24 | |
| 25 | err = of_property_read_string_index(np: of_root, propname: "compatible" , index: 0, output: &str); |
| 26 | if (!err) |
| 27 | return str; |
| 28 | |
| 29 | return "Unknown" ; |
| 30 | } |
| 31 | |