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. |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <common.h> |
| 15 | #include <linux/kbuild.h> |
Masahiro Yamada | e8ead73 | 2017-04-14 11:10:23 +0900 | [diff] [blame] | 16 | #include <linux/arm-smccc.h> |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 17 | |
Tom Rini | 31df83b | 2022-11-19 18:45:27 -0500 | [diff] [blame] | 18 | #if defined(CONFIG_MX51) || defined(CONFIG_MX53) |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 19 | #include <asm/arch/imx-regs.h> |
| 20 | #endif |
| 21 | |
| 22 | int main(void) |
| 23 | { |
| 24 | /* |
| 25 | * TODO : Check if each entry in this file is really necessary. |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 26 | * - struct esdramc_regs |
| 27 | * - struct max_regs |
| 28 | * - struct aips_regs |
| 29 | * - struct aipi_regs |
| 30 | * - struct clkctl |
| 31 | * - struct dpll |
| 32 | * are used only for generating asm-offsets.h. |
| 33 | * It means their offset addresses are referenced only from assembly |
| 34 | * code. Is it better to define the macros directly in headers? |
| 35 | */ |
| 36 | |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 37 | #if defined(CONFIG_MX51) || defined(CONFIG_MX53) |
| 38 | /* Round up to make sure size gives nice stack alignment */ |
| 39 | DEFINE(CLKCTL_CCMR, offsetof(struct clkctl, ccr)); |
| 40 | DEFINE(CLKCTL_CCDR, offsetof(struct clkctl, ccdr)); |
| 41 | DEFINE(CLKCTL_CSR, offsetof(struct clkctl, csr)); |
| 42 | DEFINE(CLKCTL_CCSR, offsetof(struct clkctl, ccsr)); |
| 43 | DEFINE(CLKCTL_CACRR, offsetof(struct clkctl, cacrr)); |
| 44 | DEFINE(CLKCTL_CBCDR, offsetof(struct clkctl, cbcdr)); |
| 45 | DEFINE(CLKCTL_CBCMR, offsetof(struct clkctl, cbcmr)); |
| 46 | DEFINE(CLKCTL_CSCMR1, offsetof(struct clkctl, cscmr1)); |
| 47 | DEFINE(CLKCTL_CSCMR2, offsetof(struct clkctl, cscmr2)); |
| 48 | DEFINE(CLKCTL_CSCDR1, offsetof(struct clkctl, cscdr1)); |
| 49 | DEFINE(CLKCTL_CS1CDR, offsetof(struct clkctl, cs1cdr)); |
| 50 | DEFINE(CLKCTL_CS2CDR, offsetof(struct clkctl, cs2cdr)); |
| 51 | DEFINE(CLKCTL_CDCDR, offsetof(struct clkctl, cdcdr)); |
| 52 | DEFINE(CLKCTL_CHSCCDR, offsetof(struct clkctl, chsccdr)); |
| 53 | DEFINE(CLKCTL_CSCDR2, offsetof(struct clkctl, cscdr2)); |
| 54 | DEFINE(CLKCTL_CSCDR3, offsetof(struct clkctl, cscdr3)); |
| 55 | DEFINE(CLKCTL_CSCDR4, offsetof(struct clkctl, cscdr4)); |
| 56 | DEFINE(CLKCTL_CWDR, offsetof(struct clkctl, cwdr)); |
| 57 | DEFINE(CLKCTL_CDHIPR, offsetof(struct clkctl, cdhipr)); |
| 58 | DEFINE(CLKCTL_CDCR, offsetof(struct clkctl, cdcr)); |
| 59 | DEFINE(CLKCTL_CTOR, offsetof(struct clkctl, ctor)); |
| 60 | DEFINE(CLKCTL_CLPCR, offsetof(struct clkctl, clpcr)); |
| 61 | DEFINE(CLKCTL_CISR, offsetof(struct clkctl, cisr)); |
| 62 | DEFINE(CLKCTL_CIMR, offsetof(struct clkctl, cimr)); |
| 63 | DEFINE(CLKCTL_CCOSR, offsetof(struct clkctl, ccosr)); |
| 64 | DEFINE(CLKCTL_CGPR, offsetof(struct clkctl, cgpr)); |
| 65 | DEFINE(CLKCTL_CCGR0, offsetof(struct clkctl, ccgr0)); |
| 66 | DEFINE(CLKCTL_CCGR1, offsetof(struct clkctl, ccgr1)); |
| 67 | DEFINE(CLKCTL_CCGR2, offsetof(struct clkctl, ccgr2)); |
| 68 | DEFINE(CLKCTL_CCGR3, offsetof(struct clkctl, ccgr3)); |
| 69 | DEFINE(CLKCTL_CCGR4, offsetof(struct clkctl, ccgr4)); |
| 70 | DEFINE(CLKCTL_CCGR5, offsetof(struct clkctl, ccgr5)); |
| 71 | DEFINE(CLKCTL_CCGR6, offsetof(struct clkctl, ccgr6)); |
| 72 | DEFINE(CLKCTL_CMEOR, offsetof(struct clkctl, cmeor)); |
| 73 | #if defined(CONFIG_MX53) |
| 74 | DEFINE(CLKCTL_CCGR7, offsetof(struct clkctl, ccgr7)); |
| 75 | #endif |
| 76 | |
| 77 | /* DPLL */ |
| 78 | DEFINE(PLL_DP_CTL, offsetof(struct dpll, dp_ctl)); |
| 79 | DEFINE(PLL_DP_CONFIG, offsetof(struct dpll, dp_config)); |
| 80 | DEFINE(PLL_DP_OP, offsetof(struct dpll, dp_op)); |
| 81 | DEFINE(PLL_DP_MFD, offsetof(struct dpll, dp_mfd)); |
| 82 | DEFINE(PLL_DP_MFN, offsetof(struct dpll, dp_mfn)); |
| 83 | DEFINE(PLL_DP_HFS_OP, offsetof(struct dpll, dp_hfs_op)); |
| 84 | DEFINE(PLL_DP_HFS_MFD, offsetof(struct dpll, dp_hfs_mfd)); |
| 85 | DEFINE(PLL_DP_HFS_MFN, offsetof(struct dpll, dp_hfs_mfn)); |
| 86 | #endif |
| 87 | |
Masahiro Yamada | e8ead73 | 2017-04-14 11:10:23 +0900 | [diff] [blame] | 88 | #ifdef CONFIG_ARM_SMCCC |
| 89 | DEFINE(ARM_SMCCC_RES_X0_OFFS, offsetof(struct arm_smccc_res, a0)); |
| 90 | DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2)); |
| 91 | DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offsetof(struct arm_smccc_quirk, id)); |
| 92 | DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_quirk, state)); |
| 93 | #endif |
| 94 | |
Masahiro Yamada | 8226dfd | 2014-03-18 16:38:13 +0900 | [diff] [blame] | 95 | return 0; |
| 96 | } |