ddr: altera: Fix DRAM end value in protection rule
authorMarek Vasut <marex@denx.de>
Mon, 4 Apr 2016 15:52:21 +0000 (17:52 +0200)
committerMarek Vasut <marex@denx.de>
Wed, 20 Apr 2016 09:28:44 +0000 (11:28 +0200)
The hi address bitfield in the protection rule must be set to
the last address in the region which the rule represents. The
behavior is now in-line with code generated by Quartus 15.1 .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Chin Liang See <clsee@altera.com>
drivers/ddr/altera/sdram.c

index 299694217279b1cc9aa51ec3947f7e3c10867ae9..7e4606de28aae01e29c7097fa7123afc8fd09cec 100644 (file)
@@ -118,7 +118,7 @@ static void sdram_set_rule(struct sdram_prot_rule *prule)
 
        /* Obtain the address bits */
        lo_addr_bits = prule->sdram_start >> 20ULL;
-       hi_addr_bits = prule->sdram_end >> 20ULL;
+       hi_addr_bits = (prule->sdram_end - 1) >> 20ULL;
 
        debug("sdram set rule start %x, %d\n", lo_addr_bits,
              prule->sdram_start);