blob: 174c6f5c4456aea62e191392ec60261571d65182 [file] [log] [blame]
Tom Rinidec7ea02024-05-20 13:35:03 -06001// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * (C) Copyright 2024 - Analog Devices, Inc.
4 *
5 * Written and/or maintained by Timesys Corporation
6 *
7 * Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
8 * Contact: Greg Malysa <greg.malysa@timesys.com>
9 */
10
11#include <asm/io.h>
12#include <asm/arch-adi/sc5xx/sc5xx.h>
13#include <asm/arch-adi/sc5xx/spl.h>
14
15#define REG_SPU0_SECUREC0 0x3108B980
16#define REG_PADS0_PCFG0 0x31004604
17#define REG_SPU0_SECUREP_START 0x3108BA00
18#define REG_SPU0_SECUREP_END 0x3108BD24
19
20#define REG_SCB5_SPI2_OSPI_REMAP 0x30400000
21#define BITM_SCB5_SPI2_OSPI_REMAP_REMAP 0x00000003
22#define ENUM_SCB5_SPI2_OSPI_REMAP_OSPI0 0x00000001
23
24adi_rom_boot_fn adi_rom_boot = (adi_rom_boot_fn)0x000000e9;
25
26void sc5xx_enable_rgmii(void)
27{
28 writel((readl(REG_PADS0_PCFG0) | 0xc), REG_PADS0_PCFG0);
29}
30
31void sc59x_remap_ospi(void)
32{
33 clrsetbits_le32(REG_SCB5_SPI2_OSPI_REMAP,
34 BITM_SCB5_SPI2_OSPI_REMAP_REMAP,
35 ENUM_SCB5_SPI2_OSPI_REMAP_OSPI0);
36}
37
38void sc5xx_soc_init(void)
39{
40 sc5xx_enable_ns_sharc_access(REG_SPU0_SECUREC0);
41 sc5xx_disable_spu0(REG_SPU0_SECUREP_START, REG_SPU0_SECUREP_END);
42 sc5xx_enable_pmu();
43}