Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2014 Freescale Semiconductor |
Cosmin-Florin Aluchenesei | ed06772 | 2021-10-07 13:07:44 +0300 | [diff] [blame] | 4 | * Copyright 2021 NXP |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __FSL_MC_H__ |
| 8 | #define __FSL_MC_H__ |
| 9 | |
Simon Glass | cd93d62 | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 10 | #include <linux/bitops.h> |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 11 | |
Tom Rini | 678be88 | 2023-11-01 12:28:18 -0400 | [diff] [blame] | 12 | struct bd_info; |
| 13 | |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 14 | #define MC_CCSR_BASE_ADDR \ |
| 15 | ((struct mc_ccsr_registers __iomem *)0x8340000) |
| 16 | |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 17 | #define GCR1_P1_STOP BIT(31) |
| 18 | #define GCR1_P2_STOP BIT(30) |
| 19 | #define GCR1_P1_DE_RST BIT(23) |
| 20 | #define GCR1_P2_DE_RST BIT(22) |
| 21 | #define GCR1_M1_DE_RST BIT(15) |
| 22 | #define GCR1_M2_DE_RST BIT(14) |
| 23 | #define GCR1_M_ALL_DE_RST (GCR1_M1_DE_RST | GCR1_M2_DE_RST) |
| 24 | #define GSR_FS_MASK 0x3fffffff |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 25 | |
| 26 | #define SOC_MC_PORTALS_BASE_ADDR ((void __iomem *)0x00080C000000) |
Prabhakar Kushwaha | 1f1c25c | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 27 | #define SOC_QBMAN_PORTALS_BASE_ADDR ((void __iomem *)0x000818000000) |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 28 | #define SOC_MC_PORTAL_STRIDE 0x10000 |
| 29 | |
| 30 | #define SOC_MC_PORTAL_ADDR(_portal_id) \ |
| 31 | ((void __iomem *)((uintptr_t)SOC_MC_PORTALS_BASE_ADDR + \ |
| 32 | (_portal_id) * SOC_MC_PORTAL_STRIDE)) |
| 33 | |
Prabhakar Kushwaha | 1730a17 | 2015-11-04 12:25:59 +0530 | [diff] [blame] | 34 | #define MC_PORTAL_OFFSET_TO_PORTAL_ID(_portal_offset) \ |
| 35 | ((_portal_offset) / SOC_MC_PORTAL_STRIDE) |
| 36 | |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 37 | struct mc_ccsr_registers { |
| 38 | u32 reg_gcr1; |
| 39 | u32 reserved1; |
| 40 | u32 reg_gsr; |
| 41 | u32 reserved2; |
| 42 | u32 reg_sicbalr; |
| 43 | u32 reg_sicbahr; |
| 44 | u32 reg_sicapr; |
| 45 | u32 reserved3; |
| 46 | u32 reg_mcfbalr; |
| 47 | u32 reg_mcfbahr; |
| 48 | u32 reg_mcfapr; |
| 49 | u32 reserved4[0x2f1]; |
| 50 | u32 reg_psr; |
| 51 | u32 reserved5; |
| 52 | u32 reg_brr[2]; |
| 53 | u32 reserved6[0x80]; |
| 54 | u32 reg_error[]; |
| 55 | }; |
| 56 | |
Cosmin-Florin Aluchenesei | ed06772 | 2021-10-07 13:07:44 +0300 | [diff] [blame] | 57 | struct log_header { |
| 58 | u32 magic_word; |
| 59 | char reserved[4]; |
| 60 | u32 buf_start; |
| 61 | u32 buf_length; |
| 62 | u32 last_byte; |
| 63 | }; |
| 64 | |
Nipun Gupta | a78df40 | 2018-08-20 16:01:14 +0530 | [diff] [blame] | 65 | void fdt_fsl_mc_fixup_iommu_map_entry(void *blob); |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 66 | int get_mc_boot_status(void); |
Prabhakar Kushwaha | fb4a87a | 2015-11-04 12:25:58 +0530 | [diff] [blame] | 67 | int get_dpl_apply_status(void); |
Mian Yousaf Kaukab | 7e96804 | 2018-12-18 14:01:17 +0100 | [diff] [blame] | 68 | int is_lazy_dpl_addr_valid(void); |
Meenakshi Aggarwal | cf0bbbd | 2019-05-23 15:13:43 +0530 | [diff] [blame] | 69 | void fdt_fixup_mc_ddr(u64 *base, u64 *size); |
Laurentiu Tudor | 1dd7b56 | 2023-09-27 18:30:47 +0300 | [diff] [blame] | 70 | void fdt_reserve_mc_mem(void *blob, u32 mc_icid); |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 71 | #ifdef CFG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET |
Prabhakar Kushwaha | fb4a87a | 2015-11-04 12:25:58 +0530 | [diff] [blame] | 72 | int get_aiop_apply_status(void); |
| 73 | #endif |
| 74 | u64 mc_get_dram_addr(void); |
Bhupesh Sharma | 422cb08 | 2015-03-19 09:20:43 -0700 | [diff] [blame] | 75 | unsigned long mc_get_dram_block_size(void); |
Masahiro Yamada | b75d8dc | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 76 | int fsl_mc_ldpaa_init(struct bd_info *bis); |
| 77 | int fsl_mc_ldpaa_exit(struct bd_info *bd); |
Bogdan Purcareata | 33a8991 | 2017-05-24 16:40:21 +0000 | [diff] [blame] | 78 | void mc_env_boot(void); |
J. German Rivera | b940ca6 | 2014-06-23 15:15:55 -0700 | [diff] [blame] | 79 | #endif |