video: simple_panel: add boe,nv140fhmn49 display
[oweals/u-boot.git] / drivers / ram / bmips_ram.c
index 7a5dfac4ab50054e0b991fb8cb7d4f7ea0e7548e..8f953e79afd791a55a4f02a26184dbbda6678687 100644 (file)
@@ -1,16 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2017 Álvaro Fernández Rojas <noltari@gmail.com>
  *
  * Derived from linux/arch/mips/bcm63xx/cpu.c:
  *     Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
  *     Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
 #include <ram.h>
 #include <asm/io.h>
 
@@ -44,6 +44,7 @@ struct bmips_ram_hw {
 
 struct bmips_ram_priv {
        void __iomem *regs;
+       u32 force_size;
        const struct bmips_ram_hw *hw;
 };
 
@@ -105,7 +106,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;
 }
@@ -151,14 +155,13 @@ static int bmips_ram_probe(struct udevice *dev)
        struct bmips_ram_priv *priv = dev_get_priv(dev);
        const struct bmips_ram_hw *hw =
                (const struct bmips_ram_hw *)dev_get_driver_data(dev);
-       fdt_addr_t addr;
-       fdt_size_t size;
 
-       addr = devfdt_get_addr_size_index(dev, 0, &size);
-       if (addr == FDT_ADDR_T_NONE)
+       priv->regs = dev_remap_addr(dev);
+       if (!priv->regs)
                return -EINVAL;
 
-       priv->regs = ioremap(addr, size);
+       dev_read_u32(dev, "force-size", &priv->force_size);
+
        priv->hw = hw;
 
        return 0;
@@ -171,5 +174,4 @@ U_BOOT_DRIVER(bmips_ram) = {
        .probe = bmips_ram_probe,
        .priv_auto_alloc_size = sizeof(struct bmips_ram_priv),
        .ops = &bmips_ram_ops,
-       .flags = DM_FLAG_PRE_RELOC,
 };