mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] at91sam9261: add bootstrap and firstage support
@ 2013-01-26 18:18 Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19 ` [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic Jean-Christophe PLAGNIOL-VILLARD
  2013-01-31 13:23 ` [PATCH 0/5] at91sam9261: add bootstrap and firstage support Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-26 18:18 UTC (permalink / raw)
  To: barebox

HI,

	the following patch serie add support to the sam9261 of
	 - bootstrap
	 - first stage
	 - spi

The following changes since commit 62c096b6e4d5fe22de09659697bf921d5dbca28b:

  at91sam9261: fix max bare_init it's 156KiB (2013-01-22 20:18:57 +0800)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git delivery/at91sam9261ek_bootstrap

for you to fetch changes up to f6c904910c2731437f09cb69b394e3927b1303ff:

  at91sam9261ek: add first stage support (2013-01-22 20:54:04 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (5):
      at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic
      at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot
      at91sam9261ek: add spi support
      at91sam9261ek: add boostrap support
      at91sam9261ek: add first stage support

 arch/arm/boards/at91sam9261ek/Makefile               |    4 +++
 arch/arm/boards/at91sam9261ek/env/config             |   10 +++++--
 arch/arm/boards/at91sam9261ek/init.c                 |   59 +++++++++++++++++++++++++++++++++++--
 arch/arm/boards/at91sam9261ek/lowlevel_init.c        |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/configs/at91sam9261ek_bootstrap_defconfig   |   25 ++++++++++++++++
 arch/arm/configs/at91sam9261ek_defconfig             |    3 +-
 arch/arm/configs/at91sam9261ek_first_stage_defconfig |   71 ++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-at91/Kconfig                           |   19 ++++++++++++
 arch/arm/mach-at91/Makefile                          |    5 +++-
 arch/arm/mach-at91/at91sam9260_lowlevel_init.c       |   34 +++++++++++++++++++++
 arch/arm/mach-at91/at91sam9261_lowlevel_init.c       |   34 +++++++++++++++++++++
 arch/arm/mach-at91/at91sam9263_lowlevel_init.c       |   34 +++++++++++++++++++++
 arch/arm/mach-at91/at91sam926x_lowlevel_init.c       |   36 +++++------------------
 arch/arm/mach-at91/include/mach/at91_lowlevel_init.h |    1 +
 arch/arm/mach-at91/include/mach/barebox-arm-head.h   |    2 +-
 15 files changed, 408 insertions(+), 37 deletions(-)
 create mode 100644 arch/arm/boards/at91sam9261ek/lowlevel_init.c
 create mode 100644 arch/arm/configs/at91sam9261ek_bootstrap_defconfig
 create mode 100644 arch/arm/configs/at91sam9261ek_first_stage_defconfig
 create mode 100644 arch/arm/mach-at91/at91sam9260_lowlevel_init.c
 create mode 100644 arch/arm/mach-at91/at91sam9261_lowlevel_init.c
 create mode 100644 arch/arm/mach-at91/at91sam9263_lowlevel_init.c

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic
  2013-01-26 18:18 [PATCH 0/5] at91sam9261: add bootstrap and firstage support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-26 18:19 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 2/5] at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 more replies)
  2013-01-31 13:23 ` [PATCH 0/5] at91sam9261: add bootstrap and firstage support Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 4 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-26 18:19 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/Kconfig                         |    6 ++++
 arch/arm/mach-at91/Makefile                        |    5 ++-
 arch/arm/mach-at91/at91sam9260_lowlevel_init.c     |   34 ++++++++++++++++++
 arch/arm/mach-at91/at91sam9261_lowlevel_init.c     |   34 ++++++++++++++++++
 arch/arm/mach-at91/at91sam9263_lowlevel_init.c     |   34 ++++++++++++++++++
 arch/arm/mach-at91/at91sam926x_lowlevel_init.c     |   36 ++++----------------
 .../mach-at91/include/mach/at91_lowlevel_init.h    |    1 +
 7 files changed, 120 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/mach-at91/at91sam9260_lowlevel_init.c
 create mode 100644 arch/arm/mach-at91/at91sam9261_lowlevel_init.c
 create mode 100644 arch/arm/mach-at91/at91sam9263_lowlevel_init.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index a3b2aba..0216a7e 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -62,6 +62,9 @@ config AT91SAM9_RESET
 config AT91SAM9G45_RESET
 	bool
 
+config AT91SAM9_LOWLEVEL_INIT
+	bool
+
 comment "Atmel AT91 System-on-Chip"
 
 config SOC_AT91RM9200
@@ -77,6 +80,7 @@ config SOC_AT91SAM9260
 	select HAVE_AT91_DBGU0
 	select HAS_MACB
 	select AT91SAM9_RESET
+	select AT91SAM9_LOWLEVEL_INIT
 	help
 	  Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
 	  or AT91SAM9G20 SoC.
@@ -86,6 +90,7 @@ config SOC_AT91SAM9261
 	select SOC_AT91SAM9
 	select HAVE_AT91_DBGU0
 	select AT91SAM9_RESET
+	select AT91SAM9_LOWLEVEL_INIT
 	help
 	  Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC.
 
@@ -95,6 +100,7 @@ config SOC_AT91SAM9263
 	select HAVE_AT91_DBGU1
 	select HAS_MACB
 	select AT91SAM9_RESET
+	select AT91SAM9_LOWLEVEL_INIT
 
 config SOC_AT91SAM9G45
 	bool
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 634b160..0eabeac 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -2,7 +2,10 @@ obj-y += setup.o clock.o gpio.o
 obj-$(CONFIG_CMD_AT91_BOOT_TEST) += boot_test_cmd.o
 
 obj-$(CONFIG_AT91_BOOTSTRAP) += bootstrap.o
-lowlevel_init-y = at91sam926x_lowlevel_init.o
+lowlevel_init-$(CONFIG_AT91SAM9_LOWLEVEL_INIT) = at91sam926x_lowlevel_init.o
+lowlevel_init-$(CONFIG_SOC_AT91SAM9260) += at91sam9260_lowlevel_init.o
+lowlevel_init-$(CONFIG_SOC_AT91SAM9261) += at91sam9261_lowlevel_init.o
+lowlevel_init-$(CONFIG_SOC_AT91SAM9263) += at91sam9263_lowlevel_init.o
 lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o
 obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y)
 
diff --git a/arch/arm/mach-at91/at91sam9260_lowlevel_init.c b/arch/arm/mach-at91/at91sam9260_lowlevel_init.c
new file mode 100644
index 0000000..c2cf8bf
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9260_lowlevel_init.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+  */
+
+#define __LOWLEVEL_INIT__
+
+#include <common.h>
+#include <asm/system.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/hardware.h>
+#include <mach/at91_pmc.h>
+#include <mach/at91_pio.h>
+#include <mach/at91_rstc.h>
+#include <mach/at91_wdt.h>
+#include <mach/at91sam9_matrix.h>
+#include <mach/at91sam9_sdramc.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/at91_lowlevel_init.h>
+#include <mach/io.h>
+#include <init.h>
+#include <sizes.h>
+
+void __naked __bare_init reset(void)
+{
+	common_reset();
+
+	arm_setup_stack(AT91SAM9260_SRAM_BASE + AT91SAM9260_SRAM_SIZE - 16);
+
+	at91sam926x_lowlevel_init(IOMEM(AT91SAM9260_BASE_PIOC), false,
+				  AT91_MATRIX_EBICSA);
+}
diff --git a/arch/arm/mach-at91/at91sam9261_lowlevel_init.c b/arch/arm/mach-at91/at91sam9261_lowlevel_init.c
new file mode 100644
index 0000000..a2e065f
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9261_lowlevel_init.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+  */
+
+#define __LOWLEVEL_INIT__
+
+#include <common.h>
+#include <asm/system.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/hardware.h>
+#include <mach/at91_pmc.h>
+#include <mach/at91_pio.h>
+#include <mach/at91_rstc.h>
+#include <mach/at91_wdt.h>
+#include <mach/at91sam9_matrix.h>
+#include <mach/at91sam9_sdramc.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/at91_lowlevel_init.h>
+#include <mach/io.h>
+#include <init.h>
+#include <sizes.h>
+
+void __naked __bare_init reset(void)
+{
+	common_reset();
+
+	arm_setup_stack(AT91SAM9261_SRAM_BASE + AT91SAM9261_SRAM_SIZE - 16);
+
+	at91sam926x_lowlevel_init(IOMEM(AT91SAM9261_BASE_PIOC), false,
+				  AT91_MATRIX_EBICSA);
+}
diff --git a/arch/arm/mach-at91/at91sam9263_lowlevel_init.c b/arch/arm/mach-at91/at91sam9263_lowlevel_init.c
new file mode 100644
index 0000000..5260658
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9263_lowlevel_init.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+  */
+
+#define __LOWLEVEL_INIT__
+
+#include <common.h>
+#include <asm/system.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/hardware.h>
+#include <mach/at91_pmc.h>
+#include <mach/at91_pio.h>
+#include <mach/at91_rstc.h>
+#include <mach/at91_wdt.h>
+#include <mach/at91sam9_matrix.h>
+#include <mach/at91sam9_sdramc.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/at91_lowlevel_init.h>
+#include <mach/io.h>
+#include <init.h>
+#include <sizes.h>
+
+void __naked __bare_init reset(void)
+{
+	common_reset();
+
+	arm_setup_stack(AT91SAM9263_SRAM0_BASE + AT91SAM9263_SRAM0_SIZE - 16);
+
+	at91sam926x_lowlevel_init(IOMEM(AT91SAM9263_BASE_PIOD), true,
+				  AT91_MATRIX_EBI0CSA);
+}
diff --git a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c
index 14afbc9..8b9b33e 100644
--- a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c
+++ b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c
@@ -46,7 +46,8 @@ static int inline running_in_sram(void)
 	return addr == 0;
 }
 
-void __bare_init at91sam926x_lowlevel_init(void)
+void __bare_init at91sam926x_lowlevel_init(void *pio, bool is_pio_asr,
+					   u32 matrix_csa)
 {
 	u32 r;
 	int i;
@@ -58,20 +59,12 @@ void __bare_init at91sam926x_lowlevel_init(void)
 	__raw_writel(cfg.wdt_mr, AT91_BASE_WDT + AT91_WDT_MR);
 
 	/* configure PIOx as EBI0 D[16-31] */
-#ifdef CONFIG_ARCH_AT91SAM9263
-	__raw_writel(cfg.ebi_pio_pdr, AT91_BASE_PIOD + PIO_PDR);
-	__raw_writel(cfg.ebi_pio_ppudr, AT91_BASE_PIOD + PIO_PUDR);
-	__raw_writel(cfg.ebi_pio_ppudr, AT91_BASE_PIOD + PIO_ASR);
-#else
-	__raw_writel(cfg.ebi_pio_pdr, AT91_BASE_PIOC + PIO_PDR);
-	__raw_writel(cfg.ebi_pio_ppudr, AT91_BASE_PIOC + PIO_PUDR);
-#endif
+	__raw_writel(cfg.ebi_pio_pdr, pio + PIO_PDR);
+	__raw_writel(cfg.ebi_pio_ppudr, pio + PIO_PUDR);
+	if (is_pio_asr)
+		__raw_writel(cfg.ebi_pio_ppudr, pio + PIO_ASR);
 
-#if defined(AT91_MATRIX_EBI0CSA)
-	at91_sys_write(AT91_MATRIX_EBI0CSA, cfg.ebi_csa);
-#else /* AT91_MATRIX_EBICSA */
-	at91_sys_write(AT91_MATRIX_EBICSA, cfg.ebi_csa);
-#endif
+	at91_sys_write(matrix_csa, cfg.ebi_csa);
 
 	/* flash */
 	at91_smc_write(cfg.smc_cs, AT91_SMC_MODE, cfg.smc_mode);
@@ -193,18 +186,3 @@ void __bare_init at91sam926x_lowlevel_init(void)
 end:
 	board_init_lowlevel_return();
 }
-
-void __naked __bare_init reset(void)
-{
-	common_reset();
-
-#ifdef CONFIG_ARCH_AT91SAM9263
-	arm_setup_stack(AT91SAM9263_SRAM0_BASE + AT91SAM9263_SRAM0_SIZE - 16);
-#elif defined(CONFIG_ARCH_AT91SAM9261) || defined(CONFIG_ARCH_AT91SAM9G10)
-	arm_setup_stack(AT91SAM9261_SRAM_BASE + AT91SAM9261_SRAM_SIZE - 16);
-#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
-	arm_setup_stack(AT91SAM9260_SRAM_BASE + AT91SAM9260_SRAM_SIZE - 16);
-#endif
-
-	at91sam926x_lowlevel_init();
-}
diff --git a/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h b/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h
index 29d9628..8c53ce7 100644
--- a/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h
+++ b/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h
@@ -29,5 +29,6 @@ struct at91sam926x_lowlevel_cfg {
 };
 
 void at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cfg *cfg);
+void at91sam926x_lowlevel_init(void *pio, bool is_pio_asr, u32 matrix_csa);
 
 #endif /* __AT91_LOWLEVEL_INIT_H__ */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/5] at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot
  2013-01-26 18:19 ` [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-26 18:19   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 3/5] at91sam9261ek: add spi support Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-26 18:19 UTC (permalink / raw)
  To: barebox

