Since we lack enough information to get parameters here as well.

Signed-off-by: Luc Verhaegen <[email protected]>
---
 meminfo.c |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/meminfo.c b/meminfo.c
index b639746..86b5c1e 100644
--- a/meminfo.c
+++ b/meminfo.c
@@ -215,6 +215,38 @@ dram_registers_print(unsigned int address, int size, const 
struct regs *regs,
        return 0;
 }
 
+static int
+dram_register_range_print(unsigned int address, int size,
+                         const char *description, const char *prefix)
+{
+       void *base;
+       int i;
+
+       base = mmap(NULL, size, PROT_READ, MAP_SHARED, devmem_fd, address);
+       if (base == MAP_FAILED) {
+               fprintf(stderr, "Failed to map %s registers: %s\n",
+                       description, strerror(errno));
+               return errno;
+       }
+
+       printf("/*\n");
+       printf(" * %s Registers\n", description);
+       printf(" */\n");
+
+       for (i = 0; i < size; i += 4) {
+               unsigned int reg = sunxi_io_read(base, i);
+
+               if (reg)
+                       printf("%s_%03X = 0x%08x;\n", prefix, i, reg);
+       }
+
+       printf("\n");
+
+       munmap(base, size);
+
+       return 0;
+}
+
 /*
  * Read DRAM parameters.
  */
@@ -638,6 +670,43 @@ sun6i_dram_regs_print(void)
        return 0;
 }
 
+/*
+ *
+ */
+static int
+sun8i_dram_regs_print(void)
+{
+       unsigned int clock;
+       int ret;
+
+       ret = sunxi_dram_clock_read(&clock);
+       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");
+       if (ret)
+               return ret;
+
+
+       ret = dram_register_range_print(SUN6I_IO_DRAMCTL_BASE,
+                                       SUN6I_IO_DRAMCTL_SIZE,
+                                       "DRAM CTL", "SDR_CTL");
+       if (ret)
+               return ret;
+
+       ret = dram_register_range_print(SUN6I_IO_DRAMPHY_BASE,
+                                       SUN6I_IO_DRAMPHY_SIZE,
+                                       "DRAM PHY", "SDR_PHY");
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
 static void
 print_usage(const char *name)
 {
@@ -702,6 +771,8 @@ main(int argc, char *argv[])
                return sun4i_dram_para_print(uboot);
        case SUNXI_SOC_SUN6I:
                return sun6i_dram_regs_print();
+       case SUNXI_SOC_SUN8I:
+               return sun8i_dram_regs_print();
        default:
                fprintf(stderr, "Error: unknown or unhandled Soc: 0x%04X\n",
                        soc_version);
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to