Skip to contentSkip to conversation

at91sam9261: add bootstrap and firstage support

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 2 participants 10 messages Jan 26, 2013 – Jan 31, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover at91sam9261: add bootstrap and firstage support

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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH 1/5 at91sam9260/9g20/9261/9g10/9263: split soc lowlevel_init from generic

---
 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
arch/arm/mach-at91/Kconfig +6 -0
index a3b2aba..0216a7e 100644
@@ -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
arch/arm/mach-at91/Makefile +4 -1
index 634b160..0eabeac 100644
@@ -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)
 
arch/arm/mach-at91/at91sam9260_lowlevel_init.c new file +34 -0
new file mode 100644
index 0000000..c2cf8bf
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
+ *
+ * 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);
+}
arch/arm/mach-at91/at91sam9261_lowlevel_init.c new file +34 -0
new file mode 100644
index 0000000..a2e065f
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
+ *
+ * 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);
+}
arch/arm/mach-at91/at91sam9263_lowlevel_init.c new file +34 -0
new file mode 100644
index 0000000..5260658
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
+ *
+ * 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);
+}
arch/arm/mach-at91/at91sam926x_lowlevel_init.c +7 -29
index 14afbc9..8b9b33e 100644
@@ -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();
-}
arch/arm/mach-at91/include/mach/at91_lowlevel_init.h +1 -0
index 29d9628..8c53ce7 100644
@@ -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__ */
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/5 at91: introduce AT91_LOAD_BAREBOX_SRAM to specifcy which size load for external boot

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

---
 arch/arm/mach-at91/Kconfig                         |   11 +++++++++++
 arch/arm/mach-at91/include/mach/barebox-arm-head.h |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
arch/arm/mach-at91/Kconfig +11 -0
index 0216a7e..661ff35 100644
@@ -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
arch/arm/mach-at91/include/mach/barebox-arm-head.h +1 -1
index a9c8dd4..7d6a009 100644
@@ -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"
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/5 at91sam9261ek: add spi support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 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(-)
arch/arm/boards/at91sam9261ek/init.c +42 -0
index 7c95435..ef13828 100644
@@ -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");
arch/arm/configs/at91sam9261ek_defconfig +2 -1
index 5daa47b..259e060 100644
@@ -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
arch/arm/mach-at91/Kconfig +1 -0
index 661ff35..a964fd6 100644
@@ -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.
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/5 at91sam9261ek: add boostrap support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 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
arch/arm/boards/at91sam9261ek/Makefile +4 -0
index eb072c0..b6460c3 100644
@@ -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
arch/arm/boards/at91sam9261ek/lowlevel_init.c new file +108 -0

108 lines not on this page · raw message

arch/arm/configs/at91sam9261ek_bootstrap_defconfig new file +25 -0
new file mode 100644
index 0000000..1511ecb
@@ -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
arch/arm/mach-at91/Kconfig +1 -0
index a964fd6..ba9a773 100644
@@ -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.
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 5/5 at91sam9261ek: add first stage support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 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
arch/arm/boards/at91sam9261ek/env/config +8 -2
index 7d85577..cb3e847 100644
@@ -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
 
arch/arm/boards/at91sam9261ek/init.c +13 -2
index ef13828..0148cbd 100644
@@ -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");
arch/arm/configs/at91sam9261ek_first_stage_defconfig new file +71 -0

71 lines not on this page · raw message

Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

Re: [PATCH 5/5] at91sam9261ek: add first stage support

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 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
arch/arm/boards/at91sam9261ek/env/config +0 -0
index 7d85577..cb3e847 100644

arch/arm/boards/at91sam9261ek/env/config kernelimage=zImage · line 37

Quoted 6 lines
arch/arm/boards/at91sam9261ek/env/config +1 -2
@@ -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?

arch/arm/boards/at91sam9261ek/env/config kernelimage=zImage · line 44

Quoted 7 lines
arch/arm/boards/at91sam9261ek/env/config +7 -0
+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

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

Re: [PATCH 5/5] at91sam9261ek: add first stage support

Quoted 16 lines · Sascha Hauer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 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
arch/arm/boards/at91sam9261ek/env/config +0 -0
index 7d85577..cb3e847 100644
@@ -34,8 +34,14 @@ kernelimage=zImage
 #kernelimage=Image.lzo
 
Quoted 6 lines

arch/arm/boards/at91sam9261ek/env/config kernelimage=zImage · line 37

Quoted 4 lines
arch/arm/boards/at91sam9261ek/env/config +1 -2
 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

Quoted 13 lines

arch/arm/boards/at91sam9261ek/env/config kernelimage=zImage · line 44

Quoted 8 lines
arch/arm/boards/at91sam9261ek/env/config +7 -0
+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.

Quoted 3 lines

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

Quoted 13 lines

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:

Quoted 8 lines
	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.

Quoted 8 lines

Sascha

Signature · 4 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#8 lore raw

Re: [PATCH 5/5] at91sam9261ek: add first stage support

Quoted 68 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Sascha Hauer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 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
arch/arm/boards/at91sam9261ek/env/config +0 -0
index 7d85577..cb3e847 100644
@@ -34,8 +34,14 @@ kernelimage=zImage
 #kernelimage=Image.lzo
 
Quoted 6 lines

arch/arm/boards/at91sam9261ek/env/config kernelimage=zImage · line 37

Quoted 4 lines
arch/arm/boards/at91sam9261ek/env/config +1 -2
 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

Quoted 13 lines

arch/arm/boards/at91sam9261ek/env/config kernelimage=zImage · line 44

Quoted 8 lines
arch/arm/boards/at91sam9261ek/env/config +7 -0
+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.

Quoted 3 lines

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

Quoted 13 lines

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:

Quoted 8 lines
	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

Quoted 6 lines

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.

Quoted 12 lines

Best Regards,
J.

Quoted 8 lines

Sascha

Signature · 4 lines
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 |
Quoted 4 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#9 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD

Hi,

can we have patch 1 to 4 applied to next?

Best Regards,
J.

Quoted 50 lines · Jean-Christophe PLAGNIOL-VILLARD

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
Quoted 7 lines

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox