Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
6ce30346
Unverified
Commit
6ce30346
authored
Feb 04, 2019
by
Antonio Niño Díaz
Committed by
GitHub
Feb 04, 2019
Browse files
Merge pull request #1783 from thloh85-intel/integration_v2
plat: intel: Add BL2 support for Stratix 10 SoC
parents
c57abde6
9d82ef26
Changes
26
Show whitespace changes
Inline
Side-by-side
maintainers.rst
View file @
6ce30346
...
@@ -93,6 +93,12 @@ HiSilicon Poplar platform port
...
@@ -93,6 +93,12 @@ HiSilicon Poplar platform port
:F: docs/plat/poplar.rst
:F: docs/plat/poplar.rst
:F: plat/hisilicon/poplar/
:F: plat/hisilicon/poplar/
Intel SocFPGA platform ports
----------------------------
:M: Tien Hock Loh <tien.hock.loh@intel.com>
:G: `thloh85-intel`
:F: plat/intel/soc
MediaTek platform ports
MediaTek platform ports
-----------------------
-----------------------
:M: Yidi Lin (林以廸) <yidi.lin@mediatek.com>
:M: Yidi Lin (林以廸) <yidi.lin@mediatek.com>
...
...
plat/intel/soc/stratix10/aarch64/plat_helpers.S
0 → 100644
View file @
6ce30346
/*
*
Copyright
(
c
)
2019
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
#include <arch.h>
#include <asm_macros.S>
#include <cpu_macros.S>
#include <platform_def.h>
.
globl
plat_secondary_cold_boot_setup
.
globl
platform_is_primary_cpu
.
globl
plat_is_my_cpu_primary
.
globl
plat_my_core_pos
.
globl
plat_crash_console_init
.
globl
plat_crash_console_putc
.
globl
plat_crash_console_flush
.
globl
platform_mem_init
.
globl
plat_get_my_entrypoint
.
globl
stratix10_sec_entry
.
globl
cpuid_release
/
*
-----------------------------------------------------
*
void
plat_secondary_cold_boot_setup
(
void
)
;
*
*
This
function
performs
any
platform
specific
actions
*
needed
for
a
secondary
cpu
after
a
cold
reset
e
.
g
*
mark
the
cpu
's presence, mechanism to place it in a
*
holding
pen
etc
.
*
-----------------------------------------------------
*/
func
plat_secondary_cold_boot_setup
/
*
Wait
until
the
it
gets
reset
signal
from
rstmgr
gets
populated
*/
poll_mailbox
:
wfi
adr
x0
,
stratix10_sec_entry
ldr
x1
,
[
x0
]
adr
x2
,
cpuid_release
ldr
x3
,
[
x2
]
mrs
x4
,
mpidr_el1
and
x4
,
x4
,
#
0xff
cmp
x3
,
x4
b.ne
poll_mailbox
br
x1
endfunc
plat_secondary_cold_boot_setup
func
platform_is_primary_cpu
and
x0
,
x0
,
#(
MPIDR_CLUSTER_MASK
|
MPIDR_CPU_MASK
)
cmp
x0
,
#
PLAT_PRIMARY_CPU
cset
x0
,
eq
ret
endfunc
platform_is_primary_cpu
func
plat_is_my_cpu_primary
mrs
x0
,
mpidr_el1
b
platform_is_primary_cpu
endfunc
plat_is_my_cpu_primary
func
plat_my_core_pos
mrs
x0
,
mpidr_el1
and
x1
,
x0
,
#
MPIDR_CPU_MASK
and
x0
,
x0
,
#
MPIDR_CLUSTER_MASK
add
x0
,
x1
,
x0
,
LSR
#
6
ret
endfunc
plat_my_core_pos
func
plat_get_my_entrypoint
adr
x1
,
stratix10_sec_entry
ldr
x0
,
[
x1
]
ret
endfunc
plat_get_my_entrypoint
/
*
---------------------------------------------
*
int
plat_crash_console_init
(
void
)
*
Function
to
initialize
the
crash
console
*
without
a
C
Runtime
to
print
crash
report
.
*
Clobber
list
:
x0
,
x1
,
x2
*
---------------------------------------------
*/
func
plat_crash_console_init
mov_imm
x0
,
PLAT_UART0_BASE
mov_imm
x1
,
PLAT_UART_CLOCK
mov_imm
x2
,
PLAT_BAUDRATE
b
console_16550_core_init
endfunc
plat_crash_console_init
/
*
---------------------------------------------
*
int
plat_crash_console_putc
(
void
)
*
Function
to
print
a
character
on
the
crash
*
console
without
a
C
Runtime
.
*
Clobber
list
:
x1
,
x2
*
---------------------------------------------
*/
func
plat_crash_console_putc
mov_imm
x1
,
PLAT_UART0_BASE
b
console_16550_core_putc
endfunc
plat_crash_console_putc
func
plat_crash_console_flush
mov_imm
x0
,
CRASH_CONSOLE_BASE
b
console_16550_core_flush
endfunc
plat_crash_console_flush
/
*
--------------------------------------------------------
*
void
platform_mem_init
(
void
)
;
*
*
Any
memory
init
,
relocation
to
be
done
before
the
*
platform
boots
.
Called
very
early
in
the
boot
process
.
*
--------------------------------------------------------
*/
func
platform_mem_init
mov
x0
,
#
0
ret
endfunc
platform_mem_init
.
data
.
align
3
stratix10_sec_entry
:
.
quad
0
cpuid_release
:
.
quad
0
plat/intel/soc/stratix10/aarch64/platform_common.c
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch_helpers.h>
#include <lib/xlat_tables/xlat_tables.h>
#include <lib/mmio.h>
#include <platform_def.h>
unsigned
int
plat_get_syscnt_freq2
(
void
)
{
return
PLAT_SYS_COUNTER_FREQ_IN_TICKS
;
}
unsigned
long
plat_get_ns_image_entrypoint
(
void
)
{
return
PLAT_NS_IMAGE_OFFSET
;
}
/******************************************************************************
* Gets SPSR for BL32 entry
*****************************************************************************/
uint32_t
plat_get_spsr_for_bl32_entry
(
void
)
{
/*
* The Secure Payload Dispatcher service is responsible for
* setting the SPSR prior to entry into the BL32 image.
*/
return
0
;
}
/******************************************************************************
* Gets SPSR for BL33 entry
*****************************************************************************/
uint32_t
plat_get_spsr_for_bl33_entry
(
void
)
{
unsigned
long
el_status
;
unsigned
int
mode
;
uint32_t
spsr
;
/* Figure out what mode we enter the non-secure world in */
el_status
=
read_id_aa64pfr0_el1
()
>>
ID_AA64PFR0_EL2_SHIFT
;
el_status
&=
ID_AA64PFR0_ELX_MASK
;
mode
=
(
el_status
)
?
MODE_EL2
:
MODE_EL1
;
/*
* TODO: Consider the possibility of specifying the SPSR in
* the FIP ToC and allowing the platform to have a say as
* well.
*/
spsr
=
SPSR_64
(
mode
,
MODE_SP_ELX
,
DISABLE_ALL_EXCEPTIONS
);
return
spsr
;
}
plat/intel/soc/stratix10/aarch64/stratix10_private.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __S10_PRIVATE_H__
#define __S10_PRIVATE_H__
#define S10_MMC_REG_BASE 0xff808000
#define EMMC_DESC_SIZE (1<<20)
#define EMMC_INIT_PARAMS(base) \
{ .bus_width = MMC_BUS_WIDTH_4, \
.clk_rate = 50000000, \
.desc_base = (base), \
.desc_size = EMMC_DESC_SIZE, \
.flags = 0, \
.reg_base = S10_MMC_REG_BASE, \
\
}
typedef
enum
{
BOOT_SOURCE_FPGA
=
0
,
BOOT_SOURCE_SDMMC
,
BOOT_SOURCE_NAND
,
BOOT_SOURCE_RSVD
,
BOOT_SOURCE_QSPI
,
}
boot_source_type
;
void
enable_nonsecure_access
(
void
);
void
stratix10_io_setup
(
void
);
#endif
plat/intel/soc/stratix10/bl2_plat_mem_params_desc.c
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <common/bl_common.h>
#include <common/desc_image_load.h>
#include <platform_def.h>
#include <plat/common/platform.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
* by BL2 to load the images and also subset of this information is
* passed to next BL image. The image loading sequence is managed by
* populating the images in required loading order. The image execution
* sequence is managed by populating the `next_handoff_image_id` with
* the next executable image id.
******************************************************************************/
static
bl_mem_params_node_t
bl2_mem_params_descs
[]
=
{
#ifdef SCP_BL2_BASE
/* Fill SCP_BL2 related information if it exists */
{
.
image_id
=
SCP_BL2_IMAGE_ID
,
SET_STATIC_PARAM_HEAD
(
ep_info
,
PARAM_IMAGE_BINARY
,
VERSION_2
,
entry_point_info_t
,
SECURE
|
NON_EXECUTABLE
),
SET_STATIC_PARAM_HEAD
(
image_info
,
PARAM_IMAGE_BINARY
,
VERSION_2
,
image_info_t
,
0
),
.
image_info
.
image_base
=
SCP_BL2_BASE
,
.
image_info
.
image_max_size
=
SCP_BL2_SIZE
,
.
next_handoff_image_id
=
INVALID_IMAGE_ID
,
},
#endif
/* SCP_BL2_BASE */
#ifdef EL3_PAYLOAD_BASE
/* Fill EL3 payload related information (BL31 is EL3 payload)*/
{
.
image_id
=
BL31_IMAGE_ID
,
SET_STATIC_PARAM_HEAD
(
ep_info
,
PARAM_EP
,
VERSION_2
,
entry_point_info_t
,
SECURE
|
EXECUTABLE
|
EP_FIRST_EXE
),
.
ep_info
.
pc
=
EL3_PAYLOAD_BASE
,
.
ep_info
.
spsr
=
SPSR_64
(
MODE_EL3
,
MODE_SP_ELX
,
DISABLE_ALL_EXCEPTIONS
),
SET_STATIC_PARAM_HEAD
(
image_info
,
PARAM_EP
,
VERSION_2
,
image_info_t
,
IMAGE_ATTRIB_PLAT_SETUP
|
IMAGE_ATTRIB_SKIP_LOADING
),
.
next_handoff_image_id
=
INVALID_IMAGE_ID
,
},
#else
/* EL3_PAYLOAD_BASE */
/* Fill BL31 related information */
{
.
image_id
=
BL31_IMAGE_ID
,
SET_STATIC_PARAM_HEAD
(
ep_info
,
PARAM_EP
,
VERSION_2
,
entry_point_info_t
,
SECURE
|
EXECUTABLE
|
EP_FIRST_EXE
),
.
ep_info
.
pc
=
BL31_BASE
,
.
ep_info
.
spsr
=
SPSR_64
(
MODE_EL3
,
MODE_SP_ELX
,
DISABLE_ALL_EXCEPTIONS
),
SET_STATIC_PARAM_HEAD
(
image_info
,
PARAM_EP
,
VERSION_2
,
image_info_t
,
IMAGE_ATTRIB_PLAT_SETUP
),
.
image_info
.
image_base
=
BL31_BASE
,
.
image_info
.
image_max_size
=
BL31_LIMIT
-
BL31_BASE
,
.
next_handoff_image_id
=
BL33_IMAGE_ID
,
},
#endif
/* EL3_PAYLOAD_BASE */
{
.
image_id
=
BL33_IMAGE_ID
,
SET_STATIC_PARAM_HEAD
(
ep_info
,
PARAM_EP
,
VERSION_2
,
entry_point_info_t
,
NON_SECURE
|
EXECUTABLE
),
.
ep_info
.
pc
=
PLAT_NS_IMAGE_OFFSET
,
SET_STATIC_PARAM_HEAD
(
image_info
,
PARAM_EP
,
VERSION_2
,
image_info_t
,
0
),
.
image_info
.
image_base
=
PLAT_NS_IMAGE_OFFSET
,
.
image_info
.
image_max_size
=
0x0
+
0x40000000
-
PLAT_NS_IMAGE_OFFSET
,
.
next_handoff_image_id
=
INVALID_IMAGE_ID
,
},
};
REGISTER_BL_IMAGE_DESCS
(
bl2_mem_params_descs
)
plat/intel/soc/stratix10/bl2_plat_setup.c
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <arch_helpers.h>
#include <drivers/arm/gicv2.h>
#include <drivers/generic_delay_timer.h>
#include <drivers/console.h>
#include <drivers/ti/uart/uart_16550.h>
#include <common/bl_common.h>
#include <common/debug.h>
#include <common/desc_image_load.h>
#include <errno.h>
#include <drivers/io/io_storage.h>
#include <common/image_decompress.h>
#include <plat/common/platform.h>
#include <platform_def.h>
#include <platform_private.h>
#include <drivers/synopsys/dw_mmc.h>
#include <lib/mmio.h>
#include <lib/xlat_tables/xlat_tables.h>
#include "s10_memory_controller.h"
#include "s10_reset_manager.h"
#include "s10_clock_manager.h"
#include "s10_handoff.h"
#include "s10_pinmux.h"
#include "aarch64/stratix10_private.h"
const
mmap_region_t
plat_stratix10_mmap
[]
=
{
MAP_REGION_FLAT
(
DRAM_BASE
,
DRAM_SIZE
,
MT_MEMORY
|
MT_RW
|
MT_NS
),
MAP_REGION_FLAT
(
DEVICE1_BASE
,
DEVICE1_SIZE
,
MT_DEVICE
|
MT_RW
|
MT_NS
),
MAP_REGION_FLAT
(
DEVICE2_BASE
,
DEVICE2_SIZE
,
MT_DEVICE
|
MT_RW
|
MT_NS
),
MAP_REGION_FLAT
(
OCRAM_BASE
,
OCRAM_SIZE
,
MT_NON_CACHEABLE
|
MT_RW
|
MT_SECURE
),
MAP_REGION_FLAT
(
DEVICE3_BASE
,
DEVICE3_SIZE
,
MT_DEVICE
|
MT_RW
|
MT_SECURE
),
MAP_REGION_FLAT
(
MEM64_BASE
,
MEM64_SIZE
,
MT_DEVICE
|
MT_RW
|
MT_NS
),
MAP_REGION_FLAT
(
DEVICE4_BASE
,
DEVICE4_SIZE
,
MT_DEVICE
|
MT_RW
|
MT_NS
),
{
0
},
};
boot_source_type
boot_source
;
void
bl2_el3_early_platform_setup
(
u_register_t
x0
,
u_register_t
x1
,
u_register_t
x2
,
u_register_t
x4
)
{
static
console_16550_t
console
;
handoff
reverse_handoff_ptr
;
generic_delay_timer_init
();
if
(
s10_get_handoff
(
&
reverse_handoff_ptr
))
return
;
config_pinmux
(
&
reverse_handoff_ptr
);
boot_source
=
reverse_handoff_ptr
.
boot_source
;
config_clkmgr_handoff
(
&
reverse_handoff_ptr
);
enable_nonsecure_access
();
deassert_peripheral_reset
();
config_hps_hs_before_warm_reset
();
console_16550_register
(
PLAT_UART0_BASE
,
PLAT_UART_CLOCK
,
PLAT_BAUDRATE
,
&
console
);
plat_delay_timer_init
();
init_hard_memory_controller
();
}
void
bl2_el3_plat_arch_setup
(
void
)
{
struct
mmc_device_info
info
;
const
mmap_region_t
bl_regions
[]
=
{
MAP_REGION_FLAT
(
BL2_BASE
,
BL2_END
-
BL2_BASE
,
MT_MEMORY
|
MT_RW
|
MT_SECURE
),
MAP_REGION_FLAT
(
BL_CODE_BASE
,
BL_CODE_END
-
BL_CODE_BASE
,
MT_CODE
|
MT_SECURE
),
MAP_REGION_FLAT
(
BL_RO_DATA_BASE
,
BL_RO_DATA_END
-
BL_RO_DATA_BASE
,
MT_RO_DATA
|
MT_SECURE
),
#if USE_COHERENT_MEM_BAR
MAP_REGION_FLAT
(
BL_COHERENT_RAM_BASE
,
BL_COHERENT_RAM_END
-
BL_COHERENT_RAM_BASE
,
MT_DEVICE
|
MT_RW
|
MT_SECURE
),
#endif
{
0
},
};
setup_page_tables
(
bl_regions
,
plat_stratix10_mmap
);
enable_mmu_el3
(
0
);
/* ECC Scrubbing */
memset
(
0
,
DRAM_BASE
,
DRAM_SIZE
);
dw_mmc_params_t
params
=
EMMC_INIT_PARAMS
(
0x100000
);
info
.
mmc_dev_type
=
MMC_IS_SD
;
switch
(
boot_source
)
{
case
BOOT_SOURCE_SDMMC
:
dw_mmc_init
(
&
params
,
&
info
);
stratix10_io_setup
();
break
;
default:
ERROR
(
"Unsupported boot source
\n
"
);
panic
();
break
;
}
}
uint32_t
get_spsr_for_bl33_entry
(
void
)
{
unsigned
long
el_status
;
unsigned
int
mode
;
uint32_t
spsr
;
/* Figure out what mode we enter the non-secure world in */
el_status
=
read_id_aa64pfr0_el1
()
>>
ID_AA64PFR0_EL2_SHIFT
;
el_status
&=
ID_AA64PFR0_ELX_MASK
;
mode
=
(
el_status
)
?
MODE_EL2
:
MODE_EL1
;
/*
* TODO: Consider the possibility of specifying the SPSR in
* the FIP ToC and allowing the platform to have a say as
* well.
*/
spsr
=
SPSR_64
(
mode
,
MODE_SP_ELX
,
DISABLE_ALL_EXCEPTIONS
);
return
spsr
;
}
int
bl2_plat_handle_post_image_load
(
unsigned
int
image_id
)
{
bl_mem_params_node_t
*
bl_mem_params
=
get_bl_mem_params_node
(
image_id
);
switch
(
image_id
)
{
case
BL33_IMAGE_ID
:
bl_mem_params
->
ep_info
.
args
.
arg0
=
0xffff
&
read_mpidr
();
bl_mem_params
->
ep_info
.
spsr
=
get_spsr_for_bl33_entry
();
break
;
default:
break
;
}
return
0
;
}
/*******************************************************************************
* Perform any BL3-1 platform setup code
******************************************************************************/
void
bl2_platform_setup
(
void
)
{
}
plat/intel/soc/stratix10/include/plat_macros.S
0 → 100644
View file @
6ce30346
/*
*
Copyright
(
c
)
2019
,
Intel
Corporation
.
All
rights
reserved
.
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
#ifndef __PLAT_MACROS_S__
#define __PLAT_MACROS_S__
#include <platform_def.h>
/
*
---------------------------------------------
*
The
below
required
platform
porting
macro
*
prints
out
relevant
platform
registers
*
whenever
an
unhandled
exception
is
taken
in
*
BL31
.
*
---------------------------------------------
*/
.
macro
plat_crash_print_regs
mov_imm
x17
,
PLAT_GICC_BASE
mov_imm
x16
,
PLAT_GICD_BASE
arm_print_gic_regs
.
endm
#endif /* __PLAT_MACROS_S__ */
plat/intel/soc/stratix10/include/platform_private.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __PLATFORM_PRIVATE_H__
#define __PLATFORM_PRIVATE_H__
#include <common/bl_common.h>
/*******************************************************************************
* Function and variable prototypes
******************************************************************************/
void
plat_configure_mmu_el3
(
unsigned
long
total_base
,
unsigned
long
total_size
,
unsigned
long
ro_start
,
unsigned
long
ro_limit
,
unsigned
long
coh_start
,
unsigned
long
coh_limit
);
void
plat_configure_mmu_el1
(
unsigned
long
total_base
,
unsigned
long
total_size
,
unsigned
long
ro_start
,
unsigned
long
ro_limit
,
unsigned
long
coh_start
,
unsigned
long
coh_limit
);
void
plat_gic_driver_init
(
void
);
void
plat_arm_gic_init
(
void
);
void
plat_delay_timer_init
(
void
);
unsigned
long
plat_get_ns_image_entrypoint
(
void
);
uint32_t
plat_get_spsr_for_bl32_entry
(
void
);
uint32_t
plat_get_spsr_for_bl33_entry
(
void
);
#endif
/* __PLATFORM_PRIVATE_H__ */
plat/intel/soc/stratix10/include/s10_clock_manager.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __CLOCKMANAGER_H__
#define __CLOCKMANAGER_H__
#include "s10_handoff.h"
#define ALT_CLKMGR 0xffd10000
#define ALT_CLKMGR_CTRL 0x0
#define ALT_CLKMGR_STAT 0x4
#define ALT_CLKMGR_INTRCLR 0x14
#define ALT_CLKMGR_INTRCLR_MAINLOCKLOST_SET_MSK 0x00000004
#define ALT_CLKMGR_INTRCLR_PERLOCKLOST_SET_MSK 0x00000008
#define ALT_CLKMGR_CTRL_BOOTMODE_SET_MSK 0x00000001
#define ALT_CLKMGR_STAT_BUSY_E_BUSY 0x1
#define ALT_CLKMGR_STAT_BUSY(x) (((x) & 0x00000001) >> 0)
#define ALT_CLKMGR_STAT_MAINPLLLOCKED(x) (((x) & 0x00000100) >> 8)
#define ALT_CLKMGR_STAT_PERPLLLOCKED(x) (((x) & 0x00000200) >> 9)
#define ALT_CLKMGR_MAINPLL 0xffd10030
#define ALT_CLKMGR_MAINPLL_EN 0x0
#define ALT_CLKMGR_MAINPLL_BYPASS 0xc
#define ALT_CLKMGR_MAINPLL_MPUCLK 0x18
#define ALT_CLKMGR_MAINPLL_NOCCLK 0x1c
#define ALT_CLKMGR_MAINPLL_CNTR2CLK 0x20
#define ALT_CLKMGR_MAINPLL_CNTR3CLK 0x24
#define ALT_CLKMGR_MAINPLL_CNTR4CLK 0x28
#define ALT_CLKMGR_MAINPLL_CNTR5CLK 0x2c
#define ALT_CLKMGR_MAINPLL_CNTR6CLK 0x30
#define ALT_CLKMGR_MAINPLL_CNTR7CLK 0x34
#define ALT_CLKMGR_MAINPLL_CNTR8CLK 0x38
#define ALT_CLKMGR_MAINPLL_CNTR9CLK 0x3c
#define ALT_CLKMGR_MAINPLL_NOCDIV 0x40
#define ALT_CLKMGR_MAINPLL_PLLGLOB 0x44
#define ALT_CLKMGR_MAINPLL_FDBCK 0x48
#define ALT_CLKMGR_MAINPLL_PLLC0 0x54
#define ALT_CLKMGR_MAINPLL_PLLC1 0x58
#define ALT_CLKMGR_MAINPLL_VCOCALIB 0x5c
#define ALT_CLKMGR_MAINPLL_EN_RESET 0x000000ff
#define ALT_CLKMGR_MAINPLL_FDBCK_MDIV(x) (((x) & 0xff000000) >> 24)
#define ALT_CLKMGR_MAINPLL_PLLGLOB_PD_SET_MSK 0x00000001
#define ALT_CLKMGR_MAINPLL_PLLGLOB_REFCLKDIV(x) (((x) & 0x00003f00) >> 8)
#define ALT_CLKMGR_MAINPLL_PLLGLOB_RST_SET_MSK 0x00000002
#define ALT_CLKMGR_MAINPLL_VCOCALIB_HSCNT_SET(x) (((x) << 0) & 0x000000ff)
#define ALT_CLKMGR_MAINPLL_VCOCALIB_MSCNT_SET(x) (((x) << 9) & 0x0001fe00)
#define ALT_CLKMGR_PERPLL 0xffd100a4
#define ALT_CLKMGR_PERPLL_EN 0x0
#define ALT_CLKMGR_PERPLL_BYPASS 0xc
#define ALT_CLKMGR_PERPLL_CNTR2CLK 0x18
#define ALT_CLKMGR_PERPLL_CNTR3CLK 0x1c
#define ALT_CLKMGR_PERPLL_CNTR4CLK 0x20
#define ALT_CLKMGR_PERPLL_CNTR5CLK 0x24
#define ALT_CLKMGR_PERPLL_CNTR6CLK 0x28
#define ALT_CLKMGR_PERPLL_CNTR7CLK 0x2c
#define ALT_CLKMGR_PERPLL_CNTR8CLK 0x30
#define ALT_CLKMGR_PERPLL_CNTR9CLK 0x34
#define ALT_CLKMGR_PERPLL_GPIODIV 0x3c
#define ALT_CLKMGR_PERPLL_EMACCTL 0x38
#define ALT_CLKMGR_PERPLL_PLLGLOB 0x40
#define ALT_CLKMGR_PERPLL_FDBCK 0x44
#define ALT_CLKMGR_PERPLL_PLLC0 0x50
#define ALT_CLKMGR_PERPLL_PLLC1 0x54
#define ALT_CLKMGR_PERPLL_EN_RESET 0x00000fff
#define ALT_CLKMGR_PERPLL_FDBCK_MDIV(x) (((x) & 0xff000000) >> 24)
#define ALT_CLKMGR_PERPLL_GPIODIV_GPIODBCLK_SET(x) (((x) << 0) & 0x0000ffff)
#define ALT_CLKMGR_PERPLL_PLLGLOB_PD_SET_MSK 0x00000001
#define ALT_CLKMGR_PERPLL_PLLGLOB_REFCLKDIV(x) (((x) & 0x00003f00) >> 8)
#define ALT_CLKMGR_PERPLL_PLLGLOB_REFCLKDIV_SET(x) (((x) << 8) & 0x00003f00)
#define ALT_CLKMGR_PERPLL_PLLGLOB_RST_SET_MSK 0x00000002
#define ALT_CLKMGR_PERPLL_VCOCALIB_HSCNT_SET(x) (((x) << 0) & 0x000000ff)
#define ALT_CLKMGR_PERPLL_VCOCALIB_MSCNT_SET(x) (((x) << 9) & 0x0001fe00)
#define ALT_CLKMGR_PERPLL_VCOCALIB 0x58
void
config_clkmgr_handoff
(
handoff
*
hoff_ptr
);
#endif
plat/intel/soc/stratix10/include/s10_handoff.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _HANDOFF_H_
#define _HANDOFF_H_
#define HANDOFF_MAGIC_HEADER 0x424f4f54
/* BOOT */
#define HANDOFF_MAGIC_PINMUX_SEL 0x504d5558
/* PMUX */
#define HANDOFF_MAGIC_IOCTLR 0x494f4354
/* IOCT */
#define HANDOFF_MAGIC_FPGA 0x46504741
/* FPGA */
#define HANDOFF_MAGIC_IODELAY 0x444c4159
/* DLAY */
#define HANDOFF_MAGIC_CLOCK 0x434c4b53
/* CLKS */
#define HANDOFF_MAGIC_MISC 0x4d495343
/* MISC */
typedef
struct
handoff_t
{
/* header */
uint32_t
header_magic
;
uint32_t
header_device
;
uint32_t
_pad_0x08_0x10
[
2
];
/* pinmux configuration - select */
uint32_t
pinmux_sel_magic
;
uint32_t
pinmux_sel_length
;
uint32_t
_pad_0x18_0x20
[
2
];
uint32_t
pinmux_sel_array
[
96
];
/* offset, value */
/* pinmux configuration - io control */
uint32_t
pinmux_io_magic
;
uint32_t
pinmux_io_length
;
uint32_t
_pad_0x1a8_0x1b0
[
2
];
uint32_t
pinmux_io_array
[
96
];
/* offset, value */
/* pinmux configuration - use fpga switch */
uint32_t
pinmux_fpga_magic
;
uint32_t
pinmux_fpga_length
;
uint32_t
_pad_0x338_0x340
[
2
];
uint32_t
pinmux_fpga_array
[
42
];
/* offset, value */
uint32_t
_pad_0x3e8_0x3f0
[
2
];
/* pinmux configuration - io delay */
uint32_t
pinmux_delay_magic
;
uint32_t
pinmux_delay_length
;
uint32_t
_pad_0x3f8_0x400
[
2
];
uint32_t
pinmux_iodelay_array
[
96
];
/* offset, value */
/* clock configuration */
uint32_t
clock_magic
;
uint32_t
clock_length
;
uint32_t
_pad_0x588_0x590
[
2
];
uint32_t
main_pll_mpuclk
;
uint32_t
main_pll_nocclk
;
uint32_t
main_pll_cntr2clk
;
uint32_t
main_pll_cntr3clk
;
uint32_t
main_pll_cntr4clk
;
uint32_t
main_pll_cntr5clk
;
uint32_t
main_pll_cntr6clk
;
uint32_t
main_pll_cntr7clk
;
uint32_t
main_pll_cntr8clk
;
uint32_t
main_pll_cntr9clk
;
uint32_t
main_pll_nocdiv
;
uint32_t
main_pll_pllglob
;
uint32_t
main_pll_fdbck
;
uint32_t
main_pll_pllc0
;
uint32_t
main_pll_pllc1
;
uint32_t
_pad_0x5cc_0x5d0
[
1
];
uint32_t
per_pll_cntr2clk
;
uint32_t
per_pll_cntr3clk
;
uint32_t
per_pll_cntr4clk
;
uint32_t
per_pll_cntr5clk
;
uint32_t
per_pll_cntr6clk
;
uint32_t
per_pll_cntr7clk
;
uint32_t
per_pll_cntr8clk
;
uint32_t
per_pll_cntr9clk
;
uint32_t
per_pll_emacctl
;
uint32_t
per_pll_gpiodiv
;
uint32_t
per_pll_pllglob
;
uint32_t
per_pll_fdbck
;
uint32_t
per_pll_pllc0
;
uint32_t
per_pll_pllc1
;
uint32_t
hps_osc_clk_h
;
uint32_t
fpga_clk_hz
;
/* misc configuration */
uint32_t
misc_magic
;
uint32_t
misc_length
;
uint32_t
_pad_0x618_0x620
[
2
];
uint32_t
boot_source
;
}
handoff
;
int
verify_handoff_image
(
handoff
*
hoff_ptr
,
handoff
*
reverse_hoff_ptr
);
int
s10_get_handoff
(
handoff
*
hoff_ptr
);
#endif
plat/intel/soc/stratix10/include/s10_memory_controller.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __S10_MEMORYCONTROLLER_H__
#define __S10_MEMORYCONTROLLER_H__
#define S10_MPFE_IOHMC_REG_DRAMADDRW 0xf80100a8
#define S10_MPFE_IOHMC_CTRLCFG0 0xf8010028
#define S10_MPFE_IOHMC_CTRLCFG1 0xf801002c
#define S10_MPFE_IOHMC_DRAMADDRW 0xf80100a8
#define S10_MPFE_IOHMC_DRAMTIMING0 0xf8010050
#define S10_MPFE_IOHMC_CALTIMING0 0xf801007c
#define S10_MPFE_IOHMC_CALTIMING1 0xf8010080
#define S10_MPFE_IOHMC_CALTIMING2 0xf8010084
#define S10_MPFE_IOHMC_CALTIMING3 0xf8010088
#define S10_MPFE_IOHMC_CALTIMING4 0xf801008c
#define S10_MPFE_IOHMC_CALTIMING9 0xf80100a0
#define S10_MPFE_IOHMC_CALTIMING9_ACT_TO_ACT(x) (((x) & 0x000000ff) >> 0)
#define S10_MPFE_IOHMC_CTRLCFG1_CFG_ADDR_ORDER(value) \
(((value) & 0x00000060) >> 5)
#define S10_RSTMGR_BRGMODRST 0xffd1102c
#define S10_RSTMGR_BRGMODRST_DDRSCH 0x00000040
#define S10_MPFE_HMC_ADP_ECCCTRL1 0xf8011100
#define S10_MPFE_HMC_ADP_ECCCTRL2 0xf8011104
#define S10_MPFE_HMC_ADP_RSTHANDSHAKESTAT 0xf8011218
#define S10_MPFE_HMC_ADP_RSTHANDSHAKESTAT_SEQ2CORE 0x000000ff
#define S10_MPFE_HMC_ADP_RSTHANDSHAKECTRL 0xf8011214
#define S10_MPFE_IOHMC_REG_CTRLCFG1 0xf801002c
#define S10_MPFE_IOHMC_REG_NIOSRESERVE0_OFST 0xf8010110
#define IOHMC_DRAMADDRW_COL_ADDR_WIDTH(x) (((x) & 0x0000001f) >> 0)
#define IOHMC_DRAMADDRW_ROW_ADDR_WIDTH(x) (((x) & 0x000003e0) >> 5)
#define IOHMC_DRAMADDRW_CS_ADDR_WIDTH(x) (((x) & 0x00070000) >> 16)
#define IOHMC_DRAMADDRW_BANK_GRP_ADDR_WIDTH(x) (((x) & 0x0000c000) >> 14)
#define IOHMC_DRAMADDRW_BANK_ADDR_WIDTH(x) (((x) & 0x00003c00) >> 10)
#define S10_MPFE_DDR(x) (0xf8000000 + x)
#define S10_MPFE_HMC_ADP_DDRCALSTAT 0xf801100c
#define S10_MPFE_DDR_MAIN_SCHED 0xf8000400
#define S10_MPFE_DDR_MAIN_SCHED_DDRCONF 0xf8000408
#define S10_MPFE_DDR_MAIN_SCHED_DDRTIMING 0xf800040c
#define S10_MPFE_DDR_MAIN_SCHED_DDRCONF_SET_MSK 0x0000001f
#define S10_MPFE_DDR_MAIN_SCHED_DDRMODE 0xf8000410
#define S10_MPFE_DDR_MAIN_SCHED_DEVTODEV 0xf800043c
#define S10_MPFE_DDR_MAIN_SCHED_READLATENCY 0xf8000414
#define S10_MPFE_DDR_MAIN_SCHED_ACTIVATE 0xf8000438
#define S10_MPFE_DDR_MAIN_SCHED_ACTIVATE_FAWBANK_OFST 10
#define S10_MPFE_DDR_MAIN_SCHED_ACTIVATE_FAW_OFST 4
#define S10_MPFE_DDR_MAIN_SCHED_ACTIVATE_RRD_OFST 0
#define S10_MPFE_DDR_MAIN_SCHED_DDRCONF_SET(x) (((x) << 0) & 0x0000001f)
#define S10_MPFE_DDR_MAIN_SCHED_DEVTODEV_BUSRDTORD_OFST 0
#define S10_MPFE_DDR_MAIN_SCHED_DEVTODEV_BUSRDTOWR_OFST 2
#define S10_MPFE_DDR_MAIN_SCHED_DEVTODEV_BUSWRTORD_OFST 4
#define S10_MPFE_HMC_ADP(x) (0xf8011000 + (x))
#define S10_MPFE_HMC_ADP_HPSINTFCSEL 0xf8011210
#define S10_MPFE_HMC_ADP_DDRIOCTRL 0xf8011008
#define HMC_ADP_DDRIOCTRL 0x8
#define HMC_ADP_DDRIOCTRL_IO_SIZE(x) (((x) & 0x00000003) >> 0)
#define HMC_ADP_DDRIOCTRL_CTRL_BURST_LENGTH(x) (((x) & 0x00003e00) >> 9)
#define ADP_DRAMADDRWIDTH 0xe0
#define ACT_TO_ACT_DIFF_BANK(value) (((value) & 0x00fc0000) >> 18)
#define ACT_TO_ACT(value) (((value) & 0x0003f000) >> 12)
#define ACT_TO_RDWR(value) (((value) & 0x0000003f) >> 0)
#define ACT_TO_ACT(value) (((value) & 0x0003f000) >> 12)
/* timing 2 */
#define RD_TO_RD_DIFF_CHIP(value) (((value) & 0x00000fc0) >> 6)
#define RD_TO_WR_DIFF_CHIP(value) (((value) & 0x3f000000) >> 24)
#define RD_TO_WR(value) (((value) & 0x00fc0000) >> 18)
#define RD_TO_PCH(value) (((value) & 0x00000fc0) >> 6)
/* timing 3 */
#define CALTIMING3_WR_TO_RD_DIFF_CHIP(value) (((value) & 0x0003f000) >> 12)
#define CALTIMING3_WR_TO_RD(value) (((value) & 0x00000fc0) >> 6)
/* timing 4 */
#define PCH_TO_VALID(value) (((value) & 0x00000fc0) >> 6)
#define DDRTIMING_BWRATIO_OFST 31
#define DDRTIMING_WRTORD_OFST 26
#define DDRTIMING_RDTOWR_OFST 21
#define DDRTIMING_BURSTLEN_OFST 18
#define DDRTIMING_WRTOMISS_OFST 12
#define DDRTIMING_RDTOMISS_OFST 6
#define DDRTIMING_ACTTOACT_OFST 0
#define ADP_DDRIOCTRL_IO_SIZE(x) (((x) & 0x00000003) >> 0)
#define DDRMODE_AUTOPRECHARGE_OFST 1
#define DDRMODE_BWRATIOEXTENDED_OFST 0
#define S10_MPFE_IOHMC_REG_DRAMTIMING0_CFG_TCL(x) (((x) & 0x0000007f) >> 0)
#define S10_MPFE_IOHMC_REG_CTRLCFG0_CFG_MEM_TYPE(x) (((x) & 0x0000000f) >> 0)
#define S10_CCU_CPU0_MPRT_DDR 0xf7004400
#define S10_CCU_CPU0_MPRT_MEM0 0xf70045c0
#define S10_CCU_CPU0_MPRT_MEM1A 0xf70045e0
#define S10_CCU_CPU0_MPRT_MEM1B 0xf7004600
#define S10_CCU_CPU0_MPRT_MEM1C 0xf7004620
#define S10_CCU_CPU0_MPRT_MEM1D 0xf7004640
#define S10_CCU_CPU0_MPRT_MEM1E 0xf7004660
#define S10_CCU_IOM_MPRT_MEM0 0xf7018560
#define S10_CCU_IOM_MPRT_MEM1A 0xf7018580
#define S10_CCU_IOM_MPRT_MEM1B 0xf70185a0
#define S10_CCU_IOM_MPRT_MEM1C 0xf70185c0
#define S10_CCU_IOM_MPRT_MEM1D 0xf70185e0
#define S10_CCU_IOM_MPRT_MEM1E 0xf7018600
#define S10_NOC_FW_DDR_SCR 0xf8020100
#define S10_NOC_FW_DDR_SCR_MPUREGION0ADDR_LIMITEXT 0xf802011c
#define S10_NOC_FW_DDR_SCR_MPUREGION0ADDR_LIMIT 0xf8020118
#define S10_NOC_FW_DDR_SCR_NONMPUREGION0ADDR_LIMITEXT 0xf802019c
#define S10_NOC_FW_DDR_SCR_NONMPUREGION0ADDR_LIMIT 0xf8020198
#define S10_SOC_NOC_FW_DDR_SCR_ENABLE 0xf8020100
#define S10_CCU_NOC_DI_SET_MSK 0x10
#define S10_SYSMGR_CORE_HMC_CLK 0xffd120b4
#define S10_SYSMGR_CORE_HMC_CLK_STATUS 0x00000001
#define S10_MPFE_IOHMC_NIOSRESERVE0_NIOS_RESERVE0(x) (((x) & 0x0000ffff) >> 0)
#define S10_MPFE_HMC_ADP_DDRIOCTRL_IO_SIZE_MSK 0x00000003
#define S10_MPFE_HMC_ADP_DDRIOCTRL_IO_SIZE_OFST 0
#define S10_MPFE_HMC_ADP_HPSINTFCSEL_ENABLE 0x001f1f1f
#define S10_IOHMC_CTRLCFG1_ENABLE_ECC_OFST 7
#define S10_MPFE_HMC_ADP_ECCCTRL1_AUTOWB_CNT_RST_SET_MSK 0x00010000
#define S10_MPFE_HMC_ADP_ECCCTRL1_CNT_RST_SET_MSK 0x00000100
#define S10_MPFE_HMC_ADP_ECCCTRL1_ECC_EN_SET_MSK 0x00000001
#define S10_MPFE_HMC_ADP_ECCCTRL2_AUTOWB_EN_SET_MSK 0x00000001
#define S10_MPFE_HMC_ADP_ECCCTRL2_OVRW_RB_ECC_EN_SET_MSK 0x00010000
#define S10_MPFE_HMC_ADP_ECCCTRL2_RMW_EN_SET_MSK 0x00000100
#define S10_MPFE_HMC_ADP_DDRCALSTAT_CAL(value) (((value) & 0x00000001) >> 0)
#define S10_MPFE_HMC_ADP_DDRIOCTRL_IO_SIZE(x) (((x) & 0x00000003) >> 0)
#define IOHMC_DRAMADDRW_CFG_BANK_ADDR_WIDTH(x) (((x) & 0x00003c00) >> 10)
#define IOHMC_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH(x) (((x) & 0x0000c000) >> 14)
#define IOHMC_DRAMADDRW_CFG_COL_ADDR_WIDTH(x) (((x) & 0x0000001f) >> 0)
#define IOHMC_DRAMADDRW_CFG_CS_ADDR_WIDTH(x) (((x) & 0x00070000) >> 16)
#define IOHMC_DRAMADDRW_CFG_ROW_ADDR_WIDTH(x) (((x) & 0x000003e0) >> 5)
#define S10_SDRAM_0_LB_ADDR 0x0
int
init_hard_memory_controller
(
void
);
#endif
plat/intel/soc/stratix10/include/s10_noc.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#define AXI_AP (1<<0)
#define FPGA2SOC (1<<16)
#define MPU (1<<24)
#define S10_NOC_PER_SCR_NAND 0xffd21000
#define S10_NOC_PER_SCR_NAND_DATA 0xffd21004
#define S10_NOC_PER_SCR_USB0 0xffd2100c
#define S10_NOC_PER_SCR_USB1 0xffd21010
#define S10_NOC_PER_SCR_SPI_M0 0xffd2101c
#define S10_NOC_PER_SCR_SPI_M1 0xffd21020
#define S10_NOC_PER_SCR_SPI_S0 0xffd21024
#define S10_NOC_PER_SCR_SPI_S1 0xffd21028
#define S10_NOC_PER_SCR_EMAC0 0xffd2102c
#define S10_NOC_PER_SCR_EMAC1 0xffd21030
#define S10_NOC_PER_SCR_EMAC2 0xffd21034
#define S10_NOC_PER_SCR_SDMMC 0xffd21040
#define S10_NOC_PER_SCR_GPIO0 0xffd21044
#define S10_NOC_PER_SCR_GPIO1 0xffd21048
#define S10_NOC_PER_SCR_I2C0 0xffd21050
#define S10_NOC_PER_SCR_I2C1 0xffd21058
#define S10_NOC_PER_SCR_I2C2 0xffd2105c
#define S10_NOC_PER_SCR_I2C3 0xffd21060
#define S10_NOC_PER_SCR_SP_TIMER0 0xffd21064
#define S10_NOC_PER_SCR_SP_TIMER1 0xffd21068
#define S10_NOC_PER_SCR_UART0 0xffd2106c
#define S10_NOC_PER_SCR_UART1 0xffd21070
#define S10_NOC_SYS_SCR_DMA_ECC 0xffd21108
#define S10_NOC_SYS_SCR_EMAC0RX_ECC 0xffd2110c
#define S10_NOC_SYS_SCR_EMAC0TX_ECC 0xffd21110
#define S10_NOC_SYS_SCR_EMAC1RX_ECC 0xffd21114
#define S10_NOC_SYS_SCR_EMAC1TX_ECC 0xffd21118
#define S10_NOC_SYS_SCR_EMAC2RX_ECC 0xffd2111c
#define S10_NOC_SYS_SCR_EMAC2TX_ECC 0xffd21120
#define S10_NOC_SYS_SCR_NAND_ECC 0xffd2112c
#define S10_NOC_SYS_SCR_NAND_READ_ECC 0xffd21130
#define S10_NOC_SYS_SCR_NAND_WRITE_ECC 0xffd21134
#define S10_NOC_SYS_SCR_OCRAM_ECC 0xffd21138
#define S10_NOC_SYS_SCR_SDMMC_ECC 0xffd21140
#define S10_NOC_SYS_SCR_USB0_ECC 0xffd21144
#define S10_NOC_SYS_SCR_USB1_ECC 0xffd21148
#define S10_NOC_SYS_SCR_CLK_MGR 0xffd2114c
#define S10_NOC_SYS_SCR_IO_MGR 0xffd21154
#define S10_NOC_SYS_SCR_RST_MGR 0xffd21158
#define S10_NOC_SYS_SCR_SYS_MGR 0xffd2115c
#define S10_NOC_SYS_SCR_OSC0_TIMER 0xffd21160
#define S10_NOC_SYS_SCR_OSC1_TIMER 0xffd21164
#define S10_NOC_SYS_SCR_WATCHDOG0 0xffd21168
#define S10_NOC_SYS_SCR_WATCHDOG1 0xffd2116c
#define S10_NOC_SYS_SCR_WATCHDOG2 0xffd21170
#define S10_NOC_SYS_SCR_WATCHDOG3 0xffd21174
#define S10_NOC_SYS_SCR_DAP 0xffd21178
#define S10_NOC_SYS_SCR_L4_NOC_PROBES 0xffd21190
#define S10_NOC_SYS_SCR_L4_NOC_QOS 0xffd21194
#define S10_CCU_NOC_BRIDGE_CPU0_RAM 0xf7004688
#define S10_CCU_NOC_BRIDGE_IOM_RAM 0xf7004688
plat/intel/soc/stratix10/include/s10_pinmux.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __S10_PINMUX_H__
#define __S10_PINMUX_H__
#define S10_PINMUX_PIN0SEL 0xffd13000
#define S10_PINMUX_IO0CTRL 0xffd13130
#define S10_PINMUX_PINMUX_EMAC0_USEFPGA 0xffd13300
#define S10_PINMUX_IO0_DELAY 0xffd13400
#include "s10_handoff.h"
void
config_pinmux
(
handoff
*
handoff
);
#endif
plat/intel/soc/stratix10/include/s10_reset_manager.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __S10_RESETMANAGER_H__
#define __S10_RESETMANAGER_H__
#define S10_RSTMGR_PER0MODRST 0xffd11024
#define S10_RSTMGR_PER1MODRST 0xffd11028
#define S10_RSTMGR_HDSKEN 0xffd11010
#define S10_RSTMGR_PER0MODRST_EMAC0 0x00000001
#define S10_RSTMGR_PER0MODRST_EMAC1 0x00000002
#define S10_RSTMGR_PER0MODRST_EMAC2 0x00000004
#define S10_RSTMGR_PER0MODRST_EMAC0OCP 0x00000100
#define S10_RSTMGR_PER0MODRST_EMAC1OCP 0x00000200
#define S10_RSTMGR_PER0MODRST_DMAOCP 0x00200000
#define S10_RSTMGR_PER0MODRST_DMA 0x00010000
#define S10_RSTMGR_PER0MODRST_EMAC0 0x00000001
#define S10_RSTMGR_PER0MODRST_EMAC1 0x00000002
#define S10_RSTMGR_PER0MODRST_EMAC2OCP 0x00000400
#define S10_RSTMGR_PER0MODRST_EMAC2 0x00000004
#define S10_RSTMGR_PER0MODRST_EMACPTP 0x00400000
#define S10_RSTMGR_PER0MODRST_NANDOCP 0x00002000
#define S10_RSTMGR_PER0MODRST_NAND 0x00000020
#define S10_RSTMGR_PER0MODRST_SDMMCOCP 0x00008000
#define S10_RSTMGR_PER0MODRST_SDMMC 0x00000080
#define S10_RSTMGR_PER0MODRST_SPIM0 0x00020000
#define S10_RSTMGR_PER0MODRST_SPIM1 0x00040000
#define S10_RSTMGR_PER0MODRST_SPIS0 0x00080000
#define S10_RSTMGR_PER0MODRST_SPIS1 0x00100000
#define S10_RSTMGR_PER0MODRST_USB0OCP 0x00000800
#define S10_RSTMGR_PER0MODRST_USB0 0x00000008
#define S10_RSTMGR_PER0MODRST_USB1OCP 0x00001000
#define S10_RSTMGR_PER0MODRST_USB1 0x00000010
#define S10_RSTMGR_PER1MODRST_WATCHDOG0 0x1
#define S10_RSTMGR_PER1MODRST_WATCHDOG1 0x2
#define S10_RSTMGR_PER1MODRST_WATCHDOG2 0x4
#define S10_RSTMGR_PER1MODRST_WATCHDOG3 0x8
#define S10_RSTMGR_PER1MODRST_GPIO0 0x01000000
#define S10_RSTMGR_PER1MODRST_GPIO0 0x01000000
#define S10_RSTMGR_PER1MODRST_GPIO1 0x02000000
#define S10_RSTMGR_PER1MODRST_GPIO1 0x02000000
#define S10_RSTMGR_PER1MODRST_I2C0 0x00000100
#define S10_RSTMGR_PER1MODRST_I2C0 0x00000100
#define S10_RSTMGR_PER1MODRST_I2C1 0x00000200
#define S10_RSTMGR_PER1MODRST_I2C1 0x00000200
#define S10_RSTMGR_PER1MODRST_I2C2 0x00000400
#define S10_RSTMGR_PER1MODRST_I2C2 0x00000400
#define S10_RSTMGR_PER1MODRST_I2C3 0x00000800
#define S10_RSTMGR_PER1MODRST_I2C3 0x00000800
#define S10_RSTMGR_PER1MODRST_I2C4 0x00001000
#define S10_RSTMGR_PER1MODRST_I2C4 0x00001000
#define S10_RSTMGR_PER1MODRST_L4SYSTIMER0 0x00000010
#define S10_RSTMGR_PER1MODRST_L4SYSTIMER1 0x00000020
#define S10_RSTMGR_PER1MODRST_SPTIMER0 0x00000040
#define S10_RSTMGR_PER1MODRST_SPTIMER0 0x00000040
#define S10_RSTMGR_PER1MODRST_SPTIMER1 0x00000080
#define S10_RSTMGR_PER1MODRST_SPTIMER1 0x00000080
#define S10_RSTMGR_PER1MODRST_UART0 0x00010000
#define S10_RSTMGR_PER1MODRST_UART0 0x00010000
#define S10_RSTMGR_PER1MODRST_UART1 0x00020000
#define S10_RSTMGR_PER1MODRST_UART1 0x00020000
#define S10_RSTMGR_HDSKEN_DEBUG_L3NOC 0x00020000
#define S10_RSTMGR_HDSKEN_ETRSTALLEN 0x00000008
#define S10_RSTMGR_HDSKEN_FPGAHSEN 0x00000004
#define S10_RSTMGR_HDSKEN_L2FLUSHEN 0x00000100
#define S10_RSTMGR_HDSKEN_L3NOC_DBG 0x00010000
#define S10_RSTMGR_HDSKEN_SDRSELFREFEN 0x00000001
#define S10_RSTMGR_PER0MODRST_DMAIF0 0x01000000
#define S10_RSTMGR_PER0MODRST_DMAIF1 0x02000000
#define S10_RSTMGR_PER0MODRST_DMAIF2 0x04000000
#define S10_RSTMGR_PER0MODRST_DMAIF3 0x08000000
#define S10_RSTMGR_PER0MODRST_DMAIF4 0x10000000
#define S10_RSTMGR_PER0MODRST_DMAIF5 0x20000000
#define S10_RSTMGR_PER0MODRST_DMAIF6 0x40000000
#define S10_RSTMGR_PER0MODRST_DMAIF7 0x80000000
void
deassert_peripheral_reset
(
void
);
void
config_hps_hs_before_warm_reset
(
void
);
#endif
plat/intel/soc/stratix10/include/s10_system_manager.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#define S10_NOC_FW_L4_PER_SCR_NAND_REGISTER 0xffd21000
#define S10_NOC_FW_L4_PER_SCR_NAND_DATA 0xffd21004
#define S10_NOC_FW_L4_PER_SCR_USB0_REGISTER 0xffd2100c
#define S10_NOC_FW_L4_PER_SCR_USB1_REGISTER 0xffd21010
#define S10_NOC_FW_L4_PER_SCR_SPI_MASTER0 0xffd2101c
#define S10_NOC_FW_L4_PER_SCR_SPI_MASTER1 0xffd21020
#define S10_NOC_FW_L4_PER_SCR_SPI_SLAVE0 0xffd21024
#define S10_NOC_FW_L4_PER_SCR_SPI_SLAVE1 0xffd21028
#define S10_NOC_FW_L4_PER_SCR_EMAC0 0xffd2102c
#define S10_NOC_FW_L4_PER_SCR_EMAC1 0xffd21030
#define S10_NOC_FW_L4_PER_SCR_EMAC2 0xffd21034
#define S10_NOC_FW_L4_PER_SCR_SDMMC 0xffd21040
#define S10_NOC_FW_L4_PER_SCR_GPIO0 0xffd21044
#define S10_NOC_FW_L4_PER_SCR_GPIO1 0xffd21048
#define S10_NOC_FW_L4_PER_SCR_I2C0 0xffd21050
#define S10_NOC_FW_L4_PER_SCR_I2C1 0xffd21054
#define S10_NOC_FW_L4_PER_SCR_I2C2 0xffd21058
#define S10_NOC_FW_L4_PER_SCR_I2C3 0xffd2105c
#define S10_NOC_FW_L4_PER_SCR_I2C4 0xffd21060
#define S10_NOC_FW_L4_PER_SCR_SP_TIMER0 0xffd21064
#define S10_NOC_FW_L4_PER_SCR_SP_TIMER1 0xffd21068
#define S10_NOC_FW_L4_PER_SCR_UART0 0xffd2106c
#define S10_NOC_FW_L4_PER_SCR_UART1 0xffd21070
#define S10_NOC_FW_L4_SYS_SCR_DMA_ECC 0xffd21108
#define S10_NOC_FW_L4_SYS_SCR_EMAC0RX_ECC 0xffd2110c
#define S10_NOC_FW_L4_SYS_SCR_EMAC0TX_ECC 0xffd21110
#define S10_NOC_FW_L4_SYS_SCR_EMAC1RX_ECC 0xffd21114
#define S10_NOC_FW_L4_SYS_SCR_EMAC1TX_ECC 0xffd21118
#define S10_NOC_FW_L4_SYS_SCR_EMAC2RX_ECC 0xffd2111c
#define S10_NOC_FW_L4_SYS_SCR_EMAC2TX_ECC 0xffd21120
#define S10_NOC_FW_L4_SYS_SCR_NAND_ECC 0xffd2112c
#define S10_NOC_FW_L4_SYS_SCR_NAND_READ_ECC 0xffd21130
#define S10_NOC_FW_L4_SYS_SCR_NAND_WRITE_ECC 0xffd21134
#define S10_NOC_FW_L4_SYS_SCR_OCRAM_ECC 0xffd21138
#define S10_NOC_FW_L4_SYS_SCR_SDMMC_ECC 0xffd21140
#define S10_NOC_FW_L4_SYS_SCR_USB0_ECC 0xffd21144
#define S10_NOC_FW_L4_SYS_SCR_USB1_ECC 0xffd21148
#define S10_NOC_FW_L4_SYS_SCR_CLK_MGR 0xffd2114c
#define S10_NOC_FW_L4_SYS_SCR_IO_MGR 0xffd21154
#define S10_NOC_FW_L4_SYS_SCR_RST_MGR 0xffd21158
#define S10_NOC_FW_L4_SYS_SCR_SYS_MGR 0xffd2115c
#define S10_NOC_FW_L4_SYS_SCR_OSC0_TIMER 0xffd21160
#define S10_NOC_FW_L4_SYS_SCR_OSC1_TIMER 0xffd21164
#define S10_NOC_FW_L4_SYS_SCR_WATCHDOG0 0xffd21168
#define S10_NOC_FW_L4_SYS_SCR_WATCHDOG1 0xffd2116c
#define S10_NOC_FW_L4_SYS_SCR_WATCHDOG2 0xffd21170
#define S10_NOC_FW_L4_SYS_SCR_WATCHDOG3 0xffd21174
#define S10_NOC_FW_L4_SYS_SCR_DAP 0xffd21178
#define S10_NOC_FW_L4_SYS_SCR_L4_NOC_PROBES 0xffd21190
#define S10_NOC_FW_L4_SYS_SCR_L4_NOC_QOS 0xffd21194
#define S10_CCU_NOC_CPU0_RAMSPACE0_0 0xf7004688
#define S10_CCU_NOC_IOM_RAMSPACE0_0 0xf7018628
#define DISABLE_L4_FIREWALL (BIT(0) | BIT(16) | BIT(24))
void
enable_nonsecure_access
(
void
);
plat/intel/soc/stratix10/plat_delay_timer.c
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <arch_helpers.h>
#include <drivers/delay_timer.h>
#include <lib/mmio.h>
#define S10_GLOBAL_TIMER 0xffd01000
#define S10_GLOBAL_TIMER_EN 0x3
/********************************************************************
* The timer delay function
********************************************************************/
static
uint32_t
plat_get_timer_value
(
void
)
{
/*
* Generic delay timer implementation expects the timer to be a down
* counter. We apply bitwise NOT operator to the tick values returned
* by read_cntpct_el0() to simulate the down counter. The value is
* clipped from 64 to 32 bits.
*/
return
(
uint32_t
)(
~
read_cntpct_el0
());
}
static
const
timer_ops_t
plat_timer_ops
=
{
.
get_timer_value
=
plat_get_timer_value
,
.
clk_mult
=
1
,
.
clk_div
=
PLAT_SYS_COUNTER_FREQ_IN_MHZ
,
};
void
plat_delay_timer_init
(
void
)
{
timer_init
(
&
plat_timer_ops
);
mmio_write_32
(
S10_GLOBAL_TIMER
,
S10_GLOBAL_TIMER_EN
);
}
plat/intel/soc/stratix10/plat_storage.c
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch_helpers.h>
#include <assert.h>
#include <common/debug.h>
#include <drivers/mmc.h>
#include <tools_share/firmware_image_package.h>
#include <drivers/io/io_block.h>
#include <drivers/io/io_driver.h>
#include <drivers/io/io_fip.h>
#include <drivers/io/io_memmap.h>
#include <drivers/io/io_storage.h>
#include <lib/mmio.h>
#include <drivers/partition/partition.h>
#include <lib/semihosting.h>
#include <string.h>
#include <lib/utils.h>
#include <common/tbbr/tbbr_img_def.h>
#include "platform_def.h"
#define STRATIX10_FIP_BASE (0)
#define STRATIX10_FIP_MAX_SIZE (0x1000000)
#define STRATIX10_MMC_DATA_BASE (0xffe3c000)
#define STRATIX10_MMC_DATA_SIZE (0x2000)
static
const
io_dev_connector_t
*
mmc_dev_con
;
static
const
io_dev_connector_t
*
fip_dev_con
;
static
uintptr_t
fip_dev_handle
;
static
uintptr_t
mmc_dev_handle
;
static
const
io_uuid_spec_t
bl2_uuid_spec
=
{
.
uuid
=
UUID_TRUSTED_BOOT_FIRMWARE_BL2
,
};
static
const
io_uuid_spec_t
bl31_uuid_spec
=
{
.
uuid
=
UUID_EL3_RUNTIME_FIRMWARE_BL31
,
};
static
const
io_uuid_spec_t
bl33_uuid_spec
=
{
.
uuid
=
UUID_NON_TRUSTED_FIRMWARE_BL33
,
};
uintptr_t
a2_lba_offset
;
static
const
io_block_spec_t
gpt_block_spec
=
{
.
offset
=
0
,
.
length
=
MMC_BLOCK_SIZE
};
static
int
check_mmc
(
const
uintptr_t
spec
);
static
int
check_fip
(
const
uintptr_t
spec
);
static
io_block_spec_t
mmc_fip_spec
=
{
.
offset
=
STRATIX10_FIP_BASE
,
.
length
=
STRATIX10_FIP_MAX_SIZE
,
};
const
char
a2
[]
=
{
0xa2
,
0x0
};
static
const
io_block_dev_spec_t
mmc_dev_spec
=
{
.
buffer
=
{
.
offset
=
STRATIX10_MMC_DATA_BASE
,
.
length
=
MMC_BLOCK_SIZE
,
},
.
ops
=
{
.
read
=
mmc_read_blocks
,
.
write
=
mmc_write_blocks
,
},
.
block_size
=
MMC_BLOCK_SIZE
,
};
struct
plat_io_policy
{
uintptr_t
*
dev_handle
;
uintptr_t
image_spec
;
int
(
*
check
)(
const
uintptr_t
spec
);
};
static
const
struct
plat_io_policy
policies
[]
=
{
[
FIP_IMAGE_ID
]
=
{
&
mmc_dev_handle
,
(
uintptr_t
)
&
mmc_fip_spec
,
check_mmc
},
[
BL2_IMAGE_ID
]
=
{
&
fip_dev_handle
,
(
uintptr_t
)
&
bl2_uuid_spec
,
check_fip
},
[
BL31_IMAGE_ID
]
=
{
&
fip_dev_handle
,
(
uintptr_t
)
&
bl31_uuid_spec
,
check_fip
},
[
BL33_IMAGE_ID
]
=
{
&
fip_dev_handle
,
(
uintptr_t
)
&
bl33_uuid_spec
,
check_fip
},
[
GPT_IMAGE_ID
]
=
{
&
mmc_dev_handle
,
(
uintptr_t
)
&
gpt_block_spec
,
check_mmc
},
};
static
int
check_mmc
(
const
uintptr_t
spec
)
{
int
result
;
uintptr_t
local_handle
;
result
=
io_dev_init
(
mmc_dev_handle
,
(
uintptr_t
)
NULL
);
if
(
result
==
0
)
{
result
=
io_open
(
mmc_dev_handle
,
spec
,
&
local_handle
);
if
(
result
==
0
)
io_close
(
local_handle
);
}
return
result
;
}
static
int
check_fip
(
const
uintptr_t
spec
)
{
int
result
;
uintptr_t
local_image_handle
;
result
=
io_dev_init
(
fip_dev_handle
,
(
uintptr_t
)
FIP_IMAGE_ID
);
if
(
result
==
0
)
{
result
=
io_open
(
fip_dev_handle
,
spec
,
&
local_image_handle
);
if
(
result
==
0
)
io_close
(
local_image_handle
);
}
return
result
;
}
void
stratix10_io_setup
(
void
)
{
int
result
;
result
=
register_io_dev_block
(
&
mmc_dev_con
);
assert
(
result
==
0
);
result
=
register_io_dev_fip
(
&
fip_dev_con
);
assert
(
result
==
0
);
result
=
io_dev_open
(
mmc_dev_con
,
(
uintptr_t
)
&
mmc_dev_spec
,
&
mmc_dev_handle
);
assert
(
result
==
0
);
result
=
io_dev_open
(
fip_dev_con
,
(
uintptr_t
)
NULL
,
&
fip_dev_handle
);
assert
(
result
==
0
);
partition_init
(
GPT_IMAGE_ID
);
mmc_fip_spec
.
offset
=
get_partition_entry
(
a2
)
->
start
;
(
void
)
result
;
}
int
plat_get_image_source
(
unsigned
int
image_id
,
uintptr_t
*
dev_handle
,
uintptr_t
*
image_spec
)
{
int
result
;
const
struct
plat_io_policy
*
policy
;
assert
(
image_id
<
ARRAY_SIZE
(
policies
));
policy
=
&
policies
[
image_id
];
result
=
policy
->
check
(
policy
->
image_spec
);
assert
(
result
==
0
);
*
image_spec
=
policy
->
image_spec
;
*
dev_handle
=
*
(
policy
->
dev_handle
);
return
result
;
}
plat/intel/soc/stratix10/platform.mk
0 → 100644
View file @
6ce30346
#
# Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
PLAT_INCLUDES
:=
\
-Iplat
/intel/soc/stratix10/
\
-Iplat
/intel/soc/stratix10/include/
\
PLAT_BL_COMMON_SOURCES
:=
\
lib/xlat_tables/xlat_tables_common.c
\
lib/xlat_tables/aarch64/xlat_tables.c
\
drivers/arm/gic/common/gic_common.c
\
drivers/arm/gic/v2/gicv2_main.c
\
drivers/arm/gic/v2/gicv2_helpers.c
\
plat/common/plat_gicv2.c
\
drivers/delay_timer/delay_timer.c
\
drivers/delay_timer/generic_delay_timer.c
\
drivers/ti/uart/aarch64/16550_console.S
\
plat/intel/soc/stratix10/aarch64/platform_common.c
\
plat/intel/soc/stratix10/aarch64/plat_helpers.S
\
BL2_SOURCES
+=
\
drivers/partition/partition.c
\
drivers/partition/gpt.c
\
drivers/arm/pl061/pl061_gpio.c
\
drivers/mmc/mmc.c
\
drivers/synopsys/emmc/dw_mmc.c
\
drivers/io/io_storage.c
\
drivers/io/io_block.c
\
drivers/io/io_fip.c
\
drivers/gpio/gpio.c
\
drivers/io/io_memmap.c
\
plat/intel/soc/stratix10/bl2_plat_setup.c
\
plat/intel/soc/stratix10/plat_storage.c
\
plat/intel/soc/stratix10/bl2_plat_mem_params_desc.c
\
plat/intel/soc/stratix10/soc/s10_reset_manager.c
\
plat/intel/soc/stratix10/soc/s10_handoff.c
\
plat/intel/soc/stratix10/soc/s10_clock_manager.c
\
plat/intel/soc/stratix10/soc/s10_pinmux.c
\
plat/intel/soc/stratix10/soc/s10_memory_controller.c
\
plat/intel/soc/stratix10/plat_delay_timer.c
\
lib/cpus/aarch64/cortex_a53.S
\
plat/intel/soc/stratix10/stratix10_image_load.c
\
plat/intel/soc/stratix10/soc/s10_system_manager.c
\
common/desc_image_load.c
# plat/intel/soc/stratix10/plat_topology.c \
PROGRAMMABLE_RESET_ADDRESS
:=
0
BL2_AT_EL3
:=
1
MULTI_CONSOLE_API
:=
1
plat/intel/soc/stratix10/platform_def.h
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __PLATFORM_DEF_H__
#define __PLATFORM_DEF_H__
#include <arch.h>
#include <common/bl_common.h>
#include <common/interrupt_props.h>
#include <common/tbbr/tbbr_img_def.h>
#include <drivers/arm/gic_common.h>
#include <plat/common/common_def.h>
/* Define next boot image name and offset */
#define PLAT_NS_IMAGE_OFFSET 0x50000
#define PLAT_HANDOFF_OFFSET 0xFFE3F000
/*******************************************************************************
* Platform binary types for linking
******************************************************************************/
#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
#define PLATFORM_LINKER_ARCH aarch64
/* Stratix 10 supports up to 124GB RAM */
#define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 39)
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 39)
/*******************************************************************************
* Generic platform constants
******************************************************************************/
#define PLAT_PRIMARY_CPU 0
#define PLAT_SECONDARY_ENTRY_BASE 0x01f78bf0
/* Size of cacheable stacks */
#define PLATFORM_STACK_SIZE 0x2000
/* PSCI related constant */
#define PLAT_NUM_POWER_DOMAINS 5
#define PLAT_MAX_PWR_LVL 1
#define PLAT_MAX_RET_STATE 1
#define PLAT_MAX_OFF_STATE 2
#define PLATFORM_SYSTEM_COUNT 1
#define PLATFORM_CLUSTER_COUNT 1
#define PLATFORM_CLUSTER0_CORE_COUNT 4
#define PLATFORM_CLUSTER1_CORE_COUNT 0
#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
PLATFORM_CLUSTER0_CORE_COUNT)
#define PLATFORM_MAX_CPUS_PER_CLUSTER 4
/* Interrupt related constant */
#define INTEL_S10_IRQ_SEC_PHY_TIMER 29
#define INTEL_S10_IRQ_SEC_SGI_0 8
#define INTEL_S10_IRQ_SEC_SGI_1 9
#define INTEL_S10_IRQ_SEC_SGI_2 10
#define INTEL_S10_IRQ_SEC_SGI_3 11
#define INTEL_S10_IRQ_SEC_SGI_4 12
#define INTEL_S10_IRQ_SEC_SGI_5 13
#define INTEL_S10_IRQ_SEC_SGI_6 14
#define INTEL_S10_IRQ_SEC_SGI_7 15
#define TSP_IRQ_SEC_PHY_TIMER INTEL_S10_IRQ_SEC_PHY_TIMER
#define TSP_SEC_MEM_BASE BL32_BASE
#define TSP_SEC_MEM_SIZE (BL32_LIMIT - BL32_BASE + 1)
/*******************************************************************************
* Platform memory map related constants
******************************************************************************/
#define DRAM_BASE (0x0)
#define DRAM_SIZE (0x80000000)
#define OCRAM_BASE (0xFFE00000)
#define OCRAM_SIZE (0x00100000)
#define MEM64_BASE (0x0100000000)
#define MEM64_SIZE (0x1F00000000)
#define DEVICE1_BASE (0x80000000)
#define DEVICE1_SIZE (0x60000000)
#define DEVICE2_BASE (0xF7000000)
#define DEVICE2_SIZE (0x08E00000)
#define DEVICE3_BASE (0xFFFC0000)
#define DEVICE3_SIZE (0x00008000)
#define DEVICE4_BASE (0x2000000000)
#define DEVICE4_SIZE (0x0100000000)
/*******************************************************************************
* BL31 specific defines.
******************************************************************************/
/*
* Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
* present). BL31_BASE is calculated using the current BL3-1 debug size plus a
* little space for growth.
*/
#define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
#define BL1_RO_BASE (0xffe00000)
#define BL1_RO_LIMIT (0xffe0f000)
#define BL1_RW_BASE (0xffe10000)
#define BL1_RW_LIMIT (0xffe1ffff)
#define BL1_RW_SIZE (0x14000)
#define BL2_BASE (0xffe00000)
#define BL2_LIMIT (0xffe1c000)
#define BL31_BASE (0xffe1c000)
#define BL31_LIMIT (0xffe3ffff)
/*******************************************************************************
* Platform specific page table and MMU setup constants
******************************************************************************/
#define MAX_XLAT_TABLES 8
#define MAX_MMAP_REGIONS 16
/*******************************************************************************
* Declarations and constants to access the mailboxes safely. Each mailbox is
* aligned on the biggest cache line size in the platform. This is known only
* to the platform as it might have a combination of integrated and external
* caches. Such alignment ensures that two maiboxes do not sit on the same cache
* line at any cache level. They could belong to different cpus/clusters &
* get written while being protected by different locks causing corruption of
* a valid mailbox address.
******************************************************************************/
#define CACHE_WRITEBACK_SHIFT 6
#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
#define PLAT_GIC_BASE (0xFFFC0000)
#define PLAT_GICC_BASE (PLAT_GIC_BASE + 0x2000)
#define PLAT_GICD_BASE (PLAT_GIC_BASE + 0x1000)
#define PLAT_GICR_BASE 0
/*******************************************************************************
* UART related constants
******************************************************************************/
#define PLAT_UART0_BASE (0xFFC02000)
#define PLAT_UART1_BASE (0xFFC02100)
#define CRASH_CONSOLE_BASE PLAT_UART0_BASE
#define PLAT_BAUDRATE (115200)
#define PLAT_UART_CLOCK (100000000)
/*******************************************************************************
* System counter frequency related constants
******************************************************************************/
#define PLAT_SYS_COUNTER_FREQ_IN_TICKS (400000000)
#define PLAT_SYS_COUNTER_FREQ_IN_MHZ (400)
#define PLAT_INTEL_S10_GICD_BASE PLAT_GICD_BASE
#define PLAT_INTEL_S10_GICC_BASE PLAT_GICC_BASE
/*
* Define a list of Group 1 Secure and Group 0 interrupts as per GICv3
* terminology. On a GICv2 system or mode, the lists will be merged and treated
* as Group 0 interrupts.
*/
#define PLAT_INTEL_S10_G1S_IRQ_PROPS(grp) \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, \
grp, GIC_INTR_CFG_LEVEL), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(INTEL_S10_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_EDGE)
#define PLAT_INTEL_S10_G0_IRQ_PROPS(grp)
#define MAX_IO_HANDLES 4
#define MAX_IO_DEVICES 4
#define MAX_IO_BLOCK_DEVICES 2
#endif
/* __PLATFORM_DEF_H__ */
plat/intel/soc/stratix10/soc/s10_clock_manager.c
0 → 100644
View file @
6ce30346
/*
* Copyright (c) 2019, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <arch_helpers.h>
#include <assert.h>
#include <drivers/delay_timer.h>
#include <lib/mmio.h>
#include <platform_def.h>
#include <platform_private.h>
#include "s10_clock_manager.h"
#include "s10_handoff.h"
void
wait_pll_lock
(
void
)
{
uint32_t
data
;
do
{
data
=
mmio_read_32
(
ALT_CLKMGR
+
ALT_CLKMGR_STAT
);
}
while
((
ALT_CLKMGR_STAT_MAINPLLLOCKED
(
data
)
==
0
)
||
(
ALT_CLKMGR_STAT_PERPLLLOCKED
(
data
)
==
0
));
}
void
wait_fsm
(
void
)
{
uint32_t
data
;
do
{
data
=
mmio_read_32
(
ALT_CLKMGR
+
ALT_CLKMGR_STAT
);
}
while
(
ALT_CLKMGR_STAT_BUSY
(
data
)
==
ALT_CLKMGR_STAT_BUSY_E_BUSY
);
}
void
config_clkmgr_handoff
(
handoff
*
hoff_ptr
)
{
uint32_t
m_div
,
refclk_div
,
mscnt
,
hscnt
;
/* Bypass all mainpllgrp's clocks */
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_BYPASS
,
0x7
);
wait_fsm
();
/* Bypass all perpllgrp's clocks */
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_BYPASS
,
0x7f
);
wait_fsm
();
/* Setup main PLL dividers */
m_div
=
ALT_CLKMGR_MAINPLL_FDBCK_MDIV
(
hoff_ptr
->
main_pll_fdbck
);
refclk_div
=
ALT_CLKMGR_MAINPLL_PLLGLOB_REFCLKDIV
(
hoff_ptr
->
main_pll_pllglob
);
mscnt
=
200
/
((
6
+
m_div
)
/
refclk_div
);
hscnt
=
(
m_div
+
6
)
*
mscnt
/
refclk_div
-
9
;
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_PLLGLOB
,
hoff_ptr
->
main_pll_pllglob
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_FDBCK
,
hoff_ptr
->
main_pll_fdbck
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_VCOCALIB
,
ALT_CLKMGR_MAINPLL_VCOCALIB_HSCNT_SET
(
hscnt
)
|
ALT_CLKMGR_MAINPLL_VCOCALIB_MSCNT_SET
(
mscnt
));
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_PLLC0
,
hoff_ptr
->
main_pll_pllc0
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_PLLC1
,
hoff_ptr
->
main_pll_pllc1
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_NOCDIV
,
hoff_ptr
->
main_pll_nocdiv
);
/* Setup peripheral PLL dividers */
m_div
=
ALT_CLKMGR_PERPLL_FDBCK_MDIV
(
hoff_ptr
->
per_pll_fdbck
);
refclk_div
=
ALT_CLKMGR_PERPLL_PLLGLOB_REFCLKDIV
(
hoff_ptr
->
per_pll_pllglob
);
mscnt
=
200
/
((
6
+
m_div
)
/
refclk_div
);
hscnt
=
(
m_div
+
6
)
*
mscnt
/
refclk_div
-
9
;
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_PLLGLOB
,
hoff_ptr
->
per_pll_pllglob
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_FDBCK
,
hoff_ptr
->
per_pll_fdbck
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_VCOCALIB
,
ALT_CLKMGR_PERPLL_VCOCALIB_HSCNT_SET
(
hscnt
)
|
ALT_CLKMGR_PERPLL_VCOCALIB_MSCNT_SET
(
mscnt
));
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_PLLC0
,
hoff_ptr
->
per_pll_pllc0
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_PLLC1
,
hoff_ptr
->
per_pll_pllc1
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_GPIODIV
,
ALT_CLKMGR_PERPLL_GPIODIV_GPIODBCLK_SET
(
hoff_ptr
->
per_pll_gpiodiv
));
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_EMACCTL
,
hoff_ptr
->
per_pll_emacctl
);
/* Take both PLL out of reset and power up */
mmio_setbits_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_PLLGLOB
,
ALT_CLKMGR_MAINPLL_PLLGLOB_PD_SET_MSK
|
ALT_CLKMGR_MAINPLL_PLLGLOB_RST_SET_MSK
);
mmio_setbits_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_PLLGLOB
,
ALT_CLKMGR_PERPLL_PLLGLOB_PD_SET_MSK
|
ALT_CLKMGR_PERPLL_PLLGLOB_RST_SET_MSK
);
wait_pll_lock
();
/* Dividers for C2 to C9 only init after PLLs are lock. */
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_MPUCLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_NOCCLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR2CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR3CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR4CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR5CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR6CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR7CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR8CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR9CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR2CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR3CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR4CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR5CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR6CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR7CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR8CLK
,
0xff
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_MPUCLK
,
hoff_ptr
->
main_pll_mpuclk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_NOCCLK
,
hoff_ptr
->
main_pll_nocclk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR2CLK
,
hoff_ptr
->
main_pll_cntr2clk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR3CLK
,
hoff_ptr
->
main_pll_cntr3clk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR4CLK
,
hoff_ptr
->
main_pll_cntr4clk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR5CLK
,
hoff_ptr
->
main_pll_cntr5clk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR6CLK
,
hoff_ptr
->
main_pll_cntr6clk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR7CLK
,
hoff_ptr
->
main_pll_cntr7clk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR8CLK
,
hoff_ptr
->
main_pll_cntr8clk
);
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_CNTR9CLK
,
hoff_ptr
->
main_pll_cntr9clk
);
/* Peripheral PLL Clock Source and Counters/Divider */
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR2CLK
,
hoff_ptr
->
per_pll_cntr2clk
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR3CLK
,
hoff_ptr
->
per_pll_cntr3clk
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR4CLK
,
hoff_ptr
->
per_pll_cntr4clk
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR5CLK
,
hoff_ptr
->
per_pll_cntr5clk
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR6CLK
,
hoff_ptr
->
per_pll_cntr6clk
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR7CLK
,
hoff_ptr
->
per_pll_cntr7clk
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR8CLK
,
hoff_ptr
->
per_pll_cntr8clk
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_CNTR9CLK
,
hoff_ptr
->
per_pll_cntr9clk
);
/* Take all PLLs out of bypass */
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_BYPASS
,
0
);
wait_fsm
();
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_BYPASS
,
0
);
wait_fsm
();
/* Set safe mode/ out of boot mode */
mmio_clrbits_32
(
ALT_CLKMGR
+
ALT_CLKMGR_CTRL
,
ALT_CLKMGR_CTRL_BOOTMODE_SET_MSK
);
wait_fsm
();
/* 10 Enable mainpllgrp's software-managed clock */
mmio_write_32
(
ALT_CLKMGR_MAINPLL
+
ALT_CLKMGR_MAINPLL_EN
,
ALT_CLKMGR_MAINPLL_EN_RESET
);
mmio_write_32
(
ALT_CLKMGR_PERPLL
+
ALT_CLKMGR_PERPLL_EN
,
ALT_CLKMGR_PERPLL_EN_RESET
);
/* Clear loss lock interrupt status register that */
/* might be set during configuration */
mmio_write_32
(
ALT_CLKMGR
+
ALT_CLKMGR_INTRCLR
,
ALT_CLKMGR_INTRCLR_MAINLOCKLOST_SET_MSK
|
ALT_CLKMGR_INTRCLR_PERLOCKLOST_SET_MSK
);
}
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment