at91: move reset vector to board code
Subsystems (4)
cover at91: move reset vector to board code
The following patchset is the start to move the reset vector for at91 boards from mach-at91 to boards code.
This is similar to what other boards do and is done to prepare for multi-image support and DT support.
The patchset convert a few boards already and I am aiming to convert all boards, but wanted feedback on the patch set before starting to do so.
The first patch have minimal impact, but prepares for a board-by-board conversion.
The patch-set includes the conversion of the boards:
at91sam9261ek
at91sam9263ek
pm9261
at91sam9g10ek
When all boards are converted then there will be no files named arch/arm/mach-at91/*lowlevel_init.c
And all CONFIG symbols named *_LWL will be no more.
The patchset was successfully booted on a AT91SAM9263EK, and all defconfigs was built (expect the ones that failed to build before this patchset was applied).
Note: the patches are from [email protected] - in the next round I will change this to my home address as this is not work related.
Sam
Sam Ravnborg (5):
at91: refactor lowlevel_init selection
at91: drop unused at91sam9x5_lowlevel_init.c
at91sam9263ek: move reset vector to board code at91sam9261ek, at91sam9g10ek: move reset vector to board code
pm9261: move reset vector to board code
arch/arm/boards/at91sam9261ek/Makefile | 2 +- arch/arm/boards/at91sam9261ek/lowlevel_init.c | 41 ++++++++--- arch/arm/boards/at91sam9263ek/Makefile | 2 +- arch/arm/boards/at91sam9263ek/lowlevel_init.c | 43 +++++++++--- arch/arm/boards/mmccpu/Makefile | 2 +- arch/arm/boards/pm9261/Makefile | 2 +- arch/arm/boards/pm9261/lowlevel_init.c | 39 ++++++++--- arch/arm/boards/pm9263/Makefile | 2 +- arch/arm/boards/tny-a926x/Makefile | 8 +-- arch/arm/boards/usb-a926x/Makefile | 6 +- arch/arm/mach-at91/Kconfig | 72 +++++++++++++++---- arch/arm/mach-at91/Makefile | 23 +++---- arch/arm/mach-at91/at91sam9x5_lowlevel_init.c | 26 ------- arch/arm/mach-at91/include/mach/at91_lowlevel_init.h | 2 +- arch/arm/mach-at91/include/mach/at91sam926x_board_init.h | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 15 files changed, 392 insertions(+), 98 deletions(-)
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/5 at91: refactor lowlevel_init selection
From e8753cfcadd7b32e304b5d98e6429392c197852e Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Wed, 5 Jul 2017 19:54:40 +0200
Subject: [PATCH 1/5] at91: refactor lowlevel_init selection
Push selection of lowlevel_init functions out to the individual boards.
Pushing it to the individual boards allows us on a per board basis to migrate to a design where the mach-at91 code no longer calls the board specific code.
When the dependency mach-at91 => boards is dropped for a board the migration to a multi-image setup is one step closer.
--- arch/arm/boards/at91sam9261ek/Makefile | 2 +- arch/arm/boards/at91sam9263ek/Makefile | 2 +- arch/arm/boards/mmccpu/Makefile | 2 +- arch/arm/boards/pm9261/Makefile | 2 +- arch/arm/boards/pm9263/Makefile | 2 +- arch/arm/boards/tny-a926x/Makefile | 8 +-- arch/arm/boards/usb-a926x/Makefile | 6 +- arch/arm/mach-at91/Kconfig | 81 ++++++++++++++++++---- arch/arm/mach-at91/Makefile | 24 +++---- .../mach-at91/include/mach/at91_lowlevel_init.h | 2 +- 10 files changed, 91 insertions(+), 40 deletions(-)
arch/arm/boards/at91sam9261ek/Makefile +1 -1
@@ -1,4 +1,4 @@ obj-y += init.o -lwl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o +lwl-$(CONFIG_AT91SAM926X_LWL) += lowlevel_init.o bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-at91sam9261ek
arch/arm/boards/at91sam9263ek/Makefile +1 -1
@@ -1,4 +1,4 @@ obj-y += init.o -lwl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o +lwl-y += lowlevel_init.o bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-at91sam9263ek
arch/arm/boards/mmccpu/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-y += init.o -lwl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o +lwl-n += lowlevel_init.o
arch/arm/boards/pm9261/Makefile +1 -1
@@ -1,4 +1,4 @@ obj-y += init.o -lwl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o +lwl-y += lowlevel_init.o bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-pm9261
arch/arm/boards/pm9263/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-y += init.o -lwl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o +lwl-y += lowlevel_init.o
arch/arm/boards/tny-a926x/Makefile +3 -5
@@ -1,9 +1,7 @@ obj-y += init.o -bootstrap-$(CONFIG_MACH_TNY_A9263) = tny_a9263_bootstrap.o -obj-$(CONFIG_AT91_BOOTSTRAP) += $(bootstrap-y) +obj-$(CONFIG_AT91_BOOTSTRAP) += tny_a9263_bootstrap.o -lowlevel_init-$(CONFIG_MACH_TNY_A9263) = tny_a9263_lowlevel_init.o - -lwl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += $(lowlevel_init-y) +# Not used, documented by an -n assignment +lwl-n += tny_a9263_lowlevel_init.o bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-tny-a926x
arch/arm/boards/usb-a926x/Makefile +2 -4
@@ -1,9 +1,7 @@ obj-y += init.o -bootstrap-$(CONFIG_MACH_USB_A9263) = usb_a9263_bootstrap.o -obj-$(CONFIG_AT91_BOOTSTRAP) += $(bootstrap-y) +obj-$(CONFIG_AT91_BOOTSTRAP) += usb_a9263_bootstrap.o -lowlevel_init-$(CONFIG_MACH_USB_A9263) = usb_a9263_lowlevel_init.o +lwl-$(CONFIG_AT91SAM926X_LWL) += usb_a9263_lowlevel_init.o -lwl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += $(lowlevel_init-y) bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-usb-a926x
arch/arm/mach-at91/Kconfig +68 -13
285 lines not on this page · raw message
arch/arm/mach-at91/Makefile +12 -12
@@ -7,18 +7,18 @@ endif obj-$(CONFIG_CMD_AT91_BOOT_TEST) += boot_test_cmd.o obj-$(CONFIG_AT91_BOOTSTRAP) += bootstrap.o -sam926x_lowlevel_init-$(CONFIG_AT91SAM9_LOWLEVEL_INIT) = at91sam926x_lowlevel_init.o -lowlevel_init-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) = $(sam926x_lowlevel_init-y) -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_SOC_AT91SAM9G45) += at91sam9g45_lowlevel_init.o -lowlevel_init-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5_lowlevel_init.o -lowlevel_init-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12_lowlevel_init.o -lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o -lowlevel_init-$(CONFIG_ARCH_SAMA5D3) += sama5d3_lowlevel_init.o -lowlevel_init-$(CONFIG_ARCH_SAMA5D4) += sama5d3_lowlevel_init.o -lwl-y += $(lowlevel_init-y) + +lwl-$(CONFIG_AT91SAM926X_LWL) += at91sam926x_lowlevel_init.o + +lwl-$(CONFIG_AT91SAM9260_LWL) += at91sam9260_lowlevel_init.o +lwl-$(CONFIG_AT91SAM9261_LWL) += at91sam9261_lowlevel_init.o +lwl-$(CONFIG_AT91SAM9263_LWL) += at91sam9263_lowlevel_init.o +lwl-$(CONFIG_AT91SAM9G45_LWL) += at91sam9g45_lowlevel_init.o +lwl-$(CONFIG_AT91SAM9X5_LWL) += at91sam9x5_lowlevel_init.o +lwl-$(CONFIG_AT91SAM9N12_LWL) += at91sam9n12_lowlevel_init.o +lwl-$(CONFIG_AT91RM9200_LWL) += at91rm9200_lowlevel_init.o +lwl-$(CONFIG_SAMA5D3_LWL) += sama5d3_lowlevel_init.o +lwl-$(CONFIG_SAMA5D4_LWL) += sama5d3_lowlevel_init.o obj-$(CONFIG_AT91SAM9_RESET) += at91sam9_reset.o obj-$(CONFIG_AT91SAM9G45_RESET) += at91sam9g45_reset.o
arch/arm/mach-at91/include/mach/at91_lowlevel_init.h +1 -1
@@ -35,7 +35,7 @@ struct at91sam926x_lowlevel_cfg {u32 rstc_rmr; }; -#ifdef CONFIG_HAVE_AT91_LOWLEVEL_INIT +#ifdef CONFIG_AT91SAM926X_LWL void at91sam926x_lowlevel_board_config (struct at91sam926x_lowlevel_cfg *cfg);void at91sam926x_lowlevel_init (struct at91sam926x_lowlevel_cfg *cfg);#else
Signature · 7 lines
2.12.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/5 at91: drop unused at91sam9x5_lowlevel_init.c
In reply to Sam RavnborgFrom 16ac2a9920e86b704abe617982ce42e06bb1d70e Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Wed, 5 Jul 2017 20:07:09 +0200
Subject: [PATCH 2/5] at91: drop unused at91sam9x5_lowlevel_init.c
After the refactoring of how we select lowlevel_init it was easy to see that at91sam9x5_lowlevel_init.c was no longer used.
Delete the file and the now unused CONFIG symbol and it uses
--- arch/arm/mach-at91/Kconfig | 2 -- arch/arm/mach-at91/Makefile | 1 - arch/arm/mach-at91/at91sam9x5_lowlevel_init.c | 26 -------------------------- 3 files changed, 29 deletions(-) delete mode 100644 arch/arm/mach-at91/at91sam9x5_lowlevel_init.c
arch/arm/mach-at91/Kconfig +0 -2
@@ -47,8 +47,6 @@ config AT91SAM9263_LWL bool config AT91SAM9G45_LWL bool -config AT91SAM9X5_LWL - bool config AT91SAM9N12_LWL bool config AT91RM9200_LWL
arch/arm/mach-at91/Makefile +0 -1
@@ -14,7 +14,6 @@ lwl-$(CONFIG_AT91SAM9260_LWL) += at91sam9260_lowlevel_init.o lwl-$(CONFIG_AT91SAM9261_LWL) += at91sam9261_lowlevel_init.o lwl-$(CONFIG_AT91SAM9263_LWL) += at91sam9263_lowlevel_init.o lwl-$(CONFIG_AT91SAM9G45_LWL) += at91sam9g45_lowlevel_init.o -lwl-$(CONFIG_AT91SAM9X5_LWL) += at91sam9x5_lowlevel_init.o lwl-$(CONFIG_AT91SAM9N12_LWL) += at91sam9n12_lowlevel_init.o lwl-$(CONFIG_AT91RM9200_LWL) += at91rm9200_lowlevel_init.o lwl-$(CONFIG_SAMA5D3_LWL) += sama5d3_lowlevel_init.o
arch/arm/mach-at91/at91sam9x5_lowlevel_init.c deleted +0 -26
@@ -1,26 +0,0 @@ -/* -* 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/io.h> -#include <mach/at91sam9_ddrsdr.h> -#include <init.h> -#include <linux/sizes.h> - -void __naked __bare_init barebox_arm_reset_vector(void) -{ -arm_cpu_lowlevel_init (); - -arm_setup_stack (AT91SAM9X5_SRAM_BASE +AT91SAM9X5_SRAM_SIZE -16 ); - -barebox_arm_entry (AT91_CHIPSELECT_1 ,at91sam9x5_get_ddram_size (),NULL ); -}
Signature · 7 lines
2.12.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/5 at91sam9263ek: move reset vector to board code
In reply to Sam RavnborgFrom 76460e67ea00acaf0ca61318bd39f2127632cb8c Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Wed, 5 Jul 2017 22:13:30 +0200
Subject: [PATCH 3/5] at91sam9263ek: move reset vector to board code
Create a new file at91sam926x_board_init.h which is a copy of at91sam926x_lowlevel_init.c with a few minor adjustments:
- We no longer call board code from this function
- The struct is renamed to avoid name clashes
- the function is rename to better match the prurpose
This file will be used in subsequent transformations
Otherwise just added the reset vector to the board code and drop the now obsolete CONFIG selectst
--- arch/arm/boards/at91sam9263ek/lowlevel_init.c | 43 ++-- arch/arm/mach-at91/Kconfig | 2 - .../include/mach/at91sam926x_board_init.h | 220 +++++++++++++++++++++ 3 files changed, 252 insertions(+), 13 deletions(-) create mode 100644 arch/arm/mach-at91/include/mach/at91sam926x_board_init.h
arch/arm/boards/at91sam9263ek/lowlevel_init.c +32 -11
@@ -4,21 +4,17 @@* 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> +#include <linux/sizes.h> + +#include <asm/barebox-arm.h> + +#include <mach/at91sam926x_board_init.h> +#include <mach/at91sam9263_matrix.h> #define MASTER_PLL_MUL 171#define MASTER_PLL_DIV 14 -void __bare_init at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cfg *cfg) +static void __bare_init at91sam9263ek_board_config(struct at91sam926x_board_cfg *cfg) {/* Disable Watchdog */ cfg->wdt_mr =
@@ -102,3 +98,28 @@ void __bare_init at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cAT91_RSTC_RSTTYP_WAKEUP |AT91_RSTC_RSTTYP_WATCHDOG ; } + +static void __bare_init at91sam9263ek_init(void) +{ +struct at91sam926x_board_cfg cfg; + + cfg.pio =IOMEM (AT91SAM9263_BASE_PIOD ); + cfg.sdramc =IOMEM (AT91SAM9263_BASE_SDRAMC0 ); + cfg.ebi_pio_is_peripha = true; + cfg.matrix_csa =AT91_MATRIX_EBI0CSA ; + +at91sam9263ek_board_config (&cfg); +at91sam926x_board_init (&cfg); + +barebox_arm_entry (AT91_CHIPSELECT_1 ,at91_get_sdram_size (cfg.sdramc), +NULL ); +} + +void __naked __bare_init barebox_arm_reset_vector(void) +{ +arm_cpu_lowlevel_init (); + +arm_setup_stack (AT91SAM9263_SRAM0_BASE +AT91SAM9263_SRAM0_SIZE -16 ); + +at91sam9263ek_init (); +}
arch/arm/mach-at91/Kconfig +0 -2
@@ -437,8 +437,6 @@ config MACH_AT91SAM9263EK bool "Atmel AT91SAM9263-EK" select HAVE_NAND_ATMEL_BUSWIDTH_16 select HAVE_AT91_BOOTSTRAP - select AT91SAM9263_LWL - select AT91SAM926X_LWL help Say y here if you are using Atmel's AT91SAM9263-EK Evaluation board
arch/arm/mach-at91/include/mach/at91sam926x_board_init.h new file +220 -0
220 lines not on this page · raw message
Signature · 7 lines
2.12.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/5 at91sam9261ek, at91sam9g10ek: move reset vector to board code
In reply to Sam RavnborgFrom 865c099363aac74310f6bacb7f6e0b1b290ecfc7 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Wed, 5 Jul 2017 22:19:16 +0200
Subject: [PATCH 4/5] at91sam9261ek, at91sam9g10ek: move reset vector to board
code
The two evaluation boards share the same board code.
Drop obsolete select of CONFIG symbols
Simplify Makefile
--- arch/arm/boards/at91sam9261ek/Makefile | 2 +- arch/arm/boards/at91sam9261ek/lowlevel_init.c | 41 ++++++++++++++++++++------- arch/arm/mach-at91/Kconfig | 3 -- 3 files changed, 31 insertions(+), 15 deletions(-)
arch/arm/boards/at91sam9261ek/Makefile +1 -1
@@ -1,4 +1,4 @@ obj-y += init.o -lwl-$(CONFIG_AT91SAM926X_LWL) += lowlevel_init.o +lwl-y += lowlevel_init.o bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-at91sam9261ek
arch/arm/boards/at91sam9261ek/lowlevel_init.c +30 -11
56 lines not on this page · raw message
arch/arm/mach-at91/Kconfig +0 -3
@@ -331,8 +331,6 @@ config MACH_AT91SAM9261EK select HAVE_AT91_DATAFLASH_CARD select HAVE_NAND_ATMEL_BUSWIDTH_16 select HAVE_AT91_BOOTSTRAP - select AT91SAM9261_LWL - select AT91SAM926X_LWL help Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit. <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
@@ -361,7 +359,6 @@ config MACH_AT91SAM9G10EK bool "Atmel AT91SAM9G10-EK Evaluation Kit" select HAVE_NAND_ATMEL_BUSWIDTH_16 select HAS_DM9000 - select AT91SAM9261_LWL help Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit. <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
Signature · 7 lines
2.12.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/5 pm9261: move reset vector to board code
In reply to Sam RavnborgFrom 75592860c696b241ee788f19ea7708628636cef9 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Wed, 5 Jul 2017 22:27:43 +0200
Subject: [PATCH 5/5] pm9261: move reset vector to board code
--- arch/arm/boards/pm9261/lowlevel_init.c | 39 +++++++++++++++++++++++++--------- arch/arm/mach-at91/Kconfig | 2 -- 2 files changed, 29 insertions(+), 12 deletions(-)
arch/arm/boards/pm9261/lowlevel_init.c +29 -10
@@ -4,22 +4,16 @@* 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 <asm/barebox-arm.h> + +#include <mach/at91sam926x_board_init.h> #include <mach/at91sam9_matrix.h> -#include <mach/at91_lowlevel_init.h> #define MASTER_PLL_DIV 15#define MASTER_PLL_MUL 162#define MAIN_PLL_DIV 2 -void __bare_init at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cfg *cfg) +static void __bare_init pm9261_board_config(struct at91sam926x_board_cfg *cfg) {/* Disable Watchdog */ cfg->wdt_mr =
@@ -100,3 +94,28 @@ void __bare_init at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cAT91_RSTC_RSTTYP_WAKEUP |AT91_RSTC_RSTTYP_WATCHDOG ; } + +static void __bare_init pm9261_init(void) +{ +struct at91sam926x_board_cfg cfg; + + cfg.pio =IOMEM (AT91SAM9261_BASE_PIOC ); + cfg.sdramc =IOMEM (AT91SAM9261_BASE_SDRAMC ); + cfg.ebi_pio_is_peripha = false; + cfg.matrix_csa =AT91_MATRIX_EBICSA ; + +pm9261_board_config (&cfg); +at91sam926x_board_init (&cfg); + +barebox_arm_entry (AT91_CHIPSELECT_1 ,at91_get_sdram_size (cfg.sdramc), +NULL ); +} + +void __naked __bare_init barebox_arm_reset_vector(void) +{ +arm_cpu_lowlevel_init (); + +arm_setup_stack (AT91SAM9261_SRAM_BASE +AT91SAM9261_SRAM_SIZE -16 ); + +pm9261_init (); +}
arch/arm/mach-at91/Kconfig +0 -2
@@ -339,8 +339,6 @@ config MACH_PM9261 bool "Ronetix PM9261" select HAS_DM9000 select HAVE_AT91_BOOTSTRAP - select AT91SAM9261_LWL - select AT91SAM926X_LWL help Say y here if you are using the Ronetix PM9261 Board
Signature · 7 lines
2.12.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox