hdata: Add DIMM actual speed to device tree

Message ID 20180412140931.23564-1-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series
  • hdata: Add DIMM actual speed to device tree
Related show

Commit Message

Vasant Hegde April 12, 2018, 2:09 p.m.
Recent HDAT provides DIMM actuall speed. Lets add this to device tree.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
@Stewart,
  Let me know if there is better name for this property.

-Vasant

 hdata/memory.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Stewart Smith April 24, 2018, 3:30 a.m. | #1
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes:
> Recent HDAT provides DIMM actuall speed. Lets add this to device tree.
>
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
> @Stewart,
>   Let me know if there is better name for this property.

I changed it to 'frequency' and put in the full HZ (which probably means
we need to go to 64 bit number soon) as that seems to fit with the other
'frequency' properties we create everywhere.

Are you able to update the doc/ on it too?

Patch

diff --git a/hdata/memory.c b/hdata/memory.c
index a83898955..a636e8181 100644
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -32,6 +32,8 @@  struct HDIF_ram_area_id {
 #define RAM_AREA_INSTALLED	0x8000
 #define RAM_AREA_FUNCTIONAL	0x4000
 	__be16 flags;
+	__be32 dimm_id;
+	__be32 speed;
 } __packed;
 
 struct HDIF_ram_area_size {
@@ -299,6 +301,11 @@  static void vpd_add_ram_area(const struct HDIF_common_hdr *msarea)
 		chip_id = add_chip_id_to_ram_area(msarea, ram_node);
 		add_bus_freq_to_ram_area(ram_node, chip_id);
 
+		if (ram_sz >= offsetof(struct HDIF_ram_area_id, speed)) {
+			dt_add_property_cells(ram_node, "frequency-mhz",
+					      be32_to_cpu(ram_id->speed));
+		}
+
 		vpd_blob = HDIF_get_idata(ramarea, 1, &ram_sz);
 
 		/*