Some SoC as sam9261 or sam9263 have enough sram to directly load a barebox
from external boot.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/Kconfig                         |   11 +++++++++++
 arch/arm/mach-at91/include/mach/barebox-arm-head.h |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 0216a7e..661ff35 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -62,6 +62,9 @@ config AT91SAM9_RESET
 config AT91SAM9G45_RESET
 	bool
 
+config HAVE_AT91_LOAD_BAREBOX_SRAM
+	bool
+
 config AT91SAM9_LOWLEVEL_INIT
 	bool
 
@@ -101,6 +104,7 @@ config SOC_AT91SAM9263
 	select HAS_MACB
 	select AT91SAM9_RESET
 	select AT91SAM9_LOWLEVEL_INIT
+	select HAVE_AT91_LOAD_BAREBOX_SRAM
 
 config SOC_AT91SAM9G45
 	bool
@@ -148,6 +152,7 @@ config ARCH_AT91SAM9260
 config ARCH_AT91SAM9261
 	bool "AT91SAM9261"
 	select SOC_AT91SAM9261
+	select HAVE_AT91_LOAD_BAREBOX_SRAM
 
 config ARCH_AT91SAM9263
 	bool "AT91SAM9263"
@@ -517,4 +522,10 @@ config AT91_BOOTSTRAP
 	depends on MACH_HAS_LOWLEVEL_INIT
 	select BOOTSTRAP
 
