at91: add boot mode detection support
cover at91: add boot mode detection support
Hi,
The following changes since commit e43e1498f65fe03cfc6b2744247eeccf27b26876:
MIPS: pbl: fix none compression support (2013-02-05 09:43:17 +0100)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/sama5d3_bootmode
for you to fetch changes up to ce538beef9fabea8c461a206bf0335eb582a9eee:
sama5d3: detect boot mode (2013-02-05 11:29:18 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
at91: add boot mode detection support
sama5d3: add boot mode supprot
sama5d3: detect boot mode
arch/arm/boards/sama5d3xek/init.c | 24 ++++++++++++++++-------- arch/arm/mach-at91/Kconfig | 9 +++++++++ arch/arm/mach-at91/Makefile | 2 ++ arch/arm/mach-at91/bootmode.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/include/mach/bootmode.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/include/mach/sama5d3.h | 1 + arch/arm/mach-at91/include/mach/sama5d3_bootmode.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/sama5d3.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/setup.c | 3 +++ 9 files changed, 284 insertions(+), 8 deletions(-) create mode 100644 arch/arm/mach-at91/bootmode.c create mode 100644 arch/arm/mach-at91/include/mach/bootmode.h create mode 100644 arch/arm/mach-at91/include/mach/sama5d3_bootmode.h
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/3 at91: add boot mode detection support
--- arch/arm/mach-at91/Kconfig | 8 ++++ arch/arm/mach-at91/Makefile | 2 + arch/arm/mach-at91/bootmode.c | 57 ++++++++++++++++++++++ arch/arm/mach-at91/include/mach/bootmode.h | 70 ++++++++++++++++++++++++++++ arch/arm/mach-at91/setup.c | 3 ++ 5 files changed, 140 insertions(+) create mode 100644 arch/arm/mach-at91/bootmode.c create mode 100644 arch/arm/mach-at91/include/mach/bootmode.h
arch/arm/mach-at91/Kconfig +8 -0
@@ -9,6 +9,9 @@ config HAVE_AT91_DBGU1 config HAVE_AT91_LOWLEVEL_INIT bool +config HAVE_AT91_BOOTMODE + bool + config AT91SAM9_SMC bool
@@ -573,4 +576,9 @@ config AT91_LOAD_BAREBOX_SRAM depends on SHELL_NONE || HAVE_AT91_LOAD_BAREBOX_SRAM default y if SHELL_NONE +config AT91_BOOTMODE + bool "at91 bootmode detect and export" + depends on HAVE_AT91_BOOTMODE + default y + endif
arch/arm/mach-at91/Makefile +2 -0
@@ -22,6 +22,8 @@ obj-$(CONFIG_AT91SAM9G45_RESET) += at91sam9g45_reset.o obj-$(CONFIG_AT91SAM9_SMC) += sam9_smc.o obj-$(CONFIG_AT91SAM9_TIMER) += at91sam926x_time.o +obj-$(CONFIG_AT91_BOOTMODE) += bootmode.o + # CPU-specific support obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam9260_devices.o
arch/arm/mach-at91/bootmode.c new file +57 -0
57 lines not on this page · raw message
arch/arm/mach-at91/include/mach/bootmode.h new file +70 -0
70 lines not on this page · raw message
arch/arm/mach-at91/setup.c +3 -0
@@ -12,6 +12,7 @@#include <mach/hardware.h> #include <mach/cpu.h> #include <mach/at91_dbgu.h> +#include <mach/bootmode.h> #include "soc.h"
@@ -248,6 +249,8 @@ static int at91_soc_device(void)dev_add_param_fixed (dev,"name" , (char *)at91_get_soc_type (&at91_soc_initdata));dev_add_param_fixed (dev,"subname" , (char *)at91_get_soc_subtype (&at91_soc_initdata)); +at91_bootmode_device_register (); +return 0 ; }coredevice_initcall (at91_soc_device);
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 sama5d3: add boot mode supprot
on sama5d3 the bootmode is pass by the rom code via the register r4 so in the at91bootstrap we save the content of r4 in the 2nd gpbr and repass it via r4 to barebox
you need to last at91bootstrap
--- arch/arm/mach-at91/Kconfig | 1 + arch/arm/mach-at91/include/mach/sama5d3.h | 1 + arch/arm/mach-at91/include/mach/sama5d3_bootmode.h | 45 +++++++++++ arch/arm/mach-at91/sama5d3.c | 81 ++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 arch/arm/mach-at91/include/mach/sama5d3_bootmode.h
arch/arm/mach-at91/Kconfig +1 -0
@@ -197,6 +197,7 @@ config ARCH_SAMA5D3 select HAVE_AT91_DBGU1 select HAS_MACB select AT91SAM9G45_RESET + select HAVE_AT91_BOOTMODE endchoice
arch/arm/mach-at91/include/mach/sama5d3.h +1 -0
@@ -102,6 +102,7 @@#define SAMA5D3_BASE_HSMC 0xffffc000#define SAMA5D3_BASE_PIT 0xfffffe30#define SAMA5D3_BASE_WDT 0xfffffe40 +#define SAMA5D3_BASE_GPBR 0xfffffe60#define SAMA5D3_BASE_PMECC 0xffffc070#define SAMA5D3_BASE_PMERRLOC 0xffffc500
arch/arm/mach-at91/include/mach/sama5d3_bootmode.h new file +45 -0
45 lines not on this page · raw message
arch/arm/mach-at91/sama5d3.c +81 -0
99 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
PATCH 3/3 sama5d3: detect boot mode
In reply to Jean-Christophe PLAGNIOL-VILLARDand dynamised where we are stored
--- arch/arm/boards/sama5d3xek/init.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
arch/arm/boards/sama5d3xek/init.c +16 -8
@@ -36,6 +36,7 @@#include <mach/at91_pmc.h> #include <mach/at91_rstc.h> #include <mach/at91sam9x5_matrix.h> +#include <mach/bootmode.h> #include <input/qt1070.h> #include <readkey.h> #include <poller.h>
@@ -381,14 +382,21 @@ static int at91sama5d3xek_devices_init(void)armlinux_set_bootparams ((void *)(SAMA5_DDRCS +0x100 )); -devfs_add_partition ("nand0" ,0x00000 ,SZ_256K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); -dev_add_bb_dev ("at91bootstrap_raw" ,"at91bootstrap" ); -devfs_add_partition ("nand0" ,SZ_256K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); -dev_add_bb_dev ("self_raw" ,"self0" ); -devfs_add_partition ("nand0" ,SZ_512K +SZ_256K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); -dev_add_bb_dev ("env_raw" ,"env0" ); -devfs_add_partition ("nand0" ,SZ_1M ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); -dev_add_bb_dev ("env_raw1" ,"env1" ); +if (at91_boot_media_at25 () &&IS_ENABLED (CONFIG_DRIVER_SPI_ATMEL )) { +devfs_add_partition ("m25p0" ,0x00000 ,SZ_64K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K +SZ_256K +SZ_128K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K +SZ_512K +SZ_128K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); + }else { +devfs_add_partition ("nand0" ,0x00000 ,SZ_256K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); +dev_add_bb_dev ("at91bootstrap_raw" ,"at91bootstrap" ); +devfs_add_partition ("nand0" ,SZ_256K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); +dev_add_bb_dev ("self_raw" ,"self0" ); +devfs_add_partition ("nand0" ,SZ_512K +SZ_256K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); +dev_add_bb_dev ("env_raw" ,"env0" ); +devfs_add_partition ("nand0" ,SZ_1M ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); +dev_add_bb_dev ("env_raw1" ,"env1" ); + }return 0 ; }
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] sama5d3: detect boot mode
Hi,
Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD
and dynamised where we are stored
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/boards/sama5d3xek/init.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)arch/arm/boards/sama5d3xek/init.c +1
-0@@ -36,6 +36,7 @@#include <mach/at91_pmc.h> #include <mach/at91_rstc.h> #include <mach/at91sam9x5_matrix.h> +#include <mach/bootmode.h> #include <input/qt1070.h> #include <readkey.h> #include <poller.h> @@ -381,14 +382,21 @@ static int at91sama5d3xek_devices_init(void)armlinux_set_bootparams ((void *)(SAMA5_DDRCS +0x100 ));
arch/arm/boards/sama5d3xek/init.c static int at91sama5d3xek_devices_init(void) · line 385
Quoted 10 lines
arch/arm/boards/sama5d3xek/init.c +1
-8-devfs_add_partition ("nand0" ,0x00000 ,SZ_256K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); -dev_add_bb_dev ("at91bootstrap_raw" ,"at91bootstrap" ); -devfs_add_partition ("nand0" ,SZ_256K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); -dev_add_bb_dev ("self_raw" ,"self0" ); -devfs_add_partition ("nand0" ,SZ_512K +SZ_256K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); -dev_add_bb_dev ("env_raw" ,"env0" ); -devfs_add_partition ("nand0" ,SZ_1M ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); -dev_add_bb_dev ("env_raw1" ,"env1" ); +if (at91_boot_media_at25 () &&IS_ENABLED (CONFIG_DRIVER_SPI_ATMEL )) {
I don't know, but is it better to use (at91_boot_media_at25() && at91_boot_from_spi()) instead of checking if SPI driver is enabled at compile time?
Regards
Alex
Quoted 25 lines
arch/arm/boards/sama5d3xek/init.c +14
-0+devfs_add_partition ("m25p0" ,0x00000 ,SZ_64K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K +SZ_256K +SZ_128K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K +SZ_512K +SZ_128K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); + }else { +devfs_add_partition ("nand0" ,0x00000 ,SZ_256K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); +dev_add_bb_dev ("at91bootstrap_raw" ,"at91bootstrap" ); +devfs_add_partition ("nand0" ,SZ_256K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); +dev_add_bb_dev ("self_raw" ,"self0" ); +devfs_add_partition ("nand0" ,SZ_512K +SZ_256K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); +dev_add_bb_dev ("env_raw" ,"env0" ); +devfs_add_partition ("nand0" ,SZ_1M ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); +dev_add_bb_dev ("env_raw1" ,"env1" ); + }return 0 ; }Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] sama5d3: detect boot mode
Quoted 26 lines · Alexander Aring
Hi,
Quoted 23 lines · Jean-Christophe PLAGNIOL-VILLARD
and dynamised where we are stored
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/boards/sama5d3xek/init.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)arch/arm/boards/sama5d3xek/init.c +1
-0@@ -36,6 +36,7 @@#include <mach/at91_pmc.h> #include <mach/at91_rstc.h> #include <mach/at91sam9x5_matrix.h> +#include <mach/bootmode.h> #include <input/qt1070.h> #include <readkey.h> #include <poller.h> @@ -381,14 +382,21 @@ static int at91sama5d3xek_devices_init(void)armlinux_set_bootparams ((void *)(SAMA5_DDRCS +0x100 ));
Quoted 12 lines
arch/arm/boards/sama5d3xek/init.c static int at91sama5d3xek_devices_init(void) · line 385
Quoted 9 lines
arch/arm/boards/sama5d3xek/init.c +1
-8-devfs_add_partition ("nand0" ,0x00000 ,SZ_256K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); -dev_add_bb_dev ("at91bootstrap_raw" ,"at91bootstrap" ); -devfs_add_partition ("nand0" ,SZ_256K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); -dev_add_bb_dev ("self_raw" ,"self0" ); -devfs_add_partition ("nand0" ,SZ_512K +SZ_256K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); -dev_add_bb_dev ("env_raw" ,"env0" ); -devfs_add_partition ("nand0" ,SZ_1M ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); -dev_add_bb_dev ("env_raw1" ,"env1" ); +if (at91_boot_media_at25 () &&IS_ENABLED (CONFIG_DRIVER_SPI_ATMEL )) {I don't know, but is it better to use (
at91_boot_media_at25()&&at91_boot_from_spi()) instead of checking if SPI driver is enabled at compile time?
simple I want one binary whtat work when we boot from mmc/spi/nand
so all the drivers are enabled
Best Regards,
J.
Quoted 25 lines
Regards
AlexQuoted 21 lines
arch/arm/boards/sama5d3xek/init.c +14
-0+devfs_add_partition ("m25p0" ,0x00000 ,SZ_64K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K +SZ_256K +SZ_128K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); +devfs_add_partition ("m25p0" ,SZ_64K +SZ_512K +SZ_128K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); + }else { +devfs_add_partition ("nand0" ,0x00000 ,SZ_256K ,DEVFS_PARTITION_FIXED ,"at91bootstrap_raw" ); +dev_add_bb_dev ("at91bootstrap_raw" ,"at91bootstrap" ); +devfs_add_partition ("nand0" ,SZ_256K ,SZ_256K +SZ_128K ,DEVFS_PARTITION_FIXED ,"self_raw" ); +dev_add_bb_dev ("self_raw" ,"self0" ); +devfs_add_partition ("nand0" ,SZ_512K +SZ_256K ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw" ); +dev_add_bb_dev ("env_raw" ,"env0" ); +devfs_add_partition ("nand0" ,SZ_1M ,SZ_256K ,DEVFS_PARTITION_FIXED ,"env_raw1" ); +dev_add_bb_dev ("env_raw1" ,"env1" ); + }return 0 ; }Signature · 1 line
1.7.10.4
Quoted 4 lines
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
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/mach-at91/Kconfig | 8 ++++ arch/arm/mach-at91/Makefile | 2 + arch/arm/mach-at91/bootmode.c | 57 ++++++++++++++++++++++
what about making this a common bootmode helper, which can be used on other platforms too?
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
+1 for getting something common. On i.MX we currently use the barebox_loc environment variable. Not that I you should do the same for Atmel, but we should come up with something both i.MX and Atmel can be converted to.
Review
Quoted 2 lines
(quoted diff) +2
-0+ + dev = add_generic_device_res("bootloc", DEVICE_ID_SINGLE, NULL, 0, NULL);
I know you are concerned about performance when the single 'global' device has many variables. I think the performance can be greatly improved by making sure the global device is the first one to be registered.
IMO adding a new device for every fart in the system does not improve the situation.
Quoted 8 lines
arch/arm/mach-at91/include/mach/bootmode.h new file +8
-0+enum at91_soc_boot_from { +AT91_BOOT_FROM_UNKNOWN , +AT91_BOOT_FROM_SPI , +AT91_BOOT_FROM_MCI , +AT91_BOOT_FROM_SMC , +AT91_BOOT_FROM_TWD , +}; +
arch/arm/mach-at91/include/mach/bootmode.h line 36
Quoted 10 lines
arch/arm/mach-at91/include/mach/bootmode.h new file +10
-0+enum at91_soc_boot_media { +AT91_BOOT_MEDIA_UNKNOWN , +AT91_BOOT_MEDIA_SD , +AT91_BOOT_MEDIA_MMC , +AT91_BOOT_MEDIA_EMMC , +AT91_BOOT_MEDIA_AT45 , +AT91_BOOT_MEDIA_AT25 , +AT91_BOOT_MEDIA_NAND , +AT91_BOOT_MEDIA_NOR , +};
Hm. For NAND/NOR the first array does not contain useful information, for MCI the second array does not contain useful information. For I2C/SPI both arrays seem redundant.
Why not merge them into one?
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
Quoted 13 lines · Sascha Hauer
+1 for getting something common. On i.MX we currently use the
barebox_locenvironment variable. Not that I you should do the same for Atmel, but we should come up with something both i.MX and Atmel can be converted to.Review
Quoted 2 lines
(quoted diff) +2
-0+ + dev = add_generic_device_res("bootloc", DEVICE_ID_SINGLE, NULL, 0, NULL);I know you are concerned about performance when the single 'global' device has many variables. I think the performance can be greatly improved by making sure the global device is the first one to be registered.
Quoted 2 lines
IMO adding a new device for every fart in the system does not improve the situation.
because this is RO data and I do not like global for specific stuff
global need to be for shell var create
and via specific dev with devinfo you can see to params quick and clear
Quoted 24 lines
Quoted 9 lines
arch/arm/mach-at91/include/mach/bootmode.h new file +8
-0+enum at91_soc_boot_from { +AT91_BOOT_FROM_UNKNOWN , +AT91_BOOT_FROM_SPI , +AT91_BOOT_FROM_MCI , +AT91_BOOT_FROM_SMC , +AT91_BOOT_FROM_TWD , +}; +arch/arm/mach-at91/include/mach/bootmode.h line 36
Quoted 10 lines
arch/arm/mach-at91/include/mach/bootmode.h new file +10
-0+enum at91_soc_boot_media { +AT91_BOOT_MEDIA_UNKNOWN , +AT91_BOOT_MEDIA_SD , +AT91_BOOT_MEDIA_MMC , +AT91_BOOT_MEDIA_EMMC , +AT91_BOOT_MEDIA_AT45 , +AT91_BOOT_MEDIA_AT25 , +AT91_BOOT_MEDIA_NAND , +AT91_BOOT_MEDIA_NOR , +};Hm. For NAND/NOR the first array does not contain useful information, for MCI the second array does not contain useful information. For I2C/SPI both arrays seem redundant.
Quoted 1 line
Why not merge them into one?
no because SMC is for NAND & NOR
SPI => at25/at45
MCI => SD/MMC/eMMC
we have the different information in the register I want to expose it
use full for IC debug as example and boot strategie
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