mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-17 14:18:14 +01:00
Pull common board initialization code from V3M Eagle board into rcar-common/v3-common.c so it can be re-used by other V3M/V3H boards. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
47 lines
949 B
C
47 lines
949 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2017-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <clock_legacy.h>
|
|
#include <asm/io.h>
|
|
|
|
#define CPGWPR 0xE6150900
|
|
#define CPGWPCR 0xE6150904
|
|
|
|
/* PLL */
|
|
#define PLL0CR 0xE61500D8
|
|
#define PLL0_STC_MASK 0x7F000000
|
|
#define PLL0_STC_OFFSET 24
|
|
|
|
#define CLK2MHZ(clk) (clk / 1000 / 1000)
|
|
void s_init(void)
|
|
{
|
|
struct rcar_rwdt *rwdt = (struct rcar_rwdt *)RWDT_BASE;
|
|
struct rcar_swdt *swdt = (struct rcar_swdt *)SWDT_BASE;
|
|
u32 stc;
|
|
|
|
/* Watchdog init */
|
|
writel(0xA5A5A500, &rwdt->rwtcsra);
|
|
writel(0xA5A5A500, &swdt->swtcsra);
|
|
|
|
/* CPU frequency setting. Set to 0.8GHz */
|
|
stc = ((800 / CLK2MHZ(get_board_sys_clk())) - 1) << PLL0_STC_OFFSET;
|
|
clrsetbits_le32(PLL0CR, PLL0_STC_MASK, stc);
|
|
}
|
|
|
|
int board_early_init_f(void)
|
|
{
|
|
/* Unlock CPG access */
|
|
writel(0xA5A5FFFF, CPGWPR);
|
|
writel(0x5A5A0000, CPGWPCR);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int board_init(void)
|
|
{
|
|
return 0;
|
|
}
|