[U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)

Andreas Bießmann andreas.devel at googlemail.com
Tue Oct 29 10:12:30 CET 2013


Dear Mateusz Kulikowski,

some comments additional to Bo's.

On 10/28/2013 05:57 AM, Bo Shen wrote:
> Hi Mateusz Kulikowski,
>   Add Andreas in loop.
> 
> On 10/28/2013 03:34, Mateusz Kulikowski wrote:
>> Add support for USB-A9263 board manufactured by Calao Systems
>> (http://www.calao-systems.com/).
>> Code is based on old U-Boot sources (2010.09) released by Calao and
>> existing AT92SAM9263-EK code.
>>
>> Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
>> ---
>>   board/calao/usb_a9263/Makefile    |  35 ++++++++
>>   board/calao/usb_a9263/partition.c |  25 ++++++
>>   board/calao/usb_a9263/usb_a9263.c | 158
>> ++++++++++++++++++++++++++++++++++
>>   boards.cfg                        |   1 +
>>   include/configs/usb_a9263.h       | 175
>> ++++++++++++++++++++++++++++++++++++++
>>   5 files changed, 394 insertions(+)
>>   create mode 100644 board/calao/usb_a9263/Makefile
>>   create mode 100644 board/calao/usb_a9263/partition.c
>>   create mode 100644 board/calao/usb_a9263/usb_a9263.c
>>   create mode 100644 include/configs/usb_a9263.h
>>
>> diff --git a/board/calao/usb_a9263/Makefile
>> b/board/calao/usb_a9263/Makefile
>> new file mode 100644
>> index 0000000..211752c
>> --- /dev/null
>> +++ b/board/calao/usb_a9263/Makefile
>> @@ -0,0 +1,35 @@
>> +#
>> +# (C) Copyright 2003-2008
>> +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
>> +#
>> +# (C) Copyright 2008
>> +# Stelian Pop <stelian at popies.net>
>> +# Lead Tech Design <www.leadtechdesign.com>
>> +#
>> +# (C) Copyright 2013
>> +# Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
>> +#
>> +# SPDX-License-Identifier:    GPL-2.0+
>> +
>> +include $(TOPDIR)/config.mk
>> +
>> +LIB    = $(obj)lib$(BOARD).o
>> +
>> +COBJS-y += usb_a9263.o
>> +COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o
>> +
>> +SRCS    := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
>> +OBJS    := $(addprefix $(obj),$(COBJS-y))
>> +SOBJS    := $(addprefix $(obj),$(SOBJS))
>> +
>> +$(LIB):    $(obj).depend $(OBJS) $(SOBJS)
>> +    $(call cmd_link_o_target, $(OBJS) $(SOBJS))
>> +
>> +#########################################################################
>>
>> +
>> +# defines $(obj).depend target
>> +include $(SRCTREE)/rules.mk
>> +
>> +sinclude $(obj).depend
>> +
>> +#########################################################################
>>
>> diff --git a/board/calao/usb_a9263/partition.c
>> b/board/calao/usb_a9263/partition.c
>> new file mode 100644
>> index 0000000..17cbbf0
>> --- /dev/null
>> +++ b/board/calao/usb_a9263/partition.c
>> @@ -0,0 +1,25 @@
>> +/*
>> + * (C) Copyright 2008-2009
>> + * Ulf Samuelsson <ulf at atmel.com>
>> + * Thomas Petazzoni, Free Electrons,
>> <thomas.petazzoni at free-electrons.com>
>> + * Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
>> + *
>> + * SPDX-License-Identifier:    GPL-2.0+
>> + */
>> +#include <common.h>
>> +#include <config.h>
>> +#include <asm/hardware.h>
>> +#include <dataflash.h>
>> +
>> +AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS];
>> +
>> +struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = {
>> +    {CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0, 0},    /* Logical adress,
>> CS */
>> +};
>> +
>> +/*define the area offsets*/
>> +dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
>> +    {0x00000000, 0x00001FFF, FLAG_PROTECT_SET, 0, "Bootstrap"},
>> +    {0x00002000, 0x00003FFF, FLAG_PROTECT_CLEAR, 0, "Environment"},
>> +    {0x00004000, 0xFFFFFFFF, FLAG_PROTECT_SET, 0, "U-Boot"},
>> +};

