summaryrefslogtreecommitdiff
path: root/board/phytec
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2019-02-13 22:46:58 +0100
committerStefano Babic <sbabic@denx.de>2019-04-13 20:30:08 +0200
commit15a445690358462226df8038fe34e295d23b5319 (patch)
treeefc319833f2f03dc60062b8a91d27de9c33a40d8 /board/phytec
parent379255f1ee12c2ddbeaba745a36e1803a5b01fcd (diff)
downloadu-boot-15a445690358462226df8038fe34e295d23b5319.tar.gz
pcm052: mac: Provide board specific imx_get_mac_from_fuse() function
This commit introduces the board specific function to read fused mac address. Signed-off-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'board/phytec')
-rw-r--r--board/phytec/pcm052/pcm052.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/board/phytec/pcm052/pcm052.c b/board/phytec/pcm052/pcm052.c
index 721e25105a..1e443a5850 100644
--- a/board/phytec/pcm052/pcm052.c
+++ b/board/phytec/pcm052/pcm052.c
@@ -310,6 +310,47 @@ int board_init(void)
}
#ifdef CONFIG_TARGET_BK4R1
+void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
+{
+ struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+ struct fuse_bank *bank = &ocotp->bank[4];
+ struct fuse_bank4_regs *fuse =
+ (struct fuse_bank4_regs *)bank->fuse_regs;
+ u32 value;
+
+ /*
+ * BK4 has different layout of stored MAC address
+ * than one used in imx_get_mac_from_fuse() @ generic.c
+ */
+
+ switch (dev_id) {
+ case 0:
+ value = readl(&fuse->mac_addr1);
+
+ mac[0] = value >> 8;
+ mac[1] = value;
+
+ value = readl(&fuse->mac_addr0);
+ mac[2] = value >> 24;
+ mac[3] = value >> 16;
+ mac[4] = value >> 8;
+ mac[5] = value;
+ break;
+ case 1:
+ value = readl(&fuse->mac_addr2);
+
+ mac[0] = value >> 24;
+ mac[1] = value >> 16;
+ mac[2] = value >> 8;
+ mac[3] = value;
+
+ value = readl(&fuse->mac_addr1);
+ mac[4] = value >> 24;
+ mac[5] = value >> 16;
+ break;
+ }
+}
+
int board_late_init(void)
{
struct src *psrc = (struct src *)SRC_BASE_ADDR;