From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/3] NAND boot: MPC8536DS support
Date: Fri, 18 Sep 2009 11:37:10 -0500 [thread overview]
Message-ID: <20090918163710.GB15674@loki.buserror.net> (raw)
In-Reply-To: <1253244935-1555-1-git-send-email-Mingkai.hu@freescale.com>
On Fri, Sep 18, 2009 at 11:35:33AM +0800, Mingkai Hu wrote:
> diff --git a/Makefile b/Makefile
> index 99837a3..4d18a9f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2446,6 +2446,7 @@ vme8349_config: unconfig
> ATUM8548_config: unconfig
> @$(MKCONFIG) $(@:_config=) ppc mpc85xx atum8548
>
> +MPC8536DS_NAND_config \
> MPC8536DS_36BIT_config \
> MPC8536DS_config: unconfig
NAND and 36BIT are orthogonal.
How about changing it to:
# Options: NAND, 36BIT
MPC8536DS_%_config MPC8536DS_config: unconfig
> +#if defined(CONFIG_NAND_BR_PRELIM) \
> + && defined(CONFIG_NAND_OR_PRELIM)
> + out_be32(&lbc->br0, CONFIG_NAND_BR_PRELIM);
> + out_be32(&lbc->or0, CONFIG_NAND_OR_PRELIM);
> + /* for FPGA */
> + out_be32(&lbc->br3, CONFIG_SYS_BR3_PRELIM);
> + out_be32(&lbc->or3, CONFIG_SYS_OR3_PRELIM);
Those last two lines should probably be #ifdef CONFIG_SYS_BR3_PRELIM.
> +#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR)
> + ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
> + uint l2srbar;
> + int i;
> +
> + l2srbar = CONFIG_SYS_INIT_L2_ADDR;
> + out_be32(&l2cache->l2srbar0, l2srbar);
> +
> + /* set MBECCDIS=1, SBECCDIS=1 */
> + out_be32(&l2cache->l2errdis,
> + (MPC85xx_L2ERRDIS_MBECC |
> + MPC85xx_L2ERRDIS_SBECC));
> +
> + /* set L2E=1 & L2SRAM=001 */
> + out_be32(&l2cache->l2ctl,
> + (MPC85xx_L2CTL_L2E |
> + MPC85xx_L2CTL_L2SRAM_ENTIRE));
> +
> + /* Initialize L2 SRAM to zero */
> + for (i = 0; i < CONFIG_SYS_L2_SIZE; i++)
> + ((char *)l2srbar)[i] = 0;
"uint" is not a valid type for either virtual or physical addresses.
Use a pointer (or uintptr_t if you must) for the former, and phys_addr_t for
the latter.
You're using it as char *, so why not just declare it that way?
> +void board_init_f(ulong bootflag)
> +{
> + u8 sysclk_ratio;
You're not saving any space over plain int/uint...
> + uint plat_ratio, bus_clk, sys_clk;
> + volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> +
> + /* initialize selected port with appropriate baud rate */
> + sysclk_ratio = *((volatile unsigned char *)(PIXIS_BASE + PIXIS_SPD));
> + sysclk_ratio &= 0x7;
> + switch (sysclk_ratio) {
> + case 0:
> + sys_clk = 33333000;
> + break;
> + case 1:
> + sys_clk = 39999600;
> + break;
> + case 2:
> + sys_clk = 49999500;
> + break;
> + case 3:
> + sys_clk = 66666000;
> + break;
> + case 4:
> + sys_clk = 83332500;
> + break;
> + case 5:
> + sys_clk = 99999000;
> + break;
> + case 6:
> + sys_clk = 133332000;
> + break;
> + case 7:
> + sys_clk = 166665000;
> + break;
> + default:
> + sys_clk = 0;
This default: case is impossible to reach.
> + break;
> + }
We could save some space by putting this in a table.
> + plat_ratio = (gur->porpllsr) & 0x0000003e;
Unnecessary parens.
> + plat_ratio >>= 1;
plat_ratio /= 2 is more readable and should generate identical code.
-Scott
next prev parent reply other threads:[~2009-09-18 16:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-18 3:35 [U-Boot] [PATCH v3 1/3] NAND boot: MPC8536DS support Mingkai Hu
2009-09-18 3:35 ` [U-Boot] [PATCH v3 2/3] On-chip ROM " Mingkai Hu
2009-09-18 3:35 ` [U-Boot] [PATCH v3 3/3] Add README.mpc8536ds Mingkai Hu
2009-09-18 13:55 ` [U-Boot] [PATCH v3 1/3] NAND boot: MPC8536DS support Kumar Gala
2009-09-21 1:32 ` Hu Mingkai-B21284
2009-09-18 16:37 ` Scott Wood [this message]
2009-09-21 6:40 ` Hu Mingkai-B21284
2009-09-21 15:57 ` Scott Wood
2009-09-18 18:41 ` Kumar Gala
2009-09-21 1:56 ` Hu Mingkai-B21284
2009-09-18 18:42 ` Kumar Gala
2009-09-19 0:00 ` Liu Dave-R63238
2009-09-20 9:10 ` Dudhat Dipen-B09055
2009-09-21 5:58 ` Hu Mingkai-B21284
2009-09-21 6:26 ` Hu Mingkai-B21284
2009-09-22 21:11 ` Wolfgang Denk
2009-09-23 2:16 ` Hu Mingkai-B21284
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=20090918163710.GB15674@loki.buserror.net \
--to=scottwood@freescale.com \
--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