All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/2] ARMV7: Add support for Samsung ORIGEN board
Date: Sun, 31 Jul 2011 12:00:09 +0200	[thread overview]
Message-ID: <20110731100009.E4D6812B7AE4@gemini.denx.de> (raw)
In-Reply-To: <1311914519-10531-2-git-send-email-chander.kashyap@linaro.org>

Dear Chander Kashyap,

In message <1311914519-10531-2-git-send-email-chander.kashyap@linaro.org> you wrote:
> Origen board is based upon S5PV310 SoC which is similiar to
> S5PC210 SoC.
> 
> Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
...
> +	/* APLL(1), MPLL(1), CORE(0), HPM(0) */
> +	ldr	r1, =0x0101
> +	ldr	r2, =0x14200			@CLK_SRC_CPU
...
> +	mov	r1, #0x10000
...
> +	ldr	r1, =0x00
> +	ldr	r2, =0x0C210			@CLK_SRC_TOP0
...
> +	ldr	r1, =0x00
> +	ldr	r2, =0x0C214			@CLK_SRC_TOP1_OFFSET
...
> +	ldr	r1, =0x10000
> +	ldr	r2, =0x10200			@CLK_SRC_DMC_OFFSET
...

..
> +	/*
> +	 * CLK_DIV_DMC0:
> +	 *
> +	 * CORE_TIMERS_RATIO[28]	0x1
> +	 * COPY2_RATIO[24]		0x3
> +	 * DMCP_RATIO[20]		0x1
> +	 * DMCD_RATIO[16]		0x1
> +	 * DMC_RATIO[12]		0x1
> +	 * DPHY_RATIO[8]		0x1
> +	 * ACP_PCLK_RATIO[4]		0x1
> +	 * ACP_RATIO[0]			0x3
> +	 */
> +	ldr	r1, =0x13111113
> +	ldr	r2, =0x010500			@CLK_DIV_DMC0_OFFSET
> +	str	r1, [r0, r2]


lease get rid of all these magic hard coded constants.  Use symbolic
names instead. If needed, auto-generate these from the respective C
structs.  If needed, create the C structs.

...
> --- /dev/null
> +++ b/board/samsung/origen/mem_setup.S
> @@ -0,0 +1,359 @@

What exactly is the reeason for not coding this in C ?

...
> +#ifdef CONFIG_MIU_1BIT_12_INTERLEAVED
> +	ldr	r1, =0x0000000c
> +	str	r1, [r0, #0x400]
> +	ldr	r1, =0x00000001
> +	str	r1, [r0, #0xc00]
> +#elif defined(CONFIG_MIU_1BIT_7_INTERLEAVED)
> +	ldr	r1, =0x00000007
> +	str	r1, [r0, #0x400]
> +	ldr	r1, =0x00000001
> +	str	r1, [r0, #0xc00]
> +#elif defined(CONFIG_MIU_2BIT_21_12_INTERLEAVED)
> +	ldr	r1, =0x2000150c
> +	str	r1, [r0, #0x400]
> +	ldr	r1, =0x00000001
> +	str	r1, [r0, #0xc00]
> +#elif defined(CONFIG_MIU_2BIT_21_7_INTERLEAVED)
> +	ldr	r1, =0x20001507
> +	str	r1, [r0, #0x400]
> +	ldr	r1, =0x00000001
> +	str	r1, [r0, #0xc00]
> +#elif defined(CONFIG_MIU_2BIT_31_INTERLEAVED)
> +	ldr	r1, =0x0000001d
> +	str	r1, [r0, #0x400]
> +	ldr	r1, =0x00000001
> +	str	r1, [r0, #0xc00]

See above.  Please get rid of all these hard-ciooded magic numbers.
[Eventually this happens automativcally when you rewrite this in C.]

> +int dram_init(void)
> +{
> +	gd->ram_size	= get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
> +			+ get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
> +			+ get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
> +			+ get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE);
> +
> +	return 0;
> +}
> +
> +void dram_init_banksize(void)
> +{
> +	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
> +	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
> +	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
> +	gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
> +	gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
> +	gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
> +	gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
> +	gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
> +}

How do you detect memory issues in one of the memory banks, say, a
memory error in bank 3?

> diff --git a/include/configs/origen.h b/include/configs/origen.h
> new file mode 100644
> index 0000000..3cd9bfe
> --- /dev/null
> +++ b/include/configs/origen.h
...
> +#define COPY_BL2_SIZE		0x80000
> +#define BL2_START_OFFSET	((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512)
> +#define BL2_SIZE_BLOC_COUNT	(COPY_BL2_SIZE/512)

Some of the defines in this file are not used anywhere in the code
(for example, COPY_BL2_SIZE, COPY_BL2_SIZEBL2_START_OFFSET or
BL2_SIZE_BLOC_COUNT.  Please remove unused defines from this patch.

Best regards,

Wolfgang Denk

-- 
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
Don't hit a man when he's down - kick him; it's easier.

  reply	other threads:[~2011-07-31 10:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29  4:41 [U-Boot] [PATCH v4 0/2] ORIGEN Board Support Chander Kashyap
2011-07-29  4:41 ` [U-Boot] [PATCH v4 1/2] ARMV7: Add support for Samsung ORIGEN board Chander Kashyap
2011-07-31 10:00   ` Wolfgang Denk [this message]
2011-08-03  3:47     ` Chander Kashyap
2011-08-03  5:59       ` Wolfgang Denk
2011-08-03  7:24         ` Chander Kashyap
2011-08-09 10:32       ` Chander Kashyap
2011-08-10 10:18         ` Detlev Zundel
2011-08-11  4:17           ` Chander Kashyap
2011-07-29  4:41 ` [U-Boot] [PATCH v4 2/2] ORIGEN: Add MMC SPL support Chander Kashyap
2011-07-31  6:56   ` Lei Wen
2011-07-31  8:19     ` Wolfgang Denk
2011-07-31  9:47       ` Wolfgang Denk
2011-08-01  6:59     ` Chander Kashyap
2011-08-01 10:09       ` Wolfgang Denk
2011-08-01 11:52         ` Chander Kashyap
2011-07-31 10:03   ` Wolfgang Denk
2011-08-03  3:49     ` Chander Kashyap

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=20110731100009.E4D6812B7AE4@gemini.denx.de \
    --to=wd@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.