u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
@ 2013-10-27 19:34 Mateusz Kulikowski
  2013-10-28  4:57 ` Bo Shen
  0 siblings, 1 reply; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-10-27 19:34 UTC (permalink / raw)
  To: u-boot

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@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@popies.net>
+# Lead Tech Design <www.leadtechdesign.com>
+#
+# (C) Copyright 2013
+# Mateusz Kulikowski <mateusz.kulikowski@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@atmel.com>
+ * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
+ * Mateusz Kulikowski <mateusz.kulikowski@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"},
+};
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@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
+ * Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/sizes.h>
+#include <asm/arch/at91sam9263.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
+ */
+
+#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);
+
+	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);
+
+	at91_macb_hw_init();
+}
+#endif
+
+int board_init(void)
+{
+	/* arch number of USB-A9263-Board */
+	gd->bd->bi_arch_number = MACH_TYPE_USB_A9263;
+	/* 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;
+#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@free-electrons.com>
 Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_eeprom                     tny_a9260:AT91SAM9G20,SYS_USE_EEPROM                                                                                              Albin Tonnerre <albin.tonnerre@free-electrons.com>
 Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_nandflash                  tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH                                                                                           Albin Tonnerre <albin.tonnerre@free-electrons.com>
+Active  arm         arm926ejs      at91        calao           usb_a9263           usb_a9263_dataflash                  usb_a9263:AT91SAM9263,SYS_USE_DATAFLASH                                                                                           Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
 Active  arm         arm926ejs      at91        egnite          ethernut5           ethernut5                            ethernut5:AT91SAM9XE                                                                                                              egnite GmbH <info@egnite.de>
 Active  arm         arm926ejs      at91        emk             top9000             top9000eval_xe                       top9000:EVAL9000                                                                                                                  Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
 Active  arm         arm926ejs      at91        emk             top9000             top9000su_xe                         top9000:SU9000                                                                                                                    Reinhard Meyer <reinhard.meyer@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@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
+ * Mateusz Kulikowski <mateusz.kulikowski@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       */
+
+#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
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#define CONFIG_DISPLAY_CPUINFO
+
+#define CONFIG_OF_LIBFDT
+
+#define CONFIG_SYS_TEXT_BASE 0x23f00000
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_LEGACY
+#define CONFIG_AT91_GPIO	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
+
+#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
+
+#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
+/* 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
+
+/* 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)"\
+	"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)
+
+#endif
-- 
1.8.4.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-27 19:34 [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263) Mateusz Kulikowski
@ 2013-10-28  4:57 ` Bo Shen
  2013-10-28 21:30   ` Mateusz Kulikowski
  2013-10-29  9:12   ` Andreas Bießmann
  0 siblings, 2 replies; 20+ messages in thread
From: Bo Shen @ 2013-10-28  4:57 UTC (permalink / raw)
  To: u-boot

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@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@popies.net>
> +# Lead Tech Design <www.leadtechdesign.com>
> +#
> +# (C) Copyright 2013
> +# Mateusz Kulikowski <mateusz.kulikowski@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@atmel.com>
> + * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
> + * Mateusz Kulikowski <mateusz.kulikowski@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"},
> +};
> 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@leadtechdesign.com>
> + * Lead Tech Design <www.leadtechdesign.com>
> + * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
> + * Mateusz Kulikowski <mateusz.kulikowski@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.

> +#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@free-electrons.com>
>   Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_eeprom                     tny_a9260:AT91SAM9G20,SYS_USE_EEPROM                                                                                              Albin Tonnerre <albin.tonnerre@free-electrons.com>
>   Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_nandflash                  tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH                                                                                           Albin Tonnerre <albin.tonnerre@free-electrons.com>
> +Active  arm         arm926ejs      at91        calao           usb_a9263           usb_a9263_dataflash                  usb_a9263:AT91SAM9263,SYS_USE_DATAFLASH                                                                                           Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
>   Active  arm         arm926ejs      at91        egnite          ethernut5           ethernut5                            ethernut5:AT91SAM9XE                                                                                                              egnite GmbH <info@egnite.de>
>   Active  arm         arm926ejs      at91        emk             top9000             top9000eval_xe                       top9000:EVAL9000                                                                                                                  Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
>   Active  arm         arm926ejs      at91        emk             top9000             top9000su_xe                         top9000:SU9000                                                                                                                    Reinhard Meyer <reinhard.meyer@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@leadtechdesign.com>
> + * Lead Tech Design <www.leadtechdesign.com>
> + * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
> + * Mateusz Kulikowski <mateusz.kulikowski@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
> +
> +#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.

> +
> +/*
> + * 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)"\
> +	"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)
> +
> +#endif
>

Best Regards,
Bo Shen

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-28  4:57 ` Bo Shen
@ 2013-10-28 21:30   ` Mateusz Kulikowski
  2013-10-29  5:20     ` Heiko Schocher
                       ` (2 more replies)
  2013-10-29  9:12   ` Andreas Bießmann
  1 sibling, 3 replies; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-10-28 21:30 UTC (permalink / raw)
  To: u-boot

Hi Bo Shen,

Thanks for the check, please see below.

On 28.10.2013 05:57, Bo Shen wrote:
> Hi Mateusz Kulikowski,
>    Add Andreas in loop.
>
> On 10/28/2013 03:34, Mateusz Kulikowski wrote:
(...)
>> +    /*
>> +     * 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.

Should I also update (in separate patch) at91sam9263ek board
(code is the same there, bad side is - I don't have that board to test)?

>> +
>> +#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.

I don't understand something here:
- this address is hardcoded in AT91bootstrap (as well as image size - 0x31000),

- I can change it, but it will not boot on "stock" board - should we force
people to recompile AT91bootstrap if they want to use new U-Boot?
or
- Should I add low-level initialization to boot U-Boot from Dataflash
without AT91bootstrap (this is a bit more work)?
or
- There is another way I'm not aware of (perhaps relocate U-Boot in RAM)?

Best Regards,
Mateusz Kulikowski

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-28 21:30   ` Mateusz Kulikowski
@ 2013-10-29  5:20     ` Heiko Schocher
  2013-10-30 18:03       ` Mateusz Kulikowski
  2013-10-29  5:24     ` Bo Shen
  2013-10-29  6:26     ` Andreas Bießmann
  2 siblings, 1 reply; 20+ messages in thread
From: Heiko Schocher @ 2013-10-29  5:20 UTC (permalink / raw)
  To: u-boot

Hello Mateusz,

Am 28.10.2013 22:30, schrieb Mateusz Kulikowski:
> Hi Bo Shen,
>
> Thanks for the check, please see below.
>
> On 28.10.2013 05:57, Bo Shen wrote:
>> Hi Mateusz Kulikowski,
>> Add Andreas in loop.
>>
>> On 10/28/2013 03:34, Mateusz Kulikowski wrote:
> (...)
[...]
>>> +#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.
>
> I don't understand something here:
> - this address is hardcoded in AT91bootstrap (as well as image size - 0x31000),

Do you have the source code?

> - I can change it, but it will not boot on "stock" board - should we force
> people to recompile AT91bootstrap if they want to use new U-Boot?

Not the preferred way ...

> or
> - Should I add low-level initialization to boot U-Boot from Dataflash
> without AT91bootstrap (this is a bit more work)?

Thats the way I would prefer! We decided for the siemens at91 board
ports I recently posted, see here:

[U-Boot,v1,1/3] at91: add defines for reset type
http://patchwork.ozlabs.org/patch/285365/

[U-Boot,v1,2/3] arm, at91: add Siemens board taurus (based on AT91SAM9G20)
http://patchwork.ozlabs.org/patch/285366/

[U-Boot,v1,3/3] arm, at91: add siemens corvus board
http://patchwork.ozlabs.org/patch/285367/

to start a try using spl instead of at91bootstrap. I hope to get this
ASAP (serial output works :-) running and post a RFC patch. They boot
from NAND but that should be no big problem to add dataflash support ...

> or
> - There is another way I'm not aware of (perhaps relocate U-Boot in RAM)?

You need always some first stage bootloader, currently this is
at91bootstrap, but we should integrate this into U-Boot SPL code ...

U-Boot gets relocated in RAM, but that is later in the boot process...

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-28 21:30   ` Mateusz Kulikowski
  2013-10-29  5:20     ` Heiko Schocher
@ 2013-10-29  5:24     ` Bo Shen
  2013-10-29  5:54       ` Heiko Schocher
  2013-10-30 18:17       ` Mateusz Kulikowski
  2013-10-29  6:26     ` Andreas Bießmann
  2 siblings, 2 replies; 20+ messages in thread
From: Bo Shen @ 2013-10-29  5:24 UTC (permalink / raw)
  To: u-boot

Hi Mateusz Kulikowski,

On 10/29/2013 05:30, Mateusz Kulikowski wrote:
> Hi Bo Shen,
>
> Thanks for the check, please see below.
>
> On 28.10.2013 05:57, Bo Shen wrote:
>> Hi Mateusz Kulikowski,
>>    Add Andreas in loop.
>>
>> On 10/28/2013 03:34, Mateusz Kulikowski wrote:
> (...)
>>> +    /*
>>> +     * 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.
>
> Should I also update (in separate patch) at91sam9263ek board
> (code is the same there, bad side is - I don't have that board to test)?

You can use GPIO API for USB-A9263 in this patch. And send another patch 
to fix at91sam9263ek board (I can help test the patch for at91sam9263ek 
board).

>>> +
>>> +#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.
>
> I don't understand something here:
> - this address is hardcoded in AT91bootstrap (as well as image size -
> 0x31000),

Yes, that's true. And this is a pain for us :(
Here just a reminder for the text base.

> - I can change it, but it will not boot on "stock" board - should we force
> people to recompile AT91bootstrap if they want to use new U-Boot?

(If you plan to modify the text base, you must ask for that.)
For new version bootstrap, we have change this address to 0x21f00000 for 
boards only have 64MiB SDRAM.

> or
> - Should I add low-level initialization to boot U-Boot from Dataflash
> without AT91bootstrap (this is a bit more work)?

I am working for SPL for Atmel EK boards, now focus on sama5d3xek board. 
After finished, I will submit then patch and go on working for other board.

> or
> - There is another way I'm not aware of (perhaps relocate U-Boot in RAM)?
>
> Best Regards,
> Mateusz Kulikowski

Best Regards,
Bo Shen

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-29  5:24     ` Bo Shen
@ 2013-10-29  5:54       ` Heiko Schocher
  2013-10-30 18:17       ` Mateusz Kulikowski
  1 sibling, 0 replies; 20+ messages in thread
From: Heiko Schocher @ 2013-10-29  5:54 UTC (permalink / raw)
  To: u-boot

Hello Bo,

Am 29.10.2013 06:24, schrieb Bo Shen:
> Hi Mateusz Kulikowski,
>
> On 10/29/2013 05:30, Mateusz Kulikowski wrote:
>> Hi Bo Shen,
>>
>> Thanks for the check, please see below.
>>
>> On 28.10.2013 05:57, Bo Shen wrote:
>>> Hi Mateusz Kulikowski,
>>> Add Andreas in loop.
>>>
>>> On 10/28/2013 03:34, Mateusz Kulikowski wrote:
>> (...)
[...]
>> or
>> - Should I add low-level initialization to boot U-Boot from Dataflash
>> without AT91bootstrap (this is a bit more work)?
>
> I am working for SPL for Atmel EK boards, now focus on sama5d3xek board. After finished, I will submit then patch and go on working for other board.

We just decided to go this way for the siemens boards too...
(Just started, serial seems to work in spl code)

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-28 21:30   ` Mateusz Kulikowski
  2013-10-29  5:20     ` Heiko Schocher
  2013-10-29  5:24     ` Bo Shen
@ 2013-10-29  6:26     ` Andreas Bießmann
  2013-10-29  6:35       ` Heiko Schocher
  2 siblings, 1 reply; 20+ messages in thread
From: Andreas Bießmann @ 2013-10-29  6:26 UTC (permalink / raw)
  To: u-boot

Dear Mateusz Kulikowski,

On 28.10.13 22:30, Mateusz Kulikowski wrote:
> Hi Bo Shen,
> 
> Thanks for the check, please see below.
> 
> On 28.10.2013 05:57, Bo Shen wrote:
>> Hi Mateusz Kulikowski,
>>    Add Andreas in loop.
>>
>> On 10/28/2013 03:34, Mateusz Kulikowski wrote:

>>> +
>>> +#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.
> 
> I don't understand something here:
> - this address is hardcoded in AT91bootstrap (as well as image size -
> 0x31000),
> 
> - I can change it, but it will not boot on "stock" board - should we force
> people to recompile AT91bootstrap if they want to use new U-Boot?
> or
> - Should I add low-level initialization to boot U-Boot from Dataflash
> without AT91bootstrap (this is a bit more work)?
> or
> - There is another way I'm not aware of (perhaps relocate U-Boot in RAM)?

The crux is that in fact u-boot is relocating u-boot in any case (the
most cases). It will place some stuff at the very top of the RAM (gd_t,
malloc arena, stack, ...) and calculate depending on some runtime values
(reserved ram, display vram, ...) where to place the resulting u-boot
image. The u-boot image will be placed right after the reserved place to
fill up the whole top of your RAM.
Therefore it depends on your compile time and runtime setup if there
will be an overlapping between running u-boot image and resulting place
when doing the relocation. It is likely to collide with the running
u-boot image while relocating if it is placed just 1MiB from top of the RAM.

We decided to change at91bootstrap and u-boot for to have another load
address for some boards in the past cause of real problems there. There
where strange errors like running system but crashing when using a
specific command.

I really recommend to leave a bit more space for u-boot runtime code to
do it's relocation ad therefore use a smaller ram location.
The best would be to get SPL working ASAP to have the setup of load
address in just one piece of code ... A long outstanding wish of mine,
but had no time to implement.

Bo and Heiko, could you both please post some RFC of your code to get
this in line?

Best regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-29  6:26     ` Andreas Bießmann
@ 2013-10-29  6:35       ` Heiko Schocher
  0 siblings, 0 replies; 20+ messages in thread
From: Heiko Schocher @ 2013-10-29  6:35 UTC (permalink / raw)
  To: u-boot

Hello Andreas,

Am 29.10.2013 07:26, schrieb Andreas Bie?mann:
> Dear Mateusz Kulikowski,
>
> On 28.10.13 22:30, Mateusz Kulikowski wrote:
>> Hi Bo Shen,
>>
>> Thanks for the check, please see below.
>>
>> On 28.10.2013 05:57, Bo Shen wrote:
>>> Hi Mateusz Kulikowski,
>>>     Add Andreas in loop.
>>>
>>> On 10/28/2013 03:34, Mateusz Kulikowski wrote:
>
>>>> +
>>>> +#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.
>>
>> I don't understand something here:
>> - this address is hardcoded in AT91bootstrap (as well as image size -
>> 0x31000),
>>
>> - I can change it, but it will not boot on "stock" board - should we force
>> people to recompile AT91bootstrap if they want to use new U-Boot?
>> or
>> - Should I add low-level initialization to boot U-Boot from Dataflash
>> without AT91bootstrap (this is a bit more work)?
>> or
>> - There is another way I'm not aware of (perhaps relocate U-Boot in RAM)?
>
> The crux is that in fact u-boot is relocating u-boot in any case (the
> most cases). It will place some stuff at the very top of the RAM (gd_t,
> malloc arena, stack, ...) and calculate depending on some runtime values
> (reserved ram, display vram, ...) where to place the resulting u-boot
> image. The u-boot image will be placed right after the reserved place to
> fill up the whole top of your RAM.
> Therefore it depends on your compile time and runtime setup if there
> will be an overlapping between running u-boot image and resulting place
> when doing the relocation. It is likely to collide with the running
> u-boot image while relocating if it is placed just 1MiB from top of the RAM.
>
> We decided to change at91bootstrap and u-boot for to have another load
> address for some boards in the past cause of real problems there. There
> where strange errors like running system but crashing when using a
> specific command.

Yep, see this on my recently posted boards too ...

> I really recommend to leave a bit more space for u-boot runtime code to
> do it's relocation ad therefore use a smaller ram location.
> The best would be to get SPL working ASAP to have the setup of load

Full Ack.

> address in just one piece of code ... A long outstanding wish of mine,
> but had no time to implement.
>
> Bo and Heiko, could you both please post some RFC of your code to get
> this in line?

I just started with it, I have only serial running under SPL Code,
need to write a small nand driver ... clean up ... and then I can
post a RFC ... hope to do this soon ...

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-28  4:57 ` Bo Shen
  2013-10-28 21:30   ` Mateusz Kulikowski
@ 2013-10-29  9:12   ` Andreas Bießmann
  2013-11-01 19:26     ` Mateusz Kulikowski
  2013-11-01 23:19     ` [U-Boot] [PATCH v2] " Mateusz Kulikowski
  1 sibling, 2 replies; 20+ messages in thread
From: Andreas Bießmann @ 2013-10-29  9:12 UTC (permalink / raw)
  To: u-boot

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@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@popies.net>
>> +# Lead Tech Design <www.leadtechdesign.com>
>> +#
>> +# (C) Copyright 2013
>> +# Mateusz Kulikowski <mateusz.kulikowski@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@atmel.com>
>> + * Thomas Petazzoni, Free Electrons,
>> <thomas.petazzoni@free-electrons.com>
>> + * Mateusz Kulikowski <mateusz.kulikowski@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@leadtechdesign.com>
>> + * Lead Tech Design <www.leadtechdesign.com>
>> + * Thomas Petazzoni, Free Electrons,
>> <thomas.petazzoni@free-electrons.com>
>> + * Mateusz Kulikowski <mateusz.kulikowski@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@free-electrons.com>
>>   Active  arm         arm926ejs      at91        calao          
>> tny_a9260           tny_a9g20_eeprom                    
>> tny_a9260:AT91SAM9G20,SYS_USE_EEPROM                                                                                             
>> Albin Tonnerre <albin.tonnerre@free-electrons.com>
>>   Active  arm         arm926ejs      at91        calao          
>> tny_a9260           tny_a9g20_nandflash                 
>> tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH                                                                                          
>> Albin Tonnerre <albin.tonnerre@free-electrons.com>
>> +Active  arm         arm926ejs      at91        calao          
>> usb_a9263           usb_a9263_dataflash                 
>> usb_a9263:AT91SAM9263,SYS_USE_DATAFLASH                                                                                          
>> Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
>>   Active  arm         arm926ejs      at91        egnite         
>> ethernut5           ethernut5                           
>> ethernut5:AT91SAM9XE                                                                                                             
>> egnite GmbH <info@egnite.de>
>>   Active  arm         arm926ejs      at91        emk            
>> top9000             top9000eval_xe                      
>> top9000:EVAL9000                                                                                                                 
>> Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
>>   Active  arm         arm926ejs      at91        emk            
>> top9000             top9000su_xe                        
>> top9000:SU9000                                                                                                                   
>> Reinhard Meyer <reinhard.meyer@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@leadtechdesign.com>
>> + * Lead Tech Design <www.leadtechdesign.com>
>> + * Thomas Petazzoni, Free Electrons,
>> <thomas.petazzoni@free-electrons.com>
>> + * Mateusz Kulikowski <mateusz.kulikowski@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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-29  5:20     ` Heiko Schocher
@ 2013-10-30 18:03       ` Mateusz Kulikowski
  0 siblings, 0 replies; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-10-30 18:03 UTC (permalink / raw)
  To: u-boot

Hi Heiko,

Sorry for late reply.

On 29.10.2013 06:20, Heiko Schocher wrote:
>> I don't understand something here:
>> - this address is hardcoded in AT91bootstrap (as well as image size - 0x31000),
>
> Do you have the source code?

Yes I do, it even seems to work properly after recompilation (with baremetal toolchain).

I should be able to do low-level init for this board.
Of course, first - SPL support for AT91 must be ready if I understand correctly (who will do it is different thing).

Regards,
Mateusz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-29  5:24     ` Bo Shen
  2013-10-29  5:54       ` Heiko Schocher
@ 2013-10-30 18:17       ` Mateusz Kulikowski
  1 sibling, 0 replies; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-10-30 18:17 UTC (permalink / raw)
  To: u-boot

Hi,

On 29.10.2013 06:24, Bo Shen wrote:
>
> You can use GPIO API for USB-A9263 in this patch. And send another patch to fix at91sam9263ek board (I can help test the patch for at91sam9263ek board).
>
Will do it in next 2 days (unless someone will be faster).

>> or
>> - Should I add low-level initialization to boot U-Boot from Dataflash
>> without AT91bootstrap (this is a bit more work)?
>
> I am working for SPL for Atmel EK boards, now focus on sama5d3xek board. After finished, I will submit then patch and go on working for other board.
Like I wrote in other mail, I should be able to do lowlevel init for this board.
Just have to read/learn/play with SPL first (never used it before).
But this part I prefer to do later (somewhere next month).


Regards,
Mateusz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-29  9:12   ` Andreas Bießmann
@ 2013-11-01 19:26     ` Mateusz Kulikowski
  2013-11-04  9:36       ` Andreas Bießmann
  2013-11-01 23:19     ` [U-Boot] [PATCH v2] " Mateusz Kulikowski
  1 sibling, 1 reply; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-11-01 19:26 UTC (permalink / raw)
  To: u-boot

Dear Andreas Bie?mann,


On 29.10.2013 10:12, Andreas Bie?mann wrote:
>>> +
>>> +/*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.

What kind of Dataflash have you used?

Dataflash on Calao (at45db021b) does not have read-id command.
It also has different command set than more recent version (*021d).
It may be tricky to probe and operate it without modifying SPI drivers.

For now I will move partition code to "main" board file;
If I figure out how to handle that Dataflash - I'll update the code.
Unless I'm missing something?

>>> +
>>> +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 *)').

AFAIK this doesn't go well with C, and will not work on default compile flags set by u-boot.

>>> +#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.

Thanks for the tip about board_[fr] - I was not aware of it and used old boot mechanism.
I'll update config file to use generic board code.

As for the memory concerns, I did little test:
- enabled debugs in board_[fr].c (they print nicely memory layout),
- Filled u-boot binary with commands/garbage to reach max size supported by AT91bootstrap (200704)
- Flashed, booted the board. Below - log (parts):
<log>
U-Boot 2013.10-00122-g509dca7-dirty (Nov 01 2013 - 20:09:46)

U-Boot code: 23F00000 -> 23F2C570  BSS: -> 23F31498
CPU: AT91SAM9263
Crystal frequency:       12 MHz
CPU clock        :      180 MHz
Master clock     :       90 MHz
DRAM:  Monitor len: 00031498
Ram size: 04000000
Ram top: 24000000
TLB table from 23ff0000 to 23ff4000
Reserving 197k for U-Boot at: 23fbe000
Reserving 152k for malloc() at: 23f98000
Reserving 84 Bytes for Board Info at: 23f97fac
Reserving 176 Bytes for Global Data at: 23f97efc

RAM Configuration:
Bank #0: 20000000
DRAM:  64 MiB
New Stack Pointer is: 23f97ed0
Relocation Offset is: 000be000
Relocating to 23fbe000, new gd at 23f97efc, sp at 23f97ed0
image_copy: 23f00000 23f2c570 <- @setup_reloc()
image_copy: 23fbe000 23fea570 <- @board_init_r()
WARNING: Caches not enabled
Now running in RAM - U-Boot at: 23fbe000
</log>

If I understand correctly, this means that we have plenty of space between start of stack, and end of non-relocated U-Boot (.

>>> (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.

I'll do it after I have SPL working - it will not fit now.

>>> +
>>> +/*
>>> + * 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 ...
It will not be possible to add more features until I get rid of AT91bootstrap.
I prefer to stick to config that may used on "stock" boards (kernel is located on separate partition, so no FS driver is needed)

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

I will post v2 soon.

Best Regards,
Mateusz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v2] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-10-29  9:12   ` Andreas Bießmann
  2013-11-01 19:26     ` Mateusz Kulikowski
@ 2013-11-01 23:19     ` Mateusz Kulikowski
  2013-11-11 11:03       ` Andreas Bießmann
  1 sibling, 1 reply; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-11-01 23:19 UTC (permalink / raw)
  To: u-boot

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@gmail.com>
---
 board/calao/usb_a9263/Makefile    |  34 ++++++++
 board/calao/usb_a9263/usb_a9263.c | 167 +++++++++++++++++++++++++++++++++++++
 boards.cfg                        |   1 +
 include/configs/usb_a9263.h       | 168 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 370 insertions(+)
 create mode 100644 board/calao/usb_a9263/Makefile
 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..dc87684
--- /dev/null
+++ b/board/calao/usb_a9263/Makefile
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian@popies.net>
+# Lead Tech Design <www.leadtechdesign.com>
+#
+# (C) Copyright 2013
+# Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS-y += usb_a9263.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/usb_a9263.c b/board/calao/usb_a9263/usb_a9263.c
new file mode 100644
index 0000000..bbc1e25
--- /dev/null
+++ b/board/calao/usb_a9263/usb_a9263.c
@@ -0,0 +1,167 @@
+/*
+ * (C) Copyright 2007-2013
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
+ * Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.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>
+#if defined(CONFIG_HAS_DATAFLASH)
+#include <dataflash.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_HAS_DATAFLASH
+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_CLEAR, 0, "U-Boot"},
+};
+#endif
+
+#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_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
+	 */
+	at91_set_pio_pullup(AT91_PIO_PORTC, 25, 0);
+	at91_set_pio_pullup(AT91_PIO_PORTE, 25, 0);
+	at91_set_pio_pullup(AT91_PIO_PORTE, 26, 0);
+
+	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 */
+	at91_set_pio_pullup(AT91_PIO_PORTC, 25, 1);
+	at91_set_pio_pullup(AT91_PIO_PORTE, 25, 1);
+	at91_set_pio_pullup(AT91_PIO_PORTE, 26, 1);
+
+	at91_macb_hw_init();
+}
+#endif
+
+int board_init(void)
+{
+	/* 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;
+
+#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 5e10125..48d6c53 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -120,6 +120,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@free-electrons.com>
 Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_eeprom                     tny_a9260:AT91SAM9G20,SYS_USE_EEPROM                                                                                              Albin Tonnerre <albin.tonnerre@free-electrons.com>
 Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_nandflash                  tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH                                                                                           Albin Tonnerre <albin.tonnerre@free-electrons.com>
+Active  arm         arm926ejs      at91        calao           usb_a9263           usb_a9263_dataflash                  usb_a9263:AT91SAM9263,SYS_USE_DATAFLASH                                                                                           Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
 Active  arm         arm926ejs      at91        egnite          ethernut5           ethernut5                            ethernut5:AT91SAM9XE                                                                                                              egnite GmbH <info@egnite.de>
 Active  arm         arm926ejs      at91        emk             top9000             top9000eval_xe                       top9000:EVAL9000                                                                                                                  Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
 Active  arm         arm926ejs      at91        emk             top9000             top9000su_xe                         top9000:SU9000                                                                                                                    Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
diff --git a/include/configs/usb_a9263.h b/include/configs/usb_a9263.h
new file mode 100644
index 0000000..6d1f43f
--- /dev/null
+++ b/include/configs/usb_a9263.h
@@ -0,0 +1,168 @@
+/*
+ * (C) Copyright 2007-2013
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
+ * Mateusz Kulikowski <mateusz.kulikowski@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_MACH_TYPE		MACH_TYPE_USB_A9263
+
+#define CONFIG_ARCH_CPU_INIT
+
+#define CONFIG_CMDLINE_TAG	/* enable passing of ATAGs      */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#define CONFIG_DISPLAY_CPUINFO
+
+#define CONFIG_OF_LIBFDT
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_SYS_TEXT_BASE 0x23f00000
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_LEGACY
+#define CONFIG_AT91_GPIO
+
+/* serial console */
+#define CONFIG_ATMEL_USART
+#define CONFIG_USART_BASE	ATMEL_BASE_DBGU
+#define CONFIG_USART_ID		ATMEL_ID_SYS
+#define CONFIG_BAUDRATE		115200
+
+#define CONFIG_BOOTDELAY 3
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
+/*
+ * 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
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_NAND
+
+/* 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
+#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
+
+/* 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
+/* 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
+
+#define MTDPARTS_DEFAULT "mtdparts=atmel_nand:16m(kernel)ro,120m(root1),-(root2)"
+
+/* Ethernet */
+#define CONFIG_MACB
+#define CONFIG_RMII
+#define CONFIG_NET_RETRY_COUNT			20
+#define CONFIG_MACB_SEARCH_PHY
+
+/* USB */
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_ATMEL
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_DOS_PARTITION
+#define CONFIG_SYS_USB_OHCI_CPU_INIT
+#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
+#define CONFIG_CMD_FAT
+#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
+#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=" MTDPARTS_DEFAULT " " \
+	"rw rootfstype=jffs2"
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"mtdparts=" MTDPARTS_DEFAULT "\0" \
+
+#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_CMDLINE_EDITING
+#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)
+
+#endif
-- 
1.8.4.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-11-01 19:26     ` Mateusz Kulikowski
@ 2013-11-04  9:36       ` Andreas Bießmann
  0 siblings, 0 replies; 20+ messages in thread
From: Andreas Bießmann @ 2013-11-04  9:36 UTC (permalink / raw)
  To: u-boot

Dear Mateusz Kulikowski,

On 11/01/2013 08:26 PM, Mateusz Kulikowski wrote:
> On 29.10.2013 10:12, Andreas Bie?mann wrote:
>>>> +
>>>> +/*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.
> 
> What kind of Dataflash have you used?
> 
> Dataflash on Calao (at45db021b) does not have read-id command.
> It also has different command set than more recent version (*021d).
> It may be tricky to probe and operate it without modifying SPI drivers.

Sorry, haven't realized that. I have to check which dataflash was
attached to that board.

> For now I will move partition code to "main" board file;
> If I figure out how to handle that Dataflash - I'll update the code.

fine!

<snip>

> As for the memory concerns, I did little test:
> - enabled debugs in board_[fr].c (they print nicely memory layout),
> - Filled u-boot binary with commands/garbage to reach max size supported
> by AT91bootstrap (200704)
> - Flashed, booted the board. Below - log (parts):
> <log>
> U-Boot 2013.10-00122-g509dca7-dirty (Nov 01 2013 - 20:09:46)
> 
> U-Boot code: 23F00000 -> 23F2C570  BSS: -> 23F31498

Your code uses 23f00000 up to 23f31498, is 197.15 KiB

> CPU: AT91SAM9263
> Crystal frequency:       12 MHz
> CPU clock        :      180 MHz
> Master clock     :       90 MHz
> DRAM:  Monitor len: 00031498
> Ram size: 04000000
> Ram top: 24000000
> TLB table from 23ff0000 to 23ff4000
> Reserving 197k for U-Boot at: 23fbe000
> Reserving 152k for malloc() at: 23f98000
> Reserving 84 Bytes for Board Info at: 23f97fac
> Reserving 176 Bytes for Global Data at: 23f97efc

The relocated environment will use the top of RAM down to 23f97efc

> 
> RAM Configuration:
> Bank #0: 20000000
> DRAM:  64 MiB
> New Stack Pointer is: 23f97ed0
> Relocation Offset is: 000be000
> Relocating to 23fbe000, new gd at 23f97efc, sp at 23f97ed0
> image_copy: 23f00000 23f2c570 <- @setup_reloc()
> image_copy: 23fbe000 23fea570 <- @board_init_r()
> WARNING: Caches not enabled
> Now running in RAM - U-Boot at: 23fbe000
> </log>
> 
> If I understand correctly, this means that we have plenty of space
> between start of stack, and end of non-relocated U-Boot (.

_plenty_ of space is not true here (in my understanding), but 410 KiB
will be enough ;)

<snip>

Best regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v2] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-11-01 23:19     ` [U-Boot] [PATCH v2] " Mateusz Kulikowski
@ 2013-11-11 11:03       ` Andreas Bießmann
  2013-11-12  8:53         ` Heiko Schocher
  2013-11-28 21:29         ` Mateusz Kulikowski
  0 siblings, 2 replies; 20+ messages in thread
From: Andreas Bießmann @ 2013-11-11 11:03 UTC (permalink / raw)
  To: u-boot

Dear Mateusz Kulikowski,

On 11/02/2013 12:19 AM, 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@gmail.com>
> ---
>  board/calao/usb_a9263/Makefile    |  34 ++++++++
>  board/calao/usb_a9263/usb_a9263.c | 167 +++++++++++++++++++++++++++++++++++++
>  boards.cfg                        |   1 +
>  include/configs/usb_a9263.h       | 168 ++++++++++++++++++++++++++++++++++++++
>  4 files changed, 370 insertions(+)
>  create mode 100644 board/calao/usb_a9263/Makefile
>  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..dc87684
> --- /dev/null
> +++ b/board/calao/usb_a9263/Makefile
> @@ -0,0 +1,34 @@
> +#
> +# (C) Copyright 2003-2008
> +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> +#
> +# (C) Copyright 2008
> +# Stelian Pop <stelian@popies.net>
> +# Lead Tech Design <www.leadtechdesign.com>
> +#
> +# (C) Copyright 2013
> +# Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> +#
> +# SPDX-License-Identifier:	GPL-2.0+
> +
> +include $(TOPDIR)/config.mk
> +
> +LIB	= $(obj)lib$(BOARD).o
> +
> +COBJS-y += usb_a9263.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
> +
> +#########################################################################

please adopt all Makefiles to latest KBuild changes in u-boot/master.

> diff --git a/board/calao/usb_a9263/usb_a9263.c b/board/calao/usb_a9263/usb_a9263.c
> new file mode 100644
> index 0000000..bbc1e25
> --- /dev/null
> +++ b/board/calao/usb_a9263/usb_a9263.c
> @@ -0,0 +1,167 @@
> +/*
> + * (C) Copyright 2007-2013
> + * Stelian Pop <stelian.pop@leadtechdesign.com>
> + * Lead Tech Design <www.leadtechdesign.com>
> + * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
> + * Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.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)

I think we can include the headers unconditionally, or is there a problem?

> +#include <net.h>
> +#endif
> +#include <netdev.h>
> +#if defined(CONFIG_HAS_DATAFLASH)
> +#include <dataflash.h>
> +#endif
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#ifdef CONFIG_HAS_DATAFLASH
> +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_CLEAR, 0, "U-Boot"},
> +};
> +#endif
> +
> +#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);

Could you please use the generic GPIO API here? Is it Ok for you to not
mux the pullup for the ready pin?

> +
> +	/* Enable NandFlash */
> +	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);

Here you could really use the gpio_direction_output(). I sent out an RFC
lately to define new GPIO_PIN_Px() macros. As long as that RFC is not
reworked and included I think it is Ok to use the CONFIG_ATMEL_LEGACY
defines.
Please switch to the generic GPIO API for defining GPIO direction and
switching GPIO, even on AT91. On the long run we will remove the
redundant at91_pio API, at least regarding plane GPIO functionality.
Therefore it would be good to use that API now, even if it costs some
function calls currently.

> +}
> +#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_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
> +	 */
> +	at91_set_pio_pullup(AT91_PIO_PORTC, 25, 0);
> +	at91_set_pio_pullup(AT91_PIO_PORTE, 25, 0);
> +	at91_set_pio_pullup(AT91_PIO_PORTE, 26, 0);
> +
> +	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 */
> +	at91_set_pio_pullup(AT91_PIO_PORTC, 25, 1);
> +	at91_set_pio_pullup(AT91_PIO_PORTE, 25, 1);
> +	at91_set_pio_pullup(AT91_PIO_PORTE, 26, 1);
> +
> +	at91_macb_hw_init();

Heiko proposed a solution for unifying macb reset sequence.

@Heiko will you send another patch?

> +}
> +#endif
> +
> +int board_init(void)
> +{
> +	/* 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 */

Here we could also use the generic GPIO API. Beside that, did you really
copy the at91sam9263 here? IOW, do you really have a slot for MMC/DF
here and therefore require to switch the 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;
> +
> +#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 5e10125..48d6c53 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -120,6 +120,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@free-electrons.com>
>  Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_eeprom                     tny_a9260:AT91SAM9G20,SYS_USE_EEPROM                                                                                              Albin Tonnerre <albin.tonnerre@free-electrons.com>
>  Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_nandflash                  tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH                                                                                           Albin Tonnerre <albin.tonnerre@free-electrons.com>
> +Active  arm         arm926ejs      at91        calao           usb_a9263           usb_a9263_dataflash                  usb_a9263:AT91SAM9263,SYS_USE_DATAFLASH                                                                                           Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
>  Active  arm         arm926ejs      at91        egnite          ethernut5           ethernut5                            ethernut5:AT91SAM9XE                                                                                                              egnite GmbH <info@egnite.de>
>  Active  arm         arm926ejs      at91        emk             top9000             top9000eval_xe                       top9000:EVAL9000                                                                                                                  Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
>  Active  arm         arm926ejs      at91        emk             top9000             top9000su_xe                         top9000:SU9000                                                                                                                    Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
> diff --git a/include/configs/usb_a9263.h b/include/configs/usb_a9263.h
> new file mode 100644
> index 0000000..6d1f43f
> --- /dev/null
> +++ b/include/configs/usb_a9263.h
> @@ -0,0 +1,168 @@
> +/*
> + * (C) Copyright 2007-2013
> + * Stelian Pop <stelian.pop@leadtechdesign.com>
> + * Lead Tech Design <www.leadtechdesign.com>
> + * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
> + * Mateusz Kulikowski <mateusz.kulikowski@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_MACH_TYPE		MACH_TYPE_USB_A9263
> +
> +#define CONFIG_ARCH_CPU_INIT
> +
> +#define CONFIG_CMDLINE_TAG	/* enable passing of ATAGs      */
> +#define CONFIG_SETUP_MEMORY_TAGS
> +#define CONFIG_INITRD_TAG
> +
> +#define CONFIG_SKIP_LOWLEVEL_INIT
> +
> +#define CONFIG_DISPLAY_CPUINFO
> +
> +#define CONFIG_OF_LIBFDT
> +#define CONFIG_SYS_GENERIC_BOARD
> +#define CONFIG_SYS_TEXT_BASE 0x23f00000
> +
> +/*
> + * Hardware drivers
> + */
> +#define CONFIG_ATMEL_LEGACY
> +#define CONFIG_AT91_GPIO
> +
> +/* serial console */
> +#define CONFIG_ATMEL_USART
> +#define CONFIG_USART_BASE	ATMEL_BASE_DBGU
> +#define CONFIG_USART_ID		ATMEL_ID_SYS
> +#define CONFIG_BAUDRATE		115200
> +
> +#define CONFIG_BOOTDELAY 3
> +
> +/*
> + * BOOTP options
> + */
> +#define CONFIG_BOOTP_BOOTFILESIZE
> +#define CONFIG_BOOTP_BOOTPATH
> +#define CONFIG_BOOTP_GATEWAY
> +#define CONFIG_BOOTP_HOSTNAME
> +
> +/*
> + * 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
> +
> +#define CONFIG_CMD_PING
> +#define CONFIG_CMD_DHCP
> +#define CONFIG_CMD_NAND
> +
> +/* 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
> +#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
> +
> +/* 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
> +/* 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
> +
> +#define MTDPARTS_DEFAULT "mtdparts=atmel_nand:16m(kernel)ro,120m(root1),-(root2)"
> +
> +/* Ethernet */
> +#define CONFIG_MACB
> +#define CONFIG_RMII
> +#define CONFIG_NET_RETRY_COUNT			20
> +#define CONFIG_MACB_SEARCH_PHY
> +
> +/* USB */
> +#ifdef CONFIG_CMD_USB
> +#define CONFIG_USB_ATMEL
> +#define CONFIG_USB_OHCI_NEW
> +#define CONFIG_DOS_PARTITION
> +#define CONFIG_SYS_USB_OHCI_CPU_INIT
> +#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
> +#define CONFIG_CMD_FAT
> +#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
> +#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=" MTDPARTS_DEFAULT " " \
> +	"rw rootfstype=jffs2"
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> +	"mtdparts=" MTDPARTS_DEFAULT "\0" \
> +
> +#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_CMDLINE_EDITING
> +#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)
> +
> +#endif
> 

Beside these minor complaints there is nothing to stop inclusion for
2014.01. Please stay tuned and do not send v3 immediately cause of the
ongoing change for GPIO API and consolidation of macb reset.
I think another ping from your side in about two weeks would be Ok, if
you haven't seen changes in the two mentioned points on the list.

Best regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v2] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-11-11 11:03       ` Andreas Bießmann
@ 2013-11-12  8:53         ` Heiko Schocher
  2013-11-28 21:29         ` Mateusz Kulikowski
  1 sibling, 0 replies; 20+ messages in thread
From: Heiko Schocher @ 2013-11-12  8:53 UTC (permalink / raw)
  To: u-boot

Hello Andreas,

Am 11.11.2013 12:03, schrieb Andreas Bie?mann:
> Dear Mateusz Kulikowski,
>
> On 11/02/2013 12:19 AM, 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@gmail.com>
>> ---
>>   board/calao/usb_a9263/Makefile    |  34 ++++++++
>>   board/calao/usb_a9263/usb_a9263.c | 167 +++++++++++++++++++++++++++++++++++++
>>   boards.cfg                        |   1 +
>>   include/configs/usb_a9263.h       | 168 ++++++++++++++++++++++++++++++++++++++
>>   4 files changed, 370 insertions(+)
>>   create mode 100644 board/calao/usb_a9263/Makefile
>>   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/usb_a9263.c b/board/calao/usb_a9263/usb_a9263.c
>> new file mode 100644
>> index 0000000..bbc1e25
>> --- /dev/null
>> +++ b/board/calao/usb_a9263/usb_a9263.c
>> @@ -0,0 +1,167 @@
[...]
>> +#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_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
>> +	 */
>> +	at91_set_pio_pullup(AT91_PIO_PORTC, 25, 0);
>> +	at91_set_pio_pullup(AT91_PIO_PORTE, 25, 0);
>> +	at91_set_pio_pullup(AT91_PIO_PORTE, 26, 0);
>> +
>> +	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 */
>> +	at91_set_pio_pullup(AT91_PIO_PORTC, 25, 1);
>> +	at91_set_pio_pullup(AT91_PIO_PORTE, 25, 1);
>> +	at91_set_pio_pullup(AT91_PIO_PORTE, 26, 1);
>> +
>> +	at91_macb_hw_init();
>
> Heiko proposed a solution for unifying macb reset sequence.
>
> @Heiko will you send another patch?

I thought I wait for your GPIO update patches, and rebase my patch-
serie for the siemens boards on them ...

Ok, based on the spl patches from bo shen, see

http://lists.denx.de/pipermail/u-boot/2013-November/166272.html

I can sent soon the "phy_reset" patch, if the patch passes a
"MAKEALL" ;-)

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v2] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-11-11 11:03       ` Andreas Bießmann
  2013-11-12  8:53         ` Heiko Schocher
@ 2013-11-28 21:29         ` Mateusz Kulikowski
  2013-11-29 11:31           ` Andreas Bießmann
  1 sibling, 1 reply; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-11-28 21:29 UTC (permalink / raw)
  To: u-boot

Dear Andreas Bie?mann,

On 11.11.2013 12:03, Andreas Bie?mann wrote:
(...)
>> +#include <asm/arch/hardware.h>
>> +#if defined(CONFIG_MACB)
>
> I think we can include the headers unconditionally, or is there a problem?

No problem with that.

>> +
>> +	writel(1 << ATMEL_ID_PIOA | 1 << ATMEL_ID_PIOCDE, &pmc->pcer);
>> +
>> +	/* Configure RDY/BSY */
>> +	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
>
> Could you please use the generic GPIO API here? Is it Ok for you to not
> mux the pullup for the ready pin?

I've checked schematics - board has external pull-ups, so I can use generic GPIO.

>> +
>> +	/* Enable NandFlash */
>> +	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
>
> Here you could really use the gpio_direction_output(). I sent out an RFC
> lately to define new GPIO_PIN_Px() macros. As long as that RFC is not
> reworked and included I think it is Ok to use the CONFIG_ATMEL_LEGACY
> defines.

> Please switch to the generic GPIO API for defining GPIO direction and
> switching GPIO, even on AT91. On the long run we will remove the
> redundant at91_pio API, at least regarding plane GPIO functionality.
> Therefore it would be good to use that API now, even if it costs some
> function calls currently.

Do I understand correctly, that for all ports that I use (via generic GPIO) I should create "temporary" defines
(with hardcoded gpio#)?

Perhaps I'm missing something, but I currently see no other way to get GPIO# (It will change once your RFC is included).

Of course CONFIG_ATMEL_LEGACY has to stay, as atmel_nand uses CONFIG_SYS_NAND_*_PIN and is still using old API (I guess this also needs fixing).

>> +	/* Re-enable pull-up */
>> +	at91_set_pio_pullup(AT91_PIO_PORTC, 25, 1);
>> +	at91_set_pio_pullup(AT91_PIO_PORTE, 25, 1);
>> +	at91_set_pio_pullup(AT91_PIO_PORTE, 26, 1);
>> +
>> +	at91_macb_hw_init();
>
> Heiko proposed a solution for unifying macb reset sequence.
+1

I will also switch usb_a9263_macb_hw_init() to generic GPIO (and remove re-enabling of pull-ups as they are dropped by at91_macb_hw_init).

>> +#ifdef CONFIG_HAS_DATAFLASH
>> +	at91_set_pio_output(AT91_PIO_PORTE, 20, 1);	/* select spi0 clock */
>
> Here we could also use the generic GPIO API. Beside that, did you really
> copy the at91sam9263 here? IOW, do you really have a slot for MMC/DF
> here and therefore require to switch the clock?

I copied (see at91sam9263ek.c:256).
I've checked board schematics and this pin is floating, so for v3 I'll drop it.

>
> Beside these minor complaints there is nothing to stop inclusion for
> 2014.01. Please stay tuned and do not send v3 immediately cause of the
> ongoing change for GPIO API and consolidation of macb reset.
> I think another ping from your side in about two weeks would be Ok, if
> you haven't seen changes in the two mentioned points on the list.

Ping :)
Do I understand correctly, that phy_reset RFC will be soon applied, then I should post v3?
Or should I wait for your GPIO RFC?

In the meantime I will start playing with SPL, as u-boot image grows slowly and soon I'll be forced to cut another features just to keep it small enough.

Best Regards,
Mateusz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v2] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-11-28 21:29         ` Mateusz Kulikowski
@ 2013-11-29 11:31           ` Andreas Bießmann
  2013-12-02 22:30             ` [U-Boot] [PATCH v3] " Mateusz Kulikowski
  0 siblings, 1 reply; 20+ messages in thread
