Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c |
| 4 | * |
| 5 | * This program is used to generate definitions needed by |
| 6 | * assembly language modules. |
| 7 | * |
| 8 | * We use the technique used in the OSF Mach kernel code: |
| 9 | * generate asm statements containing #defines, |
| 10 | * compile this file to assembler, and then extract the |
| 11 | * #defines from the assembly-language output. |
Abdellatif El Khlifi | 0b77c1d | 2023-08-04 14:33:37 +0100 | [diff] [blame] | 12 | * |
| 13 | * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 14 | * |
| 15 | * Authors: |
| 16 | * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 17 | */ |
| 18 | |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 19 | #include <linux/kbuild.h> |
Masahiro Yamada | e8ead73 | 2017-04-14 11:10:23 +0900 | [diff] [blame] | 20 | #include <linux/arm-smccc.h> |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 21 | |
Tom Rini | 31df83b | 2022-11-19 18:45:27 -0500 | [diff] [blame] | 22 | #if defined(CONFIG_MX51) || defined(CONFIG_MX53) |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 23 | #include <asm/arch/imx-regs.h> |
| 24 | #endif |
| 25 | |
| 26 | int main(void) |
| 27 | { |
| 28 | /* |
| 29 | * TODO : Check if each entry in this file is really necessary. |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 30 | * - struct esdramc_regs |
| 31 | * - struct max_regs |
| 32 | * - struct aips_regs |
| 33 | * - struct aipi_regs |
| 34 | * - struct clkctl |
| 35 | * - struct dpll |
| 36 | * are used only for generating asm-offsets.h. |
| 37 | * It means their offset addresses are referenced only from assembly |
| 38 | * code. Is it better to define the macros directly in headers? |
| 39 | */ |
| 40 | |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 41 | #if defined(CONFIG_MX51) || defined(CONFIG_MX53) |
| 42 | /* Round up to make sure size gives nice stack alignment */ |
| 43 | DEFINE(CLKCTL_CCMR, offsetof(struct clkctl, ccr)); |
| 44 | DEFINE(CLKCTL_CCDR, offsetof(struct clkctl, ccdr)); |
| 45 | DEFINE(CLKCTL_CSR, offsetof(struct clkctl, csr)); |
| 46 | DEFINE(CLKCTL_CCSR, offsetof(struct clkctl, ccsr)); |
| 47 | DEFINE(CLKCTL_CACRR, offsetof(struct clkctl, cacrr)); |
| 48 | DEFINE(CLKCTL_CBCDR, offsetof(struct clkctl, cbcdr)); |
| 49 | DEFINE(CLKCTL_CBCMR, offsetof(struct clkctl, cbcmr)); |
| 50 | DEFINE(CLKCTL_CSCMR1, offsetof(struct clkctl, cscmr1)); |
| 51 | DEFINE(CLKCTL_CSCMR2, offsetof(struct clkctl, cscmr2)); |
| 52 | DEFINE(CLKCTL_CSCDR1, offsetof(struct clkctl, cscdr1)); |
| 53 | DEFINE(CLKCTL_CS1CDR, offsetof(struct clkctl, cs1cdr)); |
| 54 | DEFINE(CLKCTL_CS2CDR, offsetof(struct clkctl, cs2cdr)); |
| 55 | DEFINE(CLKCTL_CDCDR, offsetof(struct clkctl, cdcdr)); |
| 56 | DEFINE(CLKCTL_CHSCCDR, offsetof(struct clkctl, chsccdr)); |
| 57 | DEFINE(CLKCTL_CSCDR2, offsetof(struct clkctl, cscdr2)); |
| 58 | DEFINE(CLKCTL_CSCDR3, offsetof(struct clkctl, cscdr3)); |
| 59 | DEFINE(CLKCTL_CSCDR4, offsetof(struct clkctl, cscdr4)); |
| 60 | DEFINE(CLKCTL_CWDR, offsetof(struct clkctl, cwdr)); |
| 61 | DEFINE(CLKCTL_CDHIPR, offsetof(struct clkctl, cdhipr)); |
| 62 | DEFINE(CLKCTL_CDCR, offsetof(struct clkctl, cdcr)); |
| 63 | DEFINE(CLKCTL_CTOR, offsetof(struct clkctl, ctor)); |
| 64 | DEFINE(CLKCTL_CLPCR, offsetof(struct clkctl, clpcr)); |
| 65 | DEFINE(CLKCTL_CISR, offsetof(struct clkctl, cisr)); |
| 66 | DEFINE(CLKCTL_CIMR, offsetof(struct clkctl, cimr)); |
| 67 | DEFINE(CLKCTL_CCOSR, offsetof(struct clkctl, ccosr)); |
| 68 | DEFINE(CLKCTL_CGPR, offsetof(struct clkctl, cgpr)); |
| 69 | DEFINE(CLKCTL_CCGR0, offsetof(struct clkctl, ccgr0)); |
| 70 | DEFINE(CLKCTL_CCGR1, offsetof(struct clkctl, ccgr1)); |
| 71 | DEFINE(CLKCTL_CCGR2, offsetof(struct clkctl, ccgr2)); |
| 72 | DEFINE(CLKCTL_CCGR3, offsetof(struct clkctl, ccgr3)); |
| 73 | DEFINE(CLKCTL_CCGR4, offsetof(struct clkctl, ccgr4)); |
| 74 | DEFINE(CLKCTL_CCGR5, offsetof(struct clkctl, ccgr5)); |
| 75 | DEFINE(CLKCTL_CCGR6, offsetof(struct clkctl, ccgr6)); |
| 76 | DEFINE(CLKCTL_CMEOR, offsetof(struct clkctl, cmeor)); |
| 77 | #if defined(CONFIG_MX53) |
| 78 | DEFINE(CLKCTL_CCGR7, offsetof(struct clkctl, ccgr7)); |
| 79 | #endif |
| 80 | |
| 81 | /* DPLL */ |
| 82 | DEFINE(PLL_DP_CTL, offsetof(struct dpll, dp_ctl)); |
| 83 | DEFINE(PLL_DP_CONFIG, offsetof(struct dpll, dp_config)); |
| 84 | DEFINE(PLL_DP_OP, offsetof(struct dpll, dp_op)); |
| 85 | DEFINE(PLL_DP_MFD, offsetof(struct dpll, dp_mfd)); |
| 86 | DEFINE(PLL_DP_MFN, offsetof(struct dpll, dp_mfn)); |
| 87 | DEFINE(PLL_DP_HFS_OP, offsetof(struct dpll, dp_hfs_op)); |
| 88 | DEFINE(PLL_DP_HFS_MFD, offsetof(struct dpll, dp_hfs_mfd)); |
| 89 | DEFINE(PLL_DP_HFS_MFN, offsetof(struct dpll, dp_hfs_mfn)); |
| 90 | #endif |
| 91 | |
Masahiro Yamada | e8ead73 | 2017-04-14 11:10:23 +0900 | [diff] [blame] | 92 | #ifdef CONFIG_ARM_SMCCC |
| 93 | DEFINE(ARM_SMCCC_RES_X0_OFFS, offsetof(struct arm_smccc_res, a0)); |
| 94 | DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2)); |
| 95 | DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offsetof(struct arm_smccc_quirk, id)); |
| 96 | DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_quirk, state)); |
Abdellatif El Khlifi | 0b77c1d | 2023-08-04 14:33:37 +0100 | [diff] [blame] | 97 | #ifdef CONFIG_ARM64 |
| 98 | DEFINE(ARM_SMCCC_1_2_REGS_X0_OFFS, offsetof(struct arm_smccc_1_2_regs, a0)); |
| 99 | DEFINE(ARM_SMCCC_1_2_REGS_X2_OFFS, offsetof(struct arm_smccc_1_2_regs, a2)); |
| 100 | DEFINE(ARM_SMCCC_1_2_REGS_X4_OFFS, offsetof(struct arm_smccc_1_2_regs, a4)); |
| 101 | DEFINE(ARM_SMCCC_1_2_REGS_X6_OFFS, offsetof(struct arm_smccc_1_2_regs, a6)); |
| 102 | DEFINE(ARM_SMCCC_1_2_REGS_X8_OFFS, offsetof(struct arm_smccc_1_2_regs, a8)); |
| 103 | DEFINE(ARM_SMCCC_1_2_REGS_X10_OFFS, offsetof(struct arm_smccc_1_2_regs, a10)); |
| 104 | DEFINE(ARM_SMCCC_1_2_REGS_X12_OFFS, offsetof(struct arm_smccc_1_2_regs, a12)); |
| 105 | DEFINE(ARM_SMCCC_1_2_REGS_X14_OFFS, offsetof(struct arm_smccc_1_2_regs, a14)); |
| 106 | DEFINE(ARM_SMCCC_1_2_REGS_X16_OFFS, offsetof(struct arm_smccc_1_2_regs, a16)); |
| 107 | #endif |
Masahiro Yamada | e8ead73 | 2017-04-14 11:10:23 +0900 | [diff] [blame] | 108 | #endif |
| 109 | |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 110 | return 0; |
| 111 | } |