forked from u-boot/u-boot
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: uniphier: use FIELD_GET() to get access to revision register fields
Define register fields as macros, and use FIELD_GET(). Signed-off-by: Masahiro Yamada <[email protected]>
- Loading branch information
Showing
2 changed files
with
15 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,31 +4,30 @@ | |
* Author: Masahiro Yamada <[email protected]> | ||
*/ | ||
|
||
#include <linux/bitfield.h> | ||
#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) | ||
{ | ||
u32 revision = readl(sg_base + SG_REVISION); | ||
|
||
return (revision >> shift) & mask; | ||
} | ||
|
||
unsigned int uniphier_get_soc_id(void) | ||
{ | ||
return __uniphier_get_revision_field(0xff, 16); | ||
u32 rev = readl(sg_base + SG_REVISION); | ||
|
||
return FIELD_GET(SG_REVISION_TYPE_MASK, rev); | ||
} | ||
|
||
unsigned int uniphier_get_soc_model(void) | ||
{ | ||
return __uniphier_get_revision_field(0x7, 8); | ||
u32 rev = readl(sg_base + SG_REVISION); | ||
|
||
return FIELD_GET(SG_REVISION_MODEL_MASK, rev); | ||
} | ||
|
||
unsigned int uniphier_get_soc_revision(void) | ||
{ | ||
return __uniphier_get_revision_field(0x1f, 0); | ||
u32 rev = readl(sg_base + SG_REVISION); | ||
|
||
return FIELD_GET(SG_REVISION_REV_MASK, rev); | ||
} |