From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Gorsulowski Date: Mon, 29 Jun 2009 08:38:10 +0200 Subject: [U-Boot] [PATCH] at91: Add esd gmbh MEESC board support In-Reply-To: <20090627221641.GS8587@game.jcrosoft.org> References: <12457524691480-git-send-email-Daniel.Gorsulowski@esd.eu> <20090627221641.GS8587@game.jcrosoft.org> Message-ID: <4A486152.50008@esd.eu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Jean-Christophe PLAGNIOL-VILLARD wrote: > On 12:21 Tue 23 Jun , Daniel Gorsulowski wrote: >> This patch adds support for esd gmbh MEESC board. >> The MEESC is based on an Atmel AT91SAM9263 SoC. >> >> Signed-off-by: Daniel Gorsulowski >> --- >> >> Jean-Christophe: This patch requires an up-to-date mach-types.h, >> please sync it. >> >> diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c >> new file mode 100644 >> index 0000000..557a51c >> --- /dev/null >> +++ b/board/esd/meesc/meesc.c >> @@ -0,0 +1,211 @@ >> +/* >> + * (C) Copyright 2007-2008 >> + * Stelian Pop >> + * Lead Tech Design >> + * >> + * (C) Copyright 2009 >> + * Daniel Gorsulowski >> + * esd electronic system design gmbh >> + * >> + * 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 >> + */ >> + >> +#include >> +#include >> +#include > please use ok >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +DECLARE_GLOBAL_DATA_PTR; >> + >> +/* >> + * Miscelaneous platform dependent initialisations >> + */ > it will be better to only read it only and store it in a static I only use it once, but if you really mean, I'll change it. >> +int get_hw_rev(void) >> +{ >> + int rev = at91_get_gpio_value(AT91_PIN_PB19); > please add an empty line ok >> + rev |= at91_get_gpio_value(AT91_PIN_PB20) << 1; >> + rev |= at91_get_gpio_value(AT91_PIN_PB21) << 2; >> + rev |= at91_get_gpio_value(AT91_PIN_PB22) << 3; >> + >> + if (rev == 15) >> + rev = 0; >> + >> + return rev; >> +} >> + > >> + >> +int checkboard(void) >> +{ >> + char str[32]; >> + char buf[32]; >> + >> + puts("Board: esd CAN-EtherCAT Gateway"); >> + if (getenv_r("serial#", str, sizeof(str)) > 0) { >> + puts(", serial# "); >> + puts(str); >> + } >> + printf("\nHardware-revision: 1.%d\n", get_hw_rev()); >> + printf("Crystal frequency:\t%8s MHz\n", >> + strmhz(buf, get_main_clk_rate())); >> + printf("CPU clock:\t\t%8s MHz\n", >> + strmhz(buf, get_cpu_clk_rate())); >> +#ifdef CONFIG_SHOW_VERBOSE_CLOCKINFO >> + printf("Master clock:\t\t%8s MHz\n", >> + strmhz(buf, get_mck_clk_rate())); >> + printf("PLL A clock:\t\t%8s MHz\n", >> + strmhz(buf, get_plla_clk_rate())); >> + printf("PLL B Reg.:\t\t0x%08X\n", >> + at91_sys_read(AT91_CKGR_PLLBR)); >> + printf("PLL B clock:\t\t%8s MHz\n", >> + strmhz(buf, get_pllb_clk_rate())); >> +#endif >> + printf("Mach-type: %lu\n", gd->bd->bi_arch_number); >> + return 0; >> +} > please use cpu_info when it's possible to avoid copy & paste > Coud you explain a few more? I can't find a function called 'cpu_info'. >> +int board_init(void) >> +{ >> + /* Enable Ctrlc */ >> + console_init_f(); > no need Ok, I'll remove it >> + >> + /* Peripheral Clock Enable Register */ >> + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOA | >> + 1 << AT91SAM9263_ID_PIOB | >> + 1 << AT91SAM9263_ID_PIOCDE | >> + 1 << AT91SAM9263_ID_CAN); >> + >> + /* arch number of MEESC-Board */ >> + gd->bd->bi_arch_number = MACH_TYPE_MEESC; >> + >> + /* adress of boot parameters */ >> + gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; >> + >> + at91_serial_hw_init(); >> +#ifdef CONFIG_CMD_NAND >> + meesc_nand_hw_init(); >> +#endif >> + meesc_ethercat_hw_init(); >> +#ifdef CONFIG_HAS_DATAFLASH >> + at91_spi0_hw_init(1 << 0); >> +#endif >> +#ifdef CONFIG_MACB >> + meesc_macb_hw_init(); >> +#endif >> + at91_set_A_periph(AT91_PIN_PA13, 0); /* CAN_TX */ >> + at91_set_A_periph(AT91_PIN_PA14, 1); /* CAN_RX */ > please add a at91_can_hw_init function Ok, I'll do this by a separate patch >> + return 0; >> +} > >> + >> +#ifndef __CONFIG_H >> +#define __CONFIG_H >> + >> +/* Common stuff */ >> +#define AT91_CPU_NAME "AT91SAM9263" > please remove ok >> +#define CONFIG_SYS_HZ 1000 /* decrementer freq */ >> +#define CONFIG_MEESC 1 /* Board is esd MEESC */ >> +#define CONFIG_ARM926EJS 1 /* This is an ARM926EJS Core */ >> +#define CONFIG_AT91SAM9263 1 /* It's an AT91SAM9263 SoC */ >> +#define CONFIG_ENV_OVERWRITE 1 /* necessary on prototypes */ >> +#define CONFIG_DISPLAY_BOARDINFO 1 >> +#define CONFIG_PREBOOT /* enable preboot variable */ > why which value? This is a custom value, which is set, during putting the board into operation. So it is unalterable to define CONFIG_PREBOOT >> +#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ >> +#define CONFIG_SETUP_MEMORY_TAGS 1 >> +#define CONFIG_INITRD_TAG 1 >> +#undef CONFIG_USE_IRQ /* don't need IRQ/FIQ stuff */ >> + > Best Regards, > J. > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > > Best regards, Daniel Gorsulowski