[U-Boot] [PATCH 1/7] mx27: basic cpu support

Wolfgang Denk wd at denx.de
Fri May 29 00:57:22 CEST 2009


Dear Ilya Yanok,

In message <1242777361-6717-2-git-send-email-yanok at emcraft.com> you wrote:
> This patch adds generic code to support Freescale's i.MX27 SoCs.
...
> +void imx_gpio_mode(int gpio_mode)
> +{
> +	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
> +	unsigned int pin = gpio_mode & GPIO_PIN_MASK;
> +	unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
> +	unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
> +	unsigned int aout = (gpio_mode & GPIO_AOUT_MASK) >> GPIO_AOUT_SHIFT;
> +	unsigned int bout = (gpio_mode & GPIO_BOUT_MASK) >> GPIO_BOUT_SHIFT;
> +	unsigned int tmp;
> +
> +	/* Pullup enable */
> +	if (gpio_mode & GPIO_PUEN)
> +		writel(readl(&regs->port[port].PUEN) | (1 << pin),
> +				&regs->port[port].PUEN);
> +	else
> +		writel(readl(&regs->port[port].PUEN) & ~(1 << pin),
> +				&regs->port[port].PUEN);

Please use curly braces for multiline if-else statements (2 lines in
both the if and the else branch here, and more of these down below in
the file).


> +	if (now >= lastinc)	/* normal mode (non roll) */
> +		/* move stamp forward with absolut diff ticks */
> +		timestamp += (now - lastinc);
> +	else			/* we have rollover of incrementer */
> +		timestamp += (0xFFFFFFFF - lastinc) + now;

Ditto. Braces, please.


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
"In Christianity neither morality nor religion come into contact with
reality at any point."                          - Friedrich Nietzsche


More information about the U-Boot mailing list