select SPL_OF_CONTROL if SPL
select SPL_SIMPLE_BUS if SPL
select SUPPORT_SPL
+ select TRANSLATION_OFFSET
config ARMADA_64BIT
bool
*/
#endif
+ /*
+ * Use special translation offset for SPL. This needs to be
+ * configured *before* spl_init() is called as this function
+ * calls dm_init() which calls the bind functions of the
+ * device drivers. Here the base address needs to be configured
+ * (translated) correctly.
+ */
+ gd->translation_offset = 0xd0000000 - 0xf1000000;
+
ret = spl_init();
if (ret) {
debug("spl_init() failed: %d\n", ret);
hang();
}
- /* Use special translation offset for SPL */
- dm_set_translation_offset(0xd0000000 - 0xf1000000);
-
preloader_console_init();
timer_init();
used for the address translation. This function is faster and
smaller in size than fdt_translate_address().
+config TRANSLATION_OFFSET
+ bool "Platforms specific translation offset"
+ depends on DM && OF_CONTROL
+ help
+ Some platforms need a special address translation. Those
+ platforms (e.g. mvebu in SPL) can configure a translation
+ offset by enabling this option and setting the translation_offset
+ variable in the GD in their platform- / board-specific code.
+
config OF_ISA_BUS
bool
depends on OF_TRANSLATE
}
}
+#if defined(CONFIG_TRANSLATION_OFFSET)
/*
* Some platforms need a special address translation. Those
* platforms (e.g. mvebu in SPL) can configure a translation
- * offset in the DM by calling dm_set_translation_offset() that
- * will get added to all addresses returned by devfdt_get_addr().
+ * offset by setting this value in the GD and enaling this
+ * feature via CONFIG_TRANSLATION_OFFSET. This value will
+ * get added to all addresses returned by devfdt_get_addr().
*/
- addr += dm_get_translation_offset();
+ addr += gd->translation_offset;
+#endif
return addr;
#else
DECLARE_GLOBAL_DATA_PTR;
-struct root_priv {
- fdt_addr_t translation_offset; /* optional translation offset */
-};
-
static const struct driver_info root_info = {
.name = "root_driver",
};
}
}
-fdt_addr_t dm_get_translation_offset(void)
-{
- struct udevice *root = dm_root();
- struct root_priv *priv = dev_get_priv(root);
-
- return priv->translation_offset;
-}
-
-void dm_set_translation_offset(fdt_addr_t offs)
-{
- struct udevice *root = dm_root();
- struct root_priv *priv = dev_get_priv(root);
-
- priv->translation_offset = offs;
-}
-
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
void fix_drivers(void)
{
U_BOOT_DRIVER(root_driver) = {
.name = "root_driver",
.id = UCLASS_ROOT,
- .priv_auto_alloc_size = sizeof(struct root_priv),
};
/* This is the root uclass */
*/
#ifndef __ASSEMBLY__
+#include <fdtdec.h>
#include <membuff.h>
#include <linux/list.h>
struct spl_handoff *spl_handoff;
# endif
#endif
+#if defined(CONFIG_TRANSLATION_OFFSET)
+ fdt_addr_t translation_offset; /* optional translation offset */
+#endif
} gd_t;
#endif
*/
fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name);
-/**
- * dm_set_translation_offset() - Set translation offset
- * @offs: Translation offset
- *
- * Some platforms need a special address translation. Those
- * platforms (e.g. mvebu in SPL) can configure a translation
- * offset in the DM by calling this function. It will be
- * added to all addresses returned in devfdt_get_addr().
- */
-void dm_set_translation_offset(fdt_addr_t offs);
-
-/**
- * dm_get_translation_offset() - Get translation offset
- *
- * This function returns the translation offset that can
- * be configured by calling dm_set_translation_offset().
- *
- * @return translation offset for the device address (0 as default).
- */
-fdt_addr_t dm_get_translation_offset(void);
-
#endif