Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | e27d6c7 | 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 | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
Masahiro Yamada | 351b74c | 2020-07-30 18:28:08 +0900 | [diff] [blame] | 7 | #include <linux/bitfield.h> |
Masahiro Yamada | e27d6c7 | 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 | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 14 | unsigned int uniphier_get_soc_id(void) |
| 15 | { |
Masahiro Yamada | 351b74c | 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 | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | unsigned int uniphier_get_soc_model(void) |
| 22 | { |
Masahiro Yamada | 351b74c | 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 | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | unsigned int uniphier_get_soc_revision(void) |
| 29 | { |
Masahiro Yamada | 351b74c | 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 | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 33 | } |