[U-Boot] [PATCH 11/13 v5] ARM: OMAP3: Add EVM board

Wolfgang Denk wd at denx.de
Sun Nov 9 20:43:29 CET 2008


Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20081109150321.GF25307 at game.jcrosoft.org> you wrote:
> > +	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> > +#endif
> > +
> > +#if defined(CONFIG_CMD_NET)
> > +	setup_net_chip();
> > +#endif
> > +
> > +	return 0;
> > +}
> > +
> > +/******************************************************************************
> > + * Routine: set_muxconf_regs
> > + * Description: Setting up the configuration Mux registers specific to the
> > + *              hardware. Many pins need to be moved from protect to primary
> > + *              mode.
> > + *****************************************************************************/
> > +void set_muxconf_regs(void)
> > +{
> > +	MUX_EVM();
> > +}
> > +
> > +/******************************************************************************
> > + * Routine: setup_net_chip
> > + * Description: Setting up the configuration GPMC registers specific to the
> > + *              Ethernet hardware. Pin Muxing for the SMC9118 is initialized
> > + *              here.
> > + *****************************************************************************/
> > +static int setup_net_chip(void)
> > +{
> in this function please add some blank line to make the code more readable
> > +	int i = 0;
> > +
> > +	/* Configure GPMC registers */
> > +	(*(volatile int *)(OMAP34XX_GPMC_BASE + 0x0150)) = 0x00001000;
> > +	(*(volatile int *)(OMAP34XX_GPMC_BASE + 0x0154)) = 0x001e1e01;
> > +	(*(volatile int *)(OMAP34XX_GPMC_BASE + 0x0158)) = 0x00080300;
> > +	(*(volatile int *)(OMAP34XX_GPMC_BASE + 0x015C)) = 0x1c091c09;
> > +	(*(volatile int *)(OMAP34XX_GPMC_BASE + 0x0160)) = 0x04181f1f;
> > +	(*(volatile int *)(OMAP34XX_GPMC_BASE + 0x0164)) = 0x00000FCF;
> > +	(*(volatile int *)(OMAP34XX_GPMC_BASE + 0x0168)) = 0x00000f6c;
> > +
> > +	/* Configure PIN MUX registers */
> > +	/* Enable GPMC Pin Mux Registers */
> > +	/* Enable GPMC_CLK Pin in CONTROL_PADCONF_gpmc_ncs7 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xBC)) |= 0x00180000;
> > +	/* Enable CS5 Pin in CONTROL_PADCONF_gpmc_ncs5 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xB8)) |= 0x00000018;
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xB8)) &= 0xFFFFFFF8;
> > +	/* Enable offmode for nwe in CONTROL_PADCONF_GPMC_NWE register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xC4)) |= 0x00000F00;
> > +	/* En off mode for noe and ale in CONTROL_PADCONF_GPMC_NADV_ALE reg */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xC0)) |= 0x0E000E00;
> > +	/* Enable gpmc_nbe0_cle in CONTROL_PADCONF_GPMC_NWE register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xC4)) |= 0x00180000;
> > +
> > +	/* Enable gpmc_nbe1 in CONTROL_PADCONF_GPMC_NBE1 register and
> > +	configuring the mux mode to 0 */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xC8)) |= 0x00000018;
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xC8)) &= 0xFFFFFFF8;
> > +	/* Enable d15 in CONTROL_PADCONF_GPMC_D15 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xAC)) |= 0x00000018;
> > +	/* Enable d14 - d13 in CONTROL_PADCONF_GPMC_D13 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xA8)) |= 0x00180018;
> > +	/* Enable d12 - d11 in CONTROL_PADCONF_GPMC_D11 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xA4)) |= 0x00180018;
> > +	/* Enable d10 - d9 in CONTROL_PADCONF_GPMC_D9 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0xA0)) |= 0x00180018;
> > +	/* Enable d8 - d7 in CONTROL_PADCONF_GPMC_D7 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0x9C)) |= 0x00180018;
> > +	/* Enable d6 - d5 in CONTROL_PADCONF_GPMC_D5 register */
> > +	(*(volatile int *)(OMAP34XX_CTRL_BASE + 0x98)) |= 0x00180018;

And please use accessor functions / macros to access the registers.
Access through volatile pointers is considered a Bad Thing (TM).

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
The Buddha, the Godhead, resides quite as comfortably in the circuits
of a digital computer or the gears of a cycle transmission as he does
at the top of a mountain or in the petals of a flower.
            - R.  Pirsig, "Zen and the Art of Motorcycle Maintenance"


More information about the U-Boot mailing list