bmips: ram: add an option to force the size of the ram
authorPhilippe Reynes <philippe.reynes@softathome.com>
Mon, 16 Jul 2018 17:06:13 +0000 (19:06 +0200)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Wed, 8 Aug 2018 11:34:27 +0000 (13:34 +0200)
This adds an option to force the size of the ram, and
avoid the detection of ram size.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
drivers/ram/bmips_ram.c

index cc37dfa08c14d3806f769629efbcb0b4c1d8f772..b5f19c983c80726ca0e767442a4ada19cc6abc44 100644 (file)
@@ -43,6 +43,7 @@ struct bmips_ram_hw {
 
 struct bmips_ram_priv {
        void __iomem *regs;
+       u32 force_size;
        const struct bmips_ram_hw *hw;
 };
 
@@ -104,7 +105,10 @@ static int bmips_ram_get_info(struct udevice *dev, struct ram_info *info)
        const struct bmips_ram_hw *hw = priv->hw;
 
        info->base = 0x80000000;
-       info->size = hw->get_ram_size(priv);
+       if (priv->force_size)
+               info->size = priv->force_size;
+       else
+               info->size = hw->get_ram_size(priv);
 
        return 0;
 }
@@ -155,6 +159,8 @@ static int bmips_ram_probe(struct udevice *dev)
        if (!priv->regs)
                return -EINVAL;
 
+       dev_read_u32(dev, "force-size", &priv->force_size);
+
        priv->hw = hw;
 
        return 0;