All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom <Tom.Rix@windriver.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] at91: Add esd gmbh OTC570 board support
Date: Sat, 23 Jan 2010 13:00:52 -0600	[thread overview]
Message-ID: <4B5B4764.7030900@windriver.com> (raw)
In-Reply-To: <12638874053717-git-send-email-Daniel.Gorsulowski@esd.eu>

Daniel Gorsulowski wrote:
> This patch adds support for esd gmbh OTC570 board.
> The OTC570 is based on an Atmel AT91SAM9263 SoC.
> 
> Signed-off-by: Daniel Gorsulowski <Daniel.Gorsulowski@esd.eu>

For u-boot-video.
Maybe some u-boot commands that could be common.

> ---
>  MAINTAINERS                  |    1 +
>  MAKEALL                      |    1 +
>  Makefile                     |    3 +

<snip>

> diff --git a/board/esd/otc570/otc570.c b/board/esd/otc570/otc570.c
> new file mode 100644
> index 0000000..fee27ca
> --- /dev/null
> +++ b/board/esd/otc570/otc570.c
> @@ -0,0 +1,429 @@
> +/*
> + * (C) Copyright 2007-2008
> + * Stelian Pop <stelian.pop@leadtechdesign.com>
> + * Lead Tech Design <www.leadtechdesign.com>
> + *
> + * (C) Copyright 2010
> + * Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
> + * esd electronic system design gmbh <www.esd.eu>
> + *

New copyrights before old
Swap places


> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *

<snip>

> +
> +#ifdef CONFIG_CMD_NAND
> +static void otc570_nand_hw_init(void)
> +{
> +	unsigned long csa;
> +
> +	/* Enable CS3 */
> +	csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
> +	at91_sys_write(AT91_MATRIX_EBI0CSA,
> +		csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
> +
> +	/* Configure SMC CS3 for NAND/SmartMedia */
> +	at91_sys_write(AT91_SMC_SETUP(3),
> +		AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
> +		AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
> +	at91_sys_write(AT91_SMC_PULSE(3),
> +		AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
> +		AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
> +	at91_sys_write(AT91_SMC_CYCLE(3),
> +		AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
> +	at91_sys_write(AT91_SMC_MODE(3),
> +		AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
> +		AT91_SMC_EXNWMODE_DISABLE |
> +#ifdef CONFIG_SYS_NAND_DBW_16
> +		AT91_SMC_DBW_16 |
> +#else /* CONFIG_SYS_NAND_DBW_8 */
> +		AT91_SMC_DBW_8 |
> +#endif

I do not see where CONFIG_SYS_NAND_DBW_16 is ever set to 1
I see meesc has similar logic.

It looks like this #if-def can be removed.
Do this or add comment explaining.


> +		AT91_SMC_TDF_(2));
> +
> +	/* Configure RDY/BSY */
> +	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
> +
> +	/* Enable NandFlash */
> +	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
> +}
> +#endif /* CONFIG_CMD_NAND */
> +

<snip>

Convert the element initialization to be
.vl_col = 640
.vl_row = 480
etc..

> +#ifdef CONFIG_LCD
> +/* Number of columns and rows, pixel clock in Hz and hsync/vsync polarity */
> +vidinfo_t panel_info = {
> +	vl_col:		640,
> +	vl_row:		480,
> +	vl_clk:		25175000,
> +	vl_sync:	ATMEL_LCDC_INVLINE_INVERTED |
> +			ATMEL_LCDC_INVFRAME_INVERTED,
> +
> +	vl_bpix:	3,	/* Bits per pixel, 0 = 1bit, 3 = 8bit */
> +	vl_tft:		1,	/* 0 = passive, 1 = TFT */
> +	vl_vsync_len:	1,	/* Length of vertical sync in number of lines */
> +	vl_upper_margin:35,	/* Idle lines at the beginning of the frame */
> +	vl_lower_margin:5,	/* Idle lines at the end of the frame */
> +	vl_hsync_len:	5,	/* Width of the LCDHSYNC pulse */
> +	vl_left_margin:	112,	/* Idle cycles at the beginning of the line */
> +	vl_right_margin:1,	/* Idle cycles at the end of the line */
> +
> +	mmio:		AT91SAM9263_LCDC_BASE,	/* Memory mapped registers */
> +};

<snip>

> +static void otc570_lcd_hw_init(void)
> +{
> +	at91_set_A_periph(AT91_PIN_PC0, 0);	/* LCDVSYNC */
> +	at91_set_A_periph(AT91_PIN_PC1, 0);	/* LCDHSYNC */
> +	at91_set_A_periph(AT91_PIN_PC2, 0);	/* LCDDOTCK */
> +	at91_set_A_periph(AT91_PIN_PC3, 0);	/* LCDDEN */
> +	at91_set_B_periph(AT91_PIN_PB9, 0);	/* LCDCC */
> +	at91_set_A_periph(AT91_PIN_PC6, 0);	/* LCDD2 */
> +	at91_set_A_periph(AT91_PIN_PC7, 0);	/* LCDD3 */
> +	at91_set_A_periph(AT91_PIN_PC8, 0);	/* LCDD4 */
> +	at91_set_A_periph(AT91_PIN_PC9, 0);	/* LCDD5 */
> +	at91_set_A_periph(AT91_PIN_PC10, 0);	/* LCDD6 */
> +	at91_set_A_periph(AT91_PIN_PC11, 0);	/* LCDD7 */
> +	at91_set_A_periph(AT91_PIN_PC14, 0);	/* LCDD10 */
> +	at91_set_A_periph(AT91_PIN_PC15, 0);	/* LCDD11 */
> +	at91_set_A_periph(AT91_PIN_PC16, 0);	/* LCDD12 */
> +	at91_set_B_periph(AT91_PIN_PC12, 0);	/* LCDD13 */
> +	at91_set_A_periph(AT91_PIN_PC18, 0);	/* LCDD14 */
> +	at91_set_A_periph(AT91_PIN_PC19, 0);	/* LCDD15 */
> +	at91_set_A_periph(AT91_PIN_PC22, 0);	/* LCDD18 */
> +	at91_set_A_periph(AT91_PIN_PC23, 0);	/* LCDD19 */
> +	at91_set_A_periph(AT91_PIN_PC24, 0);	/* LCDD20 */
> +	at91_set_B_periph(AT91_PIN_PC17, 0);	/* LCDD21 */
> +	at91_set_A_periph(AT91_PIN_PC26, 0);	/* LCDD22 */
> +	at91_set_A_periph(AT91_PIN_PC27, 0);	/* LCDD23 */
> +	at91_set_gpio_output(AT91_PIN_PA30, 1);	/* PCI */
> +
> +	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_LCDC);
> +
> +#ifndef CONFIG_FB_TO_SDRAM
> +	gd->fb_base = AT91SAM9263_SRAM0_BASE;

Should there be an #else ?

> +#endif
> +}
> +

<snip>

> +#ifdef CONFIG_MISC_INIT_R
> +int misc_init_r(void)
> +{
> +	char str[64];
> +
> +	at91_set_gpio_output(AT91_PIN_PA29, 1);
> +	at91_set_A_periph(AT91_PIN_PA26, 1);			/* TXD0 */
> +	at91_set_A_periph(AT91_PIN_PA27, 0);			/* RXD0 */
> +	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US0);
> +	/* Set USART_MODE = 1 (RS485) */
> +	at91_sys_write((0xFFF8C004 - AT91_BASE_SYS), 1);
> +
> +	puts("USART0: ");
> +
> +	if (getenv_r("usart0", str, sizeof(str)) == -1) {
> +		puts("No entry - assuming 1-wire\n");

Why are you mixing puts and printf ?

> +		/* CTS pin, works as mode select pin (0 = 1-wire; 1 = RS485) */
> +		at91_set_gpio_output(AT91_PIN_PA29, 0);
> +	} else {
> +		if (strcmp(str, "1-wire") == 0) {
> +			printf("%s\n", str);
> +			at91_set_gpio_output(AT91_PIN_PA29, 0);
> +		} else if (strcmp(str, "rs485") == 0) {
> +			printf("%s\n", str);
> +			at91_set_gpio_output(AT91_PIN_PA29, 1);
> +		} else {
> +			puts("Wrong entry - assuming 1-wire ");
> +			puts("(valid values are '1-wire' or 'rs485')\n");
> +			at91_set_gpio_output(AT91_PIN_PA29, 0);
> +		}
> +	}
> +	printf("Display memory address: 0x%08lX\n", gd->fb_base);

Above #ifndef may not set fb_base

> +
> +	return 0;
> +}
> +#endif /* CONFIG_MISC_INIT_R */
> +

<snip>

> +
> +/*
> + * U-Boot commands
> + */
> +
> +/* Set brightness */
> +int do_blbright(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +{
> +	unsigned long value = 0xff;
> +
> +	if (argc > 1) {
> +		value = simple_strtoul(argv[1], NULL, 0);
> +		if ((value >= 0) && (value <= 255)) {
> +			printf("Writing value %02lX ...", value);
> +			__raw_writel(value, (panel_info.mmio +
> +						ATMEL_LCDC_CONTRAST_VAL));
> +			puts("done\n");
> +		} else {
> +			puts("Invalid value! ");
> +			puts("Valid values are 0 ... 255 or 0x0 ... 0xFF\n");
> +			return -1;
> +		}
> +	} else {
> +		puts("No value given! ");
> +		puts("Valid values are 0 ... 255 or 0x0 ... 0xFF\n");
> +		return -1;
> +	}
> +	return 0;
> +}
> +U_BOOT_CMD(
> +	blbright,	2,	1,	do_blbright,
> +	"sets display brightness",
> +	"\n"
> +);
> +
> +/* Switch backlight power */
> +int do_blpower(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +{
> +	int i = 0;
> +	if (argc > 1) {
> +		i = argv[1][0] == '0';
> +		if (i) {
> +			puts("Switching backlight off... ");
> +			lcd_disable();
> +		} else {
> +			puts("Switching backlight on... ");
> +			lcd_enable();
> +		}
> +		puts("done\n");
> +	} else
> +		puts("No value given!\n");
> +	return 0;
> +}
> +U_BOOT_CMD(
> +	blpower,	2,	1,	do_blpower,
> +	"switches display-backlight on or off",
> +	"\n"
> +);

These video commands look common enough that maybe they should
go into common/*  Is there anything that already does this?


<snip>

> diff --git a/include/configs/otc570.h b/include/configs/otc570.h
> new file mode 100644
> index 0000000..bb04abd
> --- /dev/null
> +++ b/include/configs/otc570.h
> @@ -0,0 +1,247 @@
> +/*
> + * (C) Copyright 2007-2008
> + * Stelian Pop <stelian.pop@leadtechdesign.com>
> + * Lead Tech Design <www.leadtechdesign.com>
> + *
> + * (C) Copyright 2009
> + * Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
> + * esd electronic system design gmbh <www.esd.eu>
> + *

New copyrights before old
swap.

> + * Configuation settings for the esd OTC570 board.
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +/* Common stuff */
> +#define CONFIG_SYS_HZ			1000	/* decrementer freq */

board and cpu defines first
Move CONFIG_SYS_HZ lower


> +#define CONFIG_OTC570			1	/* Board is esd OTC570 */
> +#define CONFIG_ARM926EJS		1	/* This is an ARM926EJS Core */
> +#define CONFIG_AT91SAM9263		1	/* It's an AT91SAM9263 SoC */
> +#define CONFIG_DISPLAY_BOARDINFO	1
> +#define CONFIG_DISPLAY_CPUINFO		1	/* display cpu info and speed */

<snip>

> index 5b8c3c3..c91e19d 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -102,6 +102,9 @@ endif
>  ifeq ($(VENDOR),atmel)
>  LOGO_BMP= logos/atmel.bmp
>  endif
> +ifeq ($(VENDOR),esd)
> +LOGO_BMP= logos/esd.bmp
> +endif

There are a number of esd board.
Is this bmp ok for all of them ?

>  ifeq ($(VENDOR),ronetix)
>  LOGO_BMP= logos/ronetix.bmp
>  endif
> diff --git a/tools/logos/esd.bmp b/tools/logos/esd.bmp

This looks ok

> new file mode 100644

  reply	other threads:[~2010-01-23 19:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19  7:50 [U-Boot] [PATCH] at91: Add esd gmbh OTC570 board support Daniel Gorsulowski
2010-01-23 19:00 ` Tom [this message]
2010-01-25  9:50   ` Daniel Gorsulowski
2010-02-02 15:39     ` Detlev Zundel

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=4B5B4764.7030900@windriver.com \
    --to=tom.rix@windriver.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 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.