From: Andreas Bießmann @ 2013-11-29 11:31 UTC (permalink / raw)
  To: u-boot

Dear Mateusz Kulikowski,

On 11/28/2013 10:29 PM, Mateusz Kulikowski wrote:
> On 11.11.2013 12:03, Andreas Bie?mann wrote:

<snip>

>>> +
>>> +    /* Enable NandFlash */
>>> +    at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
>>
>> Here you could really use the gpio_direction_output(). I sent out an RFC
>> lately to define new GPIO_PIN_Px() macros. As long as that RFC is not
>> reworked and included I think it is Ok to use the CONFIG_ATMEL_LEGACY
>> defines.
> 
>> Please switch to the generic GPIO API for defining GPIO direction and
>> switching GPIO, even on AT91. On the long run we will remove the
>> redundant at91_pio API, at least regarding plane GPIO functionality.
>> Therefore it would be good to use that API now, even if it costs some
>> function calls currently.
> 
> Do I understand correctly, that for all ports that I use (via generic
> GPIO) I should create "temporary" defines
> (with hardcoded gpio#)?

please use the freshly defined GPIO_PIN_Px() macros from [1].

> Perhaps I'm missing something, but I currently see no other way to get
> GPIO# (It will change once your RFC is included).
> 
> Of course CONFIG_ATMEL_LEGACY has to stay, as atmel_nand uses
> CONFIG_SYS_NAND_*_PIN and is still using old API (I guess this also
> needs fixing).

The series includes change for atmel_nand [2], therefore you can remove
that switch.

<snip>

>> Beside these minor complaints there is nothing to stop inclusion for
>> 2014.01. Please stay tuned and do not send v3 immediately cause of the
>> ongoing change for GPIO API and consolidation of macb reset.
>> I think another ping from your side in about two weeks would be Ok, if
>> you haven't seen changes in the two mentioned points on the list.
> 
> Ping :)
> Do I understand correctly, that phy_reset RFC will be soon applied, then
> I should post v3?

