Add support for zmx25 board
Subsystems (5)
cover Add support for zmx25 board
zmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash and an optional NAND flash. Some additons to imx25 SoC are made to fully support the hardware on the board.
Matthias Weisser (5):
imx: Add get_tbclk() function for imx25
imx: Use correct imx25 reset.c
imx: Add support for USB EHCI on imx25
imx: Add auto generation of asm-offsets.h for imx25
imx: Add support for zmx25 board
MAINTAINERS | 1 + arch/arm/cpu/arm926ejs/mx25/Makefile | 19 ++- arch/arm/cpu/arm926ejs/mx25/asm-offsets.c | 60 ++++++++ arch/arm/cpu/arm926ejs/mx25/timer.c | 12 ++ arch/arm/include/asm/arch-mx25/imx-regs.h | 39 ++++++ board/syteco/zmx25/Makefile | 51 +++++++ board/syteco/zmx25/lowlevel_init.S | 136 +++++++++++++++++++ board/syteco/zmx25/zmx25.c | 209 +++++++++++++++++++++++++++++ boards.cfg | 1 + drivers/usb/host/ehci-mxc.c | 28 ++++- include/configs/zmx25.h | 182 +++++++++++++++++++++++++ 11 files changed, 732 insertions(+), 6 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mx25/asm-offsets.c create mode 100644 board/syteco/zmx25/Makefile create mode 100644 board/syteco/zmx25/lowlevel_init.S create mode 100644 board/syteco/zmx25/zmx25.c create mode 100644 include/configs/zmx25.h
PATCH 1/5 imx: Add get_tbclk() function for imx25
Need this function for autoboot keyd
--- arch/arm/cpu/arm926ejs/mx25/timer.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/mx25/timer.c +12 -0
@@ -187,3 +187,15 @@ void __udelay (unsigned long usec)while (get_ticks () < tmp)/* loop till event */ /*NOP*/ ; } + +/* +* This function is derived from PowerPC code (timebase clock frequency). +* On ARM it returns the number of timer ticks per second. +*/ +ulong get_tbclk (void ) +{ +ulong tbclk; + + tbclk =CONFIG_MX25_CLK32 ; +return tbclk; +}
Signature · 1 line
1.7.0.4
PATCH 1/5 imx: Add get_tbclk() function for imx25
Quoted 2 lines · Matthias Weisser
Need this function for autoboot keyd
Hi Matthias,
arch/arm/cpu/arm926ejs/mx25/timer.c void __udelay (unsigned long usec) · line 201
Quoted 11 lines
arch/arm/cpu/arm926ejs/mx25/timer.c +11
-0+/* +* This function is derived from PowerPC code (timebase clock frequency). +* On ARM it returns the number of timer ticks per second. +*/ +ulong get_tbclk (void ) +{ +ulong tbclk; + + tbclk =CONFIG_MX25_CLK32 ; +return tbclk; +}
Which is the advantage to add this function instead using directly CONFIG_MX25_CLK32 in the caller ? It is not me so clear..
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 1/5 imx: Add get_tbclk() function for imx25
Hi Stefano
Am 30.06.2011 17:38, schrieb Stefano Babic:
Quoted 6 lines · Matthias Weisser
Quoted 2 lines
Need this function for autoboot keyd
Hi Matthias,
Quoted 14 lines
arch/arm/cpu/arm926ejs/mx25/timer.c void __udelay (unsigned long usec) · line 201
Quoted 11 lines
arch/arm/cpu/arm926ejs/mx25/timer.c +11
-0+/* +* This function is derived from PowerPC code (timebase clock frequency). +* On ARM it returns the number of timer ticks per second. +*/ +ulong get_tbclk (void ) +{ +ulong tbclk; + + tbclk =CONFIG_MX25_CLK32 ; +return tbclk; +}Which is the advantage to add this function instead using directly
CONFIG_MX25_CLK32in the caller ? It is not me so clear..
The caller is in common code (see common/main.c line 76 -> 97). I think if I add CONFIG_MX25_CLK32 there whis will break a couple of boards which I don't want to. ;-)
Also, we will have all this stuff cleaned up when the timer redesign comes in.
Regards,
Matthias
PATCH 2/5 imx: Use correct imx25 reset.c
In reply to Matthias Weisserimx25 used the wrong reset.c from imx27
--- arch/arm/cpu/arm926ejs/mx25/Makefile | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
arch/arm/cpu/arm926ejs/mx25/Makefile +15 -4
@@ -24,18 +24,18 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = generic.o timer.o -MX27OBJS = reset.o +COBJS = generic.o timer.o reset.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -SRCS += $(addprefix $(SRCTREE)/arch/arm/cpu/arm926ejs/mx27/,$(MX27OBJS:.o=.c)) -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS) $(MX27OBJS)) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) all: $(obj).depend $(LIB) $(LIB): $(OBJS) $(call cmd_link_o_target, $(OBJS)) +$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h + ######################################################################### # defines $(obj).depend target
@@ -44,3 +44,14 @@ include $(SRCTREE)/rules.mk sinclude $(obj).depend ######################################################################### + +$(TOPDIR)/include/asm/arch/asm-offsets.h: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.s + @echo Generating $@ + $(TOPDIR)/tools/scripts/make-asm-offsets ./asm-offsets.s $@ + +asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.c + $(CC) -DDO_DEPS_ONLY \ + $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ + -o $@ ./asm-offsets.c -c -S
Signature · 1 line
1.7.0.4
Wolfgang Denk
NAKPATCH 2/5 imx: Use correct imx25 reset.c
Dear Matthias Weisser,
Quoted 40 lines · In message <[email protected]> you wrote:
imx25 used the wrong
reset.cfrom imx27Signed-off-by Matthias Weisser <[email protected]>--- arch/arm/cpu/arm926ejs/mx25/Makefile | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)arch/arm/cpu/arm926ejs/mx25/Makefile +5
-4@@ -24,18 +24,18 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = generic.o timer.o -MX27OBJS = reset.o +COBJS = generic.o timer.o reset.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -SRCS += $(addprefix $(SRCTREE)/arch/arm/cpu/arm926ejs/mx27/,$(MX27OBJS:.o=.c)) -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS) $(MX27OBJS)) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) all: $(obj).depend $(LIB) $(LIB): $(OBJS) $(call cmd_link_o_target, $(OBJS)) +$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h + ######################################################################### # defines $(obj).depend target@@ -44,3 +44,14 @@ include $(SRCTREE)/rules.mk sinclude $(obj).depend ######################################################################### +
arch/arm/cpu/arm926ejs/mx25/Makefile include $(SRCTREE)/rules.mk · line 57
Quoted 10 lines
arch/arm/cpu/arm926ejs/mx25/Makefile +10
-0+$(TOPDIR)/include/asm/arch/asm-offsets.h: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.s + @echo Generating $@ + $(TOPDIR)/tools/scripts/make-asm-offsets ./asm-offsets.s $@ + +asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.c + $(CC) -DDO_DEPS_ONLY \ + $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ + -o $@ ./asm-offsets.c -c -S
NAK.
See previous comments to Setano's postings. It makes no sense to copy identical lines into a large number of Makefiles.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Uncertain fortune is thoroughly mastered by the equity of the calcu- lation. - Blaise Pascal
PATCH 2/5 imx: Use correct imx25 reset.c
Hello Wolfgang
Am 30.06.2011 12:46, schrieb Wolfgang Denk:
Quoted 15 lines
arch/arm/cpu/arm926ejs/mx25/Makefile include $(SRCTREE)/rules.mk
Quoted 12 lines
arch/arm/cpu/arm926ejs/mx25/Makefile +11
-1+ +$(TOPDIR)/include/asm/arch/asm-offsets.h: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.s + @echo Generating $@ + $(TOPDIR)/tools/scripts/make-asm-offsets ./asm-offsets.s $@ + +asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.c + $(CC) -DDO_DEPS_ONLY \ + $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ + -o $@ ./asm-offsets.c -c -S --NAK.
Quoted 2 lines
See previous comments to Setano's postings. It makes no sense to copy identical lines into a large number of Makefiles.
OK. I will address this point in a v2 of the series.
Matthias
PATCH 2/5 imx: Use correct imx25 reset.c
In reply to Matthias WeisserDear Matthias Weisser,
Quoted 40 lines · In message <[email protected]> you wrote:
imx25 used the wrong
reset.cfrom imx27Signed-off-by Matthias Weisser <[email protected]>--- arch/arm/cpu/arm926ejs/mx25/Makefile | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)arch/arm/cpu/arm926ejs/mx25/Makefile +5
-4@@ -24,18 +24,18 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = generic.o timer.o -MX27OBJS = reset.o +COBJS = generic.o timer.o reset.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -SRCS += $(addprefix $(SRCTREE)/arch/arm/cpu/arm926ejs/mx27/,$(MX27OBJS:.o=.c)) -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS) $(MX27OBJS)) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) all: $(obj).depend $(LIB) $(LIB): $(OBJS) $(call cmd_link_o_target, $(OBJS)) +$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h + ######################################################################### # defines $(obj).depend target@@ -44,3 +44,14 @@ include $(SRCTREE)/rules.mk sinclude $(obj).depend ######################################################################### +
arch/arm/cpu/arm926ejs/mx25/Makefile include $(SRCTREE)/rules.mk · line 57
Quoted 10 lines
arch/arm/cpu/arm926ejs/mx25/Makefile +10
-0+$(TOPDIR)/include/asm/arch/asm-offsets.h: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.s + @echo Generating $@ + $(TOPDIR)/tools/scripts/make-asm-offsets ./asm-offsets.s $@ + +asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.c + $(CC) -DDO_DEPS_ONLY \ + $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ + -o $@ ./asm-offsets.c -c -S
Also, the asm-offset change is unrelated to the other change mentioned in your commit message. These needs to be split into two separate commits.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Bus error -- please leave by the rear door.
PATCH 2/5 imx: Use correct imx25 reset.c
Hello Wolfgang
Am 30.06.2011 12:49, schrieb Wolfgang Denk:
Quoted 17 lines
Quoted 17 lines
+$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h
arch/arm/cpu/arm926ejs/mx25/Makefile +9
-0+ ######################################################################### # defines $(obj).depend target@@ -44,3 +44,14 @@ include $(SRCTREE)/rules.mk sinclude $(obj).depend ######################################################################### + +$(TOPDIR)/include/asm/arch/asm-offsets.h: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.s + @echo Generating $@ + $(TOPDIR)/tools/scripts/make-asm-offsets ./asm-offsets.s $@ + +asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + ./asm-offsets.c
Quoted 8 lines
arch/arm/cpu/arm926ejs/mx25/Makefile include $(SRCTREE)/rules.mk
Quoted 4 lines
arch/arm/cpu/arm926ejs/mx25/Makefile +3
-1+ $(CC) -DDO_DEPS_ONLY \ + $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ + -o $@ ./asm-offsets.c -c -S --Also, the asm-offset change is unrelated to the other change mentioned in your commit message. These needs to be split into two separate commits.
You are right. That came in by accident. It should have been added in 4/5 of the series. Will fix this in a v2.
Matthias
PATCH 3/5 imx: Add support for USB EHCI on imx25
In reply to Matthias WeisserAdding support for USB host on imx25 using the internal PHY
--- drivers/usb/host/ehci-mxc.c | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-mxc.c +26 -2
@@ -29,6 +29,14 @@#define USBCTRL_OTGBASE_OFFSET 0x600 +#ifdef CONFIG_MX25 +#define MX25_USB_CTRL_IP_PUE_DOWN_BIT (1<<6) +#define MX25_USB_CTRL_HSTD_BIT (1<<5) +#define MX25_USB_CTRL_USBTE_BIT (1<<4) +#define MX25_USB_CTRL_OCPOL_OTG_BIT (1<<3) +#endif + +#ifdef CONFIG_MX31 #define MX31_OTG_SIC_SHIFT 29#define MX31_OTG_SIC_MASK (0x3 << MX31_OTG_SIC_SHIFT)#define MX31_OTG_PM_BIT (1 << 24)
@@ -42,10 +50,19 @@#define MX31_H1_SIC_MASK (0x3 << MX31_H1_SIC_SHIFT)#define MX31_H1_PM_BIT (1 << 8)#define MX31_H1_DT_BIT (1 << 4) +#endif static int mxc_set_usbcontrol (int port,unsigned int flags) {unsigned int v; + +#ifdef CONFIG_MX25 + v =MX25_USB_CTRL_IP_PUE_DOWN_BIT |MX25_USB_CTRL_HSTD_BIT | +MX25_USB_CTRL_USBTE_BIT |MX25_USB_CTRL_OCPOL_OTG_BIT ; + +writel (v,IMX_USB_BASE +USBCTRL_OTGBASE_OFFSET ); +#endif +#ifdef CONFIG_MX31 v =readl (MX31_OTG_BASE_ADDR +USBCTRL_OTGBASE_OFFSET );
@@ -94,27 +111,34 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)int ehci_hcd_init (void ) { -u32 tmp;struct usb_ehci *ehci; +#ifdef CONFIG_MX31 +u32 tmp;struct clock_control_regs *sc_regs = (struct clock_control_regs *)CCM_BASE ; tmp =__raw_readl (&sc_regs->ccmr);__raw_writel (__raw_readl (&sc_regs->ccmr) | (1 <<9 ), &sc_regs->ccmr) ; +#endif udelay (80 );/* Take USB2 */ +#ifdef CONFIG_MX25 + ehci = (struct usb_ehci *)(IMX_USB_BASE + +#else ehci = (struct usb_ehci *)(MX31_OTG_BASE_ADDR + +#endif (0x200 * CONFIG_MXC_USB_PORT)); hccr = (struct ehci_hccr *)((uint32_t )&ehci->caplength); hcor = (struct ehci_hcor *)((uint32_t ) hccr +HC_LENGTH (ehci_readl (&hccr->cr_capbase)));setbits_le32 (&ehci->usbmode,CM_HOST ); +#ifdef CONFIG_MX31 setbits_le32 (&ehci->control,USB_EN );__raw_writel (CONFIG_MXC_USB_PORTSC , &ehci->portsc); - +#endif mxc_set_usbcontrol (CONFIG_MXC_USB_PORT ,CONFIG_MXC_USB_FLAGS );udelay (10000 );
Signature · 1 line
1.7.0.4
PATCH 3/5 imx: Add support for USB EHCI on imx25
Quoted 4 lines · Matthias Weisser
Adding support for USB host on imx25 using the internal PHY
Signed-off-by Matthias Weisser <[email protected]>---
Hi Matthias,
Quoted 12 lines
drivers/usb/host/ehci-mxc.c +8
-0+#ifdef CONFIG_MX25 +#define MX25_USB_CTRL_IP_PUE_DOWN_BIT (1<<6) +#define MX25_USB_CTRL_HSTD_BIT (1<<5) +#define MX25_USB_CTRL_USBTE_BIT (1<<4) +#define MX25_USB_CTRL_OCPOL_OTG_BIT (1<<3) +#endif + +#ifdef CONFIG_MX31 #define MX31_OTG_SIC_SHIFT 29#define MX31_OTG_SIC_MASK (0x3 << MX31_OTG_SIC_SHIFT)#define MX31_OTG_PM_BIT (1 << 24)
drivers/usb/host/ehci-mxc.c line 53
Quoted 4 lines
drivers/usb/host/ehci-mxc.c +1
-0@@ -42,10 +50,19 @@#define MX31_H1_SIC_MASK (0x3 << MX31_H1_SIC_SHIFT)#define MX31_H1_PM_BIT (1 << 8)#define MX31_H1_DT_BIT (1 << 4) +#endif
Can we try to get rid of nasty #ifdef ? I am sure, we would have in future support for at least MX5, and if we add a special handling for each SOC this file will become unreadable.
It seems to me that in most cases we can do it using the same names.
drivers/usb/host/ehci-mxc.c static int mxc_set_usbcontrol(int port, unsigned int flags) · line 131
Quoted 7 lines
drivers/usb/host/ehci-mxc.c +4
-0/* Take USB2 */ +#ifdef CONFIG_MX25 + ehci = (struct usb_ehci *)(IMX_USB_BASE + +#else ehci = (struct usb_ehci *)(MX31_OTG_BASE_ADDR + +#endif
For example, here we can have a CONFIG_MXB_USB_BASE (or something like this), without adding #ifdef. I do not know if we can get completely get rid of them, but it is worth to try.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 3/5 imx: Add support for USB EHCI on imx25
Quoted 27 lines · Stefano Babic
Quoted 4 lines · Matthias Weisser
Adding support for USB host on imx25 using the internal PHY
Signed-off-by Matthias Weisser <[email protected]>---
Hi Matthias,
Quoted 19 lines
drivers/usb/host/ehci-mxc.c +8
-0+#ifdef CONFIG_MX25 +#define MX25_USB_CTRL_IP_PUE_DOWN_BIT (1<<6) +#define MX25_USB_CTRL_HSTD_BIT (1<<5) +#define MX25_USB_CTRL_USBTE_BIT (1<<4) +#define MX25_USB_CTRL_OCPOL_OTG_BIT (1<<3) +#endif + +#ifdef CONFIG_MX31 #define MX31_OTG_SIC_SHIFT 29#define MX31_OTG_SIC_MASK (0x3 << MX31_OTG_SIC_SHIFT)#define MX31_OTG_PM_BIT (1 << 24)@@ -42,10 +50,19 @@#define MX31_H1_SIC_MASK (0x3 << MX31_H1_SIC_SHIFT)#define MX31_H1_PM_BIT (1 << 8)#define MX31_H1_DT_BIT (1 << 4)
Quoted 5 lines
Review line 55
Quoted 1 line
(quoted diff) +1
-0+#endifCan we try to get rid of nasty #ifdef ? I am sure, we would have in future support for at least MX5, and if we add a special handling for each SOC this file will become unreadable.
... we would have ... if the developer won't hang himself first ;-)
Otherwise, we should probably unify this IMX_USB_BASE stuff indeed. Maybe even compute USBCTRL_OTGBASE_OFFSET on the fly (as imx51 has different offset there).
Quoted 19 lines
It seems to me that in most cases we can do it using the same names.
drivers/usb/host/ehci-mxc.c static int mxc_set_usbcontrol(int port, unsigned int flags)
Quoted 9 lines
drivers/usb/host/ehci-mxc.c +4
-0/* Take USB2 */ +#ifdef CONFIG_MX25 + ehci = (struct usb_ehci *)(IMX_USB_BASE + +#else ehci = (struct usb_ehci *)(MX31_OTG_BASE_ADDR + +#endifFor example, here we can have a
CONFIG_MXB_USB_BASE(or something like this), without adding #ifdef. I do not know if we can get completely get rid of them, but it is worth to try.Best regards,
Stefano Babic
PATCH 4/5 imx: Add auto generation of asm-offsets.h for imx25
In reply to Matthias WeisserOffsets to registers may be needed in asm code. This patch adds automated generation of these offsets form C structures.
--- arch/arm/cpu/arm926ejs/mx25/asm-offsets.c | 60 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx25/imx-regs.h | 39 +++++++++++++++++++ 2 files changed, 99 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mx25/asm-offsets.c
arch/arm/cpu/arm926ejs/mx25/asm-offsets.c new file +60 -0
@@ -0,0 +1,60 @@ +/* +* 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 ) +{ +/* Clock Control Module */ +DEFINE (CCM_CCTL , offsetof(struct ccm_regs , cctl)); +DEFINE (CCM_CGCR0 , offsetof(struct ccm_regs , cgr0)); +DEFINE (CCM_CGCR1 , offsetof(struct ccm_regs , cgr1)); +DEFINE (CCM_CGCR2 , offsetof(struct ccm_regs , cgr2)); + DEFINE(CCM_PCDR2, offsetof(struct ccm_regs, pcdr[2])); +DEFINE (CCM_MCR , offsetof(struct ccm_regs , mcr)); + +/* Enhanced SDRAM Controller */ +DEFINE (ESDRAMC_ESDCTL0 , offsetof(struct esdramc_regs , ctl0)); +DEFINE (ESDRAMC_ESDCFG0 , offsetof(struct esdramc_regs , cfg0)); +DEFINE (ESDRAMC_ESDMISC , offsetof(struct esdramc_regs , misc)); + +/* Multi-Layer AHB Crossbar Switch */ +DEFINE (MAX_MPR0 , offsetof(struct max_regs , mpr0)); +DEFINE (MAX_SGPCR0 , offsetof(struct max_regs , sgpcr0)); +DEFINE (MAX_MPR1 , offsetof(struct max_regs , mpr1)); +DEFINE (MAX_SGPCR1 , offsetof(struct max_regs , sgpcr1)); +DEFINE (MAX_MPR2 , offsetof(struct max_regs , mpr2)); +DEFINE (MAX_SGPCR2 , offsetof(struct max_regs , sgpcr2)); +DEFINE (MAX_MPR3 , offsetof(struct max_regs , mpr3)); +DEFINE (MAX_SGPCR3 , offsetof(struct max_regs , sgpcr3)); +DEFINE (MAX_MPR4 , offsetof(struct max_regs , mpr4)); +DEFINE (MAX_SGPCR4 , offsetof(struct max_regs , sgpcr4)); +DEFINE (MAX_MGPCR0 , offsetof(struct max_regs , mgpcr0)); +DEFINE (MAX_MGPCR1 , offsetof(struct max_regs , mgpcr1)); +DEFINE (MAX_MGPCR2 , offsetof(struct max_regs , mgpcr2)); +DEFINE (MAX_MGPCR3 , offsetof(struct max_regs , mgpcr3)); +DEFINE (MAX_MGPCR4 , offsetof(struct max_regs , mgpcr4)); + +/* AHB <-> IP-Bus Interface */ +DEFINE (AIPS_MPR_0_7 , offsetof(struct aips_regs , mpr_0_7)); +DEFINE (AIPS_MPR_8_15 , offsetof(struct aips_regs , mpr_8_15)); + +return 0 ; +}
arch/arm/include/asm/arch-mx25/imx-regs.h +39 -0
@@ -141,6 +141,45 @@ struct fuse_bank0_regs {u32 mac_addr[6 ]; }; +/* Multi-Layer AHB Crossbar Switch (MAX) registers */ +struct max_regs { +u32 mpr0; +u32 pad00[3 ]; +u32 sgpcr0; +u32 pad01[59 ]; +u32 mpr1; +u32 pad02[3 ]; +u32 sgpcr1; +u32 pad03[59 ]; +u32 mpr2; +u32 pad04[3 ]; +u32 sgpcr2; +u32 pad05[59 ]; +u32 mpr3; +u32 pad06[3 ]; +u32 sgpcr3; +u32 pad07[59 ]; +u32 mpr4; +u32 pad08[3 ]; +u32 sgpcr4; +u32 pad09[251 ]; +u32 mgpcr0; +u32 pad10[63 ]; +u32 mgpcr1; +u32 pad11[63 ]; +u32 mgpcr2; +u32 pad12[63 ]; +u32 mgpcr3; +u32 pad13[63 ]; +u32 mgpcr4; +}; + +/* AHB <-> IP-Bus Interface (AIPS) */ +struct aips_regs { +u32 mpr_0_7; +u32 mpr_8_15; +}; +#endif /* AIPS 1 */
Signature · 1 line
1.7.0.4
PATCH 5/5 imx: Add support for zmx25 board
In reply to Matthias Weisserzmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an optional NAND flash.
--- MAINTAINERS | 1 + board/syteco/zmx25/Makefile | 51 +++++++++ board/syteco/zmx25/lowlevel_init.S | 136 +++++++++++++++++++++++ board/syteco/zmx25/zmx25.c | 209 ++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/zmx25.h | 182 +++++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+), 0 deletions(-) create mode 100644 board/syteco/zmx25/Makefile create mode 100644 board/syteco/zmx25/lowlevel_init.S create mode 100644 board/syteco/zmx25/zmx25.c create mode 100644 include/configs/zmx25.h
MAINTAINERS +1 -0
@@ -892,6 +892,7 @@ Lei Wen <[email protected]> Matthias Weisser <[email protected]> jadecpu ARM926EJS (MB86R01 SoC) + zmx25 ARM926EJS (imx25 SoC) Richard Woodruff <[email protected]>
board/syteco/zmx25/Makefile new file +51 -0
51 lines not on this page · raw message
board/syteco/zmx25/lowlevel_init.S new file +136 -0
136 lines not on this page · raw message
board/syteco/zmx25/zmx25.c new file +209 -0
209 lines not on this page · raw message
boards.cfg +1 -0
@@ -127,6 +127,7 @@ rd6281a arm arm926ejs - Marvell sheevaplug arm arm926ejs - Marvell kirkwood dockstar arm arm926ejs - Seagate kirkwood jadecpu arm arm926ejs jadecpu syteco mb86r0x +zmx25 arm arm926ejs zmx25 syteco mx25 imx27lite arm arm926ejs imx27lite logicpd mx27 magnesium arm arm926ejs imx27lite logicpd mx27 nhk8815 arm arm926ejs nhk8815 st nomadik
include/configs/zmx25.h new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 5/5 imx: Add support for zmx25 board
Dear Matthias Weisser,
Quoted 4 lines · In message <[email protected]> you wrote:
zmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an optional NAND flash.
Signed-off-by Matthias Weisser <[email protected]>
Quoted 12 lines
--- MAINTAINERS | 1 + board/syteco/zmx25/Makefile | 51 +++++++++ board/syteco/zmx25/lowlevel_init.S | 136 +++++++++++++++++++++++ board/syteco/zmx25/zmx25.c | 209 ++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/zmx25.h | 182 +++++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+), 0 deletions(-) create mode 100644 board/syteco/zmx25/Makefile create mode 100644 board/syteco/zmx25/lowlevel_init.S create mode 100644 board/syteco/zmx25/zmx25.c create mode 100644 include/configs/zmx25.h
checkpatch says:
please, no space before tabs
...
board/syteco/zmx25/zmx25.c line 3
Quoted 9 lines
board/syteco/zmx25/zmx25.c new file +3
-0@@ -0,0 +1,209 @@ +/* +* (c) 2011 Graf-Syteco, Matthias Weisser +* <[email protected]>
Are you absolutely sure that this code was wriiten by you from scratch, without re-using any existing code?
Quoted 1 line
board/syteco/zmx25/zmx25.c new file +1
-0+void tx25_fec_init (void )
...
Quoted 1 line
+#define
tx25_fec_init()
etc.
This looks suspiciously as if the code was copied from the TX25 board, and then adapted. If so then what gives you the right to claim exclusive ownership of this code and remove/omit oall existing copyright entries???
...
board/syteco/zmx25/zmx25.c
Quoted 4 lines
board/syteco/zmx25/zmx25.c new file +4
-0+#define CONFIG_CMDLINE_TAG 1/* enable passing of ATAGs */ +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_INITRD_TAG 1 +#define BOARD_LATE_INIT 1
Please omit values from #defines that enable features only.
board/syteco/zmx25/zmx25.c
Quoted 4 lines
board/syteco/zmx25/zmx25.c new file +4
-0+#define CONFIG_BOOTP_BOOTFILESIZE 1 +#define CONFIG_BOOTP_BOOTPATH 1 +#define CONFIG_BOOTP_GATEWAY 1 +#define CONFIG_BOOTP_HOSTNAME 1
Ditto. Please fix globally.
board/syteco/zmx25/zmx25.c
Quoted 9 lines
board/syteco/zmx25/zmx25.c new file +9
-0+#include <config_cmd_default.h> +#define CONFIG_CMD_NET +#define CONFIG_CMD_CACHE +#undef CONFIG_CMD_FPGA +#undef CONFIG_CMD_IMLS +#undef CONFIG_CMD_LOADS +#undef CONFIG_CMD_SOURCE +#undef CONFIG_CMD_NFS +#undef CONFIG_CMD_XIMG
Is there any specific reason for sisabling these commands? You don't appear to be very short on resources, so this makes no sense to me.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Being schizophrenic is better than living alone.
PATCH 5/5 imx: Add support for zmx25 board
Am 30.06.2011 12:44, schrieb Wolfgang Denk:
Quoted 20 lines
Dear Matthias Weisser,
Quoted 12 lines · In message<[email protected]> you wrote:
zmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an optional NAND flash.
Signed-off-by Matthias Weisser<[email protected]>--- MAINTAINERS | 1 + board/syteco/zmx25/Makefile | 51 +++++++++ board/syteco/zmx25/lowlevel_init.S | 136 +++++++++++++++++++++++ board/syteco/zmx25/zmx25.c | 209 ++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/zmx25.h | 182 +++++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+), 0 deletions(-)Quoted 4 lines
create mode 100644 board/syteco/zmx25/Makefile create mode 100644
board/syteco/zmx25/lowlevel_init.Screate mode 100644board/syteco/zmx25/zmx25.ccreate mode 100644include/configs/zmx25.h
Quoted 3 lines
checkpatch says:
please, no space before tabs
I see. The checkpatch.pl I was using (0.28) didn't catch this. That one from latest kernel (0.31) does. So this will be fixed in v2.
Quoted 13 lines
...
board/syteco/zmx25/zmx25.c line 3
Quoted 9 lines
board/syteco/zmx25/zmx25.c new file +3
-0@@ -0,0 +1,209 @@ +/* +* (c) 2011 Graf-Syteco, Matthias Weisser +*<[email protected]> Are you absolutely sure that this code was wriiten by you from scratch, without re-using any existing code?
Well, actually not. But as the changes where that big (there are only two handful of identical lines without comments and common function names) that I thought that it will be the right way to do it so. That may be wrong. I (re)add the copyright from tx25.c in v2.
Quoted 10 lines
Quoted 1 line
board/syteco/zmx25/zmx25.c new file +1
-0+void tx25_fec_init (void )...
Quoted 1 line
+#define
tx25_fec_init()etc.
This looks suspiciously as if the code was copied from the TX25 board, and then adapted. If so then what gives you the right to claim exclusive ownership of this code and remove/omit oall existing copyright entries???
See above. Will (re)add. It was not my intention to offend someone.
Quoted 8 lines
...
board/syteco/zmx25/zmx25.c
Quoted 4 lines
board/syteco/zmx25/zmx25.c new file +4
-0+#define CONFIG_CMDLINE_TAG 1/* enable passing of ATAGs */ +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_INITRD_TAG 1 +#define BOARD_LATE_INIT 1Please omit values from #defines that enable features only.
Quoted 6 lines
board/syteco/zmx25/zmx25.c
Quoted 4 lines
board/syteco/zmx25/zmx25.c new file +4
-0+#define CONFIG_BOOTP_BOOTFILESIZE 1 +#define CONFIG_BOOTP_BOOTPATH 1 +#define CONFIG_BOOTP_GATEWAY 1 +#define CONFIG_BOOTP_HOSTNAME 1Ditto. Please fix globally.
OK
Quoted 5 lines
Quoted 5 lines
board/syteco/zmx25/zmx25.c new file +5
-0+#include <config_cmd_default.h> +#define CONFIG_CMD_NET +#define CONFIG_CMD_CACHE +#undef CONFIG_CMD_FPGA +#undef CONFIG_CMD_IMLS
Quoted 8 lines
board/syteco/zmx25/zmx25.c
Quoted 4 lines
board/syteco/zmx25/zmx25.c new file +4
-0+#undef CONFIG_CMD_LOADS +#undef CONFIG_CMD_SOURCE +#undef CONFIG_CMD_NFS +#undef CONFIG_CMD_XIMGIs there any specific reason for sisabling these commands? You don't appear to be very short on resources, so this makes no sense to me.
Well, mainly copy+paste from our other board "jadecpu". I will remove these undefs in v2 as it only saves about 10k of image size, some of them may be useful and, as you have noticed, we are not short on flash.
Thanks for your review.
Matthias
PATCH 5/5 imx: Add support for zmx25 board
In reply to Matthias WeisserQuoted 2 lines · Matthias Weisser
zmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an optional NAND flash.
Hi Matthias,
Quoted 24 lines
board/syteco/zmx25/lowlevel_init.S new file +20
-0+#include <asm/macro.h> +#include <asm/arch/imx-regs.h> +#include <asm/arch/asm-offsets.h> + +.macro init_aips + write32 IMX_AIPS1_BASE + AIPS_MPR_0_7, 0x77777777 + write32 IMX_AIPS1_BASE + AIPS_MPR_8_15, 0x77777777 + write32 IMX_AIPS2_BASE + AIPS_MPR_0_7, 0x77777777 + write32 IMX_AIPS2_BASE + AIPS_MPR_8_15, 0x77777777 +.endm + +.macro init_max + write32 IMX_MAX_BASE + MAX_MPR0, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR1, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR2, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR3, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR4, 0x43210 + + write32 IMX_MAX_BASE + MAX_SGPCR0, 0x10 + write32 IMX_MAX_BASE + MAX_SGPCR1, 0x10
board/syteco/zmx25/lowlevel_init.S line 56
Quoted 10 lines
board/syteco/zmx25/lowlevel_init.S new file +10
-0+ write32 IMX_MAX_BASE + MAX_SGPCR2, 0x10 + write32 IMX_MAX_BASE + MAX_SGPCR3, 0x10 + write32 IMX_MAX_BASE + MAX_SGPCR4, 0x10 + + write32 IMX_MAX_BASE + MAX_MGPCR0, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR1, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR2, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR3, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR4, 0x0 +.endm
All these macro are in common with karo/tx25 and you added useful names instead of raw hexadecimal values. This code is not strictly related to the board, but it is part of the processor initialisation.
I am thinking about if we can factorize this stuff. What about to have a file in asm/arch/ that can be included by all i.MX25 boards ?
Quoted 11 lines
board/syteco/zmx25/lowlevel_init.S new file +11
-0+ +/* + * clocks + */ +.macro init_clocks + + /* disable clock output */ + write32 IMX_CCM_BASE + CCM_MCR, 0x00000000 + write32 IMX_CCM_BASE + CCM_CCTL, 0x50030000 + + /*
board/syteco/zmx25/lowlevel_init.S line 77
Quoted 10 lines
board/syteco/zmx25/lowlevel_init.S new file +10
-0+ * enable all implemented clocks in all three + * clock control registers + */ + write32 IMX_CCM_BASE + CCM_CGCR0, 0x1fffffff + write32 IMX_CCM_BASE + CCM_CGCR1, 0xffffffff + write32 IMX_CCM_BASE + CCM_CGCR2, 0xfffff + + /* Devide NAND clock by 32 */ + write32 IMX_CCM_BASE + CCM_PCDR2, 0x0101011F +.endm
The same with this macro, adding maybe a parameter for the different CCTL value.
Quoted 7 lines
board/syteco/zmx25/lowlevel_init.S new file +7
-0+ /* + * Set up LAN-RESET and FEC_RX_ERR + * + * LAN-RESET: gpio3[16] is ALT 5 mode of pin U20 + * FEC_RX_ERR: FEC_RX_ERR is ALT 2 mode of pin R2 + */ + muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
board/syteco/zmx25/lowlevel_init.S
Quoted 10 lines
board/syteco/zmx25/lowlevel_init.S new file +10
-0+ padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE; + + writel(gpio_mux_mode5, &muxctl->pad_upll_bypclk); + writel(gpio_mux_mode2, &muxctl->pad_uart2_cts); + + /* assert PHY reset (low) */ + val = readl(&gpio3->dr) & ~(1 << 16); + writel(val, &gpio3->dr); + val = readl(&gpio3->dir) | (1 << 16); + writel(val, &gpio3->dir);
For i.MX there are accessors to access gpios (mxc_gpio_*). They are not yet extended to the i.MX25, but I see the internal structure is the same as for other i.MX processors. As far as I can see, it should be enough to change the i.MX25 imx-reg-h using the same defines gor GPIO base addresses already used by other microprocessors.
board/syteco/zmx25/lowlevel_init.S
Quoted 6 lines
board/syteco/zmx25/lowlevel_init.S new file +6
-0+ + udelay(5000); + + /* deassert PHY reset */ + val = readl(&gpio3->dr) | 1 << 16; + writel(val, &gpio3->dr);
The same here. Access to gpios should be fixed globally.
board/syteco/zmx25/lowlevel_init.S
Quoted 5 lines
board/syteco/zmx25/lowlevel_init.S new file +5
-0+void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = PHYS_SDRAM; + gd->bd->bi_dram[0].size = gd->ram_size; +}
You copy the same function that is defined as weak in arch/arm/lib/board.c. You could rely on that function and drop this one.
Quoted 1 line
+#define
CONFIG_CMDLINE_TAG1 /* enable passing of ATAGs */
You do not need to set this to 1, it is enough to define it. The same for most of the defines in this file.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 5/5 imx: Add support for zmx25 board
Hi Stefano
Am 30.06.2011 17:36, schrieb Stefano Babic:
Quoted 45 lines · Matthias Weisser
Quoted 2 lines
zmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an optional NAND flash.
Hi Matthias,
Quoted 24 lines
board/syteco/zmx25/lowlevel_init.S new file +20
-0+#include<asm/macro.h> +#include<asm/arch/imx-regs.h> +#include<asm/arch/asm-offsets.h> + +.macro init_aips + write32 IMX_AIPS1_BASE + AIPS_MPR_0_7, 0x77777777 + write32 IMX_AIPS1_BASE + AIPS_MPR_8_15, 0x77777777 + write32 IMX_AIPS2_BASE + AIPS_MPR_0_7, 0x77777777 + write32 IMX_AIPS2_BASE + AIPS_MPR_8_15, 0x77777777 +.endm + +.macro init_max + write32 IMX_MAX_BASE + MAX_MPR0, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR1, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR2, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR3, 0x43210 + write32 IMX_MAX_BASE + MAX_MPR4, 0x43210 + + write32 IMX_MAX_BASE + MAX_SGPCR0, 0x10 + write32 IMX_MAX_BASE + MAX_SGPCR1, 0x10board/syteco/zmx25/lowlevel_init.S line 56
Quoted 10 lines
board/syteco/zmx25/lowlevel_init.S new file +10
-0+ write32 IMX_MAX_BASE + MAX_SGPCR2, 0x10 + write32 IMX_MAX_BASE + MAX_SGPCR3, 0x10 + write32 IMX_MAX_BASE + MAX_SGPCR4, 0x10 + + write32 IMX_MAX_BASE + MAX_MGPCR0, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR1, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR2, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR3, 0x0 + write32 IMX_MAX_BASE + MAX_MGPCR4, 0x0 +.endmAll these macro are in common with karo/tx25 and you added useful names instead of raw hexadecimal values. This code is not strictly related to the board, but it is part of the processor initialisation.
Quoted 2 lines
I am thinking about if we can factorize this stuff. What about to have a file in asm/arch/ that can be included by all i.MX25 boards ?
I can do that. Would you suggest a name of this new file? Is there any convention of file extensions for asm files that can be included and define macros? Both .h and .S seems no the right extension to me.
Quoted 15 lines
Quoted 15 lines
board/syteco/zmx25/lowlevel_init.S new file +15
-0+ /* + * Set up LAN-RESET and FEC_RX_ERR + * + * LAN-RESET: gpio3[16] is ALT 5 mode of pin U20 + * FEC_RX_ERR: FEC_RX_ERR is ALT 2 mode of pin R2 + */ + muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE; + padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE; + + writel(gpio_mux_mode5,&muxctl->pad_upll_bypclk); + writel(gpio_mux_mode2,&muxctl->pad_uart2_cts); + + /* assert PHY reset (low) */ + val = readl(&gpio3->dr)& ~(1<< 16); + writel(val,&gpio3->dr);
Quoted 8 lines
board/syteco/zmx25/lowlevel_init.S
Quoted 2 lines
board/syteco/zmx25/lowlevel_init.S new file +2
-0+ val = readl(&gpio3->dir) | (1<< 16); + writel(val,&gpio3->dir);For i.MX there are accessors to access gpios (mxc_gpio_*). They are not yet extended to the i.MX25, but I see the internal structure is the same as for other i.MX processors. As far as I can see, it should be enough to change the i.MX25 imx-reg-h using the same defines gor GPIO base addresses already used by other microprocessors.
Yes, this can be done. But it will break at least tx25 board. I can fix tx25 and build test it. But as I have no hardware I can't runtime test it. What would be right way to do this?
Quoted 8 lines
board/syteco/zmx25/lowlevel_init.S
Quoted 5 lines
board/syteco/zmx25/lowlevel_init.S new file +5
-0+void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = PHYS_SDRAM; + gd->bd->bi_dram[0].size = gd->ram_size; +}You copy the same function that is defined as weak in
arch/arm/lib/board.c. You could rely on that function and drop this one.
OK
Quoted 4 lines
Quoted 1 line
+#define
CONFIG_CMDLINE_TAG1 /* enable passing of ATAGs */You do not need to set this to 1, it is enough to define it. The same for most of the defines in this file.
OK
Thanks for you review. As soon as I have answers to my questions above I will come up with a v2 of the series.
Regards,
Matthias
v2 cover Add support for zmx25 board
In reply to Matthias Weisserzmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash and an optional NAND flash. Some additons to imx25 SoC are made to fully support the hardware on the board.
Changes in v2:
- Using mxc_gpio now
- Partially unified usb for imx25 and imx31
- Factored out asm macros
Matthias Weisser (6):
imx: Add get_tbclk() function for imx25
imx: Use correct imx25 reset.c
imx: Add support for USB EHCI on imx25
imx: Add auto generation of asm-offsets.h for imx25
imx: Make imx25 compatible to mxc_gpio driver and fix in tx25
imx: Add support for zmx25 board
MAINTAINERS | 1 + arch/arm/cpu/arm926ejs/mx25/Makefile | 8 +- arch/arm/cpu/arm926ejs/mx25/asm-offsets.c | 60 +++++++++ arch/arm/cpu/arm926ejs/mx25/timer.c | 12 ++ arch/arm/include/asm/arch-mx25/imx-regs.h | 49 +++++++- arch/arm/include/asm/arch-mx25/macro.h | 64 +++++++++ arch/arm/include/asm/arch-mx31/imx-regs.h | 2 +- board/karo/tx25/tx25.c | 26 ++-- board/syteco/zmx25/Makefile | 51 +++++++ board/syteco/zmx25/lowlevel_init.S | 110 ++++++++++++++++ board/syteco/zmx25/zmx25.c | 203 +++++++++++++++++++++++++++++ boards.cfg | 1 + drivers/usb/host/ehci-mxc.c | 33 ++++- include/configs/zmx25.h | 180 +++++++++++++++++++++++++ include/mxc_gpio.h | 5 + 15 files changed, 777 insertions(+), 28 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mx25/asm-offsets.c create mode 100644 arch/arm/include/asm/arch-mx25/macro.h create mode 100644 board/syteco/zmx25/Makefile create mode 100644 board/syteco/zmx25/lowlevel_init.S create mode 100644 board/syteco/zmx25/zmx25.c create mode 100644 include/configs/zmx25.h
PATCH v2 1/6 imx: Add get_tbclk() function for imx25
In reply to Matthias WeisserNeed this function for autoboot keyd
--- arch/arm/cpu/arm926ejs/mx25/timer.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/mx25/timer.c +12 -0
@@ -187,3 +187,15 @@ void __udelay (unsigned long usec)while (get_ticks () < tmp)/* loop till event */ /*NOP*/ ; } + +/* +* This function is derived from PowerPC code (timebase clock frequency). +* On ARM it returns the number of timer ticks per second. +*/ +ulong get_tbclk (void ) +{ +ulong tbclk; + + tbclk =CONFIG_MX25_CLK32 ; +return tbclk; +}
Signature · 1 line
1.7.0.4
PATCH v2 1/6 imx: Add get_tbclk() function for imx25
Quoted 7 lines · Matthias Weisser
Need this function for autoboot keyd
Signed-off-by Matthias Weisser <[email protected]>--- arch/arm/cpu/arm926ejs/mx25/timer.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
Appplied to u-boot-imx, thanks
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v2 2/6 imx: Use correct imx25 reset.c
In reply to Matthias Weisserimx25 used the wrong reset.c from imx27
---
Changes in v2:
- Removed unrelated change
arch/arm/cpu/arm926ejs/mx25/Makefile | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/arm926ejs/mx25/Makefile +2 -4
@@ -24,12 +24,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = generic.o timer.o -MX27OBJS = reset.o +COBJS = generic.o timer.o reset.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -SRCS += $(addprefix $(SRCTREE)/arch/arm/cpu/arm926ejs/mx27/,$(MX27OBJS:.o=.c)) -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS) $(MX27OBJS)) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) all: $(obj).depend $(LIB)
Signature · 1 line
1.7.0.4
PATCH v2 2/6 imx: Use correct imx25 reset.c
Quoted 3 lines · Matthias Weisser
imx25 used the wrong
reset.cfrom imx27Signed-off-by Matthias Weisser <[email protected]>
Appplied to u-boot-imx, thanks
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v2 3/6 imx: Add support for USB EHCI on imx25
In reply to Matthias WeisserAdding support for USB host on imx25 using the internal PHY. Changing the name of base address define for imx31 to get some unification.
---
Changes in v2:
- Partially unified for imx25 and imx31
arch/arm/include/asm/arch-mx31/imx-regs.h | 2 +- drivers/usb/host/ehci-mxc.c | 33 ++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-)
arch/arm/include/asm/arch-mx31/imx-regs.h +1 -1
@@ -746,7 +746,7 @@ enum iomux_pins {#define IRAM_SIZE (16 * 1024)#define MX31_AIPS1_BASE_ADDR 0x43f00000 -#define MX31_OTG_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x88000) +#define IMX_USB_BASE (MX31_AIPS1_BASE_ADDR + 0x88000)/* USB portsc */ /* values for portsc field */
drivers/usb/host/ehci-mxc.c +25 -8
@@ -29,6 +29,14 @@#define USBCTRL_OTGBASE_OFFSET 0x600 +#ifdef CONFIG_MX25 +#define MX25_USB_CTRL_IP_PUE_DOWN_BIT (1<<6) +#define MX25_USB_CTRL_HSTD_BIT (1<<5) +#define MX25_USB_CTRL_USBTE_BIT (1<<4) +#define MX25_USB_CTRL_OCPOL_OTG_BIT (1<<3) +#endif + +#ifdef CONFIG_MX31 #define MX31_OTG_SIC_SHIFT 29#define MX31_OTG_SIC_MASK (0x3 << MX31_OTG_SIC_SHIFT)#define MX31_OTG_PM_BIT (1 << 24)
@@ -42,12 +50,19 @@#define MX31_H1_SIC_MASK (0x3 << MX31_H1_SIC_SHIFT)#define MX31_H1_PM_BIT (1 << 8)#define MX31_H1_DT_BIT (1 << 4) +#endif static int mxc_set_usbcontrol (int port,unsigned int flags) {unsigned int v; + +#ifdef CONFIG_MX25 + v =MX25_USB_CTRL_IP_PUE_DOWN_BIT |MX25_USB_CTRL_HSTD_BIT | +MX25_USB_CTRL_USBTE_BIT |MX25_USB_CTRL_OCPOL_OTG_BIT ; +#endif +#ifdef CONFIG_MX31 - v =readl (MX31_OTG_BASE_ADDR +USBCTRL_OTGBASE_OFFSET ); + v =readl (IMX_USB_BASE +USBCTRL_OTGBASE_OFFSET );switch (port) {case 0 :/* OTG port */
@@ -85,36 +100,38 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)default :return -EINVAL ; } - -writel (v,MX31_OTG_BASE_ADDR + -USBCTRL_OTGBASE_OFFSET );#endif -return 0 ; + +writel (v,IMX_USB_BASE +USBCTRL_OTGBASE_OFFSET ); +return 0 ; }int ehci_hcd_init (void ) { -u32 tmp;struct usb_ehci *ehci; +#ifdef CONFIG_MX31 +u32 tmp;struct clock_control_regs *sc_regs = (struct clock_control_regs *)CCM_BASE ; tmp =__raw_readl (&sc_regs->ccmr);__raw_writel (__raw_readl (&sc_regs->ccmr) | (1 <<9 ), &sc_regs->ccmr) ; +#endif udelay (80 );/* Take USB2 */ - ehci = (struct usb_ehci *)(MX31_OTG_BASE_ADDR + + ehci = (struct usb_ehci *)(IMX_USB_BASE + (0x200 *CONFIG_MXC_USB_PORT )); hccr = (struct ehci_hccr *)((uint32_t )&ehci->caplength); hcor = (struct ehci_hcor *)((uint32_t ) hccr +HC_LENGTH (ehci_readl (&hccr->cr_capbase)));setbits_le32 (&ehci->usbmode,CM_HOST ); +#ifdef CONFIG_MX31 setbits_le32 (&ehci->control,USB_EN );__raw_writel (CONFIG_MXC_USB_PORTSC , &ehci->portsc); - +#endif mxc_set_usbcontrol (CONFIG_MXC_USB_PORT ,CONFIG_MXC_USB_FLAGS );udelay (10000 );
Signature · 1 line
1.7.0.4
PATCH v2 3/6 imx: Add support for USB EHCI on imx25
Quoted 4 lines · Matthias Weisser
Adding support for USB host on imx25 using the internal PHY. Changing the name of base address define for imx31 to get some unification.
Signed-off-by Matthias Weisser <[email protected]>
Applied to u-boot-imx, thanks
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v2 4/6 imx: Add auto generation of asm-offsets.h for imx25
In reply to Matthias WeisserOffsets to registers may be needed in asm code. This patch adds automated generation of these offsets form C structures.
---
Changes in v2:
- Added a change in Makefile which was in wrong patch of the patch set
arch/arm/cpu/arm926ejs/mx25/Makefile | 2 + arch/arm/cpu/arm926ejs/mx25/asm-offsets.c | 60 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx25/imx-regs.h | 39 +++++++++++++++++++ 3 files changed, 101 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mx25/asm-offsets.c
arch/arm/cpu/arm926ejs/mx25/Makefile +2 -0
@@ -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
arch/arm/cpu/arm926ejs/mx25/asm-offsets.c new file +60 -0
60 lines not on this page · raw message
arch/arm/include/asm/arch-mx25/imx-regs.h +39 -0
@@ -141,6 +141,45 @@ struct fuse_bank0_regs {u32 mac_addr[6 ]; }; +/* Multi-Layer AHB Crossbar Switch (MAX) registers */ +struct max_regs { +u32 mpr0; +u32 pad00[3 ]; +u32 sgpcr0; +u32 pad01[59 ]; +u32 mpr1; +u32 pad02[3 ]; +u32 sgpcr1; +u32 pad03[59 ]; +u32 mpr2; +u32 pad04[3 ]; +u32 sgpcr2; +u32 pad05[59 ]; +u32 mpr3; +u32 pad06[3 ]; +u32 sgpcr3; +u32 pad07[59 ]; +u32 mpr4; +u32 pad08[3 ]; +u32 sgpcr4; +u32 pad09[251 ]; +u32 mgpcr0; +u32 pad10[63 ]; +u32 mgpcr1; +u32 pad11[63 ]; +u32 mgpcr2; +u32 pad12[63 ]; +u32 mgpcr3; +u32 pad13[63 ]; +u32 mgpcr4; +}; + +/* AHB <-> IP-Bus Interface (AIPS) */ +struct aips_regs { +u32 mpr_0_7; +u32 mpr_8_15; +}; +#endif /* AIPS 1 */
Signature · 1 line
1.7.0.4
PATCH v2 4/6 imx: Add auto generation of asm-offsets.h for imx25
Quoted 5 lines · Matthias Weisser
Offsets to registers may be needed in asm code. This patch adds automated generation of these offsets form C structures.
Signed-off-by Matthias Weisser <[email protected]>---
Applied to u-boot-imx, thanks
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v2 5/6 imx: Make imx25 compatible to mxc_gpio driver and fix in tx25
In reply to Matthias WeisserAdding support for mxc_gpio driver for imx25 and fix names of registers in tx25 board.
---
Changes in v2:
- New in patch set due to review of v1
arch/arm/include/asm/arch-mx25/imx-regs.h | 10 ++++++++-- board/karo/tx25/tx25.c | 26 +++++++++++++------------- include/mxc_gpio.h | 5 +++++ 3 files changed, 26 insertions(+), 15 deletions(-)
arch/arm/include/asm/arch-mx25/imx-regs.h +8 -2
@@ -86,8 +86,8 @@ struct esdramc_regs {/* GPIO registers */ struct gpio_regs { -u32 dr;/* data */ -u32 dir;/* direction */ +u32 gpio_dr;/* data */ +u32 gpio_dir;/* direction */ u32 psr;/* pad satus */ u32 icr1;/* interrupt config 1 */ u32 icr2;/* interrupt config 2 */
@@ -357,4 +357,10 @@ struct aips_regs {#define WSR_UNLOCK1 0x5555#define WSR_UNLOCK2 0xAAAA +/* Names used in GPIO driver */ +#define GPIO1_BASE_ADDR IMX_GPIO1_BASE +#define GPIO2_BASE_ADDR IMX_GPIO2_BASE +#define GPIO3_BASE_ADDR IMX_GPIO3_BASE +#define GPIO4_BASE_ADDR IMX_GPIO4_BASE +#endif /* _IMX_REGS_H */
board/karo/tx25/tx25.c +13 -13
@@ -70,18 +70,18 @@ void tx25_fec_init(void)writel (0x0 , &padctl->pad_d11);/* drop PHY power and assert reset (low) */ - val =readl (&gpio4->dr) & ~((1 <<7 ) | (1 <<9 )); -writel (val, &gpio4->dr); - val =readl (&gpio4->dir) | (1 <<7 ) | (1 <<9 ); -writel (val, &gpio4->dir); + val =readl (&gpio4->gpio_dr) & ~((1 <<7 ) | (1 <<9 )); +writel (val, &gpio4->gpio_dr); + val =readl (&gpio4->gpio_dir) | (1 <<7 ) | (1 <<9 ); +writel (val, &gpio4->gpio_dir);mdelay (5 );debug ("resetting phy\n" );/* turn on PHY power leaving reset asserted */ - val =readl (&gpio4->dr) |1 <<9 ; -writel (val, &gpio4->dr); + val =readl (&gpio4->gpio_dr) |1 <<9 ; +writel (val, &gpio4->gpio_dr);mdelay (10 );
@@ -111,19 +111,19 @@ void tx25_fec_init(void)/* * set each to 1 and make each an output */ - val =readl (&gpio3->dr) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); -writel (val, &gpio3->dr); - val =readl (&gpio3->dir) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); -writel (val, &gpio3->dir); + val =readl (&gpio3->gpio_dr) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); +writel (val, &gpio3->gpio_dr); + val =readl (&gpio3->gpio_dir) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); +writel (val, &gpio3->gpio_dir);mdelay (22 );/* this value came from RedBoot */ /* * deassert PHY reset */ - val =readl (&gpio4->dr) |1 <<7 ; -writel (val, &gpio4->dr); -writel (val, &gpio4->dr); + val =readl (&gpio4->gpio_dr) |1 <<7 ; +writel (val, &gpio4->gpio_dr); +writel (val, &gpio4->gpio_dr);mdelay (5 );
include/mxc_gpio.h +5 -0
@@ -24,6 +24,11 @@#ifndef __MXC_GPIO_H#define __MXC_GPIO_H +/* Converts a GPIO port number and the internal bit position +* to the GPIO number +*/ +#define MXC_GPIO_PORT_TO_NUM (port, bit) (((port - 1) << 5) + (bit & 0x1f)) +enum mxc_gpio_direction {MXC_GPIO_DIRECTION_IN , MXC_GPIO_DIRECTION_OUT,
Signature · 1 line
1.7.0.4
PATCH v2 5/6 imx: Make imx25 compatible to mxc_gpio driver and fix in tx25
Quoted 5 lines · Matthias Weisser
Adding support for
mxc_gpiodriver for imx25 and fix names of registers in tx25 board.Signed-off-by Matthias Weisser <[email protected]>---
Applied to u-boot-imx, thanks
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH v2 6/6 imx: Add support for zmx25 board
In reply to Matthias Weisserzmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an optional NAND flash.
---
Changes in v2:
- Using mxc_gpio now
- Factored out asm macros
MAINTAINERS | 1 + arch/arm/include/asm/arch-mx25/macro.h | 64 ++++++++++ board/syteco/zmx25/Makefile | 51 ++++++++ board/syteco/zmx25/lowlevel_init.S | 110 +++++++++++++++++ board/syteco/zmx25/zmx25.c | 203 ++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/zmx25.h | 180 ++++++++++++++++++++++++++++ 7 files changed, 610 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-mx25/macro.h create mode 100644 board/syteco/zmx25/Makefile create mode 100644 board/syteco/zmx25/lowlevel_init.S create mode 100644 board/syteco/zmx25/zmx25.c create mode 100644 include/configs/zmx25.h
MAINTAINERS +1 -0
@@ -892,6 +892,7 @@ Lei Wen <[email protected]> Matthias Weisser <[email protected]> jadecpu ARM926EJS (MB86R01 SoC) + zmx25 ARM926EJS (imx25 SoC) Richard Woodruff <[email protected]>
arch/arm/include/asm/arch-mx25/macro.h new file +64 -0
64 lines not on this page · raw message
board/syteco/zmx25/Makefile new file +51 -0
51 lines not on this page · raw message
board/syteco/zmx25/lowlevel_init.S new file +110 -0
110 lines not on this page · raw message
board/syteco/zmx25/zmx25.c new file +203 -0
203 lines not on this page · raw message
boards.cfg +1 -0
@@ -127,6 +127,7 @@ rd6281a arm arm926ejs - Marvell sheevaplug arm arm926ejs - Marvell kirkwood dockstar arm arm926ejs - Seagate kirkwood jadecpu arm arm926ejs jadecpu syteco mb86r0x +zmx25 arm arm926ejs zmx25 syteco mx25 imx27lite arm arm926ejs imx27lite logicpd mx27 magnesium arm arm926ejs imx27lite logicpd mx27 nhk8815 arm arm926ejs nhk8815 st nomadik
include/configs/zmx25.h new file +180 -0
180 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 6/6 imx: Add support for zmx25 board
Quoted 4 lines · Matthias Weisser
zmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an optional NAND flash.
Signed-off-by Matthias Weisser <[email protected]>
Applied to u-boot-imx, thanks
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================