Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Socionext Inc. |
| 4 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
Masahiro Yamada | 4706656 | 2020-07-30 18:28:08 +0900 | [diff] [blame^] | 7 | #include <linux/bitfield.h> |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 8 | #include <linux/io.h> |
| 9 | #include <linux/types.h> |
| 10 | |
| 11 | #include "sg-regs.h" |
| 12 | #include "soc-info.h" |
| 13 | |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 14 | unsigned int uniphier_get_soc_id(void) |
| 15 | { |
Masahiro Yamada | 4706656 | 2020-07-30 18:28:08 +0900 | [diff] [blame^] | 16 | u32 rev = readl(sg_base + SG_REVISION); |
| 17 | |
| 18 | return FIELD_GET(SG_REVISION_TYPE_MASK, rev); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | unsigned int uniphier_get_soc_model(void) |
| 22 | { |
Masahiro Yamada | 4706656 | 2020-07-30 18:28:08 +0900 | [diff] [blame^] | 23 | u32 rev = readl(sg_base + SG_REVISION); |
| 24 | |
| 25 | return FIELD_GET(SG_REVISION_MODEL_MASK, rev); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | unsigned int uniphier_get_soc_revision(void) |
| 29 | { |
Masahiro Yamada | 4706656 | 2020-07-30 18:28:08 +0900 | [diff] [blame^] | 30 | u32 rev = readl(sg_base + SG_REVISION); |
| 31 | |
| 32 | return FIELD_GET(SG_REVISION_REV_MASK, rev); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 33 | } |