I'll apply that patch [3] this weekend.

> Or should I wait for your GPIO RFC?

Is out now ... ;)

Best regards

Andreas Bie?mann

[1] http://patchwork.ozlabs.org/patch/295264/
[2] http://patchwork.ozlabs.org/patch/295268/
[3] http://patchwork.ozlabs.org/patch/291958/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-11-29 11:31           ` Andreas Bießmann
@ 2013-12-02 22:30             ` Mateusz Kulikowski
  2013-12-09 12:39               ` [U-Boot] [U-Boot, " Andreas Bießmann
  0 siblings, 1 reply; 20+ messages in thread
From: Mateusz Kulikowski @ 2013-12-02 22:30 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---
Changes for v3
- Updated Makefile to a new build system
- Use generic GPIO for NAND and MAC (requires new GPIO patches)
- Use common at91 phy reset
- Dropped spi0 clock setup (pin is unused)
- Fixed PHY address as 0x0001 and dropped PHY autodetect
  (no need for autodetect - PHY address is bootstrapped to 1)
---
 board/calao/usb_a9263/Makefile    |  14 ++++
 board/calao/usb_a9263/usb_a9263.c | 148 +++++++++++++++++++++++++++++++++
 boards.cfg                        |   1 +
 include/configs/usb_a9263.h       | 169 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 332 insertions(+)
 create mode 100644 board/calao/usb_a9263/Makefile
 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..8a22b3e
--- /dev/null
+++ b/board/calao/usb_a9263/Makefile
@@ -0,0 +1,14 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian@popies.net>
+# Lead Tech Design <www.leadtechdesign.com>
+#
+# (C) Copyright 2013
+# Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+
+obj-y	+= usb_a9263.o
diff --git a/board/calao/usb_a9263/usb_a9263.c b/board/calao/usb_a9263/usb_a9263.c
new file mode 100644
index 0000000..266e950
--- /dev/null
+++ b/board/calao/usb_a9263/usb_a9263.c
@@ -0,0 +1,148 @@
+/*
+ * (C) Copyright 2007-2013
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
+ * Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_matrix.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm-generic/gpio.h>
+#include <asm/io.h>
+#include <net.h>
+#include <netdev.h>
+#include <dataflash.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_HAS_DATAFLASH
+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_CLEAR, 0, "U-Boot"},
+};
+#endif
+
+#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 */
+	gpio_request(CONFIG_SYS_NAND_READY_PIN, "NAND ready/busy");
+	gpio_direction_input(CONFIG_SYS_NAND_READY_PIN);
+
+	/* Enable NandFlash */
+	gpio_request(CONFIG_SYS_NAND_ENABLE_PIN, "NAND enable");
+	gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+#endif
+
+#ifdef CONFIG_MACB
+static void usb_a9263_macb_hw_init(void)
+{
+	at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
+
+	/* 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 weak pull-up/pull-down
+	 */
+	gpio_request(GPIO_PIN_PC(25), "PHY mode");
+	gpio_direction_input(GPIO_PIN_PC(25));
+
+	gpio_request(GPIO_PIN_PE(25), "PHY ADDR0");
+	gpio_direction_input(GPIO_PIN_PE(25));
+
+	gpio_request(GPIO_PIN_PE(26), "PHY ADDR1");
+	gpio_direction_input(GPIO_PIN_PE(26));
+
+	at91_phy_reset();
+
+	/* It will set proper pinmux for ports PC25, PE25-26 */
+	at91_macb_hw_init();
+}
+#endif
+
+int board_init(void)
+{
+	/* 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_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;
+
+#ifdef CONFIG_MACB
+	rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x0001);
+#endif
+	return rc;
+}
diff --git a/boards.cfg b/boards.cfg
index 36f0924..0f14fbb 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@free-electrons.com>
 Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_eeprom                     tny_a9260:AT91SAM9G20,SYS_USE_EEPROM                                                                                              Albin Tonnerre <albin.tonnerre@free-electrons.com>
 Active  arm         arm926ejs      at91        calao           tny_a9260           tny_a9g20_nandflash                  tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH                                                                                           Albin Tonnerre <albin.tonnerre@free-electrons.com>
+Active  arm         arm926ejs      at91        calao           usb_a9263           usb_a9263_dataflash                  usb_a9263:AT91SAM9263,SYS_USE_DATAFLASH                                                                                           Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
 Active  arm         arm926ejs      at91        egnite          ethernut5           ethernut5                            ethernut5:AT91SAM9XE                                                                                                              egnite GmbH <info@egnite.de>
 Active  arm         arm926ejs      at91        emk             top9000             top9000eval_xe                       top9000:EVAL9000                                                                                                                  Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
 Active  arm         arm926ejs      at91        emk             top9000             top9000su_xe                         top9000:SU9000                                                                                                                    Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
diff --git a/include/configs/usb_a9263.h b/include/configs/usb_a9263.h
new file mode 100644
index 0000000..c4d04de
--- /dev/null
+++ b/include/configs/usb_a9263.h
@@ -0,0 +1,169 @@
+/*
+ * (C) Copyright 2007-2013
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ * Thomas Petazzoni, Free Electrons, <thomas.petazzoni@free-electrons.com>
+ * Mateusz Kulikowski <mateusz.kulikowski@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_MACH_TYPE		MACH_TYPE_USB_A9263
+
+#define CONFIG_ARCH_CPU_INIT
+
+#define CONFIG_CMDLINE_TAG	/* enable passing of ATAGs      */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#define CONFIG_DISPLAY_CPUINFO
+
+#define CONFIG_OF_LIBFDT
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_SYS_TEXT_BASE		0x23f00000
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_AT91_GPIO
+
+/* serial console */
+#define CONFIG_ATMEL_USART
+#define CONFIG_USART_BASE		ATMEL_BASE_DBGU
+#define CONFIG_USART_ID			ATMEL_ID_SYS
+#define CONFIG_BAUDRATE			115200
+
+#define CONFIG_BOOTDELAY 3
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
+/*
+ * 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_ITEST
+#undef CONFIG_CMD_LOADB
+#undef CONFIG_CMD_LOADS
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_NAND
+
+/* 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
+#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
+
+/* 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
+/* 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		GPIO_PIN_PD(15)
+#define CONFIG_SYS_NAND_READY_PIN		GPIO_PIN_PA(22)
+#endif
+
+#define MTDPARTS_DEFAULT \
+	"mtdparts=atmel_nand:16m(kernel)ro,120m(root1),-(root2)"
+
+/* Ethernet */
+#define CONFIG_MACB
+#define CONFIG_RMII
+#define CONFIG_NET_RETRY_COUNT			20
+#define CONFIG_AT91_WANTS_COMMON_PHY
+
+/* USB */
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_ATMEL
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_DOS_PARTITION
+#define CONFIG_SYS_USB_OHCI_CPU_INIT
+#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
+#define CONFIG_CMD_FAT
+#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
+#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=" MTDPARTS_DEFAULT " " \
+	"rw rootfstype=jffs2"
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"mtdparts=" MTDPARTS_DEFAULT "\0" \
+
+#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_CMDLINE_EDITING
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_LONGHELP
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN	ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
+
+#endif
-- 
1.8.4.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [U-Boot, v3] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263)
  2013-12-02 22:30             ` [U-Boot] [PATCH v3] " Mateusz Kulikowski
@ 2013-12-09 12:39               ` Andreas Bießmann
  0 siblings, 0 replies; 20+ messages in thread
From: Andreas Bießmann @ 2013-12-09 12:39 UTC (permalink / raw)
  To: u-boot

Dear Mateusz Kulikowski,

Mateusz Kulikowski <mateusz.kulikowski@gmail.com> writes:
>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.
>
>Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
>
>---
>Changes for v3
>- Updated Makefile to a new build system
>- Use generic GPIO for NAND and MAC (requires new GPIO patches)
>- Use common at91 phy reset
>- Dropped spi0 clock setup (pin is unused)
>- Fixed PHY address as 0x0001 and dropped PHY autodetect
>  (no need for autodetect - PHY address is bootstrapped to 1)
>---
> board/calao/usb_a9263/Makefile    |  14 ++++
> board/calao/usb_a9263/usb_a9263.c | 148 +++++++++++++++++++++++++++++++++
> boards.cfg                        |   1 +
> include/configs/usb_a9263.h       | 169 ++++++++++++++++++++++++++++++++++++++
> 4 files changed, 332 insertions(+)
> create mode 100644 board/calao/usb_a9263/Makefile
> create mode 100644 board/calao/usb_a9263/usb_a9263.c
> create mode 100644 include/configs/usb_a9263.h

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-12-09 12:39 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-27 19:34 [U-Boot] [PATCH] arm: at91: support for the Calao USB-A9263 board (based on AT91SAM9263) Mateusz Kulikowski
2013-10-28  4:57 ` Bo Shen
2013-10-28 21:30   ` Mateusz Kulikowski
2013-10-29  5:20     ` Heiko Schocher
2013-10-30 18:03       ` Mateusz Kulikowski
2013-10-29  5:24     ` Bo Shen
2013-10-29  5:54       ` Heiko Schocher
2013-10-30 18:17       ` Mateusz Kulikowski
2013-10-29  6:26     ` Andreas Bießmann
2013-10-29  6:35       ` Heiko Schocher
2013-10-29  9:12   ` Andreas Bießmann
2013-11-01 19:26     ` Mateusz Kulikowski
2013-11-04  9:36       ` Andreas Bießmann
2013-11-01 23:19     ` [U-Boot] [PATCH v2] " Mateusz Kulikowski
2013-11-11 11:03       ` Andreas Bießmann
2013-11-12  8:53         ` Heiko Schocher
2013-11-28 21:29         ` Mateusz Kulikowski
2013-11-29 11:31           ` Andreas Bießmann
2013-12-02 22:30             ` [U-Boot] [PATCH v3] " Mateusz Kulikowski
2013-12-09 12:39               ` [U-Boot] [U-Boot, " Andreas Bießmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).