+config AT91_LOAD_BAREBOX_SRAM
+	bool "at91 laad barebox in sram"
+	depends on MACH_HAS_LOWLEVEL_INIT
+	depends on SHELL_NONE || HAVE_AT91_LOAD_BAREBOX_SRAM
+	default y if SHELL_NONE
+
 endif
diff --git a/arch/arm/mach-at91/include/mach/barebox-arm-head.h b/arch/arm/mach-at91/include/mach/barebox-arm-head.h
index a9c8dd4..7d6a009 100644
--- a/arch/arm/mach-at91/include/mach/barebox-arm-head.h
+++ b/arch/arm/mach-at91/include/mach/barebox-arm-head.h
@@ -1,7 +1,7 @@
 #ifndef __MACH_ARM_HEAD_H
 #define __MACH_ARM_HEAD_H
 
-#ifdef CONFIG_SHELL_NONE
+#ifdef CONFIG_AT91_LOAD_BAREBOX_SRAM
 #define AT91_EXV6	".word _barebox_image_size\n"
 #else
 #define AT91_EXV6	".word _barebox_bare_init_size\n"
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/5] at91sam9261ek: add spi support
  2013-01-26 18:19 ` [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 2/5] at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-26 18:19   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 4/5] at91sam9261ek: add boostrap support Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 5/5] at91sam9261ek: add first stage support Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-26 18:19 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9261ek/init.c     |   42 ++++++++++++++++++++++++++++++
 arch/arm/configs/at91sam9261ek_defconfig |    3 ++-
 arch/arm/mach-at91/Kconfig               |    1 +
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 7c95435..ef13828 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -37,6 +37,7 @@
 #include <gpio_keys.h>
 #include <readkey.h>
 #include <led.h>
+#include <spi/spi.h>
 
 static struct atmel_nand_data nand_pdata = {
 	.ale		= 22,
@@ -229,6 +230,46 @@ static void ek_device_add_leds(void)
 static void ek_device_add_leds(void) {}
 #endif
 
+/*
+ * SPI related devices
+ */
+#if defined(CONFIG_DRIVER_SPI_ATMEL)
+/*
+ * SPI devices
+ */
+static struct spi_board_info ek_spi_devices[] = {
+	{	/* DataFlash chip */
+		.name		= "mtd_dataflash",
+		.chip_select	= 0,
+		.max_speed_hz	= 15 * 1000 * 1000,
+		.bus_num	= 0,
+	},
+#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
+	{	/* DataFlash card - jumper (J12) configurable to CS3 or CS0 */
+		.name		= "mtd_dataflash",
+		.chip_select	= 1,
+		.max_speed_hz	= 15 * 1000 * 1000,
+		.bus_num	= 0,
+	},
+#endif
+};
+
+static unsigned spi0_standard_cs[] = { AT91_PIN_PA3, AT91_PIN_PA6};
+static struct at91_spi_platform_data spi_pdata = {
+	.chipselect = spi0_standard_cs,
+	.num_chipselect = ARRAY_SIZE(spi0_standard_cs),
+};
+
+static void ek_add_device_spi(void)
+{
+	spi_register_board_info(ek_spi_devices,
+				ARRAY_SIZE(ek_spi_devices));
+	at91_add_device_spi(0, &spi_pdata);
+}
+#else
+static void ek_add_device_spi(void) {}
+#endif
+
 static int at91sam9261ek_mem_init(void)
 {
 	at91_add_device_sdram(0);
@@ -245,6 +286,7 @@ static int at91sam9261ek_devices_init(void)
 	ek_add_device_udc();
 	ek_add_device_buttons();
 	ek_device_add_leds();
+	ek_add_device_spi();
 
 	devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
 	devfs_add_partition("nand0", SZ_128K, SZ_256K, DEVFS_PARTITION_FIXED, "self_raw");
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 5daa47b..259e060 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -51,9 +51,10 @@ CONFIG_CMD_TFTP=y
 CONFIG_FS_TFTP=y
 CONFIG_NET_RESOLV=y
 CONFIG_DRIVER_NET_DM9K=y
-# CONFIG_SPI is not set
+CONFIG_DRIVER_SPI_ATMEL=y
 CONFIG_MTD=y
 # CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_MTD_DATAFLASH=y
 CONFIG_NAND=y
 # CONFIG_NAND_ECC_HW is not set
 # CONFIG_NAND_ECC_HW_SYNDROME is not set
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 661ff35..a964fd6 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -266,6 +266,7 @@ choice
 config MACH_AT91SAM9261EK
 	bool "Atmel AT91SAM9261-EK Evaluation Kit"
 	select HAS_DM9000
+	select HAVE_AT91_DATAFLASH_CARD
 	select HAVE_NAND_ATMEL_BUSWIDTH_16
 	help
 	  Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/5] at91sam9261ek: add boostrap support
  2013-01-26 18:19 ` [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 2/5] at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 3/5] at91sam9261ek: add spi support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-26 18:19   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19   ` [PATCH 5/5] at91sam9261ek: add first stage support Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-26 18:19 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9261ek/Makefile             |    4 +
 arch/arm/boards/at91sam9261ek/lowlevel_init.c      |  108 ++++++++++++++++++++
 arch/arm/configs/at91sam9261ek_bootstrap_defconfig |   25 +++++
 arch/arm/mach-at91/Kconfig                         |    1 +
 4 files changed, 138 insertions(+)
 create mode 100644 arch/arm/boards/at91sam9261ek/lowlevel_init.c
 create mode 100644 arch/arm/configs/at91sam9261ek_bootstrap_defconfig

diff --git a/arch/arm/boards/at91sam9261ek/Makefile b/arch/arm/boards/at91sam9261ek/Makefile
index eb072c0..b6460c3 100644
--- a/arch/arm/boards/at91sam9261ek/Makefile
+++ b/arch/arm/boards/at91sam9261ek/Makefile
@@ -1 +1,5 @@
 obj-y += init.o
+
+obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+
+pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
diff --git a/arch/arm/boards/at91sam9261ek/lowlevel_init.c b/arch/arm/boards/at91sam9261ek/lowlevel_init.c
new file mode 100644
index 0000000..0565841
--- /dev/null
+++ b/arch/arm/boards/at91sam9261ek/lowlevel_init.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2009-2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mach/hardware.h>
+#include <mach/at91_rstc.h>
+#include <mach/at91_wdt.h>
+#include <mach/at91_pmc.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/at91sam9_sdramc.h>
+#include <mach/at91sam9_matrix.h>
+#include <mach/at91_lowlevel_init.h>
+
+#define MASTER_CLOCK		200
+
+#if MASTER_CLOCK == 200
+#define MASTER_PLL_MUL		162
+#define MASTER_PLL_DIV		15
+#elif MASTER_CLOCK == 239
+#define MASTER_PLL_MUL		13
+#define MASTER_PLL_DIV		1
+#endif
+
+void __bare_init at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cfg *cfg)
+{
+	/* Disable Watchdog */
+	cfg->wdt_mr =
+		AT91_WDT_WDIDLEHLT | AT91_WDT_WDDBGHLT |
+		AT91_WDT_WDV |
+		AT91_WDT_WDDIS |
+		AT91_WDT_WDD;
+
+	/* define PDC[31:16] as DATA[31:16] */
+	cfg->ebi_pio_pdr = 0xFFFF0000;
+	/* no pull-up for D[31:16] */
+	cfg->ebi_pio_ppudr = 0xFFFF0000;
+	/* EBI0_CSA, CS1 SDRAM, CS3 NAND Flash, 3.3V memories */
+	cfg->ebi_csa =
+		AT91_MATRIX_DBPUC | AT91_MATRIX_CS1A_SDRAMC;
+
+	cfg->smc_cs = 3;
+	cfg->smc_mode =
+		AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+		AT91_SMC_DBW_8 |
+		AT91_SMC_EXNWMODE_DISABLE |
+		AT91_SMC_TDF_(2);
+	cfg->smc_cycle =
+		AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5);
+	cfg->smc_pulse =
+		AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3);
+	cfg->smc_setup =
+		AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0);
+
+	cfg->pmc_mor =
+		AT91_PMC_MOSCEN |
+		(255 << 8);		/* Main Oscillator Start-up Time */
+	cfg->pmc_pllar =
+		AT91_PMC_PLLA_WR_ERRATA | /* Bit 29 must be 1 when prog */
+		AT91_PMC_OUT |
+		((MASTER_PLL_MUL - 1) << 16) | (MASTER_PLL_DIV);
+	/* PCK/2 = MCK Master Clock from PLLA */
+	cfg->pmc_mckr1 =
+		AT91_PMC_CSS_SLOW |
+		AT91_PMC_PRES_1 |
+		AT91SAM9_PMC_MDIV_2 |
+		AT91_PMC_PDIV_1;
+	/* PCK/2 = MCK Master Clock from PLLA */
+	cfg->pmc_mckr2 =
+		AT91_PMC_CSS_PLLA |
+		AT91_PMC_PRES_1 |
+		AT91SAM9_PMC_MDIV_2 |
+		AT91_PMC_PDIV_1;
+
+	/* SDRAM */
+	/* SDRAMC_TR - Refresh Timer register */
+	cfg->sdrc_tr1 = 0x13C;
+	/* SDRAMC_CR - Configuration register*/
+	cfg->sdrc_cr =
+		AT91_SDRAMC_NC_9 |
+		AT91_SDRAMC_NR_13 |
+		AT91_SDRAMC_NB_4 |
+		AT91_SDRAMC_CAS_2 |
+		AT91_SDRAMC_DBW_32 |
+		(2 <<  8) |		/* Write Recovery Delay */
+		(7 << 12) |		/* Row Cycle Delay */
+		(2 << 16) |		/* Row Precharge Delay */
+		(2 << 20) |		/* Row to Column Delay */
+		(5 << 24) |		/* Active to Precharge Delay */
+		(8 << 28);		/* Exit Self Refresh to Active Delay */
+
+	/* Memory Device Register -> SDRAM */
+	cfg->sdrc_mdr = AT91_SDRAMC_MD_SDRAM;
+	/* SDRAM_TR */
+	cfg->sdrc_tr2 = (MASTER_CLOCK * 7);
+
+	/* user reset enable */
+	cfg->rstc_rmr =
+		AT91_RSTC_KEY |
+		AT91_RSTC_PROCRST |
+		AT91_RSTC_RSTTYP_WAKEUP |
+		AT91_RSTC_RSTTYP_WATCHDOG;
+}
diff --git a/arch/arm/configs/at91sam9261ek_bootstrap_defconfig b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
new file mode 100644
index 0000000..1511ecb
--- /dev/null
+++ b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
@@ -0,0 +1,25 @@
+CONFIG_ARCH_AT91SAM9261=y
+CONFIG_AT91_BOOTSTRAP=y
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x27000
+CONFIG_AEABI=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_PBL_IMAGE=y
+CONFIG_MMU=y
+CONFIG_MALLOC_DUMMY=y
+CONFIG_PROMPT="9261-EK:"
+CONFIG_SHELL_NONE=y
+# CONFIG_TIMESTAMP is not set
+CONFIG_CONSOLE_SIMPLE=y
+# CONFIG_DEFAULT_ENVIRONMENT is not set
+# CONFIG_SPI is not set
+CONFIG_MTD=y
+# CONFIG_MTD_WRITE is not set
+# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_NAND=y
+# CONFIG_NAND_ECC_HW is not set
+# CONFIG_NAND_ECC_HW_SYNDROME is not set
+# CONFIG_NAND_ECC_HW_NONE is not set
+CONFIG_NAND_ATMEL=y
+# CONFIG_FS_RAMFS is not set
+CONFIG_BOOTSTRAP_DEVFS=y
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index a964fd6..ba9a773 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -267,6 +267,7 @@ config MACH_AT91SAM9261EK
 	bool "Atmel AT91SAM9261-EK Evaluation Kit"
 	select HAS_DM9000
 	select HAVE_AT91_DATAFLASH_CARD
+	select MACH_HAS_LOWLEVEL_INIT
 	select HAVE_NAND_ATMEL_BUSWIDTH_16
 	help
 	  Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 5/5] at91sam9261ek: add first stage support
  2013-01-26 18:19 ` [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 preceding siblings ...)
  2013-01-26 18:19   ` [PATCH 4/5] at91sam9261ek: add boostrap support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-26 18:19   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 21:59     ` Sascha Hauer
  3 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-26 18:19 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9261ek/env/config           |   10 ++-
 arch/arm/boards/at91sam9261ek/init.c               |   15 ++++-
 .../configs/at91sam9261ek_first_stage_defconfig    |   71 ++++++++++++++++++++
 3 files changed, 92 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/configs/at91sam9261ek_first_stage_defconfig

