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