Skip to contentSkip to conversation

drivers/misc: Add Altera System ID driver

PATCH In review Ley Foon Tan 3 participants 8 messages Mar 4, 2013 – Mar 8, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/misc: Add Altera System ID driver

This patch is to add Altera System ID driver.
User can obtain the system ID and timestamp of the system by reading the sysfs entry.

Usage:
cat /sys/bus/platform/devices/[addr].sysid/sysid/id cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp

---
 .../devicetree/bindings/misc/altera_sysid.txt      |   18 +++
 drivers/misc/Kconfig                               |    6 +
 drivers/misc/Makefile                              |    3 +-
 drivers/misc/altera_sysid.c                        |  142 ++++++++++++++++++++
 4 files changed, 168 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/altera_sysid.txt
 create mode 100644 drivers/misc/altera_sysid.c
Documentation/devicetree/bindings/misc/altera_sysid.txt new file +18 -0
new file mode 100644
index 0000000..463dc15
@@ -0,0 +1,18 @@
+Altera Sysid IP core driver
+
+Required properties:
+- compatible: altr,sysid-1.0
+
+Optional properties:
+- id:  A unique 32-bit value that is based on the contents of the system.
+- timestamp: A unique 32-bit value that is based on the system generation time.
+
+Example:
+
+sysid_qsys: sysid@0x10000 {
+	compatible = "altr,sysid-1.0";
+	reg = < 0x10000 0x00000008 >;
+	id = < 1 >;
+	timestamp = < 1359538782 >;
+};
+
drivers/misc/Kconfig +6 -0
index e83fdfe..0e783af 100644
@@ -510,6 +510,12 @@ config LATTICE_ECP3_CONFIG
 
 	  If unsure, say N.
 
+config ALTERA_SYSID
+	tristate "Altera System ID"
+	help
+	This enables Altera System ID soft core driver.
+
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +2 -1
index 35a1463..dc7142d 100644
@@ -47,7 +47,8 @@ obj-y				+= ti-st/
 obj-y				+= lis3lv02d/
 obj-y				+= carma/
 obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
-obj-$(CONFIG_ALTERA_STAPL)	+=altera-stapl/
+obj-$(CONFIG_ALTERA_STAPL)	+= altera-stapl/
+obj-$(CONFIG_ALTERA_SYSID)	+= altera_sysid.o
 obj-$(CONFIG_INTEL_MEI)		+= mei/
 obj-$(CONFIG_MAX8997_MUIC)	+= max8997-muic.o
 obj-$(CONFIG_VMWARE_VMCI)	+= vmw_vmci/
drivers/misc/altera_sysid.c new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
1.7.7.4
maintainer
#1 lore raw
Quoted 9 lines · Ley Foon Tan

This patch is to add Altera System ID driver.
User can obtain the system ID and timestamp of the system by reading the sysfs entry.

Usage:
cat /sys/bus/platform/devices/[addr].sysid/sysid/id cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp

All sysfs files need documentation in Documentation/ABI/.

This driver looks like it should instead be using the infrastructure we have for identifying an SoC in drivers/base/soc.c, which is currently only used by the ARM u8500 platform but was introduced as a generic interface for this a while ago.

Arnd

#2 lore raw
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Ley Foon Tan

This patch is to add Altera System ID driver.
User can obtain the system ID and timestamp of the system by reading the sysfs entry.

Usage:
cat /sys/bus/platform/devices/[addr].sysid/sysid/id cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp

Quoted 8 lines
Quoted 1 line

All sysfs files need documentation in Documentation/ABI/.

This driver looks like it should instead be using the infrastructure we have for identifying an SoC in drivers/base/soc.c, which is currently only used by the ARM u8500 platform but was introduced as a generic interface for this a while ago.

I agree, this shouldn't be a one-off sysfs file.

greg k-h

#3 lore raw
Quoted 6 lines · Greg Kroah-Hartman
Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · Ley Foon Tan

This patch is to add Altera System ID driver.
User can obtain the system ID and timestamp of the system by reading the sysfs entry.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Usage:
cat /sys/bus/platform/devices/[addr].sysid/sysid/id cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp

All sysfs files need documentation in Documentation/ABI/.

Okay, I will add document in this directory.

Quoted 10 lines
Quoted 5 lines

This driver looks like it should instead be using the infrastructure we have for identifying an SoC in drivers/base/soc.c, which is currently only used by the ARM u8500 platform but was introduced as a generic interface for this a while ago.

I agree, this shouldn't be a one-off sysfs file.

greg k-h

This IP core is not in the SoC. This core is in the FPGA and can be accessed by the Nios II processor or accessed by SOCFPGA processor (ARM based) via its interface to FPGA. Due to this, I think it shouldn't use infrastructure in drivers/base/soc.c.
What do you think?

Thanks for the comments.

lftan

maintainer
#4 lore raw
Quoted 5 lines · Ley Foon Tan

This IP core is not in the SoC. This core is in the FPGA and can be accessed by the Nios II processor or accessed by SOCFPGA processor (ARM based) via its interface to FPGA. Due to this, I think it shouldn't use infrastructure in drivers/base/soc.c.
What do you think?

The sysid component gives a version for the entire FPGA part and all components inside it, right?

I think you should use the drivers/base/soc.c interface to describe the SOCFPGA SoC components as well as the actual FPGA. You basically end up having one device node that acts as the parent for the SoC components, and a way to retrieve version information about it.

Depending on how it fits the actual hardware layout more closely, you could have one node as the parent for all devices, or the FPGA SoC node as a child of the main one, or two SoC nodes side by side from the top-level.

Arnd

#5 lore raw
Quoted 15 lines · Arnd Bergmann
Quoted 5 lines · Ley Foon Tan

This IP core is not in the SoC. This core is in the FPGA and can be accessed by the Nios II processor or accessed by SOCFPGA processor (ARM based) via its interface to FPGA. Due to this, I think it shouldn't use infrastructure in drivers/base/soc.c.
What do you think?

The sysid component gives a version for the entire FPGA part and all components inside it, right?

I think you should use the drivers/base/soc.c interface to describe the SOCFPGA SoC components as well as the actual FPGA. You basically end up having one device node that acts as the parent for the SoC components, and a way to retrieve version information about it.

Quoted 7 lines

Depending on how it fits the actual hardware layout more closely, you could have one node as the parent for all devices, or the FPGA SoC node as a child of the main one, or two SoC nodes side by side from the top-level.

Arnd

The sysid give the unique system ID and system generation timestamp of the system.

CASE 1:
SOCFPGA SoC + Sysid component in FPGA

CASE 2
Nios II soft core CPU + Sysid (All in FPGA and no SoC is involved)

Quoted 1 line

From example use cases above, Case 2 doesn't involve SoC component.

To support both cases, do you think drivers/base/soc.c is still suitable?

Thanks.

LFTan

maintainer
#6 lore raw
Quoted 6 lines · Ley Foon Tan

The sysid give the unique system ID and system generation timestamp of the system.

CASE 1:
SOCFPGA SoC + Sysid component in FPGA

Quoted 6 lines

CASE 2
Nios II soft core CPU + Sysid (All in FPGA and no SoC is involved)

From example use cases above, Case 2 doesn't involve SoC component. To support both cases, do you think drivers/base/soc.c is still suitable?

Yes, I think so. I would consider the second case still a SoC, because you have a single chip that contains the CPU and peripherals. From the OS point of view, it does not matter that they are in an FPGA.

Arnd

#7 lore raw
Quoted 14 lines · Arnd Bergmann
Quoted 6 lines · Ley Foon Tan

The sysid give the unique system ID and system generation timestamp of the system.

CASE 1:
SOCFPGA SoC + Sysid component in FPGA

Quoted 6 lines

CASE 2
Nios II soft core CPU + Sysid (All in FPGA and no SoC is involved)

From example use cases above, Case 2 doesn't involve SoC component. To support both cases, do you think drivers/base/soc.c is still suitable?

Quoted 5 lines

Yes, I think so. I would consider the second case still a SoC, because you have a single chip that contains the CPU and peripherals. From the OS point of view, it does not matter that they are in an FPGA.

Arnd

Thanks for your input. I will go with your suggestion.

LFTan