-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The version of register 0 and 1 must be greater or equal to 1, otherwise do not attempt to read any data from the OTP. Signed-off-by: Francois Berder <francois.berder@imgtec.com>
- Loading branch information
1 parent
b2af95e
commit 842f390
Showing
6 changed files
with
81 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,5 @@ obj-y += cmd_scratchpad.o | |
endif | ||
ifdef CONFIG_WINBOND_OTP | ||
obj-y += fdt.o | ||
obj-y += otp.o | ||
endif |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (C) 2016 Imagination Technologies | ||
* Author: Francois Berder <francois.berder@imgtec.com> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
|
||
#include <common.h> | ||
#include <winbond-otp.h> | ||
#include "otp.h" | ||
|
||
int read_otp_version(loff_t offset) | ||
{ | ||
u_char version; | ||
|
||
if (read_otp_data(offset, sizeof(version), (char *)&version)) { | ||
printf("WARNING: Could not read register version from OTP.\n"); | ||
return -1; | ||
} | ||
|
||
return version; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2016 Imagination Technologies | ||
* Author: Francois Berder <francois.berder@imgtec.com> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
|
||
#ifndef _OTP_H | ||
#define _OTP_H | ||
|
||
#define MAC_ADDR_LEN 6 | ||
|
||
#ifdef CONFIG_WINBOND_OTP | ||
|
||
#include <linux/types.h> | ||
|
||
#define VERSION_REG0_OFFSET 0x1002 | ||
#define VERSION_REG1_OFFSET 0x2002 | ||
#define WIFI_STA_MAC_ADDRESS_OFFSET 0x1003 | ||
#define WIFI_AP_MAC_ADDRESS_OFFSET 0x1009 | ||
#define ETH_MAC_ADDRESS_OFFSET 0x1015 | ||
#define DCXO_OFFSET 0x2003 | ||
|
||
int read_otp_version(loff_t offset); | ||
|
||
#endif | ||
|
||
#endif |
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