Patchwork [U-Boot] at91 family status

login
register
mail settings
Submitter Claudio Mignanti
Date Nov. 13, 2010, 5:36 p.m.
Message ID <AANLkTim3DdWWNrJ1Df1LHL8vcK92eCiBX0PFNXi-sTzZ@mail.gmail.com>
Download mbox | patch
Permalink /patch/71063/
State Superseded
Delegated to: Reinhard Meyer
Headers show

Comments

Claudio Mignanti - Nov. 13, 2010, 5:36 p.m.
Dear Reinhard,

2010/11/10 Reinhard Meyer <u-boot@emk-elektronik.de>:
>
> Correct. However atmel_mci is the "old" driver, at at91 we are using
> the common mmc driver gen_atmel_mci. This one should work for avr32 as
> well (not tested).
>

Thanks for all your comments, now I finished to do some tests using my
board definition over the atmel/at91avr32rework-3 branch and now I
have only one issue.

The problem is related to the new MMC driver, simple the mmc driver
don't recognize my cards and also "mmc info" returns no info.

As doc/README.atmel_mci suggest I add the appropriate code to .h and board init.

Here the boot log:

U-Boot 2010.12-rc1-00054-gb535a8c (Nov 13 2010 - 18:07:19)

CPU: AT91SAM9G20
Crystal frequency:   18.432 MHz
CPU clock        :  396.288 MHz
Master clock     :  132.096 MHz
DRAM:  64 MiB
MMC:
DataFlash:AT45DB642
Nb pages:   8192

Page Size:   1056
Size= 8650752 bytes
Logical address: 0xD0000000
Area 0:	D0000000 to D00041FF (RO) Bootstrap
Area 1:	D0004200 to D00083FF      Environment
Area 2:	D0008400 to D0041FFF (RO) U-Boot
Area 3:	D0042000 to D0251FFF      Kernel
Area 4:	D0252000 to D083FFFF      FS
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   macb0
Hit any key to stop autoboot:  0
MMC Device 0 not found
** Block device mmc 0 not supported
## Executing script at 20000000
Wrong image format for "source" command

Here the board definition:
[PATCH] AT91: Add support for NetusG20

Add support for the NetusG20 board by Acmesystems srl.
This board is based on AT91SAM9G20 SoC.

Signed-off-by: Claudio Mignanti <c.mignanti@gmail.com>
---
 MAINTAINERS                            |    5 +
 board/acmesystems/netusg20/Makefile    |   55 ++++++++++
 board/acmesystems/netusg20/netusg20.c  |  130 ++++++++++++++++++++++++
 board/acmesystems/netusg20/partition.c |   39 +++++++
 boards.cfg                             |    1 +
 include/configs/netusg20.h             |  173 ++++++++++++++++++++++++++++++++
 6 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 board/acmesystems/netusg20/Makefile
 create mode 100644 board/acmesystems/netusg20/netusg20.c
 create mode 100644 board/acmesystems/netusg20/partition.c
 create mode 100644 include/configs/netusg20.h
Reinhard Meyer - Nov. 13, 2010, 8:08 p.m.
Dear Claudio Mignanti,
> The problem is related to the new MMC driver, simple the mmc driver
> don't recognize my cards and also "mmc info" returns no info.
Just a blind shot:
is your MCI on port B (like it is on the at91sam9xxx-ek)?
Then define CONFIG_ATMEL_MCI_PORTB.

Best Regards,
Reinhard
Claudio Mignanti - Nov. 15, 2010, 11:18 a.m.
Dear Reinhard Meyer

2010/11/13 Reinhard Meyer <u-boot@emk-elektronik.de>:
>>
>> The problem is related to the new MMC driver, simple the mmc driver
>> don't recognize my cards and also "mmc info" returns no info.
>
> Just a blind shot:
> is your MCI on port B (like it is on the at91sam9xxx-ek)?
> Then define CONFIG_ATMEL_MCI_PORTB.

Yes, my board is based on at91sam9g20-ek but also define
CONFIG_ATMEL_MCI_PORTB don't help.
Reinhard Meyer - Nov. 15, 2010, 11:36 a.m.
Dear Claudio Mignanti,
> 2010/11/13 Reinhard Meyer <u-boot@emk-elektronik.de>:
>>> The problem is related to the new MMC driver, simple the mmc driver
>>> don't recognize my cards and also "mmc info" returns no info.
>> Just a blind shot:
>> is your MCI on port B (like it is on the at91sam9xxx-ek)?
>> Then define CONFIG_ATMEL_MCI_PORTB.
> 
> Yes, my board is based on at91sam9g20-ek but also define
> CONFIG_ATMEL_MCI_PORTB don't help.
Did it work with the old driver? What #defines were used then?

