diff mbox

[U-Boot,4/7] omap5: omap_die_id support

Message ID 1440697034-28698-4-git-send-email-contact@paulk.fr
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Paul Kocialkowski Aug. 27, 2015, 5:37 p.m. UTC
This introduces omap5 support for omap_die_id, which matches the common
omap_die_id definition. It replaces board-specific code to grab the die id bits.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/cpu/armv7/omap5/hwinit.c    |  8 ++++++++
 arch/arm/cpu/armv7/omap5/prcm-regs.c |  4 ++++
 board/ti/dra7xx/evm.c                |  7 +++----
 board/ti/omap5_uevm/evm.c            | 12 +++---------
 4 files changed, 18 insertions(+), 13 deletions(-)

Comments

Tom Rini Sept. 4, 2015, 6:14 p.m. UTC | #1
On Thu, Aug 27, 2015 at 07:37:11PM +0200, Paul Kocialkowski wrote:

> This introduces omap5 support for omap_die_id, which matches the common
> omap_die_id definition. It replaces board-specific code to grab the die id bits.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini Oct. 22, 2015, 9:18 p.m. UTC | #2
On Thu, Aug 27, 2015 at 07:37:11PM +0200, Paul Kocialkowski wrote:

> This introduces omap5 support for omap_die_id, which matches the common
> omap_die_id definition. It replaces board-specific code to grab the die id bits.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/omap5/hwinit.c b/arch/arm/cpu/armv7/omap5/hwinit.c
index 3699050..d0ac029 100644
--- a/arch/arm/cpu/armv7/omap5/hwinit.c
+++ b/arch/arm/cpu/armv7/omap5/hwinit.c
@@ -376,6 +376,14 @@  void init_omap_revision(void)
 	init_cpu_configuration();
 }
 
+void omap_die_id(unsigned int *die_id)
+{
+	die_id[0] = readl((*ctrl)->control_std_fuse_die_id_0);
+	die_id[1] = readl((*ctrl)->control_std_fuse_die_id_1);
+	die_id[2] = readl((*ctrl)->control_std_fuse_die_id_2);
+	die_id[3] = readl((*ctrl)->control_std_fuse_die_id_3);
+}
+
 void reset_cpu(ulong ignored)
 {
 	u32 omap_rev = omap_revision();
diff --git a/arch/arm/cpu/armv7/omap5/prcm-regs.c b/arch/arm/cpu/armv7/omap5/prcm-regs.c
index d01ce88..9c182b0 100644
--- a/arch/arm/cpu/armv7/omap5/prcm-regs.c
+++ b/arch/arm/cpu/armv7/omap5/prcm-regs.c
@@ -297,6 +297,10 @@  struct prcm_regs const omap5_es1_prcm = {
 struct omap_sys_ctrl_regs const omap5_ctrl = {
 	.control_status				= 0x4A002134,
 	.control_std_fuse_opp_vdd_mpu_2		= 0x4A0021B4,
+	.control_std_fuse_die_id_0		= 0x4A002200,
+	.control_std_fuse_die_id_1		= 0x4A002208,
+	.control_std_fuse_die_id_2		= 0x4A00220C,
+	.control_std_fuse_die_id_3		= 0x4A002210,
 	.control_phy_power_usb 			= 0x4A002370,
 	.control_phy_power_sata			= 0x4A002374,
 	.control_padconf_core_base		= 0x4A002800,
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 94a1a8c..ed5ec07 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -57,16 +57,15 @@  int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	u32 id[4];
+	unsigned int die_id[4] = { 0 };
 
 	if (omap_revision() == DRA722_ES1_0)
 		setenv("board_name", "dra72x");
 	else
 		setenv("board_name", "dra7xx");
 
-	id[0] = readl((*ctrl)->control_std_fuse_die_id_0);
-	id[1] = readl((*ctrl)->control_std_fuse_die_id_1);
-	usb_set_serial_num_from_die_id(id);
+	omap_die_id(die_id);
+	usb_set_serial_num_from_die_id(die_id);
 #endif
 	return 0;
 }
diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
index 833ffe9..1b922a8 100644
--- a/board/ti/omap5_uevm/evm.c
+++ b/board/ti/omap5_uevm/evm.c
@@ -112,20 +112,14 @@  static void enable_host_clocks(void)
  */
 int misc_init_r(void)
 {
-	int reg;
-	u32 id[4];
+	unsigned int die_id[4] = { 0 };
 
 #ifdef CONFIG_PALMAS_POWER
 	palmas_init_settings();
 #endif
 
-	reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET;
-
-	id[0] = readl(reg);
-	id[1] = readl(reg + 0x8);
-	id[2] = readl(reg + 0xC);
-	id[3] = readl(reg + 0x10);
-	usb_fake_mac_from_die_id(id);
+	omap_die_id(die_id);
+	usb_fake_mac_from_die_id(die_id);
 
 	return 0;
 }