Skip to content
Kernel module for handling Atmel crypto chip (ATSHA204)
C Makefile Shell
Branch: master
Clone or download
Pull request Compare This branch is 49 commits ahead of cristeam:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Fixes compiler warnings Apr 9, 2015
LICENSE Initial commit Jun 25, 2014
Makefile clean shouldn't rmmod Apr 9, 2015 Updates README Feb 18, 2015
THANKS Move Mihai to thanks file as all of this code is by the single listed… Oct 29, 2014
atsha204-i2c.c Fixed resource leak. Apr 9, 2015
atsha204-i2c.h Replaces printks with better alternatives. Oct 29, 2014 defaults to atsha204 Oct 29, 2014


Coverity Scan Build Status [![Stories in Ready](](

Kernel module for Atmel's ATSHA204 I2C device.

This software is in ALPHA. It is subject to drastic refactoring at will by the author.

This module provides the following features:

  • An I2C driver [working]
  • Sysfs for serial number [working]
  • Char device for random data [working]


The systfs looks like this:

|-- configlocked
|-- configzone
|-- datalocked
|-- driver -> ../../../../../bus/i2c/drivers/atsha204-i2c
|-- misc
|   `-- atsha0
|       |-- dev
|       |-- device -> ../../../1-0060
|       |-- power
|       |   |-- autosuspend_delay_ms
|       |   |-- control
|       |   |-- runtime_active_time
|       |   |-- runtime_status
|       |   `-- runtime_suspended_time
|       |-- subsystem -> ../../../../../../../class/misc
|       `-- uevent
|-- modalias
|-- name
|-- power
|   |-- autosuspend_delay_ms
|   |-- control
|   |-- runtime_active_time
|   |-- runtime_status
|   `-- runtime_suspended_time
|-- serialnum
|-- subsystem -> ../../../../../bus/i2c
`-- uevent

The unique features are: configlocked, configzone, datalocked, and serialnum.

configlocked & datalocked return a 1 or 0 where 1 indicates that zone is "locked".

serial number returns the chip's unique serial number.

configzone dumps the chip's entire configuration zone.


This driver plugs into /dev/hwrng. See the /dev/hwrng documentation for how to use / switch random number generators.


The driver handles the communication layer. It expects commands in the format:

[Opcode (1)][Param1 (1)][Param2 (2)][[Data (x)]]

The number indicate the number of bytes. Data is optional. The data must be written to the fd in one shot. The driver will pre-pend the length and append the crc.

The driver will perform a write AND a read as there are specific timing constraints when the data must be read. The read data is cached until the user reads the data. The user receives the message ONLY, the single byte size and crc are removed.

You can’t perform that action at this time.