I would really like to see that removed. The dataflash thing is another
part on my todo list. The common mtd code can handle these devices too
(see for example at91sam9n12ek, at91sam9x5ek, ethernut5 sam5d3xek and
top9000). I did some short testing on that for at91sam9263ek (at home,
never sent to the list) and it worked basically. Will see if I find it
this evening, clean up and post it this evening CET.

>> diff --git a/board/calao/usb_a9263/usb_a9263.c
>> b/board/calao/usb_a9263/usb_a9263.c
>> new file mode 100644
>> index 0000000..54c7671
>> --- /dev/null
>> +++ b/board/calao/usb_a9263/usb_a9263.c
>> @@ -0,0 +1,158 @@
>> +/*
>> + * (C) Copyright 2007-2013
>> + * Stelian Pop <stelian.pop at leadtechdesign.com>
>> + * Lead Tech Design <www.leadtechdesign.com>
>> + * Thomas Petazzoni, Free Electrons,
>> <thomas.petazzoni at free-electrons.com>
>> + * Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
>> + *
>> + * SPDX-License-Identifier:    GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +#include <asm/sizes.h>
> 
> No where use it (?)
> 
>> +#include <asm/arch/at91sam9263.h>
> 
> This include can be removed as you include hardware.h.
> 
>> +#include <asm/arch/at91sam9_smc.h>
>> +#include <asm/arch/at91_common.h>
>> +#include <asm/arch/at91_pmc.h>
>> +#include <asm/arch/at91_rstc.h>
>> +#include <asm/arch/at91_matrix.h>
>> +#include <asm/arch/at91_pio.h>
>> +#include <asm/arch/clk.h>
>> +#include <asm/arch/gpio.h>
>> +#include <asm/arch/hardware.h>
>> +#if defined(CONFIG_MACB)
>> +#include <net.h>
>> +#endif
>> +#include <netdev.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +/*
>> -------------------------------------------------------------------------
>> */
>> +/*
>> + * Miscelaneous platform dependent initialisations
>> + */
> 
> I think this comment no meaning here.
> 
>> +#ifdef CONFIG_CMD_NAND
>> +static void usb_a9263_nand_hw_init(void)
>> +{
>> +    unsigned long csa;
>> +    at91_smc_t *smc = (at91_smc_t *)ATMEL_BASE_SMC0;
>> +    at91_matrix_t *matrix = (at91_matrix_t *)ATMEL_BASE_MATRIX;
>> +    at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
>> +
>> +    /* Enable CS3 */
>> +    csa = readl(&matrix->csa[0]) | AT91_MATRIX_CSA_EBI_CS3A;
>> +    writel(csa, &matrix->csa[0]);
>> +
>> +    /* Configure SMC CS3 for NAND/SmartMedia */
>> +    writel(AT91_SMC_SETUP_NWE(1) | AT91_SMC_SETUP_NCS_WR(0) |
>> +           AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
>> +           &smc->cs[3].setup);
>> +
>> +    writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(3) |
>> +           AT91_SMC_PULSE_NRD(3) | AT91_SMC_PULSE_NCS_RD(3),
>> +           &smc->cs[3].pulse);
>> +
>> +    writel(AT91_SMC_CYCLE_NWE(5) | AT91_SMC_CYCLE_NRD(5),
>> +           &smc->cs[3].cycle);
>> +
>> +    writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
>> +           AT91_SMC_MODE_EXNW_DISABLE |
>> +           AT91_SMC_MODE_DBW_8 |
>> +           AT91_SMC_MODE_TDF_CYCLE(2), &smc->cs[3].mode);
>> +
>> +    writel(1 << ATMEL_ID_PIOA | 1 << ATMEL_ID_PIOCDE, &pmc->pcer);
>> +
>> +    /* 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
>> +
>> +#ifdef CONFIG_MACB
>> +static void usb_a9263_macb_hw_init(void)
>> +{
>> +    unsigned long erstl;
>> +    at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
>> +    at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
>> +    at91_rstc_t *rstc = (at91_rstc_t *)ATMEL_BASE_RSTC;
>> +
>> +    /* Enable clock */
>> +    writel(1 << ATMEL_ID_EMAC, &pmc->pcer);
>> +
>> +    /*
>> +     * Disable pull-up on:
>> +     *  RXDV (PC25) => PHY normal mode (not Test mode)
>> +     *  ERX0 (PE25) => PHY ADDR0
>> +     *  ERX1 (PE26) => PHY ADDR1 => PHYADDR = 0x0
>> +     *
>> +     * PHY has internal pull-down
>> +     */
>> +    writel(1 << 25, &pio->pioc.pudr);
>> +    writel((1 << 25) | (1 << 26), &pio->pioe.pudr);
> 
> Use GPIO API instead of hard code.
> 
>> +
>> +    erstl = readl(&rstc->mr) & AT91_RSTC_MR_ERSTL_MASK;
>> +
>> +    /* Need to reset PHY -> 500ms reset */
>> +    writel(AT91_RSTC_KEY | AT91_RSTC_MR_ERSTL(0x0D) |
>> +           AT91_RSTC_MR_URSTEN, &rstc->mr);
>> +
>> +    writel(AT91_RSTC_KEY | AT91_RSTC_CR_EXTRST, &rstc->cr);
>> +
>> +    /* Wait for end hardware reset */
>> +    while (!(readl(&rstc->sr) & AT91_RSTC_SR_NRSTL))
>> +        ;
>> +
>> +    /* Restore NRST value */
>> +    writel(AT91_RSTC_KEY | erstl | AT91_RSTC_MR_URSTEN, &rstc->mr);
>> +
>> +    /* Re-enable pull-up */
>> +    writel(1 << 25, &pio->pioc.puer);
>> +    writel((1 << 25) | (1 << 26), &pio->pioe.puer);
> 
> Ditto
> 
>> +    at91_macb_hw_init();
>> +}
>> +#endif
>> +
>> +int board_init(void)
>> +{
>> +    /* arch number of USB-A9263-Board */
>> +    gd->bd->bi_arch_number = MACH_TYPE_USB_A9263;
> 
> Move to board configuration file.
> 
>> +    /* adress of boot parameters */
>> +    gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>> +
>> +#ifdef CONFIG_CMD_NAND
>> +    usb_a9263_nand_hw_init();
>> +#endif
>> +#ifdef CONFIG_HAS_DATAFLASH
>> +    at91_set_pio_output(AT91_PIO_PORTE, 20, 1);    /* select spi0
>> clock */
>> +    at91_spi0_hw_init(1 << 0);
>> +#endif
>> +#ifdef CONFIG_MACB
>> +    usb_a9263_macb_hw_init();
>> +#endif
>> +#ifdef CONFIG_USB_OHCI_NEW
>> +    at91_uhp_hw_init();
>> +#endif
>> +    return 0;
>> +}
>> +
>> +int dram_init(void)
>> +{
>> +    gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
>> +                    CONFIG_SYS_SDRAM_SIZE);
>> +    return 0;
>> +}
>> +
>> +int board_eth_init(bd_t *bis)
>> +{
>> +    int rc = 0;
>> +
>> +    (void)bis;
> 
> No need this.

A good way to avoid 'unused parameter' warnings is to just leave the
parameter name out (i.e. use 'int board_eth_init(bd_t *)').

>> +#ifdef CONFIG_MACB
>> +    rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x00);
>> +#endif
>> +    return rc;
>> +}
>> diff --git a/boards.cfg b/boards.cfg
>> index 56af102..601482a 100644
>> --- a/boards.cfg
>> +++ b/boards.cfg
>> @@ -119,6 +119,7 @@ Active  arm         arm926ejs      at91       
>> calao           tny_a9260
>>   Active  arm         arm926ejs      at91        calao          
>> tny_a9260           tny_a9260_nandflash                 
>> tny_a9260:AT91SAM9260,SYS_USE_NANDFLASH                                                                                          
>> Albin Tonnerre <albin.tonnerre at free-electrons.com>
>>   Active  arm         arm926ejs      at91        calao          
>> tny_a9260           tny_a9g20_eeprom                    
>> tny_a9260:AT91SAM9G20,SYS_USE_EEPROM                                                                                             
>> Albin Tonnerre <albin.tonnerre at free-electrons.com>
>>   Active  arm         arm926ejs      at91        calao          
>> tny_a9260           tny_a9g20_nandflash                 
>> tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH                                                                                          
>> Albin Tonnerre <albin.tonnerre at free-electrons.com>
>> +Active  arm         arm926ejs      at91        calao          
>> usb_a9263           usb_a9263_dataflash                 
>> usb_a9263:AT91SAM9263,SYS_USE_DATAFLASH                                                                                          
>> Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
>>   Active  arm         arm926ejs      at91        egnite         
>> ethernut5           ethernut5                           
>> ethernut5:AT91SAM9XE                                                                                                             
>> egnite GmbH <info at egnite.de>
>>   Active  arm         arm926ejs      at91        emk            
>> top9000             top9000eval_xe                      
>> top9000:EVAL9000                                                                                                                 
>> Reinhard Meyer <reinhard.meyer at emk-elektronik.de>
>>   Active  arm         arm926ejs      at91        emk            
>> top9000             top9000su_xe                        
>> top9000:SU9000                                                                                                                   
>> Reinhard Meyer <reinhard.meyer at emk-elektronik.de>
>> diff --git a/include/configs/usb_a9263.h b/include/configs/usb_a9263.h
>> new file mode 100644
>> index 0000000..1d36795
>> --- /dev/null
>> +++ b/include/configs/usb_a9263.h
>> @@ -0,0 +1,175 @@
>> +/*
>> + * (C) Copyright 2007-2013
>> + * Stelian Pop <stelian.pop at leadtechdesign.com>
>> + * Lead Tech Design <www.leadtechdesign.com>
>> + * Thomas Petazzoni, Free Electrons,
>> <thomas.petazzoni at free-electrons.com>
>> + * Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
>> + *
>> + * Settings for Calao USB-A9263 board
>> + *
>> + * U-Boot image has to be less than 200704 bytes, otherwise
>> at91bootstrap
>> + * installed on board will not be able to load it properly.
>> + *
>> + * SPDX-License-Identifier:    GPL-2.0+
>> + */
>> +
>> +#ifndef __CONFIG_H
>> +#define __CONFIG_H
>> +#include <asm/hardware.h>
>> +
>> +/* ARM asynchronous clock */
>> +#define CONFIG_SYS_AT91_MAIN_CLOCK    12000000    /* 12 MHz crystal */
>> +#define CONFIG_SYS_AT91_SLOW_CLOCK    32768
>> +#define CONFIG_SYS_HZ                1000
>> +
>> +#define CONFIG_CALAO_USB_A9263     1    /* Calao USB A 9263
>> Board       */
> 
> No where use it.
> 
>> +
>> +#define CONFIG_ARCH_CPU_INIT
>> +
>> +#define CONFIG_CMDLINE_TAG    1    /* enable passing of ATAGs      */
>> +#define CONFIG_SETUP_MEMORY_TAGS 1
>> +#define CONFIG_INITRD_TAG    1

Please do not set a value where just the 'is defined' state is tested.

>> +
>> +#define CONFIG_SKIP_LOWLEVEL_INIT
>> +
>> +#define CONFIG_DISPLAY_CPUINFO
>> +
>> +#define CONFIG_OF_LIBFDT
>> +
>> +#define CONFIG_SYS_TEXT_BASE 0x23f00000
> 
> This address should be considered as u-boot is top down map, so if your
> system only 64MiB, there is only 1MiB left.

As mentioned in another mail. Just one point more. It is up to you to
set a correct value here. It may be ok for your setup to just leave 1MiB
to top of RAM, but I doubt it really works in any case cause of the
relocation. Please hack the code and print out the '__image_copy_start'
and '__image_copy_end' symbol position before and after relocate_code().
Beware, arm moved to generic relocation, you have to look up
common/board_[fr].c.
Also it may happen that the relocation clobbers some stuff in rel_dyn or
bss sections.
If you can prove it will not collide at that position I'm fine to take
it as is.

> 
>> +
>> +/*
>> + * Hardware drivers
>> + */
>> +#define CONFIG_ATMEL_LEGACY
>> +#define CONFIG_AT91_GPIO    1
> 
> Please discard all unnecessary the "1".
> 
>> +
>> +/* serial console */
>> +#define CONFIG_ATMEL_USART    1
>> +#define CONFIG_USART_BASE    ATMEL_BASE_DBGU
>> +#define CONFIG_USART_ID        ATMEL_ID_SYS
>> +#define CONFIG_BAUDRATE        115200
>> +
>> +/* LCD */
>> +#undef CONFIG_LCD
> 
> Nowhere define it, so, need need undef it.
> 
>> +
>> +#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_FPGA
>> +#undef CONFIG_CMD_IMI
>> +#undef CONFIG_CMD_IMLS
>> +#undef CONFIG_CMD_LOADS
>> +#undef CONFIG_CMD_SOURCE
>> +#undef CONFIG_CMD_NFS
>> +/*
>> + * U-Boot with enabled USB stack is too big to load properly on default
>> + * at91bootstrap.
>> + */
>> +#undef CONFIG_CMD_USB
> 
> Ditto.
> 
>> +
>> +#define CONFIG_CMD_PING        1
>> +#define CONFIG_CMD_DHCP        1
>> +#define CONFIG_CMD_NAND        1
>> +
>> +/* SDRAM */
>> +#define CONFIG_NR_DRAM_BANKS        1
>> +#define CONFIG_SYS_SDRAM_BASE        ATMEL_BASE_CS1
>> +#define CONFIG_SYS_SDRAM_SIZE        0x04000000
>> +
>> +#define CONFIG_SYS_INIT_SP_ADDR \
>> +    (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
>> +
>> +/* DataFlash */
>> +#define CONFIG_ATMEL_DATAFLASH_SPI
>> +#define CONFIG_HAS_DATAFLASH            1
>> +#define CONFIG_SYS_SPI_WRITE_TOUT        (5*CONFIG_SYS_HZ)
>> +#define CONFIG_SYS_MAX_DATAFLASH_BANKS        1
>> +#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0    0xC0000000
>> +#define AT91_SPI_CLK            8000000
>> +#define DATAFLASH_TCSS            (0x1a << 16)
>> +#define DATAFLASH_TCHS            (0x1 << 24)
>> +
>> +/* no NOR flash */
>> +#define CONFIG_SYS_NO_FLASH            1
>> +
>> +/* NAND flash */
>> +#ifdef CONFIG_CMD_NAND
>> +#define CONFIG_NAND_ATMEL
>> +#define CONFIG_SYS_MAX_NAND_DEVICE        1
>> +#define CONFIG_SYS_NAND_BASE            ATMEL_BASE_CS3
>> +#define CONFIG_SYS_NAND_DBW_8            1
> 
> No where use it.
> 
>> +/* our ALE is AD21 */
>> +#define CONFIG_SYS_NAND_MASK_ALE        (1 << 21)
>> +/* our CLE is AD22 */
>> +#define CONFIG_SYS_NAND_MASK_CLE        (1 << 22)
>> +#define CONFIG_SYS_NAND_ENABLE_PIN        AT91_PIN_PD15
>> +#define CONFIG_SYS_NAND_READY_PIN        AT91_PIN_PA22
>> +#endif
>> +
>> +/* Ethernet */
>> +#define CONFIG_MACB                1
>> +#define CONFIG_RMII                1
>> +#define CONFIG_NET_RETRY_COUNT            20
>> +#define CONFIG_MACB_SEARCH_PHY            1
>> +#define CONFIG_ETHADDR                00:0D:00:0D:00:AB
> 
> For the MAC address, I think we should get from environment or other
> method, while not hard code it here.
> 
>> +
>> +/* USB */
>> +#ifdef CONFIG_CMD_USB
>> +#define CONFIG_USB_ATMEL
>> +#define CONFIG_USB_OHCI_NEW                1
>> +#define CONFIG_DOS_PARTITION                1
>> +#define CONFIG_SYS_USB_OHCI_CPU_INIT        1
>> +#define CONFIG_SYS_USB_OHCI_REGS_BASE        0x00a00000
>> +#define CONFIG_SYS_USB_OHCI_SLOT_NAME        "at91sam9263"
>> +#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS    2
>> +#define CONFIG_USB_STORAGE                1
>> +#define CONFIG_CMD_FAT                    1
>> +#endif
>> +
>> +#define CONFIG_SYS_LOAD_ADDR            0x22000000
>> +
>> +#define CONFIG_SYS_MEMTEST_START        CONFIG_SYS_SDRAM_BASE
>> +#define CONFIG_SYS_MEMTEST_END            0x23e00000
>> +
>> +/* bootstrap + u-boot + env in dataflash on CS0 */
>> +#define CONFIG_ENV_IS_IN_DATAFLASH    1
>> +#define CONFIG_SYS_MONITOR_BASE   
>> (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x4000)
>> +#define CONFIG_ENV_OFFSET        0x2000
>> +#define CONFIG_ENV_ADDR        (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + \
>> +                 CONFIG_ENV_OFFSET)
>> +#define CONFIG_ENV_SIZE        0x2000
>> +#define CONFIG_BOOTCOMMAND    "nboot 21000000 0"
>> +#define CONFIG_BOOTARGS        "console=ttyS0,115200 " \
>> +    "root=/dev/mtdblock1 " \
>> +    "mtdparts=atmel_nand:16m(kernel)ro,120m(root1),-(root2)"\

