ddr: fix dmc_monitor register bit missmatch on G12A/G12B [1/1]
authortao zeng <tao.zeng@amlogic.com>
Wed, 21 Nov 2018 01:13:48 +0000 (09:13 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 21 Nov 2018 03:21:38 +0000 (19:21 -0800)
PD#172256

Problem:
On G12A/G12B, bit for ddr0 protection 0 vilation is not same

Solution:
Fix bit missmatch problem

Verify:
U212

Change-Id: I5dca14c8bc96bdcb85dbe8bbd5a9a18157834bcf
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
drivers/amlogic/ddr_tool/dmc_g12.c
drivers/amlogic/ddr_tool/dmc_monitor.c

index e5097a5..9afc61e 100644 (file)
@@ -83,10 +83,17 @@ static void check_violation(struct dmc_monitor *mon)
        struct page *page;
        unsigned long *p;
        char id_str[4];
+       char off1 = 21, off2 = 10;
+
+       if (mon->chip == MESON_CPU_MAJOR_ID_G12B) {
+               /* bit fix for G12B */
+               off1 = 24;
+               off2 = 13;
+       }
 
        for (i = 1; i < 4; i += 2) {
                status = dmc_rw(DMC_VIO_ADDR0 + (i << 2), 0, DMC_READ);
-               if (!(status & DMC_VIO_PROT_RANGE0))
+               if (!(status & (1 << off1)))
                        continue;
                addr = dmc_rw(DMC_VIO_ADDR0 + ((i - 1) << 2), 0,
                              DMC_READ);
@@ -100,7 +107,7 @@ static void check_violation(struct dmc_monitor *mon)
                        continue;
                }
 
-               port = (status >> 13) & 0x1f;
+               port = (status >> off2) & 0x1f;
                subport = (status >> 6) & 0xf;
                pr_info(DMC_TAG", addr:%08lx, s:%08lx, ID:%s, sub:%s, c:%ld\n",
                        addr, status, to_ports(port),
index 58c9400..17086aa 100644 (file)
@@ -66,7 +66,7 @@ static int dev_name_to_id(const char *dev_name)
        }
        if (i >= dmc_mon->port_num)
                return -1;
-       return i;
+       return dmc_mon->port[i].port_id;
 }
 
 char *to_ports(int id)