diff --git a/arch/arm/boards/at91sam9261ek/env/config b/arch/arm/boards/at91sam9261ek/env/config
index 7d85577..cb3e847 100644
--- a/arch/arm/boards/at91sam9261ek/env/config
+++ b/arch/arm/boards/at91sam9261ek/env/config
@@ -34,8 +34,14 @@ kernelimage=zImage
 #kernelimage=Image.lzo
 
 nand_device=atmel_nand
-nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
-rootfs_mtdblock_nand=6
+if [ x$borebox_first_stage = x1 ]
+then
+	nand_parts="384k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
+	rootfs_mtdblock_nand=5
+else
+	nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
+	rootfs_mtdblock_nand=6
+fi
 
 autoboot_timeout=3
 
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index ef13828..0148cbd 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -280,6 +280,8 @@ mem_initcall(at91sam9261ek_mem_init);
 
 static int at91sam9261ek_devices_init(void)
 {
+	u32 barebox_part_start;
+	u32 barebox_part_size;
 
 	ek_add_device_nand();
 	ek_add_device_dm9000();
@@ -288,8 +290,17 @@ static int at91sam9261ek_devices_init(void)
 	ek_device_add_leds();
 	ek_add_device_spi();
 
-	devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
-	devfs_add_partition("nand0", SZ_128K, SZ_256K, DEVFS_PARTITION_FIXED, "self_raw");
+	if (IS_ENABLED(CONFIG_AT91_LOAD_BAREBOX_SRAM)) {
+		barebox_part_start = 0;
+		barebox_part_size = SZ_256K + SZ_128K;
+		export_env_ull("borebox_first_stage", 1);
+	} else {
+		devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
+		barebox_part_start = SZ_128K;
+		barebox_part_size = SZ_256K;
+	}
+	devfs_add_partition("nand0", barebox_part_start, barebox_part_size,
+			    DEVFS_PARTITION_FIXED, "self_raw");
 	dev_add_bb_dev("self_raw", "self0");
 	devfs_add_partition("nand0", SZ_256K + SZ_128K, SZ_128K, DEVFS_PARTITION_FIXED, "env_raw");
 	dev_add_bb_dev("env_raw", "env0");
diff --git a/arch/arm/configs/at91sam9261ek_first_stage_defconfig b/arch/arm/configs/at91sam9261ek_first_stage_defconfig
new file mode 100644
index 0000000..c4bc207
--- /dev/null
+++ b/arch/arm/configs/at91sam9261ek_first_stage_defconfig
@@ -0,0 +1,71 @@
+CONFIG_ARCH_AT91SAM9261=y
+CONFIG_CMD_AT91_BOOT_TEST=y
+CONFIG_AT91_LOAD_BAREBOX_SRAM=y
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x27000
+CONFIG_AEABI=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_PBL_IMAGE=y
+CONFIG_MMU=y
+CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
+CONFIG_PROMPT="9261-EK:"
+CONFIG_LONGHELP=y
+CONFIG_GLOB=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+CONFIG_CONSOLE_ACTIVATE_ALL=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/at91sam9261ek/env"
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_PASSWD=y
+CONFIG_CMD_TFTP=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_LOADB=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_BOOTM_SHOW_TYPE=y
+CONFIG_CMD_BOOTM_INITRD=y
+CONFIG_CMD_UIMAGE=y
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_RESET=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_MTEST=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LED_TRIGGER=y
+CONFIG_NET=y
+CONFIG_NET_DHCP=y
+CONFIG_NET_NFS=y
+CONFIG_NET_PING=y
+CONFIG_NET_RESOLV=y
+CONFIG_DRIVER_NET_DM9K=y
+CONFIG_DRIVER_SPI_ATMEL=y
+CONFIG_MTD=y
+# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_MTD_DATAFLASH=y
+CONFIG_NAND=y
+# CONFIG_NAND_ECC_HW is not set
+# CONFIG_NAND_ECC_HW_SYNDROME is not set
+# CONFIG_NAND_ECC_HW_NONE is not set
+CONFIG_NAND_ATMEL=y
+CONFIG_UBI=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DFU=y
+CONFIG_USB_GADGET_SERIAL=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_TRIGGERS=y
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_FS_TFTP=y
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 5/5] at91sam9261ek: add first stage support
  2013-01-26 18:19   ` [PATCH 5/5] at91sam9261ek: add first stage support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-26 21:59     ` Sascha Hauer
  2013-01-26 23:14       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2013-01-26 21:59 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Jan 26, 2013 at 07:19:59PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/boards/at91sam9261ek/env/config           |   10 ++-
