1 /* 2 * Copyright (C) 2017 Socionext Inc. 3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #include <linux/io.h> 9 #include <linux/types.h> 10 11 #include "sg-regs.h" 12 #include "soc-info.h" 13 14 static unsigned int __uniphier_get_revision_field(unsigned int mask, 15 unsigned int shift) 16 { 17 u32 revision = readl(SG_REVISION); 18 19 return (revision >> shift) & mask; 20 } 21 22 unsigned int uniphier_get_soc_id(void) 23 { 24 return __uniphier_get_revision_field(0xff, 16); 25 } 26 27 unsigned int uniphier_get_soc_model(void) 28 { 29 return __uniphier_get_revision_field(0x7, 8); 30 } 31 32 unsigned int uniphier_get_soc_revision(void) 33 { 34 return __uniphier_get_revision_field(0x1f, 0); 35 } 36