soc: at91: Add Atmel SFR SN (Serial Number) support
PATCH v6 1/1 soc: at91: Add Atmel SFR SN (Serial Number) support
Add support to read SFR's read-only registers providing the SoC Serial Numbers (SN0+SN1) to userspace.
~ # hexdump -n 8 -e'"%d\n"' /sys/bus/nvmem/devices/atmel-sfr0/nvmem 959527243
371539274
---
Changes in v2:
- updated atmel-sfr.c to sfr.c in Makefile
- fixed missing drvdata struct definition
- added missing syscon header
Changes in v3:
- Fixed typo: processor in Kconfig
- Renamed private struct sfr_priv to atmel_sfr_priv
- Dropped the drvdata structure as we have same size for both SN registers in SAMA5D2/4, just hardcoded it for now.
- Cleaned up private struct from unused members
- Fixed misusage of devm_kzalloc
Changes in v5:
- Removed the blankline at EOF
- Feeded the entropy pool with the SoC SN using add_device_randomness() and do it only once at probe().
Changes in v6:
- Fixed missing return of a possible error from atmel_sfr_read()
- Added T-b and R-b tags
drivers/soc/atmel/Kconfig | 11 +++++ drivers/soc/atmel/Makefile | 1 + drivers/soc/atmel/sfr.c | 99 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 drivers/soc/atmel/sfr.c
drivers/soc/atmel/Kconfig +11 -0
@@ -5,3 +5,14 @@ config AT91_SOC_ID default ARCH_AT91 help Include support for the SoC bus on the Atmel ARM SoCs. + +config AT91_SOC_SFR + tristate "Special Function Registers support" + depends on ARCH_AT91 || COMPILE_TEST + help + This is a driver for the Special Function Registers available on + Atmel SAMA5Dx SoCs, providing access to specific aspects of the + integrated memory, bridge implementations, processor etc. + + This driver can also be built as a module. If so, the module + will be called sfr.
drivers/soc/atmel/Makefile +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_AT91_SOC_ID) += soc.o +obj-$(CONFIG_AT91_SOC_SFR) += sfr.o
drivers/soc/atmel/sfr.c new file +99 -0
99 lines not on this page · raw message
--
2.23.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 30 lines · Kamel Bouhara
Add support to read SFR's read-only registers providing the SoC Serial Numbers (SN0+SN1) to userspace.
~ # hexdump -n 8 -e'"%d\n"'
/sys/bus/nvmem/devices/atmel-sfr0/nvmem959527243
371539274Signed-off-by Kamel Bouhara <[email protected]>Tested-by Tudor Ambarus <[email protected]>Reviewed-by Tudor Ambarus <[email protected]>---
Changes in v2:
- updatedatmel-sfr.ctosfr.cinMakefile
- fixed missing drvdata struct definition
- added missing syscon header
Changes in v3:
- Fixed typo: processor inKconfig
- Renamed private structsfr_privtoatmel_sfr_priv
- Dropped the drvdata structure as we have same size for both SN registers in SAMA5D2/4, just hardcoded it for now.
- Cleaned up private struct from unused members
- Fixed misusage ofdevm_kzalloc
Changes in v5:
- Removed the blankline at EOF
- Feeded the entropy pool with the SoC SN usingadd_device_randomness()and do it only once atprobe().
Changes in v6:
- Fixed missing return of a possible error fromatmel_sfr_read()
- Added T-b and R-b tags
Quoted 6 lines
drivers/soc/atmel/Kconfig | 11 +++++ drivers/soc/atmel/Makefile | 1 + drivers/soc/atmel/sfr.c | 99 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 drivers/soc/atmel/sfr.c
Applied, thanks.
Signature · 8 lines
Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel