2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-01-21 09:05:26 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Socionext Inc.
|
|
|
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include "sg-regs.h"
|
|
|
|
#include "soc-info.h"
|
|
|
|
|
|
|
|
static unsigned int __uniphier_get_revision_field(unsigned int mask,
|
|
|
|
unsigned int shift)
|
|
|
|
{
|
2019-07-10 11:07:40 +00:00
|
|
|
u32 revision = readl(sg_base + SG_REVISION);
|
2017-01-21 09:05:26 +00:00
|
|
|
|
|
|
|
return (revision >> shift) & mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int uniphier_get_soc_id(void)
|
|
|
|
{
|
|
|
|
return __uniphier_get_revision_field(0xff, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int uniphier_get_soc_model(void)
|
|
|
|
{
|
2017-05-09 08:14:55 +00:00
|
|
|
return __uniphier_get_revision_field(0x7, 8);
|
2017-01-21 09:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int uniphier_get_soc_revision(void)
|
|
|
|
{
|
|
|
|
return __uniphier_get_revision_field(0x1f, 0);
|
|
|
|
}
|