1e27d6c7dSMasahiro Yamada /* 2e27d6c7dSMasahiro Yamada * Copyright (C) 2013-2014 Panasonic Corporation 3e27d6c7dSMasahiro Yamada * Copyright (C) 2015-2017 Socionext Inc. 4e27d6c7dSMasahiro Yamada * Author: Masahiro Yamada <yamada.masahiro@socionext.com> 5e27d6c7dSMasahiro Yamada * 6e27d6c7dSMasahiro Yamada * SPDX-License-Identifier: GPL-2.0+ 7e27d6c7dSMasahiro Yamada */ 8e27d6c7dSMasahiro Yamada 9*dd74b945SMasahiro Yamada #include <stdio.h> 10e27d6c7dSMasahiro Yamada #include <linux/errno.h> 11e27d6c7dSMasahiro Yamada #include <linux/io.h> 12*dd74b945SMasahiro Yamada #include <linux/printk.h> 13e27d6c7dSMasahiro Yamada 14e27d6c7dSMasahiro Yamada #include "soc-info.h" 15e27d6c7dSMasahiro Yamada 16e27d6c7dSMasahiro Yamada int print_cpuinfo(void) 17e27d6c7dSMasahiro Yamada { 18e27d6c7dSMasahiro Yamada unsigned int id, model, rev, required_model = 1, required_rev = 1; 19e27d6c7dSMasahiro Yamada 20e27d6c7dSMasahiro Yamada id = uniphier_get_soc_id(); 21e27d6c7dSMasahiro Yamada model = uniphier_get_soc_model(); 22e27d6c7dSMasahiro Yamada rev = uniphier_get_soc_revision(); 23e27d6c7dSMasahiro Yamada 24b8faf5f1SMasahiro Yamada puts("SoC: "); 25e27d6c7dSMasahiro Yamada 26e27d6c7dSMasahiro Yamada switch (id) { 27e27d6c7dSMasahiro Yamada case UNIPHIER_LD4_ID: 28b8faf5f1SMasahiro Yamada puts("LD4"); 29e27d6c7dSMasahiro Yamada required_rev = 2; 30e27d6c7dSMasahiro Yamada break; 31e27d6c7dSMasahiro Yamada case UNIPHIER_PRO4_ID: 32b8faf5f1SMasahiro Yamada puts("Pro4"); 33e27d6c7dSMasahiro Yamada break; 34e27d6c7dSMasahiro Yamada case UNIPHIER_SLD8_ID: 35b8faf5f1SMasahiro Yamada puts("sLD8"); 36e27d6c7dSMasahiro Yamada break; 37e27d6c7dSMasahiro Yamada case UNIPHIER_PRO5_ID: 38b8faf5f1SMasahiro Yamada puts("Pro5"); 39e27d6c7dSMasahiro Yamada break; 40e27d6c7dSMasahiro Yamada case UNIPHIER_PXS2_ID: 41b8faf5f1SMasahiro Yamada puts("PXs2"); 42e27d6c7dSMasahiro Yamada break; 43e27d6c7dSMasahiro Yamada case UNIPHIER_LD6B_ID: 44b8faf5f1SMasahiro Yamada puts("LD6b"); 45e27d6c7dSMasahiro Yamada break; 46e27d6c7dSMasahiro Yamada case UNIPHIER_LD11_ID: 47b8faf5f1SMasahiro Yamada puts("LD11"); 48e27d6c7dSMasahiro Yamada break; 49e27d6c7dSMasahiro Yamada case UNIPHIER_LD20_ID: 50b8faf5f1SMasahiro Yamada puts("LD20"); 51e27d6c7dSMasahiro Yamada break; 522c2ab3d4SMasahiro Yamada case UNIPHIER_PXS3_ID: 532c2ab3d4SMasahiro Yamada puts("PXs3"); 542c2ab3d4SMasahiro Yamada break; 55e27d6c7dSMasahiro Yamada default: 56e27d6c7dSMasahiro Yamada printf("Unknown Processor ID (0x%x)\n", id); 57e27d6c7dSMasahiro Yamada return -ENOTSUPP; 58e27d6c7dSMasahiro Yamada } 59e27d6c7dSMasahiro Yamada 60b8faf5f1SMasahiro Yamada printf(" (model %d, revision %d)\n", model, rev); 61e27d6c7dSMasahiro Yamada 62e27d6c7dSMasahiro Yamada if (model < required_model) { 63*dd74b945SMasahiro Yamada pr_err("Only model %d or newer is supported.\n", 64e27d6c7dSMasahiro Yamada required_model); 65e27d6c7dSMasahiro Yamada return -ENOTSUPP; 66e27d6c7dSMasahiro Yamada } else if (rev < required_rev) { 67*dd74b945SMasahiro Yamada pr_err("Only revision %d or newer is supported.\n", 68e27d6c7dSMasahiro Yamada required_rev); 69e27d6c7dSMasahiro Yamada return -ENOTSUPP; 70e27d6c7dSMasahiro Yamada } 71e27d6c7dSMasahiro Yamada 72e27d6c7dSMasahiro Yamada return 0; 73e27d6c7dSMasahiro Yamada } 74