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