Can you #define DEBUG 1 in gen_atmel_mci.c and see what is printed?

Best Regards,
Reinhard

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index ccece74..7ce96b5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -852,6 +852,11 @@  Alex Z
 	lart		SA1100
 	dnp1110		SA1110

+
+Claudio Mignanti <c.mignanti@gmail.com>
+
+	netusg20	ARM926EJS (AT91SAM9G20 SoC)
+
 -------------------------------------------------------------------------

 Unknown / orphaned boards:
diff --git a/board/acmesystems/netusg20/Makefile
b/board/acmesystems/netusg20/Makefile
new file mode 100644
index 0000000..09e6695
--- /dev/null
+++ b/board/acmesystems/netusg20/Makefile
@@ -0,0 +1,55 @@ 
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-$(CONFIG_NETUSG20)	+= netusg20.o
+COBJS-y	+= partition.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/acmesystems/netusg20/netusg20.c
b/board/acmesystems/netusg20/netusg20.c
new file mode 100644
index 0000000..7190f41
--- /dev/null
+++ b/board/acmesystems/netusg20/netusg20.c
@@ -0,0 +1,130 @@ 
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * (C) Copyright 2010
+ * Reinhard Meyer, EMK Elektronik, reinhard.meyer@emk-elektronik.de
+ * Claudio Mignanti <c.mignanti@gmail.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <net.h>
+#include <netdev.h>
+#include <mmc.h>
+#include <i2c.h>
+#include <spi.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/at91sam9260_matrix.h>
+#include <asm/arch/at91sam9260.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+#ifdef CONFIG_MACB
+static void netus_macb_init(void)
+{
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
+	/* Enable EMAC clock */
+	writel(1 << ATMEL_ID_EMAC0, &pmc->pcer);
+
+	/* Initialize EMAC=MACB hardware */
+	at91_macb_hw_init();
+}
+
+int board_eth_init(bd_t *bis)
+{
+	int rc = 0;
+	rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC0, 0x00);
+	return rc;
+}
+#else
+/* code is more readable if #directive are around the function
+ * and not in the middle */
+void netus_macb_init(void) {}		/* define of dummy function */
+int board_eth_init(bd_t *bis) { return 0;}
+#endif
+
+int board_early_init_f(void)
+{
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
+	/* Enable clocks for all PIOs */
+	writel(	(1 << ATMEL_ID_PIOA) | (1 << ATMEL_ID_PIOB) |
+		(1 << ATMEL_ID_PIOC),
+		&pmc->pcer);
+
+	return 0;
+}
+
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int netus_mmc_init(void)
+{
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
+	/* Enable MCI clock */
+	writel(1 << ATMEL_ID_MCI, &pmc->pcer);
+	at91_mci_hw_init();
+
+	/* This calls the atmel_mmc_init in gen_atmel_mci.c */
+	return atmel_mci_init((void *)ATMEL_BASE_MCI);
+}
+
+/* this is a weak define that we are overriding */
+int board_mmc_getcd(u8 *cd, struct mmc *mmc)
+{
+	/*
+	 *return *cs = TRUE if card is NOT detected
+	 */
+	*cs = 0;
+	return 0;
+}
+#else
+void netus_mmc_init(void) {}
+#endif
+
+int board_init (void) {
+
+	gd->bd->bi_arch_number = 3129; //MACH_TYPE_ACMENETUSFOXG20
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+	netus_macb_init();
+	netus_mmc_init();
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->ram_size = get_ram_size(
+		(void *)CONFIG_SYS_SDRAM_BASE,
+		CONFIG_SYS_SDRAM_SIZE);
+	return 0;
+}
+
diff --git a/board/acmesystems/netusg20/partition.c
b/board/acmesystems/netusg20/partition.c
new file mode 100644
index 0000000..7d79e53
--- /dev/null
+++ b/board/acmesystems/netusg20/partition.c
@@ -0,0 +1,39 @@ 
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+#include <common.h>
+#include <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_CS1, 1}
+};
+
+/*define the area offsets*/
+dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+	{0x00000000, 0x000041FF, FLAG_PROTECT_SET,   0, "Bootstrap"},
+	{0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
+	{0x00008400, 0x00041FFF, FLAG_PROTECT_SET,   0, "U-Boot"},
+	{0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0,	"Kernel"},
+	{0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0,	"FS"},
+};
diff --git a/boards.cfg b/boards.cfg
index 648603d..97382f2 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -377,6 +377,7 @@  smdk2400	arm	arm920t		-		samsung		s3c24x0
 smdk2410	arm	arm920t		-		samsung		s3c24x0
 voiceblue	arm	arm925t
 omap1510inn	arm	arm925t		-		ti
+netusg20	arm	arm926ejs	-		acmesystems	at91
 afeb9260	arm	arm926ejs	-		-		at91
 at91cap9adk	arm	arm926ejs	-		atmel		at91
 davinci_dvevm	arm	arm926ejs	dvevm		davinci		davinci
diff --git a/include/configs/netusg20.h b/include/configs/netusg20.h
new file mode 100644
index 0000000..74a9371
--- /dev/null
+++ b/include/configs/netusg20.h
@@ -0,0 +1,173 @@ 
+/*
+ * (C) Copyright 2009-2010
+ * Reinhard Meyer, EMK Elektronik, reinhard.meyer@emk-elektronik.de
+ * Claudio Mignanti <c.mignanti@gmail.com>
+ *
+ * Configuation settings for the NetusG20 boards.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+
+#define CONFIG_AT91SAM9G20
+#define CONFIG_NETUSG20
+#include <asm/hardware.h>
+
+#define CONFIG_SYS_TEXT_BASE	0x23f00000
+
+/* ARM asynchronous clock */
+#define CONFIG_SYS_AT91_SLOW_CLOCK	32768
+#define CONFIG_SYS_AT91_MAIN_CLOCK	18432000	/* 18.432 MHz */
+#define CONFIG_SYS_HZ		1000
+
+/* Misc CPU related */
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+#define CONFIG_CMDLINE_TAG		/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_DISPLAY_CPUINFO
+
+/* General purpose I/O */
+#define CONFIG_ATMEL_LEGACY		/* required until (g)pio is fixed */
+#define CONFIG_AT91_GPIO
+#define CONFIG_AT91_GPIO_PULLUP	1	/* keep pullups on peripheral pins */
+
+/* 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_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+#define CONFIG_BOARD_EARLY_INIT_F
+#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_FPGA
+#undef CONFIG_CMD_IMLS /* related to flash support, so uneeded */
+
+#define CONFIG_CMD_DHCP		1
+#define CONFIG_CMD_USB		1
+#define CONFIG_CMD_PING		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_CS1	0xD0000000	/* CS1 */
+#define AT91_SPI_CLK			15000000
+
+#define DATAFLASH_TCSS			(0x22 << 16)
+#define DATAFLASH_TCHS			(0x1 << 24)
+
+/* no NAND flash on this board*/
+#define CONFIG_SYS_NO_FLASH
+
+/* Ethernet */
+#define CONFIG_MACB				1
+#define CONFIG_RMII				1
+#define CONFIG_NET_MULTI		1
+#define CONFIG_NET_RETRY_COUNT	20
+
+/* MMC */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_GENERIC_ATMEL_MCI
+
+/* 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	0x00500000
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME	"at91sam9260"
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
+#define CONFIG_USB_STORAGE		1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Filesystem */
+#define CONFIG_CMD_FAT		1
+#define CONFIG_CMD_EXT2		1
+#define CONFIG_CMD_MMC		1
+
+/* bootstrap + u-boot + env + linux in dataflash on CS1 */
+#define CONFIG_ENV_IS_IN_DATAFLASH	1
+#define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + 0x8400)
+#define CONFIG_ENV_OFFSET		0x4200
+#define CONFIG_ENV_ADDR	\
+	(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + CONFIG_ENV_OFFSET)
+#define CONFIG_ENV_SIZE		0x4200
+#define CONFIG_BOOTCOMMAND	"mmc init; sleep 1; " \
+                            "ext2load mmc 0 0x20000000 uImage; " \
+                            "source 0x20000000"
+#define CONFIG_BOOTARGS		"mem=64M console=ttyS0,115200 " \
+                            "root=/dev/mmcblk0p1 rootwait"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#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
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
+
+#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif