[U-Boot] [PATCH][AT91] Custom AFEB9260 board support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Aug 29 02:25:20 CEST 2008


On 11:55 Fri 08 Aug     , Sergey Lapin wrote:
> This patch provides support for AFEB9260 board, a product of
> OpenSource hardware and software. Some commertial projects
> are made with this design. A board is basically AT91SAM9260-EK
> with some modifications and different peripherals and different
> parts used. Main purpose of this project is to gain experience in
> hardware design.
> More info: http://groups.google.com/group/arm9fpga-evolution-board
> (In Russian only, sorry).
> Subversion repository: svn://194.85.238.22/home/users/george/svn/arm9eb
> 
> Signed-off-by: Sergey Lapin <slapin at ossfans.org>
> ---
Please add it in MAKEALL
>  Makefile                   |    3 +
>  board/afeb9260/Makefile    |   56 +++++++++++
>  board/afeb9260/afeb9260.c  |  230 ++++++++++++++++++++++++++++++++++++++++++++
>  board/afeb9260/config.mk   |    1 +
>  board/afeb9260/nand.c      |   79 +++++++++++++++
>  board/afeb9260/partition.c |   36 +++++++
>  include/configs/afeb9260.h |  169 ++++++++++++++++++++++++++++++++
>  7 files changed, 574 insertions(+), 0 deletions(-)
>  create mode 100644 board/afeb9260/Makefile
>  create mode 100644 board/afeb9260/afeb9260.c
>  create mode 100644 board/afeb9260/config.mk
>  create mode 100644 board/afeb9260/nand.c
>  create mode 100644 board/afeb9260/partition.c
>  create mode 100644 include/configs/afeb9260.h
> 
> diff --git a/Makefile b/Makefile
> index 3179c67..edef217 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2387,6 +2387,9 @@ at91cap9adk_config	:	unconfig
>  at91sam9260ek_config	:	unconfig
>  	@$(MKCONFIG) $(@:_config=) arm arm926ejs at91sam9260ek atmel at91sam9
>  
> +afeb9260_config	:	unconfig
> +	@$(MKCONFIG) $(@:_config=) arm arm926ejs afeb9260 NULL at91sam9
> +
>  ########################################################################
>  ## ARM Integrator boards - see doc/README-integrator for more info.
>  integratorap_config	\
> diff --git a/board/afeb9260/Makefile b/board/afeb9260/Makefile
> new file mode 100644
> index 0000000..60c4304
> --- /dev/null
> +++ b/board/afeb9260/Makefile
> @@ -0,0 +1,56 @@
> +#
> +# (C) Copyright 2003-2008
> +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> +#########################################################################
> diff --git a/board/afeb9260/afeb9260.c b/board/afeb9260/afeb9260.c
> new file mode 100644
> index 0000000..252a1ea
> --- /dev/null
> +++ b/board/afeb9260/afeb9260.c
> @@ -0,0 +1,230 @@
> +/*
> + * (C) Copyright 2008 Sergey Lapin <slapin at ossfans.org>
I'm not sure you can remove orignal copyright where yours fiels are nearly 80%
copy from at91sam9260ek
btw could you resend your patch generate with
git-format-patch -M -B -C --find-copies-harder
> + * 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 <common.h>
> +#include <asm/arch/at91sam9260.h>
> +#include <asm/arch/at91sam9260_matrix.h>
> +#include <asm/arch/at91sam9_smc.h>
> +#include <asm/arch/at91_pmc.h>
> +#include <asm/arch/at91_rstc.h>
> +#include <asm/arch/gpio.h>
> +#include <asm/arch/io.h>
> +#if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
> +#include <net.h>
> +#endif
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +/* ------------------------------------------------------------------------- */
> +/*
> + * Miscelaneous platform dependent initialisations
> + */
> +
> +static void afeb9260_serial_hw_init(void)
> +{
> +#ifdef CONFIG_USART0
> +	at91_set_A_periph(AT91_PIN_PB4, 1);		/* TXD0 */
> +	at91_set_A_periph(AT91_PIN_PB5, 0);		/* RXD0 */
> +	at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US0);
> +#endif
> +
> +#ifdef CONFIG_USART1
> +	at91_set_A_periph(AT91_PIN_PB6, 1);		/* TXD1 */
> +	at91_set_A_periph(AT91_PIN_PB7, 0);		/* RXD1 */
> +	at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US1);
> +#endif
> +
> +#ifdef CONFIG_USART2
> +	at91_set_A_periph(AT91_PIN_PB8, 1);		/* TXD2 */
> +	at91_set_A_periph(AT91_PIN_PB9, 0);		/* RXD2 */
> +	at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_US2);
> +#endif
> +
> +#ifdef CONFIG_USART3	/* DBGU */
> +	at91_set_A_periph(AT91_PIN_PB14, 0);		/* DRXD */
> +	at91_set_A_periph(AT91_PIN_PB15, 1);		/* DTXD */
> +	at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
> +#endif
> +}
> +
> +static void afeb9260_nand_hw_init(void)
> +{
> +	unsigned long csa;
> +
> +	/* Enable CS3 */
> +	csa = at91_sys_read(AT91_MATRIX_EBICSA);
> +	at91_sys_write(AT91_MATRIX_EBICSA,
> +		       csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
> +
> +	/* Configure SMC CS3 for NAND/SmartMedia */
> +	at91_sys_write(AT91_SMC_SETUP(3),
> +		       AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
> +		       AT91_SMC_NRDSETUP_(0) | 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 |
> +		       AT91_SMC_DBW_8 |
> +		       AT91_SMC_TDF_(2));
> +
> +	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
> +
> +	/* Configure RDY/BSY */
> +	at91_set_gpio_input(AT91_PIN_PC13, 1);
> +
> +	/* Enable NandFlash */
> +	at91_set_gpio_output(AT91_PIN_PC14, 1);
> +}
> +
> +}
> +#endif
> +
> +int board_init(void)
> +{
> +	/* Enable Ctrlc */
> +	console_init_f();
> +
> +	/* arch number of AT91SAM9260EK-Board */
> +	// gd->bd->bi_arch_number = CONFIG_MACH_AFEB9260
> +	gd->bd->bi_arch_number = 1859;
please update mach file
add no c++ comment
> +	/* adress of boot parameters */
> +	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
> +
> +	afeb9260_serial_hw_init();
> +#ifdef CONFIG_CMD_NAND
> +	afeb9260_nand_hw_init();
> +#endif
> +	afeb9260_spi_hw_init();
> +#ifdef CONFIG_MACB
> +	afeb9260_macb_hw_init();
> +#endif
> +
> +	return 0;
> +}
> +#include <config.h>
> +#include <asm/hardware.h>
> +#include <dataflash.h>
> +
> +AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
> +
> +struct dataflash_addr cs[CFG_MAX_DATAFLASH_BANKS] = {
> +	{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
> +	{CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
> +};
> +
> +/*define the area offsets*/
> +dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
> +	{0x00000000, 0x000041FF, FLAG_PROTECT_CLEAR,   0, "Bootstrap"},
                                                    ^^^
whitespaces pleaes remove

> +	{0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
> +	{0x00008400, 0x00041FFF, FLAG_PROTECT_CLEAR,   0, "U-Boot"},
                                                    ^^^
Ditto
> +};
> diff --git a/include/configs/afeb9260.h b/include/configs/afeb9260.h
> new file mode 100644
> index 0000000..6241687
> --- /dev/null
> +++ b/include/configs/afeb9260.h
> @@ -0,0 +1,169 @@
> +/*
> + * (C) Copyright 2008 Sergey Lapin
please add your e-mail
> + *
> + * Configuation settings for the AFEB9260 board.
> +
> +/*
> + * Hardware drivers
> + */
> +#define CONFIG_ATMEL_USART	1
> +#undef CONFIG_USART0
> +#undef CONFIG_USART1
> +#undef CONFIG_USART2
> +#define CONFIG_USART3		1	/* USART 3 is DBGU */
> +
> +#define CONFIG_BOOTDELAY	3
> +
> +/*
> + * BOOTP options
> + */
> +#define CONFIG_BOOTP_BOOTFILESIZE	1
> +#define CONFIG_BOOTP_BOOTPATH		1
> +#define CONFIG_BOOTP_GATEWAY		1
> +#define CONFIG_BOOTP_HOSTNAME		1
> +
> +/*
> + * Command line configuration.
> + */
> +#include <config_cmd_default.h>
> +#undef CONFIG_CMD_BDI
> +#undef CONFIG_CMD_IMI
> +#undef CONFIG_CMD_AUTOSCRIPT
why do you undef autoscript?
> +#undef CONFIG_CMD_FPGA
> +#undef CONFIG_CMD_LOADS
> +#undef CONFIG_CMD_IMLS

Best regards,
J.


More information about the U-Boot mailing list