1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-30 23:11:32 +02:00
Files
u-boot-megous/arch/arm/mach-aspeed/ast2600/board_common.c
Tom Rini d678a59d2d Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d, reversing
changes made to 2ee6f3a5f7.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19 08:16:36 -06:00

107 lines
2.2 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) Aspeed Technology Inc.
*/
#include <common.h>
#include <dm.h>
#include <ram.h>
#include <timer.h>
#include <asm/io.h>
#include <asm/arch/timer.h>
#include <linux/bitops.h>
#include <linux/err.h>
#include <dm/uclass.h>
#include <asm/arch/scu_ast2600.h>
#include <asm/global_data.h>
DECLARE_GLOBAL_DATA_PTR;
/* Memory Control registers */
#define MCR_BASE 0x1e6e0000
#define MCR_CONF (MCR_BASE + 0x004)
/* bit fields of MCR_CONF */
#define MCR_CONF_ECC_EN BIT(7)
#define MCR_CONF_VGA_MEMSZ_MASK GENMASK(3, 2)
#define MCR_CONF_VGA_MEMSZ_SHIFT 2
#define MCR_CONF_MEMSZ_MASK GENMASK(1, 0)
#define MCR_CONF_MEMSZ_SHIFT 0
int dram_init(void)
{
int ret;
struct udevice *dev;
struct ram_info ram;
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
if (ret) {
debug("cannot get DRAM driver\n");
return ret;
}
ret = ram_get_info(dev, &ram);
if (ret) {
debug("cannot get DRAM information\n");
return ret;
}
gd->ram_size = ram.size;
return 0;
}
int board_init(void)
{
int i = 0, rc;
struct udevice *dev;
gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
while (1) {
rc = uclass_get_device(UCLASS_MISC, i++, &dev);
if (rc)
break;
}
return 0;
}
void board_add_ram_info(int use_default)
{
int rc;
uint32_t conf;
uint32_t ecc, act_size, vga_rsvd;
struct udevice *scu_dev;
struct ast2600_scu *scu;
rc = uclass_get_device_by_driver(UCLASS_CLK,
DM_DRIVER_GET(aspeed_ast2600_scu), &scu_dev);
if (rc) {
debug("%s: cannot find SCU device, rc=%d\n", __func__, rc);
return;
}
scu = devfdt_get_addr_ptr(scu_dev);
if (IS_ERR_OR_NULL(scu)) {
debug("%s: cannot get SCU address pointer\n", __func__);
return;
}
conf = readl(MCR_CONF);
ecc = conf & MCR_CONF_ECC_EN;
act_size = 0x100 << ((conf & MCR_CONF_MEMSZ_MASK) >> MCR_CONF_MEMSZ_SHIFT);
vga_rsvd = 0x8 << ((conf & MCR_CONF_VGA_MEMSZ_MASK) >> MCR_CONF_VGA_MEMSZ_SHIFT);
/* no VGA reservation if efuse VGA disable bit is set */
if (readl(scu->efuse) & SCU_EFUSE_DIS_VGA)
vga_rsvd = 0;
printf(" (capacity:%d MiB, VGA:%d MiB), ECC %s", act_size,
vga_rsvd, (ecc) ? "on" : "off");
}
void enable_caches(void)
{
/* get rid of the warning message */
}