Siew Chin Lim | 954d599 | 2021-03-24 13:11:34 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 |
| 2 | * |
Siew Chin Lim | 02d2500 | 2021-03-24 13:11:37 +0800 | [diff] [blame] | 3 | * Copyright (C) 2016-2020 Intel Corporation <www.intel.com> |
Siew Chin Lim | 954d599 | 2021-03-24 13:11:34 +0800 | [diff] [blame] | 4 | * |
| 5 | */ |
| 6 | |
| 7 | #ifndef _HANDOFF_SOC64_H_ |
| 8 | #define _HANDOFF_SOC64_H_ |
| 9 | |
| 10 | /* |
| 11 | * Offset for HW handoff from Quartus tools |
| 12 | */ |
Siew Chin Lim | 02d2500 | 2021-03-24 13:11:37 +0800 | [diff] [blame] | 13 | /* HPS handoff */ |
Siew Chin Lim | ff1eec3 | 2021-03-24 13:11:38 +0800 | [diff] [blame] | 14 | #define SOC64_HANDOFF_MAGIC_BOOT 0x424F4F54 |
Siew Chin Lim | 954d599 | 2021-03-24 13:11:34 +0800 | [diff] [blame] | 15 | #define SOC64_HANDOFF_MAGIC_MUX 0x504D5558 |
| 16 | #define SOC64_HANDOFF_MAGIC_IOCTL 0x494F4354 |
| 17 | #define SOC64_HANDOFF_MAGIC_FPGA 0x46504741 |
| 18 | #define SOC64_HANDOFF_MAGIC_DELAY 0x444C4159 |
| 19 | #define SOC64_HANDOFF_MAGIC_CLOCK 0x434C4B53 |
| 20 | #define SOC64_HANDOFF_MAGIC_MISC 0x4D495343 |
Siew Chin Lim | 02d2500 | 2021-03-24 13:11:37 +0800 | [diff] [blame] | 21 | |
Siew Chin Lim | 954d599 | 2021-03-24 13:11:34 +0800 | [diff] [blame] | 22 | #define SOC64_HANDOFF_OFFSET_LENGTH 0x4 |
| 23 | #define SOC64_HANDOFF_OFFSET_DATA 0x10 |
Siew Chin Lim | 02d2500 | 2021-03-24 13:11:37 +0800 | [diff] [blame] | 24 | #define SOC64_HANDOFF_SIZE 4096 |
| 25 | |
| 26 | #define SOC64_HANDOFF_BASE 0xFFE3F000 |
| 27 | #define SOC64_HANDOFF_MISC (SOC64_HANDOFF_BASE + 0x610) |
| 28 | #define SOC64_HANDOFF_MUX (SOC64_HANDOFF_BASE + 0x10) |
| 29 | #define SOC64_HANDOFF_IOCTL (SOC64_HANDOFF_BASE + 0x1A0) |
| 30 | #define SOC64_HANDOFF_FPGA (SOC64_HANDOFF_BASE + 0x330) |
| 31 | #define SOC64_HANDOFF_DELAY (SOC64_HANDOFF_BASE + 0x3F0) |
| 32 | #define SOC64_HANDOFF_CLOCK (SOC64_HANDOFF_BASE + 0x580) |
Siew Chin Lim | 954d599 | 2021-03-24 13:11:34 +0800 | [diff] [blame] | 33 | |
Siew Chin Lim | ff1eec3 | 2021-03-24 13:11:38 +0800 | [diff] [blame] | 34 | #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_STRATIX10) |
Siew Chin Lim | 954d599 | 2021-03-24 13:11:34 +0800 | [diff] [blame] | 35 | #define SOC64_HANDOFF_CLOCK_OSC (SOC64_HANDOFF_BASE + 0x608) |
| 36 | #define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x60C) |
| 37 | #else |
| 38 | #define SOC64_HANDOFF_CLOCK_OSC (SOC64_HANDOFF_BASE + 0x5fc) |
| 39 | #define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x600) |
| 40 | #endif |
| 41 | |
Siew Chin Lim | ff1eec3 | 2021-03-24 13:11:38 +0800 | [diff] [blame] | 42 | #define SOC64_HANDOFF_MUX_LEN 96 |
| 43 | #define SOC64_HANDOFF_IOCTL_LEN 96 |
| 44 | #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_STRATIX10) |
| 45 | #define SOC64_HANDOFF_FPGA_LEN 42 |
| 46 | #else |
| 47 | #define SOC64_HANDOFF_FPGA_LEN 40 |
| 48 | #endif |
| 49 | #define SOC64_HANDOFF_DELAY_LEN 96 |
| 50 | |
| 51 | #ifndef __ASSEMBLY__ |
| 52 | #include <asm/types.h> |
| 53 | enum endianness { |
| 54 | LITTLE_ENDIAN = 0, |
| 55 | BIG_ENDIAN |
| 56 | }; |
| 57 | |
| 58 | int socfpga_get_handoff_size(void *handoff_address, enum endianness endian); |
| 59 | int socfpga_handoff_read(void *handoff_address, void *table, u32 table_len, |
| 60 | enum endianness big_endian); |
| 61 | #endif |
Siew Chin Lim | 954d599 | 2021-03-24 13:11:34 +0800 | [diff] [blame] | 62 | #endif /* _HANDOFF_SOC64_H_ */ |