arm: at91: Makefile: Compile lowlevel_init only when really necessary
Subsystems (5)
PATCH 1/11 arm: at91: Makefile: Compile lowlevel_init only when really necessary
Make sure that lowlevel_init is not compiled when CONFIG_SKIP_LOWLEVEL_INIT_ONLY is configured.
--- arch/arm/mach-at91/arm926ejs/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-at91/arm926ejs/Makefile +2 -0
@@ -24,8 +24,10 @@ obj-y += timer.o endif ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY obj-y += lowlevel_init.o endif +endif ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD ifndef CONFIG_HAS_THUMB2
Signature · 1 line
2.21.0
PATCH 2/11 arm: at91: spl_at91.c: Call spl_early_init() if OF_CONTROL is enabled
This patch adds a call to spl_early_init() to board_init_f() which is needed when CONFIG_SPL_OF_CONTROL is configured. This is necessary for the early SPL setup including the DTB setup for later usage.
Please note that this call might also be needed for non SPL_OF_CONTROL board, like the smartweb target. But smartweb fails to build with this call because its binary grows too big. So I disabled it for these kind of targets for now.
--- arch/arm/mach-at91/spl_at91.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-at91/spl_at91.c +10 -0
@@ -75,6 +75,16 @@ void __weak spl_board_init(void)void board_init_f (ulong dummy) { +#if CONFIG_IS_ENABLED (OF_CONTROL ) +int ret; + + ret =spl_early_init (); +if (ret) { +debug ("spl_early_init() failed: %d\n" , ret); +hang (); + } +#endif +lowlevel_clock_init ();#if !defined(CONFIG_WDT_AT91 )at91_disable_wdt ();
Signature · 1 line
2.21.0
PATCH 3/11 serial: atmel_usart: Use fixed clock value in SPL version
In reply to Stefan RoeseThis patch adds an alterative SPL version of atmel_serial_enable_clk(). This enables the usage of this driver without full clock support (in drivers and DT nodes). This saves some space in the SPL image.
If some boards need a different clock than the one provided with this patch, then support for this needs to be added later.
--- drivers/serial/atmel_usart.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/serial/atmel_usart.c +12 -0
@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#ifdef CONFIG_SPL_BUILD +static int atmel_serial_enable_clk (struct udevice *dev) +{ +struct atmel_serial_priv *priv =dev_get_priv (dev); + +/* Use fixed clock value in SPL */ + priv->usart_clk_rate =132096000 ; + +return 0 ; +} +#else static int atmel_serial_enable_clk (struct udevice *dev) {struct atmel_serial_priv *priv =dev_get_priv (dev);
@@ -245,6 +256,7 @@ static int atmel_serial_enable_clk(struct udevice *dev) return 0; } +#endif static int atmel_serial_probe (struct udevice *dev) {
Signature · 1 line
2.21.0
PATCH 3/11 serial: atmel_usart: Use fixed clock value in SPL version
Quoted 23 lines · Stefan Roese
External E-Mail
This patch adds an alterative SPL version of
atmel_serial_enable_clk(). This enables the usage of this driver without full clock support (in drivers and DT nodes). This saves some space in the SPL image.If some boards need a different clock than the one provided with this patch, then support for this needs to be added later.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- drivers/serial/atmel_usart.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/serial/atmel_usart.c +0
-0
drivers/serial/atmel_usart.c static const struct dm_serial_ops atmel_serial_ops = { · line 227
Quoted 10 lines
drivers/serial/atmel_usart.c +7
-0@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#ifdef CONFIG_SPL_BUILD +static int atmel_serial_enable_clk (struct udevice *dev) +{ +struct atmel_serial_priv *priv =dev_get_priv (dev); + +/* Use fixed clock value in SPL */ + priv->usart_clk_rate =132096000 ;
Hi Stefan,
Does this mean that the SPL will work *if and only if* this clock matches the board's clock, for all at91 boards? (thus, boards having a different clock , the serial will not function correctly anymore ?)
Eugen
Quoted 16 lines
drivers/serial/atmel_usart.c +5
-0+ + return 0; +} +#else static int atmel_serial_enable_clk (struct udevice *dev) {struct atmel_serial_priv *priv =dev_get_priv (dev);@@ -245,6 +256,7 @@ static int atmel_serial_enable_clk(struct udevice *dev) return 0; } +#endif static int atmel_serial_probe (struct udevice *dev) {
PATCH 3/11 serial: atmel_usart: Use fixed clock value in SPL version
Quoted 39 lines · Eugen.Hristev at microchip.com
Quoted 23 lines · Stefan Roese
External E-Mail
This patch adds an alterative SPL version of
atmel_serial_enable_clk(). This enables the usage of this driver without full clock support (in drivers and DT nodes). This saves some space in the SPL image.If some boards need a different clock than the one provided with this patch, then support for this needs to be added later.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- drivers/serial/atmel_usart.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/serial/atmel_usart.c +0
-0drivers/serial/atmel_usart.c static const struct dm_serial_ops atmel_serial_ops = { · line 227
Quoted 10 lines
drivers/serial/atmel_usart.c +7
-0@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#ifdef CONFIG_SPL_BUILD +static int atmel_serial_enable_clk (struct udevice *dev) +{ +struct atmel_serial_priv *priv =dev_get_priv (dev); + +/* Use fixed clock value in SPL */ + priv->usart_clk_rate =132096000 ;Hi Stefan,
Quoted 3 lines
Does this mean that the SPL will work *if and only if* this clock matches the board's clock, for all at91 boards? (thus, boards having a different clock , the serial will not function correctly anymore ?)
Yes, thats the case (as explained in the commit message above). For this to work on all boards we need to add some macro like CONFIG_DEBUG_UART_CLOCK which can be set by each board port individually.
If agreed on such an idea, I can add this new Kconfig option in a later version of this patch. Perhaps something like CONFIG_SPL_UART_CLOCK?
Thanks,
Stefan
PATCH 3/11 serial: atmel_usart: Use fixed clock value in SPL version
Quoted 45 lines · Stefan Roese
Quoted 39 lines · Eugen.Hristev at microchip.com
Quoted 23 lines · Stefan Roese
External E-Mail
This patch adds an alterative SPL version of
atmel_serial_enable_clk(). This enables the usage of this driver without full clock support (in drivers and DT nodes). This saves some space in the SPL image.If some boards need a different clock than the one provided with this patch, then support for this needs to be added later.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
drivers/serial/atmel_usart.c| 12 ++++++++++++1 file changed, 12 insertions(+)drivers/serial/atmel_usart.c +0
-0drivers/serial/atmel_usart.c static const struct dm_serial_ops · line 227
Quoted 10 lines
drivers/serial/atmel_usart.c +7
-0@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#ifdef CONFIG_SPL_BUILD +static int atmel_serial_enable_clk (struct udevice *dev) +{ + struct atmel_serial_priv *priv = dev_get_priv(dev); + + /* Use fixed clock value in SPL */ + priv->usart_clk_rate = 132096000;Hi Stefan,
Quoted 3 lines
Does this mean that the SPL will work *if and only if* this clock matches the board's clock, for all at91 boards? (thus, boards having a different clock , the serial will not function correctly anymore ?)
Quoted 8 lines
Yes, thats the case (as explained in the commit message above). For this to work on all boards we need to add some macro like
CONFIG_DEBUG_UART_CLOCKwhich can be set by each board port individually.If agreed on such an idea, I can add this new
Kconfigoption in a later version of this patch. Perhaps something likeCONFIG_SPL_UART_CLOCK?
If this breaks the serial for the other boards... it's not good. I think either we do a patch that fixes a thing, but does not break other functionality... or we leave it as is.
Would hate to see serial failing on all other SPLs
How big is the SPL reduction with this ?
Maybe just keep old code in case CONFIG_SPL_UART_CLOCK is *not* defined ? and if defined, use the hardcoded value from config ?
Eugen
Quoted 3 lines
Thanks,
Stefan
PATCH 3/11 serial: atmel_usart: Use fixed clock value in SPL version
Quoted 53 lines · Eugen.Hristev at microchip.com
Quoted 50 lines · Stefan Roese
Quoted 39 lines · Eugen.Hristev at microchip.com
Quoted 23 lines · Stefan Roese
External E-Mail
This patch adds an alterative SPL version of
atmel_serial_enable_clk(). This enables the usage of this driver without full clock support (in drivers and DT nodes). This saves some space in the SPL image.If some boards need a different clock than the one provided with this patch, then support for this needs to be added later.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- drivers/serial/atmel_usart.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/serial/atmel_usart.c +0
-0drivers/serial/atmel_usart.c static const struct dm_serial_ops · line 227
Quoted 10 lines
drivers/serial/atmel_usart.c +7
-0@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#ifdef CONFIG_SPL_BUILD +static int atmel_serial_enable_clk (struct udevice *dev) +{ + struct atmel_serial_priv *priv = dev_get_priv(dev); + + /* Use fixed clock value in SPL */ + priv->usart_clk_rate = 132096000;Hi Stefan,
Quoted 3 lines
Does this mean that the SPL will work *if and only if* this clock matches the board's clock, for all at91 boards? (thus, boards having a different clock , the serial will not function correctly anymore ?)
Yes, thats the case (as explained in the commit message above). For this to work on all boards we need to add some macro like
CONFIG_DEBUG_UART_CLOCKwhich can be set by each board port individually.
Quoted 5 lines
Quoted 3 lines
If agreed on such an idea, I can add this new
Kconfigoption in a later version of this patch. Perhaps something likeCONFIG_SPL_UART_CLOCK?If this breaks the serial for the other boards... it's not good.
Currently it breaks no other board port, as no other board port uses SPL with DM_SERIAL support on AT91, AFAICT. So no breakage is introduced with this patch (please correct me if I'm wrong).
Quoted 3 lines
I think either we do a patch that fixes a thing, but does not break other functionality... or we leave it as is.
Would hate to see serial failing on all other SPLs
Again, this is only for ports that will move to DM_SERIAL in SPL in the future.
Quoted 1 line
How big is the SPL reduction with this ?
Frankly I can't tell.
Quoted 2 lines
Maybe just keep old code in case
CONFIG_SPL_UART_CLOCKis *not* defined ? and if defined, use the hardcoded value from config ?
Which old code are you referring to? Again, this code is new for the newly introduced SPL & DM_SERIAL support in this driver.
Thanks,
Stefan
PATCH 4/11 watchdog: Handle SPL build with watchdog disabled
In reply to Stefan RoeseThis patch adds some checks, so that the watchdog can be enabled in main U-Boot proper but can be disabled in SPL.
This will be used by some AT91SAM based boards, which might enable the watchdog in the main U-Boot proper and not in SPL. It will be enabled in SPL by default there, so no need to configure it there. This approach saves some space in SPL.
--- include/watchdog.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/watchdog.h +8 -2
@@ -51,9 +51,15 @@ int init_func_watchdog_reset(void);#if defined(__ASSEMBLY__)#define WATCHDOG_RESET bl watchdog_reset#else -extern void watchdog_reset (void ); +/* Don't require the watchdog to be enabled in SPL */ +#if defined(CONFIG_SPL_BUILD ) && \ + !defined(CONFIG_SPL_WATCHDOG_SUPPORT ) +#define WATCHDOG_RESET () {} +#else +extern void watchdog_reset (void ); -#define WATCHDOG_RESET watchdog_reset +#define WATCHDOG_RESET watchdog_reset +#endif #endif #else /*
Signature · 1 line
2.21.0
PATCH 4/11 watchdog: Handle SPL build with watchdog disabled
Quoted 5 lines · Stefan Roese
External E-Mail
This patch adds some checks, so that the watchdog can be enabled in main U-Boot proper but can be disabled in SPL.
Hi Stefan,
Actually your code looks at CONFIG_SPL_WATCHDOG_SUPPORT , so , if this is disabled in the config, you say that the watchdog was still enabled? (thus broken CONFIG_SPL_WATCHDOG_SUPPORT ?)
Eugen
Quoted 37 lines
This will be used by some AT91SAM based boards, which might enable the watchdog in the main U-Boot proper and not in SPL. It will be enabled in SPL by default there, so no need to configure it there. This approach saves some space in SPL.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- include/watchdog.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)include/watchdog.h +8
-2@@ -51,9 +51,15 @@ int init_func_watchdog_reset(void);#if defined(__ASSEMBLY__)#define WATCHDOG_RESET bl watchdog_reset#else -extern void watchdog_reset (void ); +/* Don't require the watchdog to be enabled in SPL */ +#if defined(CONFIG_SPL_BUILD ) && \ + !defined(CONFIG_SPL_WATCHDOG_SUPPORT ) +#define WATCHDOG_RESET () {} +#else +extern void watchdog_reset (void ); -#define WATCHDOG_RESET watchdog_reset +#define WATCHDOG_RESET watchdog_reset +#endif #endif #else /*
PATCH 4/11 watchdog: Handle SPL build with watchdog disabled
Quoted 6 lines · Eugen.Hristev at microchip.com
Quoted 3 lines · Stefan Roese
External E-Mail
Quoted 8 lines
Quoted 2 lines
This patch adds some checks, so that the watchdog can be enabled in main U-Boot proper but can be disabled in SPL.
Hi Stefan,
Actually your code looks at
CONFIG_SPL_WATCHDOG_SUPPORT, so , if this is disabled in the config, you say that the watchdog was still enabled? (thus brokenCONFIG_SPL_WATCHDOG_SUPPORT?)
Yes, in my case here, the watchdog is disabled in SPL and enabled in main U-Boot proper. This use case is what this patch fixes.
Is this still unclear? Sorry, I didn't fully understand your question.
Thanks,
Stefan
Quoted 32 lines
Eugen
Quoted 30 lines
This will be used by some AT91SAM based boards, which might enable the watchdog in the main U-Boot proper and not in SPL. It will be enabled in SPL by default there, so no need to configure it there. This approach saves some space in SPL.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- include/watchdog.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)include/watchdog.h +6
-1@@ -51,9 +51,15 @@ int init_func_watchdog_reset(void);#if defined(__ASSEMBLY__)#define WATCHDOG_RESET bl watchdog_reset#else -extern void watchdog_reset (void ); +/* Don't require the watchdog to be enabled in SPL */ +#if defined(CONFIG_SPL_BUILD ) && \ + !defined(CONFIG_SPL_WATCHDOG_SUPPORT ) +#define WATCHDOG_RESET () {} +#else +extern void watchdog_reset (void );
Quoted 7 lines
include/watchdog.h int init_func_watchdog_reset(void); · line 65
Quoted 7 lines
include/watchdog.h +2
-1-#define WATCHDOG_RESET watchdog_reset +#define WATCHDOG_RESET watchdog_reset +#endif #endif #else /*
Viele Grüße,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 4/11 watchdog: Handle SPL build with watchdog disabled
Quoted 15 lines · Stefan Roese
External E-Mail
Quoted 11 lines · Eugen.Hristev at microchip.com
Quoted 5 lines · Stefan Roese
External E-Mail
This patch adds some checks, so that the watchdog can be enabled in main U-Boot proper but can be disabled in SPL.
Hi Stefan,
Quoted 8 lines
Quoted 3 lines
Actually your code looks at
CONFIG_SPL_WATCHDOG_SUPPORT, so , if this is disabled in the config, you say that the watchdog was still enabled? (thus brokenCONFIG_SPL_WATCHDOG_SUPPORT?)Yes, in my case here, the watchdog is disabled in SPL and enabled in main U-Boot proper. This use case is what this patch fixes.
Is this still unclear? Sorry, I didn't fully understand your question.
There is a Kconfig named CONFIG_SPL_WATCHDOG_SUPPORT
If this is y, then the watchdog support should be included in SPL If this is n, then the watchdog support should not be included in SPL.
Considering your use case, you want CONFIG_SPL_WATCHDOG_SUPPORT=n
Configuring this, the watchdog is still enabled in SPL?
So my question: is the behavior of CONFIG_SPL_WATCHDOG_SUPPORT=n not aligned with your use case ? So you are actually fixing the behavior of CONFIG_SPL_WATCHDOG_SUPPORT=n ?
Quoted 45 lines
Thanks,
StefanQuoted 30 lines
Eugen
Quoted 28 lines
This will be used by some AT91SAM based boards, which might enable the watchdog in the main U-Boot proper and not in SPL. It will be enabled in SPL by default there, so no need to configure it there. This approach saves some space in SPL.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
include/watchdog.h| 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)include/watchdog.h +5
-1@@ -51,9 +51,15 @@ int init_func_watchdog_reset(void); #if defined(__ASSEMBLY__) #define WATCHDOG_RESET bl watchdog_reset #else - extern void watchdog_reset(void); + /* Don't require the watchdog to be enabled in SPL */ + #if defined(CONFIG_SPL_BUILD) && \ + !defined(CONFIG_SPL_WATCHDOG_SUPPORT) + #define WATCHDOG_RESET() {} + #elseQuoted 8 lines
include/watchdog.h int init_func_watchdog_reset(void);
Quoted 8 lines
include/watchdog.h +3
-1+ extern void watchdog_reset(void); - #define WATCHDOG_RESET watchdog_reset + #define WATCHDOG_RESET watchdog_reset + #endif #endif #else /*Viele Grüße,
Stefan
PATCH 4/11 watchdog: Handle SPL build with watchdog disabled
Quoted 25 lines · Eugen.Hristev at microchip.com
Quoted 22 lines · Stefan Roese
External E-Mail
Quoted 6 lines · Eugen.Hristev at microchip.com
Quoted 3 lines · Stefan Roese
External E-Mail
Quoted 8 lines
Quoted 2 lines
This patch adds some checks, so that the watchdog can be enabled in main U-Boot proper but can be disabled in SPL.
Hi Stefan,
Actually your code looks at
CONFIG_SPL_WATCHDOG_SUPPORT, so , if this is disabled in the config, you say that the watchdog was still enabled? (thus brokenCONFIG_SPL_WATCHDOG_SUPPORT?)Yes, in my case here, the watchdog is disabled in SPL and enabled in main U-Boot proper. This use case is what this patch fixes.
Quoted 7 lines
Quoted 1 line
Is this still unclear? Sorry, I didn't fully understand your question.
There is a
KconfignamedCONFIG_SPL_WATCHDOG_SUPPORT
If this is y, then the watchdog support should be included in SPL If this is n, then the watchdog support should not be included in SPL.Considering your use case, you want
CONFIG_SPL_WATCHDOG_SUPPORT=n
Correct.
Quoted 1 line
Configuring this, the watchdog is still enabled in SPL?
I don't want the U-Boot SPL support enabled (mainly because of code size). AFAIU, the AT91SAM watchdog is enabled by default. So its enabled in the SoC when SPL is running, as I don't want to disable it (as done e.g. in AT91Bootrap if configured this way).
Quoted 3 lines
So my question: is the behavior of
CONFIG_SPL_WATCHDOG_SUPPORT=nnot aligned with your use case ? So you are actually fixing the behavior ofCONFIG_SPL_WATCHDOG_SUPPORT=n?
Yes. Without this patch I do get this build error:
...
LD spl/u-boot-spllib/built-in.o: In function `udelay':/home/stefan/git/u-boot/u-boot/lib/time.c:167: undefined reference to watchdog_reset' drivers/built-in.o: In function atmel_nand_pmecc_write_page':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:592: undefined reference to watchdog_reset' drivers/built-in.o: In function atmel_nand_pmecc_read_page':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:552: undefined reference to watchdog_reset' drivers/built-in.o: In function pmecc_err_location':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:416: undefined reference to `watchdog_reset' scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1651: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2
Thanks,
Stefan
Quoted 38 lines
Quoted 38 lines
Thanks,
StefanQuoted 34 lines
Eugen
Quoted 32 lines
This will be used by some AT91SAM based boards, which might enable the watchdog in the main U-Boot proper and not in SPL. It will be enabled in SPL by default there, so no need to configure it there. This approach saves some space in SPL.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- include/watchdog.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)include/watchdog.h +8
-2@@ -51,9 +51,15 @@ int init_func_watchdog_reset(void); #if defined(__ASSEMBLY__) #define WATCHDOG_RESET bl watchdog_reset #else - extern void watchdog_reset(void); + /* Don't require the watchdog to be enabled in SPL */ + #if defined(CONFIG_SPL_BUILD) && \ + !defined(CONFIG_SPL_WATCHDOG_SUPPORT) + #define WATCHDOG_RESET() {} + #else + extern void watchdog_reset(void); - #define WATCHDOG_RESET watchdog_reset + #define WATCHDOG_RESET watchdog_reset + #endif
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
include/watchdog.h int init_func_watchdog_reset(void); · line 65
Quoted 4 lines
include/watchdog.h +0
-0#endif #else /*Viele Grüße,
Stefan
Viele Grüße,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 4/11 watchdog: Handle SPL build with watchdog disabled
Quoted 63 lines · Stefan Roese
External E-Mail
Quoted 26 lines · Eugen.Hristev at microchip.com
Quoted 23 lines · Stefan Roese
External E-Mail
Quoted 10 lines · Eugen.Hristev at microchip.com
Quoted 6 lines · Stefan Roese
External E-Mail
This patch adds some checks, so that the watchdog can be enabled in main
U-Boot proper but can be disabled in SPL.Quoted 5 lines
Hi Stefan,
Actually your code looks at
CONFIG_SPL_WATCHDOG_SUPPORT, so , if this is disabled in the config, you say that the watchdog was still enabled? (thus brokenCONFIG_SPL_WATCHDOG_SUPPORT?)Yes, in my case here, the watchdog is disabled in SPL and enabled in main U-Boot proper. This use case is what this patch fixes.
Quoted 7 lines
Quoted 1 line
Is this still unclear? Sorry, I didn't fully understand your question.
There is a
KconfignamedCONFIG_SPL_WATCHDOG_SUPPORT
If this is y, then the watchdog support should be included in SPL If this is n, then the watchdog support should not be included in SPL.Considering your use case, you want
CONFIG_SPL_WATCHDOG_SUPPORT=nCorrect.
Quoted 1 line
Configuring this, the watchdog is still enabled in SPL?
I don't want the U-Boot SPL support enabled (mainly because of code size). AFAIU, the AT91SAM watchdog is enabled by default. So its enabled in the SoC when SPL is running, as I don't want to disable it (as done e.g. in AT91Bootrap if configured this way).
Quoted 3 lines
So my question: is the behavior of
CONFIG_SPL_WATCHDOG_SUPPORT=nnot aligned with your use case ? So you are actually fixing the behavior ofCONFIG_SPL_WATCHDOG_SUPPORT=n?Yes. Without this patch I do get this build error:
...
LD spl/u-boot-spllib/built-in.o: In function `udelay':/home/stefan/git/u-boot/u-boot/lib/time.c:167: undefined reference to `watchdog_reset'drivers/built-in.o: In function `atmel_nand_pmecc_write_page':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:592:
undefined reference towatchdog_reset' drivers/built-in.o: In functionatmel_nand_pmecc_read_page':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:552:
Quoted 9 lines
undefined reference to
watchdog_reset' drivers/built-in.o: In functionpmecc_err_location':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:416:
undefined reference to `watchdog_reset'scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1651: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2
OK so that's what I want to settle: you are actually fixing the issue of CONFIG_SPL_WATCHDOG_SUPPORT=n not working properly
Also, we may have to look inside the atmel_nand.c as it may be affected?
Thanks,
Eugen
Quoted 54 lines
Thanks,
StefanQuoted 39 lines
Quoted 39 lines
Thanks,
StefanQuoted 35 lines
Eugen
Quoted 33 lines
This will be used by some AT91SAM based boards, which might enable the watchdog in the main U-Boot proper and not in SPL. It will be enabled in
SPL by default there, so no need to configure it there. This approach saves some space in SPL.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
include/watchdog.h| 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)include/watchdog.h +8
-2@@ -51,9 +51,15 @@ int init_func_watchdog_reset(void); #if defined(__ASSEMBLY__) #define WATCHDOG_RESET bl watchdog_reset #else - extern void watchdog_reset(void); + /* Don't require the watchdog to be enabled in SPL */ + #if defined(CONFIG_SPL_BUILD) && \ + !defined(CONFIG_SPL_WATCHDOG_SUPPORT) + #define WATCHDOG_RESET() {} + #else + extern void watchdog_reset(void); - #define WATCHDOG_RESET watchdog_reset + #define WATCHDOG_RESET watchdog_reset + #endifQuoted 8 lines
Quoted 8 lines
Quoted 4 lines
include/watchdog.h int init_func_watchdog_reset(void); · line 65
Quoted 4 lines
include/watchdog.h +0
-0#endif #else /*Viele Grüße,
StefanViele Grüße,
Stefan
PATCH 4/11 watchdog: Handle SPL build with watchdog disabled
On 20.03.19 09:06, Eugen.Hristev at microchip.com wrote:
<snip>
Quoted 26 lines
Quoted 16 lines
Quoted 3 lines
So my question: is the behavior of
CONFIG_SPL_WATCHDOG_SUPPORT=nnot aligned with your use case ? So you are actually fixing the behavior ofCONFIG_SPL_WATCHDOG_SUPPORT=n?Yes. Without this patch I do get this build error:
...
LD spl/u-boot-spllib/built-in.o: In function `udelay':/home/stefan/git/u-boot/u-boot/lib/time.c:167: undefined reference to `watchdog_reset'drivers/built-in.o: In function `atmel_nand_pmecc_write_page':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:592:
undefined reference towatchdog_reset' drivers/built-in.o: In functionatmel_nand_pmecc_read_page':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:552:Quoted 9 lines
undefined reference to
watchdog_reset' drivers/built-in.o: In functionpmecc_err_location':/home/stefan/git/u-boot/u-boot/drivers/mtd/nand/raw/atmel_nand.c:416:
undefined reference to `watchdog_reset'scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1651: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2
Quoted 2 lines
OK so that's what I want to settle: you are actually fixing the issue of
CONFIG_SPL_WATCHDOG_SUPPORT=nnot working properly
Yes, its *not* a AT91 specific issue. Its a general issue of the code.
Quoted 1 line
Also, we may have to look inside the
atmel_nand.cas it may be affected?
Affected in which way? You mean that the watchdog might time out while loading the main U-Boot proper from NAND? Or what are you referring to?
Thanks,
Stefan
PATCH 5/11 watchdog: at91sam9_wdt: Fix WDT setup in at91_wdt_start()
In reply to Stefan RoeseThis patch fixes the timer register setup in at91_wdt_start() to correctly configure the register again. The input timeout value is now in milli-seconds instead of seconds with the new watchdog API. Make sure to take this into account and only use a max timeout value of 16 seconds as appropriate for this SoC.
Also the check against a lower timeout value than 0 is removed. This check makes no sense, as the timeout value is unsigned.
--- drivers/watchdog/at91sam9_wdt.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/watchdog/at91sam9_wdt.c +14 -12
@@ -17,6 +17,7 @@#include <asm/io.h> #include <asm/arch/at91_wdt.h> #include <common.h> +#include <div64.h> #include <dm.h> #include <errno.h> #include <wdt.h>
@@ -31,27 +32,30 @@ DECLARE_GLOBAL_DATA_PTR;#define WDT_SEC2TICKS (s) (((s) << 8) - 1)/* Hardware timeout in seconds */ -#define WDT_MAX_TIMEOUT 16 -#define WDT_MIN_TIMEOUT 0 -#define WDT_DEFAULT_TIMEOUT 2 +#define WDT_MAX_TIMEOUT 16 +#define WDT_DEFAULT_TIMEOUT 2struct at91_wdt_priv {void __iomem *regs; -u32 regval; -u32 timeout; +u32 regval; +u32 timeout; };/* * Set the watchdog time interval in 1/256Hz (write-once) * Counter is 12 bit. */ -static int at91_wdt_start (struct udevice *dev,u64 timeout_s,ulong flags) +static int at91_wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {struct at91_wdt_priv *priv =dev_get_priv (dev); -u32 timeout =WDT_SEC2TICKS (timeout_s); +u64 timeout; +u32 ticks; -if (timeout_s >WDT_MAX_TIMEOUT || timeout_s <WDT_MIN_TIMEOUT ) - timeout = priv->timeout; +/* Calculate timeout in seconds and the resulting ticks */ + timeout = timeout_ms; +do_div (timeout,1000 ); + timeout =min_t (u64, timeout,WDT_MAX_TIMEOUT ); + ticks =WDT_SEC2TICKS (timeout);/* Check if disabled */ if (readl (priv->regs +AT91_WDT_MR ) &AT91_WDT_MR_WDDIS ) {
@@ -65,12 +69,10 @@ static int at91_wdt_start(struct udevice *dev, u64 timeout_s, ulong flags)* Since WDV is a 12-bit counter, the maximum period is * 4096 / 256 = 16 seconds. */ - priv->regval =AT91_WDT_MR_WDRSTEN /* causes watchdog reset */ |AT91_WDT_MR_WDDBGHLT /* disabled in debug mode */ |AT91_WDT_MR_WDD (0xfff )/* restart at any time */ - |AT91_WDT_MR_WDV (timeout);/* timer value */ - + |AT91_WDT_MR_WDV (ticks);/* timer value */ writel (priv->regval, priv->regs +AT91_WDT_MR );return 0 ;
Signature · 1 line
2.21.0
PATCH 6/11 arm: at91: Enable watchdog support
In reply to Stefan RoeseThis patch enables and starts the watchdog on the AT91 platform if configured. Currently the WD timeout is configured to 16 seconds, which is the longest value for this timer.
--- arch/arm/mach-at91/clock.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
arch/arm/mach-at91/clock.c +41 -0
@@ -5,6 +5,8 @@*/ #include <common.h> +#include <dm.h> +#include <wdt.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pmc.h>
@@ -118,3 +120,42 @@ void at91_pllicpr_init(u32 icpr)writel (icpr, &pmc->pllicpr); } + +#if defined(CONFIG_WATCHDOG ) && !defined(CONFIG_SPL_BUILD ) +static struct udevice *watchdog_dev; + +/* Called by macro WATCHDOG_RESET */ +void watchdog_reset (void ) +{ +static ulong next_reset; +ulong now; + +if (!watchdog_dev) +return ; + + now =get_timer (0 ); + +/* Do not reset the watchdog too often */ +if (now > next_reset) { + next_reset = now +1000 ;/* reset every 1000ms */ +wdt_reset (watchdog_dev); + } +} + +int arch_misc_init (void ) +{ +/* Init watchdog */ +if (uclass_get_device_by_seq (UCLASS_WDT ,0 , &watchdog_dev)) { +debug ("Watchdog: Not found by seq!\n" ); +if (uclass_get_device (UCLASS_WDT ,0 , &watchdog_dev)) { +puts ("Watchdog: Not found!\n" ); +return 0 ; + } + } + +wdt_start (watchdog_dev,16000 ,0 );/* 16 seconds is max */ +printf ("Watchdog: Started\n" ); + +return 0 ; +} +#endif
Signature · 1 line
2.21.0
PATCH 6/11 arm: at91: Enable watchdog support
Quoted 29 lines · Stefan Roese
External E-Mail
This patch enables and starts the watchdog on the AT91 platform if configured. Currently the WD timeout is configured to 16 seconds, which is the longest value for this timer.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- arch/arm/mach-at91/clock.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)arch/arm/mach-at91/clock.c +2
-0@@ -5,6 +5,8 @@*/ #include <common.h> +#include <dm.h> +#include <wdt.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pmc.h>
arch/arm/mach-at91/clock.c void at91_pllicpr_init(u32 icpr) · line 124
Quoted 5 lines
arch/arm/mach-at91/clock.c +2
-0@@ -118,3 +120,42 @@ void at91_pllicpr_init(u32 icpr)writel (icpr, &pmc->pllicpr); } + +#if defined(CONFIG_WATCHDOG ) && !defined(CONFIG_SPL_BUILD )
Hi Stefan,
Does this mean that for CONFIG_SPL_BUILD, this functions won't exist, thus the SPL cannot use the watchdog ?
For example, configuring CONFIG_SPL_WATCHDOG_SUPPORT=y makes SPL build fail :
drivers/built-in.o: In function `atmel_nand_pmecc_write_page':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:592: undefined reference to `watchdog_reset'drivers/built-in.o: In function `atmel_nand_pmecc_read_page':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:552: undefined reference to `watchdog_reset'drivers/built-in.o: In function `pmecc_err_location':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:416: undefined reference to `watchdog_reset'scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
Quoted 24 lines
arch/arm/mach-at91/clock.c +24
-0+static struct udevice *watchdog_dev; + +/* Called by macro WATCHDOG_RESET */ +void watchdog_reset (void ) +{ +static ulong next_reset; +ulong now; + +if (!watchdog_dev) +return ; + + now =get_timer (0 ); + +/* Do not reset the watchdog too often */ +if (now > next_reset) { + next_reset = now +1000 ;/* reset every 1000ms */ +wdt_reset (watchdog_dev); + } +} + +int arch_misc_init (void ) +{ +/* Init watchdog */ +if (uclass_get_device_by_seq (UCLASS_WDT ,0 , &watchdog_dev)) {
arch/arm/mach-at91/clock.c void at91_pllicpr_init(u32 icpr) · line 158
Quoted 10 lines
arch/arm/mach-at91/clock.c +10
-0+debug ("Watchdog: Not found by seq!\n" ); +if (uclass_get_device (UCLASS_WDT ,0 , &watchdog_dev)) { +puts ("Watchdog: Not found!\n" ); +return 0 ; + } + } + +wdt_start (watchdog_dev,16000 ,0 );/* 16 seconds is max */ +printf ("Watchdog: Started\n" ); +
Any reason why you use printf and puts and debug in the same function ? Would expect to see debug everywhere except some fatal error that should be printed all the time.
Eugen
Quoted 4 lines
arch/arm/mach-at91/clock.c +3
-0+ return 0; +} +#endif
PATCH 6/11 arm: at91: Enable watchdog support
Quoted 46 lines · Eugen.Hristev at microchip.com
Quoted 29 lines · Stefan Roese
External E-Mail
This patch enables and starts the watchdog on the AT91 platform if configured. Currently the WD timeout is configured to 16 seconds, which is the longest value for this timer.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- arch/arm/mach-at91/clock.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)arch/arm/mach-at91/clock.c +2
-0@@ -5,6 +5,8 @@*/ #include <common.h> +#include <dm.h> +#include <wdt.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pmc.h> arch/arm/mach-at91/clock.c void at91_pllicpr_init(u32 icpr) · line 124
Quoted 5 lines
arch/arm/mach-at91/clock.c +2
-0@@ -118,3 +120,42 @@ void at91_pllicpr_init(u32 icpr)writel (icpr, &pmc->pllicpr); } + +#if defined(CONFIG_WATCHDOG ) && !defined(CONFIG_SPL_BUILD )Hi Stefan,
Does this mean that for
CONFIG_SPL_BUILD, this functions won't exist, thus the SPL cannot use the watchdog ?For example, configuring
CONFIG_SPL_WATCHDOG_SUPPORT=ymakes SPL build fail :
Quoted 10 lines
drivers/built-in.o: In function `atmel_nand_pmecc_write_page':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:592: undefined reference to `watchdog_reset'drivers/built-in.o: In function `atmel_nand_pmecc_read_page':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:552: undefined reference to `watchdog_reset'drivers/built-in.o: In function `pmecc_err_location':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:416: undefined reference to `watchdog_reset'scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
Let me see, if I can change this so that this code is available if selected in SPL as well. Even though arch_misc_init() will not be called, so the watchdog will not be started.
But the code looks cleaner without this #ifdef and if you agree, I will send v2 soon with this change.
Quoted 31 lines
Quoted 31 lines
arch/arm/mach-at91/clock.c +30
-0+static struct udevice *watchdog_dev; + +/* Called by macro WATCHDOG_RESET */ +void watchdog_reset (void ) +{ +static ulong next_reset; +ulong now; + +if (!watchdog_dev) +return ; + + now =get_timer (0 ); + +/* Do not reset the watchdog too often */ +if (now > next_reset) { + next_reset = now +1000 ;/* reset every 1000ms */ +wdt_reset (watchdog_dev); + } +} + +int arch_misc_init (void ) +{ +/* Init watchdog */ +if (uclass_get_device_by_seq (UCLASS_WDT ,0 , &watchdog_dev)) { +debug ("Watchdog: Not found by seq!\n" ); +if (uclass_get_device (UCLASS_WDT ,0 , &watchdog_dev)) { +puts ("Watchdog: Not found!\n" ); +return 0 ; + } + }
Quoted 8 lines
arch/arm/mach-at91/clock.c void at91_pllicpr_init(u32 icpr) · line 158
Quoted 4 lines
arch/arm/mach-at91/clock.c +4
-0+ +wdt_start (watchdog_dev,16000 ,0 );/* 16 seconds is max */ +printf ("Watchdog: Started\n" ); +Any reason why you use printf and puts and debug in the same function ? Would expect to see debug everywhere except some fatal error that should be printed all the time.
Good catch. This is copy-pasted from other very similar implementations. I personally find this last status message "Watchdog: Started" quite useful and would like to keep it. All others might be changed to debug().
Thanks,
Stefan
PATCH 6/11 arm: at91: Enable watchdog support
Quoted 60 lines · Stefan Roese
External E-Mail
Quoted 45 lines · Eugen.Hristev at microchip.com
Quoted 29 lines · Stefan Roese
External E-Mail
This patch enables and starts the watchdog on the AT91 platform if configured. Currently the WD timeout is configured to 16 seconds, which is the longest value for this timer.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
arch/arm/mach-at91/clock.c| 41
++++++++++++++++++++++++++++++++++++++1 file changed, 41 insertions(+)arch/arm/mach-at91/clock.c +2
-0@@ -5,6 +5,8 @@*/ #include <common.h> +#include <dm.h> +#include <wdt.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pmc.h>arch/arm/mach-at91/clock.c void at91_pllicpr_init(u32 icpr) · line 123
Quoted 4 lines
arch/arm/mach-at91/clock.c +2
-0@@ -118,3 +120,42 @@ void at91_pllicpr_init(u32 icpr) writel(icpr, &pmc->pllicpr); } + +#if defined(CONFIG_WATCHDOG ) && !defined(CONFIG_SPL_BUILD )Hi Stefan,
Does this mean that for
CONFIG_SPL_BUILD, this functions won't exist, thus the SPL cannot use the watchdog ?For example, configuring
CONFIG_SPL_WATCHDOG_SUPPORT=ymakes SPL build fail :Quoted 10 lines
drivers/built-in.o: In function `atmel_nand_pmecc_write_page':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:592: undefined reference to `watchdog_reset'drivers/built-in.o: In function `atmel_nand_pmecc_read_page':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:552: undefined reference to `watchdog_reset'drivers/built-in.o: In function `pmecc_err_location':/home/eugen/u-boot-denx/drivers/mtd/nand/raw/atmel_nand.c:416: undefined reference to `watchdog_reset'scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
Quoted 3 lines
Let me see, if I can change this so that this code is available if selected in SPL as well. Even though
arch_misc_init()will not be called, so the watchdog will not be started.
It should at least build :)
Quoted 3 lines
But the code looks cleaner without this #ifdef and if you agree, I will send v2 soon with this change.
I did not have time to review all the patch series yet. So more reviews will follow
Quoted 41 lines
Quoted 32 lines
Quoted 32 lines
arch/arm/mach-at91/clock.c +30
-0+static struct udevice *watchdog_dev; + +/* Called by macro WATCHDOG_RESET */ +void watchdog_reset (void ) +{ + static ulong next_reset; + ulong now; + + if (!watchdog_dev) + return; + + now = get_timer(0); + + /* Do not reset the watchdog too often */ + if (now > next_reset) { + next_reset = now + 1000; /* reset every 1000ms */ + wdt_reset(watchdog_dev); + } +} + +int arch_misc_init (void ) +{ + /* Init watchdog */ + if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) { + debug("Watchdog: Not found by seq!\n"); + if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) { + puts("Watchdog: Not found!\n"); + return 0; + } + }Quoted 8 lines
arch/arm/mach-at91/clock.c void at91_pllicpr_init(u32 icpr) · line 158
Quoted 4 lines
arch/arm/mach-at91/clock.c +4
-0+ + wdt_start(watchdog_dev, 16000, 0); /* 16 seconds is max */ + printf("Watchdog: Started\n"); +Any reason why you use printf and puts and debug in the same function ? Would expect to see debug everywhere except some fatal error that should be printed all the time.
Quoted 3 lines
Good catch. This is copy-pasted from other very similar implementations. I personally find this last status message "Watchdog: Started" quite useful and would like to keep it. All others might be changed to
debug().
I do not mind if you keep it
Eugen
Quoted 3 lines
Thanks,
Stefan
PATCH 7/11 arm: at91: arm926ejs/u-boot-spl.lds: Add _image_binary_end to SPL lds
In reply to Stefan RoeseThis patch adds _image_binary_end to the SPL linker script. This will be used be the upcoming GARDENA AT91SAM based platform, which uses DT in SPL and configures CONFIGURE_SPL_SEPARATE_BSS.
--- arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-at91/arm926ejs/u-boot-spl.lds +2 -0
@@ -39,6 +39,8 @@ SECTIONS *(.__end) } >.sram + _image_binary_end = .; + .bss : { . = ALIGN(4);
Signature · 1 line
2.21.0
PATCH 8/11 Makefile.spl: Move generate AT91SAM NAND image boot.bin to spl directory
In reply to Stefan RoeseThis patch moves the AT91SAM NAND booting SPL image "boot.bin" which includes the ECC values from the root directory into the spl directory, where all SPL related images are located.
--- scripts/Makefile.spl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/Makefile.spl +3 -3
@@ -179,10 +179,10 @@ MKIMAGEFLAGS_boot.bin = -T atmelimage ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y) MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params) -boot.bin: $(obj)/../tools/atmel_pmecc_params +$(obj)/boot.bin: $(obj)/../tools/atmel_pmecc_params endif -boot.bin: $(obj)/u-boot-spl.bin FORCE +$(obj)/boot.bin: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) else ifdef CONFIG_ARCH_ZYNQ
@@ -225,7 +225,7 @@ endif endif ifeq ($(CONFIG_SYS_SOC),"at91") -ALL-y += boot.bin +ALL-y += $(obj)/boot.bin endif ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-16bit-spl.bin
Signature · 1 line
2.21.0
PATCH 8/11 Makefile.spl: Move generate AT91SAM NAND image boot.bin to spl directory
Quoted 6 lines · Stefan Roese
External E-Mail
This patch moves the AT91SAM NAND booting SPL image "boot.bin" which includes the ECC values from the root directory into the spl directory, where all SPL related images are located.
Hi Stefan,
Yes, indeed, but someone may be using this fact? Removing it might break someone's expectations (scripts). Can we make a copy to spl/ dir and leave the boot.bin in the root as-is ?
Unless someone has objections of course...
Eugen
Quoted 36 lines
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- scripts/Makefile.spl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)scripts/Makefile.spl +3
-3@@ -179,10 +179,10 @@ MKIMAGEFLAGS_boot.bin = -T atmelimage ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y) MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params) -boot.bin: $(obj)/../tools/atmel_pmecc_params +$(obj)/boot.bin: $(obj)/../tools/atmel_pmecc_params endif -boot.bin: $(obj)/u-boot-spl.bin FORCE +$(obj)/boot.bin: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) else ifdef CONFIG_ARCH_ZYNQ@@ -225,7 +225,7 @@ endif endif ifeq ($(CONFIG_SYS_SOC),"at91") -ALL-y += boot.bin +ALL-y += $(obj)/boot.bin endif ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-16bit-spl.bin
PATCH 8/11 Makefile.spl: Move generate AT91SAM NAND image boot.bin to spl directory
Quoted 10 lines · Eugen.Hristev at microchip.com
Quoted 6 lines · Stefan Roese
External E-Mail
This patch moves the AT91SAM NAND booting SPL image "boot.bin" which includes the ECC values from the root directory into the spl directory, where all SPL related images are located.
Quoted 5 lines
Hi Stefan,
Yes, indeed, but someone may be using this fact? Removing it might break someone's expectations (scripts). Can we make a copy to spl/ dir and leave the boot.bin in the root as-is ?
That would be possible, but I find the solution to move the file to the correct directory cleaner / better. Who uses this image? I'm pretty sure that Heiko does.
Heiko, do you have any comments on this SPL binary file move? Is somebody else using it?
Thanks,
Stefan
Quoted 33 lines
Unless someone has objections of course...
Eugen
Quoted 29 lines
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>--- scripts/Makefile.spl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)scripts/Makefile.spl +2
-2@@ -179,10 +179,10 @@ MKIMAGEFLAGS_boot.bin = -T atmelimage ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y) MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params) -boot.bin: $(obj)/../tools/atmel_pmecc_params +$(obj)/boot.bin: $(obj)/../tools/atmel_pmecc_params endif -boot.bin: $(obj)/u-boot-spl.bin FORCE +$(obj)/boot.bin: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) else ifdef CONFIG_ARCH_ZYNQ@@ -225,7 +225,7 @@ endif endif
Quoted 7 lines
scripts/Makefile.spl endif · line 231
Quoted 7 lines
scripts/Makefile.spl +1
-1ifeq ($(CONFIG_SYS_SOC),"at91") -ALL-y += boot.bin +ALL-y += $(obj)/boot.bin endif ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-16bit-spl.bin
Viele Grüße,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 8/11 Makefile.spl: Move generate AT91SAM NAND image boot.bin to spl directory
Hello Stefan,
Am 25.03.2019 um 15:24 schrieb Stefan Roese:
Quoted 17 lines · Eugen.Hristev at microchip.com
Quoted 10 lines · Stefan Roese
Quoted 6 lines
External E-Mail
This patch moves the AT91SAM NAND booting SPL image "boot.bin" which includes the ECC values from the root directory into the spl directory, where all SPL related images are located.
Quoted 5 lines
Hi Stefan,
Yes, indeed, but someone may be using this fact? Removing it might break someone's expectations (scripts). Can we make a copy to spl/ dir and leave the boot.bin in the root as-is ?
Quoted 6 lines
That would be possible, but I find the solution to move the file to the correct directory cleaner / better. Who uses this image? I'm pretty sure that Heiko does.
Heiko, do you have any comments on this SPL binary file move? Is somebody else using it?
I am fine with this move, as I also think, spl directory is the correct place for it. Yes, I have some scripts, but they are fixed very fast.
bye,
Heiko
Quoted 44 lines
Thanks,
StefanQuoted 28 lines
Unless someone has objections of course...
Eugen
Quoted 24 lines
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
scripts/Makefile.spl| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)scripts/Makefile.spl +1
-1@@ -179,10 +179,10 @@ MKIMAGEFLAGS_boot.bin = -T atmelimage ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y) MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params) -boot.bin: $(obj)/../tools/atmel_pmecc_params +$(obj)/boot.bin: $(obj)/../tools/atmel_pmecc_paramsendif
-boot.bin: $(obj)/u-boot-spl.bin FORCE
+$(obj)/boot.bin: $(obj)/u-boot-spl.bin FORCE
$(call if_changed,mkimage)
else
ifdefCONFIG_ARCH_ZYNQQuoted 8 lines
Quoted 8 lines
scripts/Makefile.spl +0
-0@@ -225,7 +225,7 @@ endifendif
ifeq ($(CONFIG_SYS_SOC),"at91")scripts/Makefile.spl +1
-1-ALL-y += boot.bin +ALL-y += $(obj)/boot.binendif
ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-16bit-spl.binViele Grüße,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
PATCH 9/11 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
In reply to Stefan RoeseThis patch adds the CONFIG_SPL_IMAGE option to select the SPL image that shall be used to generate the combined SPL + U-Boot image. The default value is the current value "spl/u-boot-spl.bin".
This patch also sets CONFIG_SPL_IMAGE to "spl/boot.bin" for AT91 targets which use SPL NAND support (boot from NAND).
--- Kconfig | 10 ++++++++++ Makefile | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-)
Kconfig +10 -0
@@ -224,6 +224,15 @@ config BUILD_ROM which are not shipped in the U-Boot source tree. Please, see doc/README.x86 for details. +config SPL_IMAGE + string "SPL image filename that is generated" + default "spl/boot.bin" if ARCH_AT91 && SPL_NAND_SUPPORT + default "spl/u-boot-spl.bin" + help + The SPL image filename that is generated by the build process. + This image might be used to generated a combined image with + SPL and main U-Boot proper as well. + config BUILD_TARGET string "Build target special images" default "u-boot-with-spl.sfp" if ARCH_SOCFPGA
@@ -231,6 +240,7 @@ config BUILD_TARGET default "u-boot-elf.srec" if RCAR_GEN3 default "u-boot.itb" if SPL_LOAD_FIT && ARCH_SUNXI default "u-boot.kwb" if KIRKWOOD + default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT help Some SoCs need special image types (e.g. U-Boot binary with a special header) as build targets. By defining
Makefile +3 -1
@@ -1219,9 +1219,11 @@ else SPL_PAYLOAD := u-boot.bin endif +SPL_IMAGE := $(CONFIG_SPL_IMAGE:"%"=%) + OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \ --pad-to=$(CONFIG_SPL_PAD_TO) -u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE +u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE $(call if_changed,pad_cat) ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
Signature · 1 line
2.21.0
PATCH 10/11 arm: at91: siemens: Add support to generate combined SPL+U-Boot image
In reply to Stefan RoeseThis patch adds the necessary defines to the Siemens AT91SAM based boards (smartweb, corvus and taurus) to generate the combined binary image with SPL and main U-Boot image combined (u-boot-with-spl.bin).
--- include/configs/corvus.h | 3 +++ include/configs/smartweb.h | 4 ++++ include/configs/taurus.h | 3 +++ 3 files changed, 10 insertions(+)
include/configs/corvus.h +3 -0
@@ -139,4 +139,7 @@#define CONFIG_SYS_MCKR 0x1301#define CONFIG_SYS_MCKR_CSS 0x1302 +#define CONFIG_SPL_PAD_TO CONFIG_SYS_NAND_U_BOOT_OFFS +#define CONFIG_SYS_SPL_LEN CONFIG_SPL_PAD_TO +#endif
include/configs/smartweb.h +4 -0
@@ -221,4 +221,8 @@#define CONFIG_SYS_ICACHE_OFF #define CONFIG_SYS_DCACHE_OFF #endif + +#define CONFIG_SPL_PAD_TO CONFIG_SYS_NAND_U_BOOT_OFFS +#define CONFIG_SYS_SPL_LEN CONFIG_SPL_PAD_TO +#endif /* __CONFIG_H */
include/configs/taurus.h +3 -0
@@ -177,4 +177,7 @@#define CONFIG_SYS_MCKR_CSS (0x02 | CONFIG_SYS_MCKR)#define CONFIG_SYS_AT91_PLLB 0x10193F05 +#define CONFIG_SPL_PAD_TO CONFIG_SYS_NAND_U_BOOT_OFFS +#define CONFIG_SYS_SPL_LEN CONFIG_SPL_PAD_TO +#endif
Signature · 1 line
2.21.0
PATCH 11/11 arm: at91: Add gardena-gateway-at91sam support
In reply to Stefan RoeseThe GARDENA smart Gateway boards are equipped with an Atmel / Microchip AT91SAM9G25 SoC and with 128 MiB of RAM and 256 MiB of NAND storage. This patch adds support for this board including SPL support. Therefore the AT91Boostrap is not needed on this platform any more.
--- .../arm/dts/gardena-smart-gateway-at91sam.dts | 104 ++++++++++++++ arch/arm/mach-at91/Kconfig | 8 ++ board/gardena/smart-gateway-at91sam/Kconfig | 12 ++ .../gardena/smart-gateway-at91sam/MAINTAINERS | 7 + board/gardena/smart-gateway-at91sam/Makefile | 7 + board/gardena/smart-gateway-at91sam/board.c | 59 ++++++++ board/gardena/smart-gateway-at91sam/spl.c | 135 ++++++++++++++++++ .../gardena-smart-gateway-at91sam_defconfig | 84 +++++++++++ .../configs/gardena-smart-gateway-at91sam.h | 88 ++++++++++++ 9 files changed, 504 insertions(+) create mode 100644 arch/arm/dts/gardena-smart-gateway-at91sam.dts create mode 100644 board/gardena/smart-gateway-at91sam/Kconfig create mode 100644 board/gardena/smart-gateway-at91sam/MAINTAINERS create mode 100644 board/gardena/smart-gateway-at91sam/Makefile create mode 100644 board/gardena/smart-gateway-at91sam/board.c create mode 100644 board/gardena/smart-gateway-at91sam/spl.c create mode 100644 configs/gardena-smart-gateway-at91sam_defconfig create mode 100644 include/configs/gardena-smart-gateway-at91sam.h
arch/arm/dts/gardena-smart-gateway-at91sam.dts new file +104 -0
@@ -0,0 +1,104 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Device Tree file for the GARDENA smart Gateway (AT91SAM) + * + * Copyright (C) 2012 Atmel, + * 2012 Nicolas Ferre <[email protected]> + */ + +/dts-v1/; + +#include "at91sam9g25.dtsi" +#include "at91sam9x5ek.dtsi" + +/ { + model = "GARDENA smart Gateway (AT91SAM)"; + compatible = "gardena,smart-gateway-at91sam", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; + + memory { + reg = <0x20000000 0x8000000>; + }; + + leds { + compatible = "gpio-leds"; + + power_blue { + label = "smartgw:power:blue"; + gpios = <&pioC 21 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + power_green { + label = "smartgw:power:green"; + gpios = <&pioC 20 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + power_red { + label = "smartgw:power:red"; + gpios = <&pioC 19 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + radio_blue { + label = "smartgw:radio:blue"; + gpios = <&pioC 18 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + radio_green { + label = "smartgw:radio:green"; + gpios = <&pioC 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + radio_red { + label = "smartgw:radio:red"; + gpios = <&pioC 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + internet_blue { + label = "smartgw:internet:blue"; + gpios = <&pioC 15 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + internet_green { + label = "smartgw:internet:green"; + gpios = <&pioC 14 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + internet_red { + label = "smartgw:internet:red"; + gpios = <&pioC 13 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; +}; + +&dbgu { + status = "okay"; +}; + +&macb0 { + phy-mode = "rmii"; + status = "okay"; +}; + +&mmc0 { + status = "disabled"; +}; + +&mmc1 { + status = "disabled"; +}; + +&nand0 { + status = "okay"; +}; + +&spi0 { + status = "disabled"; +};
arch/arm/mach-at91/Kconfig +8 -0
@@ -147,6 +147,13 @@ config TARGET_AT91SAM9X5EK select BOARD_LATE_INIT select SUPPORT_SPL +config TARGET_GARDENA_SMART_GATWAY_AT91SAM + bool "GARDENA smart Gateway (AT91SAM)" + select AT91SAM9X5 + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + select SUPPORT_SPL + config TARGET_SAMA5D2_PTC_EK bool "SAMA5D2 PTC EK board" select BOARD_EARLY_INIT_F
@@ -283,6 +290,7 @@ source "board/bluewater/snapper9260/Kconfig" source "board/calao/usb_a9263/Kconfig" source "board/egnite/ethernut5/Kconfig" source "board/esd/meesc/Kconfig" +source "board/gardena/smart-gateway-at91sam/Kconfig" source "board/l+g/vinco/Kconfig" source "board/mini-box/picosam9g45/Kconfig" source "board/ronetix/pm9261/Kconfig"
board/gardena/smart-gateway-at91sam/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if TARGET_GARDENA_SMART_GATWAY_AT91SAM + +config SYS_BOARD + default "smart-gateway-at91sam" + +config SYS_VENDOR + default "gardena" + +config SYS_CONFIG_NAME + default "gardena-smart-gateway-at91sam" + +endif
board/gardena/smart-gateway-at91sam/MAINTAINERS new file +7 -0
@@ -0,0 +1,7 @@ +GARDENA_SMART_GATEWAY_AT91SAM BOARD +M: Stefan Roese <[email protected]> +S: Maintained +F: board/gardena/smart-gateway-at91sam/ +F: include/configs/gardena-smart-gateway-at91sam.h +F: configs/gardena-smart-gateway-at91sam_defconfig +F: arch/arm/dts/gardena-smart-gateway-at91sam.dts
board/gardena/smart-gateway-at91sam/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += board.o + +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +endif
board/gardena/smart-gateway-at91sam/board.c new file +59 -0
59 lines not on this page · raw message
board/gardena/smart-gateway-at91sam/spl.c new file +135 -0
135 lines not on this page · raw message
configs/gardena-smart-gateway-at91sam_defconfig new file +84 -0
84 lines not on this page · raw message
include/configs/gardena-smart-gateway-at91sam.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.21.0