This prints the soc version, and should aid future use of collected
data.

Signed-off-by: Luc Verhaegen <l...@skynet.be>
---
 meminfo.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/meminfo.c b/meminfo.c
index bc8bb82..b200224 100644
--- a/meminfo.c
+++ b/meminfo.c
@@ -636,18 +636,37 @@ sun6i_dramphy_regs[] = {
        {0, NULL}
 };
 
+
+static int
+sun6i_soc_version_and_clock_print(void)
+{
+       unsigned int clock;
+       int ret;
+
+       printf("/*\n");
+       printf(" * Sunxi meminfo.\n");
+       printf(" * SoC: 0x%04X\n", soc_version);
+
+       ret = sunxi_dram_clock_read(&clock);
+       if (ret)
+               return ret;
+
+       printf(" * DRAM Clock: %dMHz\n", clock);
+       printf(" */\n");
+       printf("\n");
+
+       return 0;
+}
+
 static int
 sun6i_dram_regs_print(void)
 {
-       unsigned int clock;
        int ret;
 
-       ret = sunxi_dram_clock_read(&clock);
+       ret = sun6i_soc_version_and_clock_print();
        if (ret)
                return ret;
 
-       printf("DRAM Clock: %dMHz\n", clock);
-
        ret = dram_registers_print(SUN6I_IO_DRAMCOM_BASE,
                                   SUN6I_IO_DRAMCOM_SIZE,
                                   &sun6i_dramcom_regs[0],
@@ -678,15 +697,12 @@ sun6i_dram_regs_print(void)
 static int
 sun8i_dram_regs_print(void)
 {
-       unsigned int clock;
        int ret;
 
-       ret = sunxi_dram_clock_read(&clock);
+       ret = sun6i_soc_version_and_clock_print();
        if (ret)
                return ret;
 
-       printf("DRAM Clock: %dMHz\n", clock);
-
        ret = dram_register_range_print(SUN6I_IO_DRAMCOM_BASE,
                                        SUN6I_IO_DRAMCOM_SIZE,
                                        "DRAM COM", "SDR_COM");
@@ -726,15 +742,12 @@ sun8i_dram_regs_print(void)
 static int
 sun9i_dram_regs_print(void)
 {
-       unsigned int clock;
        int ret;
 
-       ret = sunxi_dram_clock_read(&clock);
+       ret = sun6i_soc_version_and_clock_print();
        if (ret)
                return ret;
 
-       printf("DRAM Clock: %dMHz\n", clock);
-
        ret = dram_register_range_print(SUN9I_IO_DRAMCOM_BASE,
                                        SUN9I_IO_DRAMCOM_SIZE,
                                        "DRAM COM", "SDR_COM");
-- 
1.7.7

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to