>  arch/arm/boards/at91sam9261ek/init.c               |   15 ++++-
>  .../configs/at91sam9261ek_first_stage_defconfig    |   71 ++++++++++++++++++++
>  3 files changed, 92 insertions(+), 4 deletions(-)
>  create mode 100644 arch/arm/configs/at91sam9261ek_first_stage_defconfig
> 
> diff --git a/arch/arm/boards/at91sam9261ek/env/config b/arch/arm/boards/at91sam9261ek/env/config
> index 7d85577..cb3e847 100644
> --- a/arch/arm/boards/at91sam9261ek/env/config
> +++ b/arch/arm/boards/at91sam9261ek/env/config
> @@ -34,8 +34,14 @@ kernelimage=zImage
>  #kernelimage=Image.lzo
>  
>  nand_device=atmel_nand
> -nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> -rootfs_mtdblock_nand=6
> +if [ x$borebox_first_stage = x1 ]

LOL ;) Found a new name for the project?

> +then
> +	nand_parts="384k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> +	rootfs_mtdblock_nand=5
> +else
> +	nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> +	rootfs_mtdblock_nand=6
> +fi

I find this rather confusing. Now we have a bootstrap config, a first
stage config and a regular config, two different partition layouts and
no indication how these play together.

I think it's dangerous to have two different partition layouts. What's
the reason to concatenate the at91bootstrap and barebox partition
together for the first stage case?

