blob: 8460acb00d9895d9eb9b2f9aceb5858fda1bb4c1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Ley Foon Tanb149f2b2017-04-26 02:44:36 +08002/*
Tien Fong Chee8ca17082021-11-07 23:08:55 +08003 * Copyright (C) 2016-2021 Intel Corporation
Ley Foon Tanb149f2b2017-04-26 02:44:36 +08004 */
5
Simon Goldschmidt52166712019-10-23 22:32:30 +02006#ifndef _SOCFPGA_MISC_H_
7#define _SOCFPGA_MISC_H_
Ley Foon Tanb149f2b2017-04-26 02:44:36 +08008
Simon Goldschmidtda13a0a2018-10-10 14:55:23 +02009#include <asm/sections.h>
10
Ley Foon Tanb149f2b2017-04-26 02:44:36 +080011void dwmac_deassert_reset(const unsigned int of_reset_id, const u32 phymode);
12
13struct bsel {
14 const char *mode;
15 const char *name;
16};
17
18extern struct bsel bsel_str[];
19
20#ifdef CONFIG_FPGA
Ang, Chee Hongff14f162018-12-19 18:35:15 -080021void socfpga_fpga_add(void *fpga_desc);
Ley Foon Tanb149f2b2017-04-26 02:44:36 +080022#else
Tom Riniea84ae62020-05-14 08:30:05 -040023static inline void socfpga_fpga_add(void *fpga_desc) {}
Ley Foon Tanb149f2b2017-04-26 02:44:36 +080024#endif
25
Simon Goldschmidt8e302032018-08-13 21:34:35 +020026#ifdef CONFIG_TARGET_SOCFPGA_GEN5
27void socfpga_sdram_remap_zero(void);
Simon Goldschmidtda13a0a2018-10-10 14:55:23 +020028static inline bool socfpga_is_booting_from_fpga(void)
29{
30 if ((__image_copy_start >= (char *)SOCFPGA_FPGA_SLAVES_ADDRESS) &&
31 (__image_copy_start < (char *)SOCFPGA_STM_ADDRESS))
32 return true;
33 return false;
34}
Simon Goldschmidt8e302032018-08-13 21:34:35 +020035#endif
36
Marek Vasut8fdb4192018-08-18 19:11:52 +020037#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10
38void socfpga_init_security_policies(void);
39void socfpga_sdram_remap_zero(void);
40#endif
41
Chee Hong Ang61e91992020-08-06 11:56:29 +080042#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) || \
43 defined(CONFIG_TARGET_SOCFPGA_AGILEX)
44int is_fpga_config_ready(void);
45#endif
46
Marek Vasut713a8a22019-04-16 22:28:08 +020047void do_bridge_reset(int enable, unsigned int mask);
Tien Fong Cheeadc079f2021-11-07 23:08:56 +080048void force_periph_program(unsigned int status);
Tien Fong Chee8ca17082021-11-07 23:08:55 +080049bool is_regular_boot_valid(void);
Tien Fong Cheeadc079f2021-11-07 23:08:56 +080050bool is_periph_program_force(void);
Tien Fong Chee8ca17082021-11-07 23:08:55 +080051void set_regular_boot(unsigned int status);
Marek Vasutb6ba4902019-03-21 23:05:38 +010052void socfpga_pl310_clear(void);
Ley Foon Tanfed4c952019-11-08 10:38:19 +080053void socfpga_get_managers_addr(void);
Tien Fong Chee8ca17082021-11-07 23:08:55 +080054int qspi_flash_software_reset(void);
Ley Foon Tan4cc6b582018-05-24 00:17:23 +080055
Simon Goldschmidt52166712019-10-23 22:32:30 +020056#endif /* _SOCFPGA_MISC_H_ */