Patchwork [U-Boot,2/2] MX27: Update to autogenerated asm-offsets.h

login
register
mail settings
Submitter Stefano Babic
Date July 7, 2011, 1:37 p.m.
Message ID <1310045827-14561-2-git-send-email-sbabic@denx.de>
Download mbox | patch
Permalink /patch/103666/
State Accepted
Commit 727024a9a431f717546d696d0872ef5f5934cf5b
Delegated to: Stefano Babic
Headers show

Comments

Stefano Babic - July 7, 2011, 1:37 p.m.
On i.MX27, the asm-offsets.h file is not yet generated as it should be.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Matthias Weisser <weisserm@arcor.de>
---
Changes in V2:
	The patch is based on Matthias Weisser's patch for the
	MX35 that sets the rules into rules.mk

 arch/arm/cpu/arm926ejs/mx27/Makefile         |    2 +
 arch/arm/cpu/arm926ejs/mx27/asm-offsets.c    |   45 ++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx27/asm-offsets.h |   16 ---------
 3 files changed, 47 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/mx27/asm-offsets.c
 delete mode 100644 arch/arm/include/asm/arch-mx27/asm-offsets.h
Wolfgang Denk - Sept. 5, 2011, 1:13 p.m.
Dear Stefano Babic,

In message <1310045827-14561-2-git-send-email-sbabic@denx.de> you wrote:
> On i.MX27, the asm-offsets.h file is not yet generated as it should be.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Matthias Weisser <weisserm@arcor.de>

This commit breaks out-of-tree building of all i.MX27 boards:

MAKEALL_LOGDIR=/work/wd/tmp-arm-LOG \
BUILD_DIR=/work/wd/tmp-arm \
./MAKEALL imx27lite
Configuring for imx27lite board...
make[1]: *** No rule to make target `/home/wd/git/u-boot/work/include/autoconf.mk.dep', needed by
`/home/wd/git/u-boot/work/include/asm/arch/asm-offsets.h'.  Stop.
make: *** [/work/wd/tmp-arm/arch/arm/cpu/arm926ejs/mx27/libmx27.o] Error 2
make: *** Waiting for unfinished jobs....
arm-linux-size: '/work/wd/tmp-arm/u-boot': No such file


Can you please have a look?

Thanks.

Wolfgang Denk
Stefano Babic - Sept. 5, 2011, 1:30 p.m.
On 09/05/2011 03:13 PM, Wolfgang Denk wrote:
> Dear Stefano Babic,
> 
> In message <1310045827-14561-2-git-send-email-sbabic@denx.de> you wrote:
>> On i.MX27, the asm-offsets.h file is not yet generated as it should be.
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
>> CC: Matthias Weisser <weisserm@arcor.de>
> 
> This commit breaks out-of-tree building of all i.MX27 boards:
> 

It was not exactly this one, but yes, out-of-tree building was broken
adding the asm-offsets.h.

I sent a patch to fix this issue:

http://patchwork.ozlabs.org/patch/112374/

commit 0edf8b5b2fa0d210ebc4d6da0fd1aceeb7e44e47 breaks
building on a different directory with the O= parameter.
The patch will fix this issue, generating always asm-offsets.h before
the other targets.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Matthias Weisser <weisserm@arcor.de>
CC: Wolfgang Denk <wd@denx.de>

This Patch should be reviewed. I have tested it with all architectures
(V2 of my patch broke PowerPc boards !), and I am quite sure it works -
not sure the solution I proposed is the best.

Best regards,
Stefano Babic
Wolfgang Denk - Sept. 5, 2011, 1:38 p.m.
Dear Stefano Babic,

In message <4E64CEE5.8050305@denx.de> you wrote:
>
> > This commit breaks out-of-tree building of all i.MX27 boards:
> 
> It was not exactly this one, but yes, out-of-tree building was broken
> adding the asm-offsets.h.

Well, that's what git bisect says...

> I sent a patch to fix this issue:
> 
> http://patchwork.ozlabs.org/patch/112374/

Will check.

Best regards,

Wolfgang Denk

Patch

