mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-11 13:56:30 +00:00
34ded87506
Until the last SoC, the register addresses have been hard-coded because they are always constant. For a planned new SoC, the register bases will be completely changed. I insist on supporting multiple SoCs/boards by a single defconfig (uniphier_v8_defconfig) since duplicating similar defconfig files is a maintenance burden. The base addresses must be fixed-up at run-time somehow. Previously, the board init code identified the SoC by reading out the SG_REVISION register. This is much easier than parsing DT. You cannot do it any more because the base address of SG will be changed. The SG_REVISION register exists to read out the SoC ID, but you never know its address before identifying the SoC. Oh well. So, the possible solution is to parse the DT, and find out the node with "*-soc-glue" compatible string. Then, sg_base is set to the value of the "reg" property. The sc_base is set up likewise. It is worth noting a pit-fall. Having sc_base and sg_base in the global scope will make the life easier, but the global variables are poorly supported before the relocation. In fact, the .bss section overwraps with DT. Allocating them in the .bss section would break DT. So, I gave dummy initializers to assign them in the .data section. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
78 lines
1.5 KiB
C
78 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2013-2014 Panasonic Corporation
|
|
* Copyright (C) 2015-2017 Socionext Inc.
|
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/io.h>
|
|
#include <linux/printk.h>
|
|
|
|
#include "base-address.h"
|
|
#include "soc-info.h"
|
|
|
|
int print_cpuinfo(void)
|
|
{
|
|
unsigned int id, model, rev, required_model = 1, required_rev = 1;
|
|
int ret;
|
|
|
|
ret = uniphier_base_address_init();
|
|
if (ret)
|
|
return ret;
|
|
|
|
id = uniphier_get_soc_id();
|
|
model = uniphier_get_soc_model();
|
|
rev = uniphier_get_soc_revision();
|
|
|
|
puts("SoC: ");
|
|
|
|
switch (id) {
|
|
case UNIPHIER_LD4_ID:
|
|
puts("LD4");
|
|
required_rev = 2;
|
|
break;
|
|
case UNIPHIER_PRO4_ID:
|
|
puts("Pro4");
|
|
break;
|
|
case UNIPHIER_SLD8_ID:
|
|
puts("sLD8");
|
|
break;
|
|
case UNIPHIER_PRO5_ID:
|
|
puts("Pro5");
|
|
break;
|
|
case UNIPHIER_PXS2_ID:
|
|
puts("PXs2");
|
|
break;
|
|
case UNIPHIER_LD6B_ID:
|
|
puts("LD6b");
|
|
break;
|
|
case UNIPHIER_LD11_ID:
|
|
puts("LD11");
|
|
break;
|
|
case UNIPHIER_LD20_ID:
|
|
puts("LD20");
|
|
break;
|
|
case UNIPHIER_PXS3_ID:
|
|
puts("PXs3");
|
|
break;
|
|
default:
|
|
printf("Unknown Processor ID (0x%x)\n", id);
|
|
return -ENOTSUPP;
|
|
}
|
|
|
|
printf(" (model %d, revision %d)\n", model, rev);
|
|
|
|
if (model < required_model) {
|
|
pr_err("Only model %d or newer is supported.\n",
|
|
required_model);
|
|
return -ENOTSUPP;
|
|
} else if (rev < required_rev) {
|
|
pr_err("Only revision %d or newer is supported.\n",
|
|
required_rev);
|
|
return -ENOTSUPP;
|
|
}
|
|
|
|
return 0;
|
|
}
|