Just a pointer ... you could use the CONFIG_CMD_MTDPARTS define. The
same mtdparts provided to the kernel could be used in u-boot -> 'nboot
kernel'. Some newer at91 boards use that, I personally find it quite useful.

>> +    "rw rootfstype=jffs2"
>> +
>> +#define CONFIG_SYS_PROMPT        "U-Boot> "
>> +#define CONFIG_SYS_CBSIZE        256
>> +#define CONFIG_SYS_MAXARGS        16
>> +#define CONFIG_SYS_PBSIZE        (CONFIG_SYS_CBSIZE + \
>> +                     sizeof(CONFIG_SYS_PROMPT) + 16)
>> +#define CONFIG_SYS_LONGHELP        1
>> +#define CONFIG_CMDLINE_EDITING    1
>> +#define CONFIG_AUTO_COMPLETE
>> +#define CONFIG_SYS_HUSH_PARSER
>> +
>> +/*
>> + * Size of malloc() pool
>> + */
>> +#define CONFIG_SYS_MALLOC_LEN    ROUND(3 * CONFIG_ENV_SIZE +
>> 128*1024, 0x1000)

Malloc is 152KiB, gd_t is smaller than 1KiB, your u-boot is smaller than
196KiB (as you mention in some comment) ... It may fit into the 1MiB
gap, if there is no other runtime defined parameters changing the
relocation address ...
But this is only true if you do not add more features, for example
ubi(fs) which has some more runtime code and requires more than 512KiB
malloc arena, about 4MiB recommended. Yust my 2¢, you should really have
a look for ubi(fs) when using NAND devices ...

Apart from that your patch looks good. Please address my concern about
dataflash driver and Bo's comments and send a v2 for inclusion.

Best regards

Andreas Bießmann


More information about the U-Boot mailing list