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