Skip to contentSkip to conversation

Ethernut 5 board support

PATCH Superseded Tim Schendekehl 2 participants 2 messages Oct 24, 2011

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Ethernut 5 board support

Add support for the Ethernut 5 open hardware design, based on Atmel's AT91SAM9XE512 SoC.

V3
- Fix issues with latest git.

---
 MAINTAINERS                               |    4 +
 board/egnite/ethernut5/Makefile           |   54 +++++
 board/egnite/ethernut5/ethernut5.c        |  281 ++++++++++++++++++++++++
 board/egnite/ethernut5/ethernut5_pwrman.c |  338 +++++++++++++++++++++++++++++
 board/egnite/ethernut5/ethernut5_pwrman.h |   68 ++++++
 boards.cfg                                |    1 +
 include/configs/ethernut5.h               |  290 +++++++++++++++++++++++++
 7 files changed, 1036 insertions(+), 0 deletions(-)
 create mode 100644 board/egnite/ethernut5/Makefile
 create mode 100644 board/egnite/ethernut5/ethernut5.c
 create mode 100644 board/egnite/ethernut5/ethernut5_pwrman.c
 create mode 100644 board/egnite/ethernut5/ethernut5_pwrman.h
 create mode 100644 include/configs/ethernut5.h
MAINTAINERS +4 -0
index bb95e6d..a4695a1 100644
@@ -142,6 +142,10 @@ Phil Edworthy <[email protected]>
 
 	rsk7264		SH7264
 
+egnite GmbH <[email protected]>
+
+	ethernut5	ARM926EJS (AT91SAM9XE SoC)
+
 Dirk Eibach <[email protected]>
 
 	devconcenter	PPC460EX
board/egnite/ethernut5/Makefile new file +54 -0

54 lines not on this page · raw message

board/egnite/ethernut5/ethernut5.c new file +281 -0

281 lines not on this page · raw message

board/egnite/ethernut5/ethernut5_pwrman.c new file +338 -0

338 lines not on this page · raw message

board/egnite/ethernut5/ethernut5_pwrman.h new file +68 -0

68 lines not on this page · raw message

boards.cfg +1 -0
index 1e3bfdc..e3b2947 100644
@@ -109,6 +109,7 @@ cpu9G20                      arm         arm926ejs   cpu9260             eukrea
 cpu9G20_nand                 arm         arm926ejs   cpu9260             eukrea         at91        cpu9260:CPU9G20,NANDBOOT
 cpu9G20_128M                 arm         arm926ejs   cpu9260             eukrea         at91        cpu9260:CPU9G20,CPU9G20_128M
 cpu9G20_nand_128M            arm         arm926ejs   cpu9260             eukrea         at91        cpu9260:CPU9G20,CPU9G20_128M,NANDBOOT
+ethernut5                    arm         arm926ejs   ethernut5           egnite         at91        ethernut5:AT91SAM9XE
 top9000eval_xe               arm         arm926ejs   top9000             emk            at91        top9000:EVAL9000
 top9000su_xe                 arm         arm926ejs   top9000             emk            at91        top9000:SU9000
 meesc                        arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_NANDFLASH
include/configs/ethernut5.h new file +290 -0

290 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw

PATCH v3 1/1 Ethernut 5 board support

Quoted 8 lines · Tim Schendekehl

Add support for the Ethernut 5 open hardware design, based on Atmel's AT91SAM9XE512 SoC.

V3
- Fix issues with latest git.

---

[...]

Quoted 5 lines

diff --git a/board/egnite/ethernut5/Makefile b/board/egnite/ethernut5/Makefile
new file mode 100644
index 0000000..d8e485f

board/egnite/ethernut5/Makefile new file +0 -0

[...]

board/egnite/ethernut5/Makefile line 45

Quoted 6 lines
board/egnite/ethernut5/Makefile new file +6 -0
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend

You shouldn't be adding this.
Please, see the commit 464c79207c89f247f97b344495924eabb0c9738e (punt unused clean/distclean targets) by Mike.

[...]

Quoted 5 lines
board/egnite/ethernut5/ethernut5.c new file +0 -0
new file mode 100644
index 0000000..50c4cb3

[...]

Quoted 24 lines
board/egnite/ethernut5/ethernut5.c new file +24 -0
+#ifdef CONFIG_CMD_NAND
+static void ethernut5_nand_hw_init(void)
+{
+	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+	struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
+	unsigned long csa;
+
+	/* Assign CS3 to NAND/SmartMedia Interface */
+	csa = readl(&matrix->ebicsa);
+	csa |= AT91_MATRIX_CS3A_SMC_SMARTMEDIA;
+	writel(csa, &matrix->ebicsa);
+
+	/* 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 |

board/egnite/ethernut5/ethernut5.c line 161

Quoted 10 lines
board/egnite/ethernut5/ethernut5.c new file +10 -0
+		AT91_SMC_MODE_TDF_CYCLE(2),
+		&smc->cs[3].mode);
+
+#ifdef CONFIG_SYS_NAND_READY_PIN
+	/* Ready pin is optional. */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+#endif
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+
+

Please, remove these 2 empty lines.

Quoted 7 lines
board/egnite/ethernut5/ethernut5.c new file +7 -0
+}
+#endif
+
+/*
+ * This is called first during late initialization.
+ */
+int board_init(void)

board/egnite/ethernut5/ethernut5.c line 178

Quoted 10 lines
board/egnite/ethernut5/ethernut5.c new file +10 -0
+{
+	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);
+
+	/* Enable ctrl+c. */
+	console_init_f();

This one has already been called in the init_sequence array. Why do you need to call it the second time?

board/egnite/ethernut5/ethernut5.c line 180

Quoted 2 lines
board/egnite/ethernut5/ethernut5.c new file +2 -0
+	/* Set our official architecture number. */
+	gd->bd->bi_arch_number = 1971; /*MACH_TYPE_ETHERNUT5*/

This should be done in the board config file. Please, read the README file (CONFIG_MACH_TYPE option).

Quoted 13 lines
board/egnite/ethernut5/ethernut5.c new file +13 -0
+	/* Set adress of boot parameters. */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+	/* Initialize UARTs and power management. */
+	at91_seriald_hw_init();
+	ethernut5_power_init();
+
+	ethernut5_nand_hw_init();
+
+#ifdef CONFIG_HAS_DATAFLASH
+	at91_spi0_hw_init(1 << 0);
+#endif
+	return 0;
+}

[...]

board/egnite/ethernut5/ethernut5.c line 241

Quoted 8 lines
board/egnite/ethernut5/ethernut5.c new file +8 -0
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bd)
+{
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
+	/* Enable MCI clock. */
+	writel(1 << ATMEL_ID_MCI,
+		&pmc->pcer);

Why not leave this on the same line?

board/egnite/ethernut5/ethernut5.c line 247

Quoted 6 lines
board/egnite/ethernut5/ethernut5.c new file +6 -0
+
+	/* Initialize MCI hardware. */
+	at91_mci_hw_init();
+	/* Register the device. */
+	return atmel_mci_init((void *)ATMEL_BASE_MCI);
+}

[...]

Regards,
Igor.