[U-Boot] [PATCH 01/11] zipitz2: restore board support

Marek Vasut marex at denx.de
Mon Mar 21 02:45:56 CET 2016


On 03/21/2016 02:37 AM, Vasily Khoruzhick wrote:
> zipitz2 was dropped in 49d8899ba9c26335e4a12e01c18028fc5e40c796

That's great to know. So what does this patch do ?

> Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>

Hi!

> +int dram_init(void)
> +{
> +	pxa2xx_dram_init();
> +	gd->ram_size = PHYS_SDRAM_1_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;

There should be a default function for this in common/board_*c

> +}
> +
> +#ifdef	CONFIG_CMD_MMC
> +int board_mmc_init(bd_t *bis)
> +{
> +	pxa_mmc_register(0);
> +	return 0;
> +}
> +#endif

[...]

> +void zipitz2_spi_sda(int set)
> +{
> +	/* GPIO 13 */
> +	if (set)
> +		writel((1 << 13), GPSR0);
> +	else
> +		writel((1 << 13), GPCR0);

This could seriously use a conversion to GPIO driver, but this can be
done later. You can drop the excess parenthesis around 1 << 13 here and
all over the place. You can even convert it to BIT(13) .

> +}
> +
> +void zipitz2_spi_scl(int set)
> +{
> +	/* GPIO 22 */
> +	if (set)
> +		writel((1 << 22), GPCR0);
> +	else
> +		writel((1 << 22), GPSR0);
> +}

[...]

> +void lcd_start(void)
> +{
> +	int i;
> +	unsigned char reg[3] = { 0x74, 0x00, 0 };
> +	unsigned char data[3] = { 0x76, 0, 0 };
> +	unsigned char dummy[3] = { 0, 0, 0 };

all should be const

> +	/* PWM2 AF */
> +	writel(readl(GAFR0_L) | 0x00800000, GAFR0_L);
> +	/* Enable clock to all PWM */
> +	writel(readl(CKEN) | 0x3, CKEN);
> +	/* Configure PWM2 */
> +	writel(0x4f, PWM_CTRL2);
> +	writel(0x2ff, PWM_PWDUTY2);
> +	writel(792, PWM_PERVAL2);
> +
> +	/* Toggle the reset pin to reset the LCD */
> +	writel((1 << 19), GPSR0);
> +	udelay(100000);
> +	writel((1 << 19), GPCR0);
> +	udelay(20000);
> +	writel((1 << 19), GPSR0);

BIT()

> +	udelay(20000);
> +
> +	/* Program the LCD init sequence */
> +	for (i = 0; i < sizeof(lcd_data) / sizeof(lcd_data[0]); i++) {
> +		reg[0] = 0x74;
> +		reg[1] = 0x0;
> +		reg[2] = lcd_data[i].reg;
> +		spi_xfer(NULL, 24, reg, dummy, SPI_XFER_BEGIN | SPI_XFER_END);
> +
> +		data[0] = 0x76;
> +		data[1] = lcd_data[i].data >> 8;
> +		data[2] = lcd_data[i].data & 0xff;
> +		spi_xfer(NULL, 24, data, dummy, SPI_XFER_BEGIN | SPI_XFER_END);
> +
> +		if (lcd_data[i].mdelay)
> +			udelay(lcd_data[i].mdelay * 1000);

mdelay ;-)

> +	}
> +
> +	writel((1 << 11), GPSR0);
> +}
> +#endif

[...]

> diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
> new file mode 100644
> index 0000000..586a445
> --- /dev/null
> +++ b/include/configs/zipitz2.h
> @@ -0,0 +1,224 @@
> +/*
> + * Aeronix Zipit Z2 configuration file
> + *
> + * Copyright (C) 2009-2010 Marek Vasut <marek.vasut at gmail.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +/*
> + * High Level Board Configuration Options
> + */
> +#define	CONFIG_CPU_PXA27X		1	/* Marvell PXA270 CPU */
> +#define	CONFIG_SYS_TEXT_BASE		0x0

use #define[SPACE] not #define[TAB] and please fix it all over the patch.

> +#undef	CONFIG_BOARD_LATE_INIT
> +#undef	CONFIG_SKIP_LOWLEVEL_INIT
> +#define	CONFIG_PREBOOT

[...]

Run checkpatch.pl on the patches please ;-)

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list