public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] imx: Add support for zmx25 board
Date: Thu, 30 Jun 2011 17:36:13 +0200	[thread overview]
Message-ID: <4E0C97ED.3030207@denx.de> (raw)
In-Reply-To: <1309427865-17531-6-git-send-email-weisserm@arcor.de>

On 06/30/2011 11:57 AM, Matthias Weisser wrote:
> zmx25 is a board based on imx25 SoC, 64 Megs of LPDDR, 32 Megs of NOR flash, an
> optional NAND flash.

Hi Matthias,

> diff --git a/board/syteco/zmx25/lowlevel_init.S b/board/syteco/zmx25/lowlevel_init.S
> new file mode 100644
> index 0000000..4f3b756

> +#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
> +	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 ?

> +
> +/*
> + * clocks
> + */
> +.macro init_clocks
> +
> +	/* disable clock output */
> +	write32	IMX_CCM_BASE + CCM_MCR, 0x00000000
> +	write32	IMX_CCM_BASE + CCM_CCTL, 0x50030000
> +
> +	/*
> +	 * 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.


> +	/*
> +	 * 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);
> +	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.

> +
> +	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.

> +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.

> +#define CONFIG_CMDLINE_TAG	1	/* 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

-- 
=====================================================================
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
=====================================================================

  parent reply	other threads:[~2011-06-30 15:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30  9:57 [U-Boot] [PATCH 0/5] Add support for zmx25 board Matthias Weisser
2011-06-30  9:57 ` [U-Boot] [PATCH 1/5] imx: Add get_tbclk() function for imx25 Matthias Weisser
2011-06-30 15:38   ` Stefano Babic
2011-07-04  5:56     ` Matthias Weißer
2011-06-30  9:57 ` [U-Boot] [PATCH 2/5] imx: Use correct imx25 reset.c Matthias Weisser
2011-06-30 10:46   ` Wolfgang Denk
2011-06-30 11:35     ` Matthias Weißer
2011-06-30 10:49   ` Wolfgang Denk
2011-06-30 11:30     ` Matthias Weißer
2011-06-30  9:57 ` [U-Boot] [PATCH 3/5] imx: Add support for USB EHCI on imx25 Matthias Weisser
2011-06-30 15:48   ` Stefano Babic
2011-07-05 20:07     ` Marek Vasut
2011-06-30  9:57 ` [U-Boot] [PATCH 4/5] imx: Add auto generation of asm-offsets.h for imx25 Matthias Weisser
2011-06-30  9:57 ` [U-Boot] [PATCH 5/5] imx: Add support for zmx25 board Matthias Weisser
2011-06-30 10:44   ` Wolfgang Denk
2011-06-30 13:44     ` Matthias Weißer
2011-06-30 15:36   ` Stefano Babic [this message]
2011-07-04  6:28     ` Matthias Weißer
2011-07-06 10:28 ` [U-Boot] [PATCH v2 0/6] " Matthias Weisser
2011-07-06 10:28 ` [U-Boot] [PATCH v2 1/6] imx: Add get_tbclk() function for imx25 Matthias Weisser
2011-07-13 11:33   ` Stefano Babic
2011-07-06 10:28 ` [U-Boot] [PATCH v2 2/6] imx: Use correct imx25 reset.c Matthias Weisser
2011-07-13 11:33   ` Stefano Babic
2011-07-06 10:28 ` [U-Boot] [PATCH v2 3/6] imx: Add support for USB EHCI on imx25 Matthias Weisser
2011-07-13 11:34   ` Stefano Babic
2011-07-06 10:28 ` [U-Boot] [PATCH v2 4/6] imx: Add auto generation of asm-offsets.h for imx25 Matthias Weisser
2011-07-13 11:35   ` Stefano Babic
2011-07-06 10:28 ` [U-Boot] [PATCH v2 5/6] imx: Make imx25 compatible to mxc_gpio driver and fix in tx25 Matthias Weisser
2011-07-13 11:35   ` Stefano Babic
2011-07-06 10:28 ` [U-Boot] [PATCH v2 6/6] imx: Add support for zmx25 board Matthias Weisser
2011-07-13 11:36   ` Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E0C97ED.3030207@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox