public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] ppc_4xx resubmit: netstal/common define routines used by all boards
Date: Thu, 17 Jan 2008 10:07:25 +0100	[thread overview]
Message-ID: <200801171007.26076.sr@denx.de> (raw)
In-Reply-To: <1200560356-21332-1-git-send-email-niklaus.giger@netstal.com>

On Thursday 17 January 2008, Niklaus Giger wrote:
> Added some routines used by all Netstal boards:
> - nm_bsp.c: - nm_show_print and
>         -  common_misc_init_r
>         - set_params_for_sw_install. Bery specific code to handle our SW
>           installation procedure
> - fixed_sdram.c: Common routines for HCU4 (and upcoming) MCU25 boards
>   to handle sdram initialization.
> - nm.h: Common header

Please see below.

> Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
> ---
>  board/netstal/common/fixed_sdram.c |  106 +++++++++++++++++++++++++++++
>  board/netstal/common/nm.h          |   40 +++++++++++
>  board/netstal/common/nm_bsp.c      |  128
> +++++++++++++++++++++++++++++++----- 3 files changed, 258 insertions(+), 16
> deletions(-)
>  create mode 100644 board/netstal/common/fixed_sdram.c
>  create mode 100644 board/netstal/common/nm.h
>
> diff --git a/board/netstal/common/fixed_sdram.c
> b/board/netstal/common/fixed_sdram.c new file mode 100644
> index 0000000..65b297f
> --- /dev/null
> +++ b/board/netstal/common/fixed_sdram.c
> @@ -0,0 +1,106 @@
> +/*
> + *(C) Copyright 2005-2008 Netstal Maschinen AG
> + *    Niklaus Giger (Niklaus.Giger at netstal.com)
> + *
> + *    This source code is free software; you can redistribute it
> + *    and/or modify it in source code form 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.
> + *
> + *    This program is distributed in the hope that it will be useful,
> + *    but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *    GNU General Public License for more details.
> + *
> + *    You should have received a copy of the GNU General Public License
> + *    along with this program; if not, write to the Free Software
> + *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> 02111-1307, USA + */
> +
> +#include <common.h>
> +#include  <ppc4xx.h>
> +#include  <asm/processor.h>
> +#include  "nm.h"
> +
> +#if defined(DEBUG)
> +void show_sdram_registers(void)
> +{
> +	u32 value;
> +
> +	printf("SDRAM Controller Registers --\n");
> +	mfsdram(mem_mcopt1, value);
> +	printf("    SDRAM0_CFG   : 0x%08x\n", value);
> +	mfsdram(mem_status, value);
> +	printf("    SDRAM0_STATUS: 0x%08x\n", value);
> +	mfsdram(mem_mb0cf, value);
> +	printf("    SDRAM0_B0CR  : 0x%08x\n", value);
> +	mfsdram(mem_mb1cf, value);
> +	printf("    SDRAM0_B1CR  : 0x%08x\n", value);
> +	mfsdram(mem_sdtr1, value);
> +	printf("    SDRAM0_TR    : 0x%08x\n", value);
> +	mfsdram(mem_rtr, value);
> +	printf("    SDRAM0_RTR   : 0x%08x\n", value);
> +}
> +#endif
> +
> +long int fixed_hcu4_sdram (unsigned int dram_size)
> +{
> +#ifdef DEBUG
> +	printf(__FUNCTION__);
> +#endif
> +	/* disable memory controller */
> +	mtsdram(mem_mcopt1, 0x00000000);
> +
> +	udelay (500);
> +
> +	/* Clear SDRAM0_BESR0 (Bus Error Syndrome Register) */
> +	mtsdram(mem_besra, 0xffffffff);
> +
> +	/* Clear SDRAM0_BESR1 (Bus Error Syndrome Register) */
> +	mtsdram(mem_besrb, 0xffffffff);
> +
> +	/* Clear SDRAM0_ECCCFG (disable ECC) */
> +	mtsdram(mem_ecccf, 0x00000000);
> +
> +	/* Clear SDRAM0_ECCESR (ECC Error Syndrome Register) */
> +	mtsdram(mem_eccerr, 0xffffffff);
> +
> +	/* Timing register: CASL=2, PTA=2, CTP=2, LDF=1, RFTA=5, RCD=2
> +	 */
> +	mtsdram(mem_sdtr1, 0x008a4015);
> +
> +	/* Memory Bank 0 Config == BA=0x00000000, SZ=64M, AM=3, BE=1
> +	 * and refresh timer
> +	 */
> +	switch (dram_size >> 20) {
> +	case 32:
> +		mtsdram(mem_mb0cf, 0x00062001);
> +		mtsdram(mem_rtr,   0x07F00000);
> +		break;
> +	case 64:
> +		mtsdram(mem_mb0cf, 0x00084001);
> +		mtsdram(mem_rtr,   0x04100000);
> +		break;
> +	case 128:
> +		mtsdram(mem_mb0cf, 0x000A4001);
> +		mtsdram(mem_rtr,   0x04100000);
> +		break;
> +	default:
> +		printf("Some error here...\n");

Heh. This was just an example that you should fill with a reasonable error 
message. :)

Please fix and resubmit.

Thanks.

Best regards,
Stefan

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

  reply	other threads:[~2008-01-17  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-17  8:59 [U-Boot-Users] [PATCH] ppc_4xx resubmit: netstal/common define routines used by all boards Niklaus Giger
2008-01-17  9:07 ` Stefan Roese [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-17 11:53 Niklaus Giger
2008-01-16 17:39 [U-Boot-Users] [PATCH] ppc_4xx resubmit: Netstal HCU5 board: added various fixes and POST Niklaus Giger
2008-01-16 17:39 ` [U-Boot-Users] [PATCH] ppc_4xx resubmit: netstal/common define routines used by all boards Niklaus Giger
2008-01-17  7:18   ` Stefan Roese
2008-01-17 13:36   ` Stefan Roese

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=200801171007.26076.sr@denx.de \
    --to=sr@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