Solution ZynqMP SoC revision read mechanism

This page gives an overview of the zynqmp_nvmem driver which is available as part of the ZynqMP Linux distribution. Paths, files, links and documentation on this page are given relative to the Linux kernel source tree.


Table of  Contents


HW IP Features

  • SoC revision information
  • Efuse memory access.

Features supported in driver

  • SoC revision information
  • Programming and reading efuse memory

Missing Features, Known Issues and Limitations

  • None.

Kernel Configuration


Device Drivers ---> NVMEM Support ---> <*> Xilinx ZYNQMP SoC ID suppor


Devicetree


Test procedure

Using dd command

To access efuse memory, PMUFW should be built by enabling ENABLE_EFUSE_ACCESS in xpfw_config.h. By default this is disabled. But revision at offset 0x0 is enabled by default. Once booted into Linux, to read/write particular field please do read/write from/to "/sys/bus/nvmem/devices/zynqmp-nvmem0/nvmem" to the particular offset with the corresponding size.

The following table gives the overview of possible addresses for read/write and with the sizes.

RegisterReadWriteSize in bytesOffset is
VersionYESNO0x00x4
DNAYESNO0xc0xC
User0YESYES0x40x20
User1YESYES0x40x24
User2YESYES0x40x28
User3YESYES0x40x2c
User4YESYES0x40x30
User5YESYES0x40x34
User6YESYES0x40x38
User7YESYES0x40x3C
Misc userYESYES0x40x40
Secure controlYESYES0x40x58
SPK IDYESYES0x40x5C
AES keyNOYES0x200x60
PPK0 hashYESYES0x300xA0
PPK1 hashYESYES0x300xD0

Reading/writing unrestricted number of bytes results into an error.

Restricted bits from programming:

Secure Control eFuses :

  • RSA_EN (BITS - [25:11])
  • DFT_DIS (BIT-6 )
  • JTAG_DIS (BIT-5)
  • ENC_ONLY (BIT - 2)

Misc User Control eFuses :

  • LBIST_EN (BIT - 10)


Expected Output

Please refer to below table for values of bs, count , skip for various eFuses:
RegisterSize in bytes(hex)Offset (hex)bs(dec)count(dec)skip(dec)
Version04401
User743C4115
User64384114
User54344113
User44304112
User342C4111
User24284110
User1424419
User0420418
SPK ID45C4123
Secure Control4584122
PPK1 hash30D041252
PPK0 hash30A041240
Misc user4404116
DNACC1211
Known Limitation : dd command can be used to read one word of data only (This means bs =4 and count =1). Therefore dd command cannot be used for reading PPK0/1. Linux application provided in wiki page can be used to read PPK0/1 values . 

Using linux application


As an alternative to dd command, a linux application can be used to read/write into eFuse from linux. 
  • Copy below code in a .c file say efuse_access_app.c and compile it with aarch64-linux-gnu-gcc compiler.
  • After booting till linux, below commands can be used to read/write into eFuses.
    • For help : ./efuse_access_app --help
    • For reading from eFuses : ./efuse_access_app --read <offset in hex>
    • For writing into eFuses : ./efuse_access_app --write <offset in hex> <value in hex>

Mainline Status

  • This driver is not available at Mainline.

Change Log

2017.1
Summary:
  • nvmem: zynqmp: Added zynqmp nvmem firmware driver
  • nvmem: zynqmp: Fix the size to one byte to read the correct value from the nvmem sysfs entry.
Commits:
  • c808007nvmem: zynqmp: Added zynqmp nvmem firmware driver
  • 3494c67 nvmem: zynqmp: Fix the size to one byte to read the correct value from the nvmem sysfs entry.

2017.2
  • None

2017.3
Summary:
  • zynqmp: Use new firmware.h instead of pm.h
Commits:
  • 5e81ba5zynqmp: Use new firmware.h instead of pm.h

2017.4
  • None

2018.1
Summary:
  • soc: zynqmp: Define EEMI ops structure
  • soc: zynqmp: Use new firmware APIs

Commits
  • 31c2a5esoc: zynqmp: Define EEMI ops structure
  • 0b7483csoc: zynqmp: Use new firmware APIs

2018.2
  • None

2018.3

  • Added support to access eFUSE memory


Related Links

http://www.wiki.xilinx.com/Linux+Drivers
https://github.com/Xilinx/linux-xlnx/blob/master/drivers/nvmem/zynqmp_nvmem.c