blob: cce2fde219a357ecc1a3cc574be673f2b0e4647a [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-or-later
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Copyright (C) 2016 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005 */
6
7#include <linux/of.h>
8
9#include <asm/bootinfo.h>
10
Olivier Deprez157378f2022-04-04 15:47:50 +020011char *system_type;
12
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000013const char *get_system_type(void)
14{
15 const char *str;
16 int err;
17
Olivier Deprez157378f2022-04-04 15:47:50 +020018 if (system_type)
19 return system_type;
20
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000021 err = of_property_read_string(of_root, "model", &str);
22 if (!err)
23 return str;
24
25 err = of_property_read_string_index(of_root, "compatible", 0, &str);
26 if (!err)
27 return str;
28
29 return "Unknown";
30}