blob: 9afd837599961aca706371da9adfffb4a872a799 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada8226dfd2014-03-18 16:38:13 +09002/*
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 Khlifi0b77c1d2023-08-04 14:33:37 +010012 *
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 Yamada8226dfd2014-03-18 16:38:13 +090017 */
18
Masahiro Yamada8226dfd2014-03-18 16:38:13 +090019#include <linux/kbuild.h>
Masahiro Yamadae8ead732017-04-14 11:10:23 +090020#include <linux/arm-smccc.h>
Masahiro Yamada8226dfd2014-03-18 16:38:13 +090021
Tom Rini31df83b2022-11-19 18:45:27 -050022#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
Masahiro Yamada8226dfd2014-03-18 16:38:13 +090023#include <asm/arch/imx-regs.h>
24#endif
25
26int main(void)
27{
28 /*
29 * TODO : Check if each entry in this file is really necessary.
Masahiro Yamada8226dfd2014-03-18 16:38:13 +090030 * - 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 Yamada8226dfd2014-03-18 16:38:13 +090041#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 Yamadae8ead732017-04-14 11:10:23 +090092#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 Khlifi0b77c1d2023-08-04 14:33:37 +010097#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 Yamadae8ead732017-04-14 11:10:23 +0900108#endif
109
Masahiro Yamada8226dfd2014-03-18 16:38:13 +0900110 return 0;
111}