diff --git a/arch/arm/cpu/arm926ejs/mx27/Makefile b/arch/arm/cpu/arm926ejs/mx27/Makefile
index 0e112b3..7ac1a21 100644
--- a/arch/arm/cpu/arm926ejs/mx27/Makefile
+++ b/arch/arm/cpu/arm926ejs/mx27/Makefile
@@ -34,6 +34,8 @@  all:	$(obj).depend $(LIB)
 $(LIB):	$(OBJS)
 	$(call cmd_link_o_target, $(OBJS))
 
+$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h
+
 #########################################################################
 
 # defines $(obj).depend target
diff --git a/arch/arm/cpu/arm926ejs/mx27/asm-offsets.c b/arch/arm/cpu/arm926ejs/mx27/asm-offsets.c
new file mode 100644
index 0000000..f3a8d7b
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/mx27/asm-offsets.c
@@ -0,0 +1,45 @@ 
+/*
+ * Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c
+ *
+ * This program is used to generate definitions needed by
+ * assembly language modules.
+ *
+ * We use the technique used in the OSF Mach kernel code:
+ * generate asm statements containing #defines,
+ * compile this file to assembler, and then extract the
+ * #defines from the assembly-language output.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <common.h>
+#include <asm/arch/imx-regs.h>
+
+#include <linux/kbuild.h>
+
+int main(void)
+{
+	DEFINE(AIPI1_PSR0, IMX_AIPI1_BASE + offsetof(struct aipi_regs, psr0));
+	DEFINE(AIPI1_PSR1, IMX_AIPI1_BASE + offsetof(struct aipi_regs, psr1));
+	DEFINE(AIPI2_PSR0, IMX_AIPI2_BASE + offsetof(struct aipi_regs, psr0));
+	DEFINE(AIPI2_PSR1, IMX_AIPI2_BASE + offsetof(struct aipi_regs, psr1));
+
+	DEFINE(CSCR, IMX_PLL_BASE + offsetof(struct pll_regs, cscr));
+	DEFINE(MPCTL0, IMX_PLL_BASE + offsetof(struct pll_regs, mpctl0));
+	DEFINE(SPCTL0, IMX_PLL_BASE + offsetof(struct pll_regs, spctl0));
+	DEFINE(PCDR0, IMX_PLL_BASE + offsetof(struct pll_regs, pcdr0));
+	DEFINE(PCDR1, IMX_PLL_BASE + offsetof(struct pll_regs, pcdr1));
+	DEFINE(PCCR0, IMX_PLL_BASE + offsetof(struct pll_regs, pccr0));
+	DEFINE(PCCR1, IMX_PLL_BASE + offsetof(struct pll_regs, pccr1));
+
+	DEFINE(ESDCTL0_ROF, offsetof(struct esdramc_regs, esdctl0));
+	DEFINE(ESDCFG0_ROF, offsetof(struct esdramc_regs, esdcfg0));
+	DEFINE(ESDCTL1_ROF, offsetof(struct esdramc_regs, esdctl1));
+	DEFINE(ESDCFG1_ROF, offsetof(struct esdramc_regs, esdcfg1));
+	DEFINE(ESDMISC_ROF, offsetof(struct esdramc_regs, esdmisc));
+
+	return 0;
+}
diff --git a/arch/arm/include/asm/arch-mx27/asm-offsets.h b/arch/arm/include/asm/arch-mx27/asm-offsets.h
deleted file mode 100644
index 497afe5..0000000
--- a/arch/arm/include/asm/arch-mx27/asm-offsets.h
+++ /dev/null
@@ -1,16 +0,0 @@ 
-#define AIPI1_PSR0	0x10000000
-#define AIPI1_PSR1	0x10000004
-#define AIPI2_PSR0	0x10020000
-#define AIPI2_PSR1	0x10020004
-#define CSCR		0x10027000
-#define MPCTL0		0x10027004
-#define SPCTL0		0x1002700c
-#define PCDR0		0x10027018
-#define PCDR1		0x1002701c
-#define PCCR0		0x10027020
-#define PCCR1		0x10027024
-#define ESDCTL0_ROF	0x00
-#define ESDCFG0_ROF	0x04
-#define ESDCTL1_ROF	0x08
-#define ESDCFG1_ROF	0x0C
-#define ESDMISC_ROF	0x10