blob: 258738dfc8c263333f890dccde5a5b2b65615503 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
J. German Riverab940ca62014-06-23 15:15:55 -07002/*
3 * Copyright (C) 2014 Freescale Semiconductor
Cosmin-Florin Alucheneseied067722021-10-07 13:07:44 +03004 * Copyright 2021 NXP
J. German Riverab940ca62014-06-23 15:15:55 -07005 */
6
7#ifndef __FSL_MC_H__
8#define __FSL_MC_H__
9
10#include <common.h>
Simon Glasscd93d622020-05-10 11:40:13 -060011#include <linux/bitops.h>
J. German Riverab940ca62014-06-23 15:15:55 -070012
13#define MC_CCSR_BASE_ADDR \
14 ((struct mc_ccsr_registers __iomem *)0x8340000)
15
J. German Riverab940ca62014-06-23 15:15:55 -070016#define GCR1_P1_STOP BIT(31)
17#define GCR1_P2_STOP BIT(30)
18#define GCR1_P1_DE_RST BIT(23)
19#define GCR1_P2_DE_RST BIT(22)
20#define GCR1_M1_DE_RST BIT(15)
21#define GCR1_M2_DE_RST BIT(14)
22#define GCR1_M_ALL_DE_RST (GCR1_M1_DE_RST | GCR1_M2_DE_RST)
23#define GSR_FS_MASK 0x3fffffff
J. German Riverab940ca62014-06-23 15:15:55 -070024
25#define SOC_MC_PORTALS_BASE_ADDR ((void __iomem *)0x00080C000000)
Prabhakar Kushwaha1f1c25c2015-07-02 11:28:59 +053026#define SOC_QBMAN_PORTALS_BASE_ADDR ((void __iomem *)0x000818000000)
J. German Riverab940ca62014-06-23 15:15:55 -070027#define SOC_MC_PORTAL_STRIDE 0x10000
28
29#define SOC_MC_PORTAL_ADDR(_portal_id) \
30 ((void __iomem *)((uintptr_t)SOC_MC_PORTALS_BASE_ADDR + \
31 (_portal_id) * SOC_MC_PORTAL_STRIDE))
32
Prabhakar Kushwaha1730a172015-11-04 12:25:59 +053033#define MC_PORTAL_OFFSET_TO_PORTAL_ID(_portal_offset) \
34 ((_portal_offset) / SOC_MC_PORTAL_STRIDE)
35
J. German Riverab940ca62014-06-23 15:15:55 -070036struct mc_ccsr_registers {
37 u32 reg_gcr1;
38 u32 reserved1;
39 u32 reg_gsr;
40 u32 reserved2;
41 u32 reg_sicbalr;
42 u32 reg_sicbahr;
43 u32 reg_sicapr;
44 u32 reserved3;
45 u32 reg_mcfbalr;
46 u32 reg_mcfbahr;
47 u32 reg_mcfapr;
48 u32 reserved4[0x2f1];
49 u32 reg_psr;
50 u32 reserved5;
51 u32 reg_brr[2];
52 u32 reserved6[0x80];
53 u32 reg_error[];
54};
55
Cosmin-Florin Alucheneseied067722021-10-07 13:07:44 +030056struct log_header {
57 u32 magic_word;
58 char reserved[4];
59 u32 buf_start;
60 u32 buf_length;
61 u32 last_byte;
62};
63
Nipun Guptaa78df402018-08-20 16:01:14 +053064void fdt_fsl_mc_fixup_iommu_map_entry(void *blob);
J. German Riverab940ca62014-06-23 15:15:55 -070065int get_mc_boot_status(void);
Prabhakar Kushwahafb4a87a2015-11-04 12:25:58 +053066int get_dpl_apply_status(void);
Mian Yousaf Kaukab7e968042018-12-18 14:01:17 +010067int is_lazy_dpl_addr_valid(void);
Meenakshi Aggarwalcf0bbbd2019-05-23 15:13:43 +053068void fdt_fixup_mc_ddr(u64 *base, u64 *size);
Laurentiu Tudor1dd7b562023-09-27 18:30:47 +030069void fdt_reserve_mc_mem(void *blob, u32 mc_icid);
Tom Rini65cc0e22022-11-16 13:10:41 -050070#ifdef CFG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
Prabhakar Kushwahafb4a87a2015-11-04 12:25:58 +053071int get_aiop_apply_status(void);
72#endif
73u64 mc_get_dram_addr(void);
Bhupesh Sharma422cb082015-03-19 09:20:43 -070074unsigned long mc_get_dram_block_size(void);
Masahiro Yamadab75d8dc2020-06-26 15:13:33 +090075int fsl_mc_ldpaa_init(struct bd_info *bis);
76int fsl_mc_ldpaa_exit(struct bd_info *bd);
Bogdan Purcareata33a89912017-05-24 16:40:21 +000077void mc_env_boot(void);
J. German Riverab940ca62014-06-23 15:15:55 -070078#endif