File tree Expand file tree Collapse file tree 5 files changed +70
-6
lines changed
board/imgtec/pistachio_bub Expand file tree Collapse file tree 5 files changed +70
-6
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,5 @@ obj-y += cmd_scratchpad.o
21
21
endif
22
22
ifdef CONFIG_WINBOND_OTP
23
23
obj-y += fdt.o
24
+ obj-y += otp.o
24
25
endif
Original file line number Diff line number Diff line change 10
10
#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP )
11
11
12
12
#include <winbond-otp.h>
13
-
14
- #define WIFI_STA_MAC_ADDRESS_OFFSET 0x1003
15
- #define WIFI_AP_MAC_ADDRESS_OFFSET 0x1009
16
- #define DCXO_OFFSET 0x2003
13
+ #include "otp.h"
17
14
18
15
DECLARE_GLOBAL_DATA_PTR ;
19
16
@@ -24,6 +21,10 @@ static void fixup_wifi(void *blob)
24
21
char dcxo ;
25
22
char * rf_params_prop ;
26
23
24
+ if (check_otp_version (VERSION_REG0_OFFSET )
25
+ || check_otp_version (VERSION_REG1_OFFSET ))
26
+ return ;
27
+
27
28
node = fdt_path_offset (blob , "/uccp@18480000" );
28
29
if (node < 0 ) {
29
30
printf ("WARNING: no /uccp@18480000 path\n" );
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2016 Imagination Technologies
3
+ * Author: Francois Berder <[email protected] >
4
+ *
5
+ * SPDX-License-Identifier: GPL-2.0+
6
+ */
7
+
8
+ #include <common.h>
9
+ #include <winbond-otp.h>
10
+ #include "otp.h"
11
+
12
+ int check_otp_version (loff_t offset )
13
+ {
14
+ u_char version ;
15
+
16
+ if (read_otp_data (offset , sizeof (version ), (char * )& version )) {
17
+ printf ("WARNING: Could not read register version from OTP.\n" );
18
+ return -1 ;
19
+ }
20
+
21
+ if (version != 1 ) {
22
+ printf ("WARNING: Unknown version in OTP.\n" );
23
+ return -1 ;
24
+ }
25
+
26
+ return 0 ;
27
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2016 Imagination Technologies
3
+ * Author: Francois Berder <[email protected] >
4
+ *
5
+ * SPDX-License-Identifier: GPL-2.0+
6
+ */
7
+
8
+ #ifndef _OTP_H
9
+ #define _OTP_H
10
+
11
+ #ifdef CONFIG_WINBOND_OTP
12
+
13
+ #include <linux/types.h>
14
+
15
+ #define VERSION_REG0_OFFSET 0x1002
16
+ #define VERSION_REG1_OFFSET 0x2002
17
+ #define WIFI_STA_MAC_ADDRESS_OFFSET 0x1003
18
+ #define WIFI_AP_MAC_ADDRESS_OFFSET 0x1009
19
+ #define ETH_MAC_ADDRESS_OFFSET 0x1015
20
+ #define DCXO_OFFSET 0x2003
21
+
22
+ /*
23
+ * check_otp_version: Check version register from OTP
24
+ * @offset: Offset of the register in the OTP.
25
+ *
26
+ * returns:
27
+ * 0 if the version is equal to 1
28
+ * -1 otherwise
29
+ */
30
+ int check_otp_version (loff_t offset );
31
+
32
+ #endif
33
+
34
+ #endif
Original file line number Diff line number Diff line change 23
23
#include <tpm.h>
24
24
#include <winbond-otp.h>
25
25
#include "mfio.h"
26
+ #include "otp.h"
26
27
27
- #define ETH_MAC_ADDRESS_OFFSET 0x1015 /* Ethernet MAC address offset */
28
28
29
29
DECLARE_GLOBAL_DATA_PTR ;
30
30
@@ -129,7 +129,8 @@ int board_eth_init(bd_t *bs)
129
129
eth_getenv_enetaddr ("ethaddr" , mac_addr );
130
130
131
131
#ifdef CONFIG_WINBOND_OTP
132
- if (!is_valid_ethaddr (mac_addr )) {
132
+ if (!is_valid_ethaddr (mac_addr )
133
+ && !check_otp_version (VERSION_REG0_OFFSET )) {
133
134
if (!read_otp_data (ETH_MAC_ADDRESS_OFFSET , MAC_ADDR_LEN ,
134
135
(char * )mac_addr )
135
136
&& is_valid_ethaddr (mac_addr ))
You can’t perform that action at this time.
0 commit comments