Aaron Williams | d5e3766 | 2022-04-07 09:11:28 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2018-2022 Marvell International Ltd. |
| 4 | */ |
| 5 | |
| 6 | #include <log.h> |
| 7 | #include <time.h> |
| 8 | #include <linux/delay.h> |
| 9 | |
| 10 | #include <mach/cvmx-regs.h> |
| 11 | #include <mach/cvmx-csr.h> |
| 12 | #include <mach/cvmx-bootmem.h> |
| 13 | #include <mach/octeon-model.h> |
| 14 | #include <mach/cvmx-fuse.h> |
| 15 | #include <mach/octeon-feature.h> |
| 16 | #include <mach/cvmx-qlm.h> |
| 17 | #include <mach/octeon_qlm.h> |
| 18 | #include <mach/cvmx-pcie.h> |
| 19 | #include <mach/cvmx-coremask.h> |
| 20 | |
| 21 | #include <mach/cvmx-global-resources.h> |
| 22 | |
| 23 | #include <mach/cvmx-pki.h> |
| 24 | #include <mach/cvmx-helper.h> |
| 25 | #include <mach/cvmx-helper-board.h> |
| 26 | #include <mach/cvmx-helper-cfg.h> |
| 27 | |
| 28 | #include <mach/cvmx-hwfau.h> |
| 29 | |
| 30 | u8 *cvmx_fau_regs_ptr; |
| 31 | |
| 32 | void cvmx_fau_bootmem_init(void *bootmem) |
| 33 | { |
| 34 | memset(bootmem, 0, CVMX_FAU_MAX_REGISTERS_8); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Initializes FAU region for devices without FAU unit. |
| 39 | * @return 0 on success -1 on failure |
| 40 | */ |
| 41 | int cvmx_fau_init(void) |
| 42 | { |
| 43 | cvmx_fau_regs_ptr = (u8 *)cvmx_bootmem_alloc_named_range_once( |
| 44 | CVMX_FAU_MAX_REGISTERS_8, 0, 1ull << 31, 128, |
| 45 | "cvmx_fau_registers", cvmx_fau_bootmem_init); |
| 46 | |
| 47 | if (cvmx_fau_regs_ptr == 0ull) { |
| 48 | debug("ERROR: Failed to alloc named block for software FAU.\n"); |
| 49 | return -1; |
| 50 | } |
| 51 | |
| 52 | return 0; |
| 53 | } |