What I would understand is:

- have a 128k first stage barebox which either
  - loads the kernel directly
  - or loads the second stage (bigger) barebox

  The decision could be made by the environment or maybe a button/key

However, this makes for two defconfigs, not three.

BTW your at91 bootstrap code has:

	bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);

Which means that you will use up to 1MB of Nand if you have bad blocks.
This conflicts with your partition layout above.

I suggest that you combine the first stage and bootstrap config into one
by adding some switch in the environment to optionally start the second
stage loader or directly boot through to the kernel.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 5/5] at91sam9261ek: add first stage support
  2013-01-26 21:59     ` Sascha Hauer
@ 2013-01-26 23:14       ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-31 13:22         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-26 23:14 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 22:59 Sat 26 Jan     , Sascha Hauer wrote:
> On Sat, Jan 26, 2013 at 07:19:59PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  arch/arm/boards/at91sam9261ek/env/config           |   10 ++-
> >  arch/arm/boards/at91sam9261ek/init.c               |   15 ++++-
> >  .../configs/at91sam9261ek_first_stage_defconfig    |   71 ++++++++++++++++++++
> >  3 files changed, 92 insertions(+), 4 deletions(-)
> >  create mode 100644 arch/arm/configs/at91sam9261ek_first_stage_defconfig
> > 
> > diff --git a/arch/arm/boards/at91sam9261ek/env/config b/arch/arm/boards/at91sam9261ek/env/config
> > index 7d85577..cb3e847 100644
> > --- a/arch/arm/boards/at91sam9261ek/env/config
> > +++ b/arch/arm/boards/at91sam9261ek/env/config
> > @@ -34,8 +34,14 @@ kernelimage=zImage
> >  #kernelimage=Image.lzo
> >  
> >  nand_device=atmel_nand
> > -nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> > -rootfs_mtdblock_nand=6
> > +if [ x$borebox_first_stage = x1 ]
> 
> LOL ;) Found a new name for the project?
typo
> 
> > +then
> > +	nand_parts="384k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> > +	rootfs_mtdblock_nand=5
> > +else
> > +	nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> > +	rootfs_mtdblock_nand=6
> > +fi
> 
> I find this rather confusing. Now we have a bootstrap config, a first
> stage config and a regular config, two different partition layouts and
> no indication how these play together.
> 
> I think it's dangerous to have two different partition layouts. What's
> the reason to concatenate the at91bootstrap and barebox partition
> together for the first stage case?
yes because the 9261 can only load 156K into sram

so it's more than the first block
> 
> What I would understand is:
> 
> - have a 128k first stage barebox which either
>   - loads the kernel directly
>   - or loads the second stage (bigger) barebox
> 
>   The decision could be made by the environment or maybe a button/key
> 
> However, this makes for two defconfigs, not three.
> 
> BTW your at91 bootstrap code has:
> 
> 	bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
> 
> Which means that you will use up to 1MB of Nand if you have bad blocks.
> This conflicts with your partition layout above.
> 
> I suggest that you combine the first stage and bootstrap config into one
> by adding some switch in the environment to optionally start the second
> stage loader or directly boot through to the kernel.

if you do this the first stage will be limited artificially at 128KiB where we
can go to 156KiB

and later
when we can have the support of the mini nand laod we will use the 384KiB for
barebox first stage

so I prefer to have 2 layout onthe ref board
as it's here for dev not production

Best Regards,
J.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 5/5] at91sam9261ek: add first stage support
  2013-01-26 23:14       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-31 13:22         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-31 13:22 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 00:14 Sun 27 Jan     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 22:59 Sat 26 Jan     , Sascha Hauer wrote:
> > On Sat, Jan 26, 2013 at 07:19:59PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > >  arch/arm/boards/at91sam9261ek/env/config           |   10 ++-
> > >  arch/arm/boards/at91sam9261ek/init.c               |   15 ++++-
> > >  .../configs/at91sam9261ek_first_stage_defconfig    |   71 ++++++++++++++++++++
> > >  3 files changed, 92 insertions(+), 4 deletions(-)
> > >  create mode 100644 arch/arm/configs/at91sam9261ek_first_stage_defconfig
> > > 
> > > diff --git a/arch/arm/boards/at91sam9261ek/env/config b/arch/arm/boards/at91sam9261ek/env/config
> > > index 7d85577..cb3e847 100644
> > > --- a/arch/arm/boards/at91sam9261ek/env/config
> > > +++ b/arch/arm/boards/at91sam9261ek/env/config
> > > @@ -34,8 +34,14 @@ kernelimage=zImage
> > >  #kernelimage=Image.lzo
> > >  
> > >  nand_device=atmel_nand
> > > -nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> > > -rootfs_mtdblock_nand=6
> > > +if [ x$borebox_first_stage = x1 ]
> > 
> > LOL ;) Found a new name for the project?
> typo
> > 
> > > +then
> > > +	nand_parts="384k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> > > +	rootfs_mtdblock_nand=5
> > > +else
> > > +	nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
> > > +	rootfs_mtdblock_nand=6
> > > +fi
> > 
> > I find this rather confusing. Now we have a bootstrap config, a first
> > stage config and a regular config, two different partition layouts and
> > no indication how these play together.
> > 
> > I think it's dangerous to have two different partition layouts. What's
> > the reason to concatenate the at91bootstrap and barebox partition
> > together for the first stage case?
> yes because the 9261 can only load 156K into sram
> 
> so it's more than the first block
> > 
> > What I would understand is:
> > 
> > - have a 128k first stage barebox which either
> >   - loads the kernel directly
> >   - or loads the second stage (bigger) barebox
> > 
> >   The decision could be made by the environment or maybe a button/key
> > 
> > However, this makes for two defconfigs, not three.
> > 
> > BTW your at91 bootstrap code has:
> > 
> > 	bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
> > 
> > Which means that you will use up to 1MB of Nand if you have bad blocks.
> > This conflicts with your partition layout above.
> > 
> > I suggest that you combine the first stage and bootstrap config into one
> > by adding some switch in the environment to optionally start the second
> > stage loader or directly boot through to the kernel.
> 
> if you do this the first stage will be limited artificially at 128KiB where we
> can go to 156KiB
> 
> and later
> when we can have the support of the mini nand laod we will use the 384KiB for
> barebox first stage
> 
> so I prefer to have 2 layout onthe ref board
> as it's here for dev not production

is it ok with you?

Best Regards,
J.
> 
> Best Regards,
> J.
> > 
> > Sascha
> > 
> > -- 
> > Pengutronix e.K.                           |                             |
> > Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> > Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 0/5] at91sam9261: add bootstrap and firstage support
  2013-01-26 18:18 [PATCH 0/5] at91sam9261: add bootstrap and firstage support Jean-Christophe PLAGNIOL-VILLARD
  2013-01-26 18:19 ` [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-31 13:23 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-31 13:23 UTC (permalink / raw)
  To: barebox

Hi,

	can we have patch 1 to 4 applied to next?

Best Regards,
J.
On 19:18 Sat 26 Jan     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> HI,
> 
> 	the following patch serie add support to the sam9261 of
> 	 - bootstrap
> 	 - first stage
> 	 - spi
> 
> The following changes since commit 62c096b6e4d5fe22de09659697bf921d5dbca28b:
> 
>   at91sam9261: fix max bare_init it's 156KiB (2013-01-22 20:18:57 +0800)
> 
> are available in the git repository at:
> 
>   git://git.jcrosoft.org/barebox.git delivery/at91sam9261ek_bootstrap
> 
> for you to fetch changes up to f6c904910c2731437f09cb69b394e3927b1303ff:
> 
>   at91sam9261ek: add first stage support (2013-01-22 20:54:04 +0800)
> 
> ----------------------------------------------------------------
> Jean-Christophe PLAGNIOL-VILLARD (5):
>       at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic
>       at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot
>       at91sam9261ek: add spi support
>       at91sam9261ek: add boostrap support
>       at91sam9261ek: add first stage support
> 
>  arch/arm/boards/at91sam9261ek/Makefile               |    4 +++
>  arch/arm/boards/at91sam9261ek/env/config             |   10 +++++--
>  arch/arm/boards/at91sam9261ek/init.c                 |   59 +++++++++++++++++++++++++++++++++++--
>  arch/arm/boards/at91sam9261ek/lowlevel_init.c        |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  arch/arm/configs/at91sam9261ek_bootstrap_defconfig   |   25 ++++++++++++++++
>  arch/arm/configs/at91sam9261ek_defconfig             |    3 +-
>  arch/arm/configs/at91sam9261ek_first_stage_defconfig |   71 ++++++++++++++++++++++++++++++++++++++++++++
>  arch/arm/mach-at91/Kconfig                           |   19 ++++++++++++
>  arch/arm/mach-at91/Makefile                          |    5 +++-
>  arch/arm/mach-at91/at91sam9260_lowlevel_init.c       |   34 +++++++++++++++++++++
>  arch/arm/mach-at91/at91sam9261_lowlevel_init.c       |   34 +++++++++++++++++++++
>  arch/arm/mach-at91/at91sam9263_lowlevel_init.c       |   34 +++++++++++++++++++++
>  arch/arm/mach-at91/at91sam926x_lowlevel_init.c       |   36 +++++------------------
>  arch/arm/mach-at91/include/mach/at91_lowlevel_init.h |    1 +
>  arch/arm/mach-at91/include/mach/barebox-arm-head.h   |    2 +-
>  15 files changed, 408 insertions(+), 37 deletions(-)
>  create mode 100644 arch/arm/boards/at91sam9261ek/lowlevel_init.c
>  create mode 100644 arch/arm/configs/at91sam9261ek_bootstrap_defconfig
>  create mode 100644 arch/arm/configs/at91sam9261ek_first_stage_defconfig
>  create mode 100644 arch/arm/mach-at91/at91sam9260_lowlevel_init.c
>  create mode 100644 arch/arm/mach-at91/at91sam9261_lowlevel_init.c
>  create mode 100644 arch/arm/mach-at91/at91sam9263_lowlevel_init.c
> 
> Best Regards,
> J.
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2013-01-31 13:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-26 18:18 [PATCH 0/5] at91sam9261: add bootstrap and firstage support Jean-Christophe PLAGNIOL-VILLARD
2013-01-26 18:19 ` [PATCH 1/5] at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic Jean-Christophe PLAGNIOL-VILLARD
2013-01-26 18:19   ` [PATCH 2/5] at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot Jean-Christophe PLAGNIOL-VILLARD
2013-01-26 18:19   ` [PATCH 3/5] at91sam9261ek: add spi support Jean-Christophe PLAGNIOL-VILLARD
2013-01-26 18:19   ` [PATCH 4/5] at91sam9261ek: add boostrap support Jean-Christophe PLAGNIOL-VILLARD
2013-01-26 18:19   ` [PATCH 5/5] at91sam9261ek: add first stage support Jean-Christophe PLAGNIOL-VILLARD
2013-01-26 21:59     ` Sascha Hauer
2013-01-26 23:14       ` Jean-Christophe PLAGNIOL-VILLARD
2013-01-31 13:22         ` Jean-Christophe PLAGNIOL-VILLARD
2013-01-31 13:23 ` [PATCH 0/5] at91sam9261: add bootstrap and firstage support Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox