arm: at91: Makefile: Compile lowlevel_init only when really necessary
Subsystems (5)
PATCH v3 1/13 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.
Tested on the taurus board:
---
v3:
- No change
v2:
- No change
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 v3 2/13 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.
Tested on the taurus board:
---
v3:
- No change
v2:
- No change
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 v3 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
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.
Please note that this fixed clock support is only added to the SPL code in the DM_SERIAL part of this file. All boards not using SPL & DM_SERIAL should not be affected.
This patch also introduces CONFIG_SPL_UART_CLOCK for the fixed UART input clock. It defaults to 132096000 for ARCH_AT91 but can be set to a different value if needed.
Tested on the taurus board:
---
v3:
- Depend fixed clock atmel_serial_enable_clk() function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- Introcude CONFIG_SPL_UART_CLOCK and use this Kconfig option instead of the hardcoded value
v2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL and DM_SERIAL enabled
drivers/serial/Kconfig | 9 +++++++++ drivers/serial/atmel_usart.c | 12 ++++++++++++ 2 files changed, 21 insertions(+)
drivers/serial/Kconfig +9 -0
@@ -508,6 +508,15 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node. +config SPL_UART_CLOCK + int "SPL fixed UART input clock" + depends on SPL + default 132096000 if ARCH_AT91 + help + Provide a fixed clock value as input to the UART controller. This + might be needed on platforms which can't enable CONFIG_SPL_CLK + because of SPL image size restirctions. + config BCM283X_MU_SERIAL bool "Support for BCM283x Mini-UART" depends on DM_SERIAL && ARCH_BCM283X
drivers/serial/atmel_usart.c +12 -0
@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#if defined(CONFIG_SPL_BUILD ) && !defined(CONFIG_SPL_CLK ) +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 =CONFIG_SPL_UART_CLOCK ; + +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 v3 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Quoted 40 lines · Stefan Roese
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.Please note that this fixed clock support is only added to the SPL code in the
DM_SERIALpart of this file. All boards not using SPL &DM_SERIALshould not be affected.This patch also introduces
CONFIG_SPL_UART_CLOCKfor the fixed UART input clock. It defaults to 132096000 forARCH_AT91but can be set to a different value if needed.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested on the taurus board:
Tested-by Heiko Schocher <[email protected]>---
v3:
- Depend fixed clockatmel_serial_enable_clk()function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- IntrocudeCONFIG_SPL_UART_CLOCKand use thisKconfigoption instead of the hardcoded valuev2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL andDM_SERIALenableddrivers/serial/Kconfig | 9 +++++++++ drivers/serial/atmel_usart.c | 12 ++++++++++++ 2 files changed, 21 insertions(+)drivers/serial/Kconfig +0
-0
drivers/serial/Kconfig config ATMEL_USART · line 514
Quoted 7 lines
drivers/serial/Kconfig +4
-0@@ -508,6 +508,15 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node. +config SPL_UART_CLOCK + int "SPL fixed UART input clock" + depends on SPL + default 132096000 if ARCH_AT91
Hi Stefan,
This doesn't look good. This has to be unset for the platforms that do not specifically set it.
For example, when I build the sama5d2_xplained_mmc_defconfig, I look in .config and :
CONFIG_SPL_UART_CLOCK=132096000
This may be unused, but it's confusing
Can you make this default unset and then specifically set it in the boards that need it ? ( the specific defconfig )
And if you have a mutual exclusion with CONFIG_SPL_CLK can we make it somehow ? (in a menu or choice..., either old behavior or fixed uart clock)
Does this make sense?
Thanks
Quoted 39 lines
drivers/serial/Kconfig +5
-0+ help + Provide a fixed clock value as input to the UART controller. This + might be needed on platforms which can't enable CONFIG_SPL_CLK + because of SPL image size restirctions. + config BCM283X_MU_SERIAL bool "Support for BCM283x Mini-UART" depends on DM_SERIAL && ARCH_BCM283Xdrivers/serial/atmel_usart.c +12
-0@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#if defined(CONFIG_SPL_BUILD ) && !defined(CONFIG_SPL_CLK ) +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 =CONFIG_SPL_UART_CLOCK ; + +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 v3 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Hi Eugen,
Quoted 57 lines · Eugen.Hristev at microchip.com
Quoted 40 lines · Stefan Roese
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.Please note that this fixed clock support is only added to the SPL code in the
DM_SERIALpart of this file. All boards not using SPL &DM_SERIALshould not be affected.This patch also introduces
CONFIG_SPL_UART_CLOCKfor the fixed UART input clock. It defaults to 132096000 forARCH_AT91but can be set to a different value if needed.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested on the taurus board:
Tested-by Heiko Schocher <[email protected]>---
v3:
- Depend fixed clockatmel_serial_enable_clk()function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- IntrocudeCONFIG_SPL_UART_CLOCKand use thisKconfigoption instead of the hardcoded valuev2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL andDM_SERIALenableddrivers/serial/Kconfig | 9 +++++++++ drivers/serial/atmel_usart.c | 12 ++++++++++++ 2 files changed, 21 insertions(+)drivers/serial/Kconfig +0
-0drivers/serial/Kconfig config ATMEL_USART · line 514
Quoted 7 lines
drivers/serial/Kconfig +4
-0@@ -508,6 +508,15 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node. +config SPL_UART_CLOCK + int "SPL fixed UART input clock" + depends on SPL + default 132096000 if ARCH_AT91Hi Stefan,
This doesn't look good. This has to be unset for the platforms that do not specifically set it.
Quoted 6 lines
For example, when I build the
sama5d2_xplained_mmc_defconfig, I look in .config and :
CONFIG_SPL_UART_CLOCK=132096000This may be unused, but it's confusing
Okay, I agree.
Quoted 5 lines
Can you make this default unset and then specifically set it in the boards that need it ? ( the specific defconfig )
And if you have a mutual exclusion with
CONFIG_SPL_CLKcan we make it somehow ? (in a menu or choice..., either old behavior or fixed uart clock)
How about this version?
config SPL_UART_CLOCK
int "SPL fixed UART input clock"
depends on SPL && !SPL_CLK
help
Provide a fixed clock value as input to the UART controller. This might be needed on platforms which can't enable CONFIG_SPL_CLK because of SPL image size restirctions.
Thanks,
Stefan
PATCH v3 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Quoted 79 lines · Stefan Roese
External E-Mail
Hi Eugen,
Quoted 55 lines · Eugen.Hristev at microchip.com
Quoted 39 lines · Stefan Roese
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.Please note that this fixed clock support is only added to the SPL code in the
DM_SERIALpart of this file. All boards not using SPL &DM_SERIALshould not be affected.This patch also introduces
CONFIG_SPL_UART_CLOCKfor the fixed UART input clock. It defaults to 132096000 forARCH_AT91but can be set to a different value if needed.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested on the taurus board:
Tested-by Heiko Schocher <[email protected]>---
v3:
- Depend fixed clockatmel_serial_enable_clk()function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- IntrocudeCONFIG_SPL_UART_CLOCKand use thisKconfigoption instead of the hardcoded valuev2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL andDM_SERIALenabled drivers/serial/Kconfig | 9 +++++++++drivers/serial/atmel_usart.c| 12 ++++++++++++2 files changed, 21 insertions(+)drivers/serial/Kconfig +0
-0@@ -508,6 +508,15 @@ config ATMEL_USARTQuoted 6 lines
configured in the device tree, and input clock frequency can be got from the clk node.
+configSPL_UART_CLOCK
+ int "SPL fixed UART input clock"
+ depends on SPL
+ default 132096000 ifARCH_AT91Hi Stefan,
This doesn't look good. This has to be unset for the platforms that do not specifically set it.
Quoted 6 lines
For example, when I build the
sama5d2_xplained_mmc_defconfig, I look in .config and :
CONFIG_SPL_UART_CLOCK=132096000This may be unused, but it's confusing
Okay, I agree.
Quoted 6 lines
Can you make this default unset and then specifically set it in the boards that need it ? ( the specific defconfig )
And if you have a mutual exclusion with
CONFIG_SPL_CLKcan we make it somehow ? (in a menu or choice..., either old behavior or fixed uart clock)How about this version?
Quoted 7 lines
config
SPL_UART_CLOCK
int "SPL fixed UART input clock"
depends on SPL && !SPL_CLK
help
Provide a fixed clock value as input to the UART controller. This might be needed on platforms which can't enableCONFIG_SPL_CLKbecause of SPL image size restirctions.
Looks much better. Typo on restrictirions
Can also add some default then, to not break build in case someone disables SPL_CLK but does not set SPL_UART_CLOCK ?
Thanks !
Quoted 3 lines
Thanks,
Stefan
PATCH v4 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
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.
Please note that this fixed clock support is only added to the SPL code in the DM_SERIAL part of this file. All boards not using SPL & DM_SERIAL should not be affected.
This patch also introduces CONFIG_SPL_UART_CLOCK for the fixed UART input clock. It defaults to 132096000 for ARCH_AT91 but can be set to a different value if needed.
---
v4:
- Restrict SPL_UART_CLOCK on SPL && !SPL_CLK
- Provide default value for non AT91 platforms to not break the build
- Fix typo in Kconfig text
v3:
- Depend fixed clock atmel_serial_enable_clk() function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- Introcude CONFIG_SPL_UART_CLOCK and use this Kconfig option instead of the hardcoded value
v2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL and DM_SERIAL enabled
drivers/serial/Kconfig | 10 ++++++++++ drivers/serial/atmel_usart.c | 12 ++++++++++++ 2 files changed, 22 insertions(+)
drivers/serial/Kconfig +10 -0
@@ -508,6 +508,16 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node. +config SPL_UART_CLOCK + int "SPL fixed UART input clock" + depends on SPL && !SPL_CLK + default 132096000 if ARCH_AT91 + default 0 + help + Provide a fixed clock value as input to the UART controller. This + might be needed on platforms which can't enable CONFIG_SPL_CLK + because of SPL image size restrictions. + config BCM283X_MU_SERIAL bool "Support for BCM283x Mini-UART" depends on DM_SERIAL && ARCH_BCM283X
drivers/serial/atmel_usart.c +12 -0
@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#if defined(CONFIG_SPL_BUILD ) && !defined(CONFIG_SPL_CLK ) +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 =CONFIG_SPL_UART_CLOCK ; + +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 v4 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Quoted 46 lines · Stefan Roese
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.Please note that this fixed clock support is only added to the SPL code in the
DM_SERIALpart of this file. All boards not using SPL &DM_SERIALshould not be affected.This patch also introduces
CONFIG_SPL_UART_CLOCKfor the fixed UART input clock. It defaults to 132096000 forARCH_AT91but can be set to a different value if needed.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
v4:
- RestrictSPL_UART_CLOCKon SPL && !SPL_CLK
- Provide default value for non AT91 platforms to not break the build
- Fix typo inKconfigtextv3:
- Depend fixed clockatmel_serial_enable_clk()function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- IntrocudeCONFIG_SPL_UART_CLOCKand use thisKconfigoption instead of the hardcoded valuev2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL andDM_SERIALenableddrivers/serial/Kconfig | 10 ++++++++++ drivers/serial/atmel_usart.c | 12 ++++++++++++ 2 files changed, 22 insertions(+)drivers/serial/Kconfig +0
-0@@ -508,6 +508,16 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node.
drivers/serial/Kconfig config ATMEL_USART · line 520
Quoted 10 lines
drivers/serial/Kconfig +10
-0+config SPL_UART_CLOCK + int "SPL fixed UART input clock" + depends on SPL && !SPL_CLK + default 132096000 if ARCH_AT91 + default 0 + help + Provide a fixed clock value as input to the UART controller. This + might be needed on platforms which can't enable CONFIG_SPL_CLK + because of SPL image size restrictions. +
Hi Stefan,
Looking again over this, the Kconfig you added is useless and has no effect unless ATMEL_USART driver...
Can you make it to depend on atmel usart or be named ATMEL_SPL_UART_CLOCK if this is not needed for anything else whatsoever (no other platforms/drivers)
This way nobody gets confused that by enabling this Kconfig on their platform, something changes (like a fixed clock for their serial in SPL, which will not happen).
Eugen
Quoted 34 lines
drivers/serial/Kconfig +0
-0config BCM283X_MU_SERIAL bool "Support for BCM283x Mini-UART" depends on DM_SERIAL && ARCH_BCM283Xdrivers/serial/atmel_usart.c +12
-0@@ -218,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = { .setbrg = atmel_serial_setbrg, }; +#if defined(CONFIG_SPL_BUILD ) && !defined(CONFIG_SPL_CLK ) +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 =CONFIG_SPL_UART_CLOCK ; + +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 v4 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Hi Eugen,
Quoted 62 lines · Eugen.Hristev at microchip.com
Quoted 46 lines · Stefan Roese
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.Please note that this fixed clock support is only added to the SPL code in the
DM_SERIALpart of this file. All boards not using SPL &DM_SERIALshould not be affected.This patch also introduces
CONFIG_SPL_UART_CLOCKfor the fixed UART input clock. It defaults to 132096000 forARCH_AT91but can be set to a different value if needed.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
v4:
- RestrictSPL_UART_CLOCKon SPL && !SPL_CLK
- Provide default value for non AT91 platforms to not break the build
- Fix typo inKconfigtextv3:
- Depend fixed clockatmel_serial_enable_clk()function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- IntrocudeCONFIG_SPL_UART_CLOCKand use thisKconfigoption instead of the hardcoded valuev2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL andDM_SERIALenableddrivers/serial/Kconfig | 10 ++++++++++ drivers/serial/atmel_usart.c | 12 ++++++++++++ 2 files changed, 22 insertions(+)drivers/serial/Kconfig +0
-0@@ -508,6 +508,16 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node.drivers/serial/Kconfig config ATMEL_USART · line 520
Quoted 10 lines
drivers/serial/Kconfig +10
-0+config SPL_UART_CLOCK + int "SPL fixed UART input clock" + depends on SPL && !SPL_CLK + default 132096000 if ARCH_AT91 + default 0 + help + Provide a fixed clock value as input to the UART controller. This + might be needed on platforms which can't enable CONFIG_SPL_CLK + because of SPL image size restrictions. +Hi Stefan,
Quoted 8 lines
Looking again over this, the
Kconfigyou added is useless and has no effect unlessATMEL_USARTdriver...
Can you make it to depend on atmel usart or be namedATMEL_SPL_UART_CLOCKif this is not needed for anything else whatsoever (no other platforms/drivers)
This way nobody gets confused that by enabling thisKconfigon their platform, something changes (like a fixed clock for their serial in SPL, which will not happen).
My first intention was to add this Kconfig option as a generic one, which can be used by other (non-AT91) platforms as well. This is the reasoning for its name and the non-exclusive availability.
But I have no hard feelings here. If nobody sees any use of this Kconfig option on other platforms (hard for us to guess), then I can definitely make your suggested changes from above.
Thanks,
Stefan
PATCH v4 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Quoted 72 lines · Stefan Roese
Hi Eugen,
Quoted 60 lines · Eugen.Hristev at microchip.com
Quoted 44 lines · Stefan Roese
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.Please note that this fixed clock support is only added to the SPL code in the
DM_SERIALpart of this file. All boards not using SPL &DM_SERIALshould not be affected.This patch also introduces
CONFIG_SPL_UART_CLOCKfor the fixed UART input clock. It defaults to 132096000 forARCH_AT91but can be set to a different value if needed.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
v4:
- RestrictSPL_UART_CLOCKon SPL && !SPL_CLK
- Provide default value for non AT91 platforms to not break the build
- Fix typo inKconfigtextv3:
- Depend fixed clockatmel_serial_enable_clk()function also on !CONFIG_SPL_CLK so that board with full clocj support in SPL can still use the normal function here
- IntrocudeCONFIG_SPL_UART_CLOCKand use thisKconfigoption instead of the hardcoded valuev2:
- Reword patch subject and commit text to make it more clear, that this change only affects ports with SPL andDM_SERIALenabled drivers/serial/Kconfig | 10 ++++++++++drivers/serial/atmel_usart.c| 12 ++++++++++++2 files changed, 22 insertions(+)drivers/serial/Kconfig +0
-0@@ -508,6 +508,16 @@ config ATMEL_USARTconfigured in the device tree, and input clock frequency can be got from the clk node.
drivers/serial/Kconfig config ATMEL_USART · line 520
Quoted 10 lines
drivers/serial/Kconfig +10
-0+config SPL_UART_CLOCK + int "SPL fixed UART input clock" + depends on SPL && !SPL_CLK + default 132096000 if ARCH_AT91 + default 0 + help + Provide a fixed clock value as input to the UART controller. This + might be needed on platforms which can't enable CONFIG_SPL_CLK + because of SPL image size restrictions. +Hi Stefan,
Quoted 8 lines
Looking again over this, the
Kconfigyou added is useless and has no effect unlessATMEL_USARTdriver...
Can you make it to depend on atmel usart or be namedATMEL_SPL_UART_CLOCKif this is not needed for anything else whatsoever (no other platforms/drivers)
This way nobody gets confused that by enabling thisKconfigon their platform, something changes (like a fixed clock for their serial in SPL, which will not happen).
Quoted 8 lines
My first intention was to add this
Kconfigoption as a generic one, which can be used by other (non-AT91) platforms as well. This is the reasoning for its name and the non-exclusive availability.But I have no hard feelings here. If nobody sees any use of this
Kconfigoption on other platforms (hard for us to guess), then I can definitely make your suggested changes from above.
Makes sense, but as it is now, it has no effect on other platforms. So I think it's best to make it a generic name indeed, but dependent on ATMEL_USART then... and other platforms can add their dependency once and if they implement it.
Sounds good to you ?
Quoted 2 lines
Thanks,
Stefan
PATCH v4 3/13 serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Hi Eugen,
On 03.04.19 13:05, Eugen.Hristev at microchip.com wrote:
<snip>
Quoted 18 lines
Quoted 9 lines
Quoted 8 lines
Looking again over this, the
Kconfigyou added is useless and has no effect unlessATMEL_USARTdriver...
Can you make it to depend on atmel usart or be namedATMEL_SPL_UART_CLOCKif this is not needed for anything else whatsoever (no other platforms/drivers)
This way nobody gets confused that by enabling thisKconfigon their platform, something changes (like a fixed clock for their serial in SPL, which will not happen).Quoted 8 lines
My first intention was to add this
Kconfigoption as a generic one, which can be used by other (non-AT91) platforms as well. This is the reasoning for its name and the non-exclusive availability.But I have no hard feelings here. If nobody sees any use of this
Kconfigoption on other platforms (hard for us to guess), then I can definitely make your suggested changes from above.
Quoted 6 lines
Makes sense, but as it is now, it has no effect on other platforms. So I think it's best to make it a generic name indeed, but dependent on
ATMEL_USARTthen... and other platforms can add their dependency once and if they implement it.Sounds good to you ?
Yes, I'm perfectly fine with this approach. I'll send v5 of this patch soon.
Thanks,
Stefan
PATCH v3 4/13 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.
Tested on the taurus board:
---
v3:
- No change
v2:
- No change
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 v3 5/13 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.
Tested on the taurus board:
---
v3:
- No change
v2:
- No change
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 v3 6/13 arm: at91: Remove CONFIG_AT91_HW_WDT_TIMEOUT
In reply to Stefan RoeseThis patch removes the CONFIG_AT91_HW_WDT_TIMEOUT as its not needed any more. The WD timeout value can be provided via the "timeout-sec" DT property. If not provided this way, the default value of 2 seconds will be used.
---
v3:
- New patch
README | 3 --- configs/smartweb_defconfig | 1 - configs/taurus_defconfig | 1 - drivers/watchdog/Kconfig | 4 ---- drivers/watchdog/at91sam9_wdt.c | 2 -- 5 files changed, 11 deletions(-)
README +0 -3
@@ -767,9 +767,6 @@ The following options need to be configured: SoC, then define this variable and provide board specific code for the "hw_watchdog_reset" function. - CONFIG_AT91_HW_WDT_TIMEOUT - specify the timeout in seconds. default 2 seconds. - - Real-Time Clock: When CONFIG_CMD_DATE is selected, the type of the RTC
configs/smartweb_defconfig +0 -1
@@ -59,6 +59,5 @@ CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_MCS7830=y CONFIG_WDT=y CONFIG_WDT_AT91=y -CONFIG_AT91_HW_WDT_TIMEOUT=y CONFIG_SPL_TINY_MEMSET=y # CONFIG_EFI_LOADER is not set
configs/taurus_defconfig +0 -1
@@ -62,5 +62,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x02d2 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_WDT=y CONFIG_WDT_AT91=y -CONFIG_AT91_HW_WDT_TIMEOUT=y CONFIG_USE_TINY_PRINTF=y
drivers/watchdog/Kconfig +0 -4
@@ -139,10 +139,6 @@ config WDT_AT91 Select this to enable Microchip watchdog timer, which can be found on some AT91 devices. -config AT91_HW_WDT_TIMEOUT - bool "AT91 watchdog timeout specified" - depends on WDT_AT91 - config WDT_MT7621 bool "MediaTek MT7621 watchdog timer support" depends on WDT && ARCH_MT7620
drivers/watchdog/at91sam9_wdt.c +0 -2
@@ -117,11 +117,9 @@ static int at91_wdt_probe(struct udevice *dev)if (!priv->regs)return -EINVAL ; -#ifdef CONFIG_AT91_HW_WDT_TIMEOUT priv->timeout =dev_read_u32_default (dev,"timeout-sec" ,WDT_DEFAULT_TIMEOUT );debug ("%s: timeout %d" , __func__, priv->timeout); -#endif debug ("%s: Probing wdt%u\n" , __func__, dev->seq);
Signature · 1 line
2.21.0
PATCH v3 6/13 arm: at91: Remove CONFIG_AT91_HW_WDT_TIMEOUT
Quoted 80 lines · Stefan Roese
External E-Mail
This patch removes the
CONFIG_AT91_HW_WDT_TIMEOUTas its not needed any more. The WD timeout value can be provided via the "timeout-sec" DT property. If not provided this way, the default value of 2 seconds will be used.Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>---
v3:
- New patchREADME | 3 --- configs/smartweb_defconfig | 1 - configs/taurus_defconfig | 1 - drivers/watchdog/Kconfig | 4 ---- drivers/watchdog/at91sam9_wdt.c | 2 -- 5 files changed, 11 deletions(-)README +0
-3@@ -767,9 +767,6 @@ The following options need to be configured: SoC, then define this variable and provide board specific code for the "hw_watchdog_reset" function. - CONFIG_AT91_HW_WDT_TIMEOUT - specify the timeout in seconds. default 2 seconds. - - Real-Time Clock: When CONFIG_CMD_DATE is selected, the type of the RTCconfigs/smartweb_defconfig +0
-1@@ -59,6 +59,5 @@ CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_MCS7830=y CONFIG_WDT=y CONFIG_WDT_AT91=y -CONFIG_AT91_HW_WDT_TIMEOUT=y CONFIG_SPL_TINY_MEMSET=y # CONFIG_EFI_LOADER is not setconfigs/taurus_defconfig +0
-1@@ -62,5 +62,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x02d2 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_WDT=y CONFIG_WDT_AT91=y -CONFIG_AT91_HW_WDT_TIMEOUT=y CONFIG_USE_TINY_PRINTF=ydrivers/watchdog/Kconfig +0
-4@@ -139,10 +139,6 @@ config WDT_AT91 Select this to enable Microchip watchdog timer, which can be found on some AT91 devices. -config AT91_HW_WDT_TIMEOUT - bool "AT91 watchdog timeout specified" - depends on WDT_AT91 - config WDT_MT7621 bool "MediaTek MT7621 watchdog timer support" depends on WDT && ARCH_MT7620drivers/watchdog/at91sam9_wdt.c +0
-0@@ -117,11 +117,9 @@ static int at91_wdt_probe(struct udevice *dev)if (!priv->regs)
drivers/watchdog/at91sam9_wdt.c static int at91_wdt_probe(struct udevice *dev) · line 125
Quoted 10 lines
drivers/watchdog/at91sam9_wdt.c +0
-2return -EINVAL ; -#ifdef CONFIG_AT91_HW_WDT_TIMEOUT priv->timeout =dev_read_u32_default (dev,"timeout-sec" ,WDT_DEFAULT_TIMEOUT );debug ("%s: timeout %d" , __func__, priv->timeout); -#endif debug ("%s: Probing wdt%u\n" , __func__, dev->seq);
Hi Stefan,
This breaks picosam9g45_defconfig
include/dm/read.h:535: undefined reference to `ofnode_read_u32_default'
arm-linux-gnueabihf-ld.bfd: BFD (Linaro_Binutils-2018.05)
2.28.2.20170706 assertion fail /home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-linux-gnueabihf/snapshots/binutils-gdb.git~users~linaro~binutils-2_28-branch/bfd/elf32-arm.c:9514 Makefile:1497: recipe for target 'u-boot' failed
gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)
PATCH v4 6/13 arm: at91: Remove CONFIG_AT91_HW_WDT_TIMEOUT
In reply to Stefan RoeseThis patch removes the CONFIG_AT91_HW_WDT_TIMEOUT as its not needed any more. The WD timeout value can be provided via the "timeout-sec" DT property. If not provided this way, the default value of 2 seconds will be used.
---
v4:
- Add CONFIG_IS_ENABLED(OF_CONTROL) to DT property read and provide default value for in the non-DT version
v3:
- New patch
README | 3 --- configs/smartweb_defconfig | 1 - configs/taurus_defconfig | 1 - drivers/watchdog/Kconfig | 4 ---- drivers/watchdog/at91sam9_wdt.c | 4 +++- 5 files changed, 3 insertions(+), 10 deletions(-)
README +0 -3
@@ -767,9 +767,6 @@ The following options need to be configured: SoC, then define this variable and provide board specific code for the "hw_watchdog_reset" function. - CONFIG_AT91_HW_WDT_TIMEOUT - specify the timeout in seconds. default 2 seconds. - - Real-Time Clock: When CONFIG_CMD_DATE is selected, the type of the RTC
configs/smartweb_defconfig +0 -1
@@ -59,6 +59,5 @@ CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_MCS7830=y CONFIG_WDT=y CONFIG_WDT_AT91=y -CONFIG_AT91_HW_WDT_TIMEOUT=y CONFIG_SPL_TINY_MEMSET=y # CONFIG_EFI_LOADER is not set
configs/taurus_defconfig +0 -1
@@ -62,5 +62,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x02d2 CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_WDT=y CONFIG_WDT_AT91=y -CONFIG_AT91_HW_WDT_TIMEOUT=y CONFIG_USE_TINY_PRINTF=y
drivers/watchdog/Kconfig +0 -4
@@ -139,10 +139,6 @@ config WDT_AT91 Select this to enable Microchip watchdog timer, which can be found on some AT91 devices. -config AT91_HW_WDT_TIMEOUT - bool "AT91 watchdog timeout specified" - depends on WDT_AT91 - config WDT_MT7621 bool "MediaTek MT7621 watchdog timer support" depends on WDT && ARCH_MT7620
drivers/watchdog/at91sam9_wdt.c +3 -1
@@ -117,10 +117,12 @@ static int at91_wdt_probe(struct udevice *dev)if (!priv->regs)return -EINVAL ; -#ifdef CONFIG_AT91_HW_WDT_TIMEOUT +#if CONFIG_IS_ENABLED (OF_CONTROL ) priv->timeout =dev_read_u32_default (dev,"timeout-sec" ,WDT_DEFAULT_TIMEOUT );debug ("%s: timeout %d" , __func__, priv->timeout); +#else + priv->timeout =WDT_DEFAULT_TIMEOUT ;#endif debug ("%s: Probing wdt%u\n" , __func__, dev->seq);
Signature · 1 line
2.21.0
PATCH v3 7/13 arm: at91: Enable watchdog support
In reply to Stefan RoeseThis patch enables and starts the watchdog on the AT91 platform if configured. The WD timeout value is read in the AT91 WD device driver from the DT, using the "timeout-sec" DT property. If not provided in the DT, the default value of 2 seconds is used.
---
v3:
- Move WDT struct and macros into arch header so that it can be used by the arch code to start the driver (timeout value)
- This change now enables the use of the "timeout-sec" DT property to specifiy a board specific WD timeout value
v2:
- Remove #ifdef to enable compilation also in SPL version
arch/arm/mach-at91/clock.c | 48 ++++++++++++++++++++++ arch/arm/mach-at91/include/mach/at91_wdt.h | 10 +++++ drivers/watchdog/at91sam9_wdt.c | 10 ----- 3 files changed, 58 insertions(+), 10 deletions(-)
arch/arm/mach-at91/clock.c +48 -0
@@ -5,12 +5,17 @@*/ #include <common.h> +#include <dm.h> +#include <wdt.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pmc.h> +#include <asm/arch/at91_wdt.h> #define EN_UPLL_TIMEOUT 500 +static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL; +void at91_periph_clk_enable (int id) {struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ;
@@ -118,3 +123,46 @@ void at91_pllicpr_init(u32 icpr)writel (icpr, &pmc->pllicpr); } + +/* 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_early_init_r (void ) +{ +struct at91_wdt_priv *priv; + +/* 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 ; + } + } + + priv =dev_get_priv (watchdog_dev); +if (!priv) { +printf ("Watchdog: priv not available!\n" ); +return 0 ; + } + +wdt_start (watchdog_dev, priv->timeout *1000 ,0 ); +printf ("Watchdog: Started\n" ); + +return 0 ; +}
arch/arm/mach-at91/include/mach/at91_wdt.h +10 -0
@@ -43,4 +43,14 @@ typedef struct at91_wdt {#define AT91_WDT_MR_WDDBGHLT 0x10000000#define AT91_WDT_MR_WDIDLEHLT 0x20000000 +/* Hardware timeout in seconds */ +#define WDT_MAX_TIMEOUT 16 +#define WDT_DEFAULT_TIMEOUT 2 + +struct at91_wdt_priv { +void __iomem *regs; +u32 regval; +u32 timeout; +}; +#endif
drivers/watchdog/at91sam9_wdt.c +0 -10
@@ -31,16 +31,6 @@ DECLARE_GLOBAL_DATA_PTR;*/ #define WDT_SEC2TICKS (s) (((s) << 8) - 1) -/* Hardware timeout in seconds */ -#define WDT_MAX_TIMEOUT 16 -#define WDT_DEFAULT_TIMEOUT 2 - -struct at91_wdt_priv { -void __iomem *regs; -u32 regval; -u32 timeout; -}; -/* * Set the watchdog time interval in 1/256Hz (write-once) * Counter is 12 bit.
Signature · 1 line
2.21.0
PATCH v3 7/13 arm: at91: Enable watchdog support
Quoted 10 lines · Stefan Roese
This patch enables and starts the watchdog on the AT91 platform if configured. The WD timeout value is read in the AT91 WD device driver from the DT, using the "timeout-sec" DT property. If not provided in the DT, the default value of 2 seconds is used.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>
Quoted 6 lines
---
v3:
- Move WDT struct and macros into arch header so that it can be used by the arch code to start the driver (timeout value)
- This change now enables the use of the "timeout-sec" DT property to specifiy a board specific WD timeout value
Hi Stefan,
This breaks pm9261_defconfig
AS arch/arm/mach-at91/arm926ejs/lowlevel_init.o./arch/arm/include/asm/arch/at91_wdt.h: Assembler messages:./arch/arm/include/asm/arch/at91_wdt.h:50: Error: bad instruction struct at91_wdt_priv {' ./arch/arm/include/asm/arch/at91_wdt.h:51: Error: bad instruction void __iomem*regs'./arch/arm/include/asm/arch/at91_wdt.h:52: Error: bad instruction `u32 regval'./arch/arm/include/asm/arch/at91_wdt.h:53: Error: bad instruction `u32 timeout'./arch/arm/include/asm/arch/at91_wdt.h:54: Error: junk at end of line, first unrecognized character is `}' scripts/Makefile.build:314: recipe for target 'arch/arm/mach-at91/arm926ejs/lowlevel_init.o' failed
Quoted 119 lines
v2:
- Remove #ifdef to enable compilation also in SPL versionarch/arm/mach-at91/clock.c | 48 ++++++++++++++++++++++ arch/arm/mach-at91/include/mach/at91_wdt.h | 10 +++++ drivers/watchdog/at91sam9_wdt.c | 10 ----- 3 files changed, 58 insertions(+), 10 deletions(-)arch/arm/mach-at91/clock.c +48
-0@@ -5,12 +5,17 @@*/ #include <common.h> +#include <dm.h> +#include <wdt.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pmc.h> +#include <asm/arch/at91_wdt.h> #define EN_UPLL_TIMEOUT 500 +static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL; +void at91_periph_clk_enable (int id) {struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ;@@ -118,3 +123,46 @@ void at91_pllicpr_init(u32 icpr)writel (icpr, &pmc->pllicpr); } + +/* 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_early_init_r (void ) +{ +struct at91_wdt_priv *priv; + +/* 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 ; + } + } + + priv =dev_get_priv (watchdog_dev); +if (!priv) { +printf ("Watchdog: priv not available!\n" ); +return 0 ; + } + +wdt_start (watchdog_dev, priv->timeout *1000 ,0 ); +printf ("Watchdog: Started\n" ); + +return 0 ; +}arch/arm/mach-at91/include/mach/at91_wdt.h +10
-0@@ -43,4 +43,14 @@ typedef struct at91_wdt {#define AT91_WDT_MR_WDDBGHLT 0x10000000#define AT91_WDT_MR_WDIDLEHLT 0x20000000 +/* Hardware timeout in seconds */ +#define WDT_MAX_TIMEOUT 16 +#define WDT_DEFAULT_TIMEOUT 2 + +struct at91_wdt_priv { +void __iomem *regs; +u32 regval; +u32 timeout; +}; +#endif drivers/watchdog/at91sam9_wdt.c +0
-10@@ -31,16 +31,6 @@ DECLARE_GLOBAL_DATA_PTR;*/ #define WDT_SEC2TICKS (s) (((s) << 8) - 1) -/* Hardware timeout in seconds */ -#define WDT_MAX_TIMEOUT 16 -#define WDT_DEFAULT_TIMEOUT 2 - -struct at91_wdt_priv { -void __iomem *regs; -u32 regval; -u32 timeout; -}; -/* * Set the watchdog time interval in 1/256Hz (write-once) * Counter is 12 bit.
PATCH v3 7/13 arm: at91: Enable watchdog support
Quoted 26 lines · Eugen.Hristev at microchip.com
Quoted 10 lines · Stefan Roese
This patch enables and starts the watchdog on the AT91 platform if configured. The WD timeout value is read in the AT91 WD device driver from the DT, using the "timeout-sec" DT property. If not provided in the DT, the default value of 2 seconds is used.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Quoted 6 lines
---
v3:
- Move WDT struct and macros into arch header so that it can be used by the arch code to start the driver (timeout value)
- This change now enables the use of the "timeout-sec" DT property to specifiy a board specific WD timeout valueHi Stefan,
This breaks
pm9261_defconfig
Quoted 14 lines
AS
arch/arm/mach-at91/arm926ejs/lowlevel_init.o./arch/arm/include/asm/arch/at91_wdt.h: Assembler messages:./arch/arm/include/asm/arch/at91_wdt.h:50: Error: bad instructionstruct at91_wdt_priv {' ./arch/arm/include/asm/arch/at91_wdt.h:51: Error: bad instructionvoid __iomem*regs'./arch/arm/include/asm/arch/at91_wdt.h:52: Error: bad instruction `u32 regval'./arch/arm/include/asm/arch/at91_wdt.h:53: Error: bad instruction `u32 timeout'./arch/arm/include/asm/arch/at91_wdt.h:54: Error: junk at end of line, first unrecognized character is `}'scripts/Makefile.build:314: recipe for target 'arch/arm/mach-at91/arm926ejs/lowlevel_init.o' failed
Sorry about these breakages. I'll fix this and will run the new patches through Travis and will only send the next version once this is compile clean.
Thanks,
Stefan
PATCH v3 7/13 arm: at91: Enable watchdog support
Hi Eugen,
On 02.04.19 13:50, Stefan Roese wrote:
<snip>
Quoted 17 lines
Quoted 16 lines
This breaks
pm9261_defconfigAS
arch/arm/mach-at91/arm926ejs/lowlevel_init.o./arch/arm/include/asm/arch/at91_wdt.h: Assembler messages:./arch/arm/include/asm/arch/at91_wdt.h:50: Error: bad instructionstruct at91_wdt_priv {' ./arch/arm/include/asm/arch/at91_wdt.h:51: Error: bad instructionvoid __iomem*regs'./arch/arm/include/asm/arch/at91_wdt.h:52: Error: bad instruction `u32 regval'./arch/arm/include/asm/arch/at91_wdt.h:53: Error: bad instruction `u32 timeout'./arch/arm/include/asm/arch/at91_wdt.h:54: Error: junk at end of line, first unrecognized character is `}'scripts/Makefile.build:314: recipe for target 'arch/arm/mach-at91/arm926ejs/lowlevel_init.o' failed
Quoted 3 lines
Sorry about these breakages. I'll fix this and will run the new patches through Travis and will only send the next version once this is compile clean.
I've sent out 2 new patch versions and this series now compiles clean. Here the Travis build log:
https://travis-ci.org/stroese/u-boot/builds/514639947
Thanks,
Stefan
PATCH v4 7/13 arm: at91: Enable watchdog support
In reply to Stefan RoeseThis patch enables and starts the watchdog on the AT91 platform if configured. The WD timeout value is read in the AT91 WD device driver from the DT, using the "timeout-sec" DT property. If not provided in the DT, the default value of 2 seconds is used.
---
v4:
- Move struct in header into location not compiled in assembler files to remove the compile breakage
v3:
- Move WDT struct and macros into arch header so that it can be used by the arch code to start the driver (timeout value)
- This change now enables the use of the "timeout-sec" DT property to specifiy a board specific WD timeout value
v2:
- Remove #ifdef to enable compilation also in SPL version
arch/arm/mach-at91/clock.c | 48 ++++++++++++++++++++++ arch/arm/mach-at91/include/mach/at91_wdt.h | 10 +++++ drivers/watchdog/at91sam9_wdt.c | 10 ----- 3 files changed, 58 insertions(+), 10 deletions(-)
arch/arm/mach-at91/clock.c +48 -0
@@ -5,12 +5,17 @@*/ #include <common.h> +#include <dm.h> +#include <wdt.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pmc.h> +#include <asm/arch/at91_wdt.h> #define EN_UPLL_TIMEOUT 500 +static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL; +void at91_periph_clk_enable (int id) {struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ;
@@ -118,3 +123,46 @@ void at91_pllicpr_init(u32 icpr)writel (icpr, &pmc->pllicpr); } + +/* 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_early_init_r (void ) +{ +struct at91_wdt_priv *priv; + +/* 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 ; + } + } + + priv =dev_get_priv (watchdog_dev); +if (!priv) { +printf ("Watchdog: priv not available!\n" ); +return 0 ; + } + +wdt_start (watchdog_dev, priv->timeout *1000 ,0 ); +printf ("Watchdog: Started\n" ); + +return 0 ; +}
arch/arm/mach-at91/include/mach/at91_wdt.h +10 -0
@@ -25,6 +25,12 @@ typedef struct at91_wdt { u32 sr; } at91_wdt_t; +struct at91_wdt_priv { +void __iomem *regs; +u32 regval; +u32 timeout; +}; +#endif /* Watchdog Control Register */
@@ -43,4 +49,8 @@ typedef struct at91_wdt {#define AT91_WDT_MR_WDDBGHLT 0x10000000#define AT91_WDT_MR_WDIDLEHLT 0x20000000 +/* Hardware timeout in seconds */ +#define WDT_MAX_TIMEOUT 16 +#define WDT_DEFAULT_TIMEOUT 2 +#endif
drivers/watchdog/at91sam9_wdt.c +0 -10
@@ -31,16 +31,6 @@ DECLARE_GLOBAL_DATA_PTR;*/ #define WDT_SEC2TICKS (s) (((s) << 8) - 1) -/* Hardware timeout in seconds */ -#define WDT_MAX_TIMEOUT 16 -#define WDT_DEFAULT_TIMEOUT 2 - -struct at91_wdt_priv { -void __iomem *regs; -u32 regval; -u32 timeout; -}; -/* * Set the watchdog time interval in 1/256Hz (write-once) * Counter is 12 bit.
Signature · 1 line
2.21.0
PATCH v3 8/13 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.
---
v3:
- No change
v2:
- No change
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 v3 9/13 Makefile.spl: Move generated 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.
Tested on the taurus board:
---
v3:
- No change
v2:
- No change
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 v3 10/13 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). For these build targets the combined image "u-boot-with-spl.bin" is now automatically generated and can be programmed into NAND as one single image (vs. SPL image and U-Boot as 2 separate images).
Tested on the taurus board:
---
v3:
- No change
v2:
- No change
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 TARGET_SOCFPGA_ARRIA10
@@ -232,6 +241,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
@@ -1225,9 +1225,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 v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
Quoted 36 lines · Stefan Roese
This patch adds the
CONFIG_SPL_IMAGEoption 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_IMAGEto "spl/boot.bin" for AT91 targets which use SPL NAND support (boot from NAND). For these build targets the combined image "u-boot-with-spl.bin" is now automatically generated and can be programmed into NAND as one single image (vs. SPL image and U-Boot as 2 separate images).Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested on the taurus board:
Tested-by Heiko Schocher <[email protected]>---
v3:
- No changev2:
- No changeKconfig | 10 ++++++++++ Makefile | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-)Kconfig +0
-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.
Kconfig config BUILD_ROM · line 235
Quoted 10 lines
Kconfig +9
-0+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. +
Hi Stefan,
If I try to just use menuconfig and change this value to something else, build fails. The purpose of this Kconfig is to name the SPL filename as per the config's desire ?
Or in fact is "which binary file to use to make the Combined SPL+U-BOOT mega image" ?
Eugen
Quoted 29 lines
Kconfig +1
-0config BUILD_TARGET string "Build target special images" default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_ARRIA10@@ -232,6 +241,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 definingMakefile +3
-1@@ -1225,9 +1225,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)
PATCH v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
Quoted 52 lines · Eugen Hristev
Quoted 36 lines · Stefan Roese
This patch adds the
CONFIG_SPL_IMAGEoption 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_IMAGEto "spl/boot.bin" for AT91 targets which use SPL NAND support (boot from NAND). For these build targets the combined image "u-boot-with-spl.bin" is now automatically generated and can be programmed into NAND as one single image (vs. SPL image and U-Boot as 2 separate images).Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested on the taurus board:
Tested-by Heiko Schocher <[email protected]>---
v3:
- No changev2:
- No changeKconfig | 10 ++++++++++
Makefile| 4 +++-2 files changed, 13 insertions(+), 1 deletion(-)Kconfig +0
-0@@ -224,6 +224,15 @@ config BUILD_ROMwhich are not shipped in the U-Boot source tree. Please, see doc/README.x86 for details.
Kconfig config BUILD_ROM · line 235
Quoted 9 lines
Kconfig +9
-0+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. +Hi Stefan,
Quoted 6 lines
If I try to just use menuconfig and change this value to something else, build fails. The purpose of this
Kconfigis to name the SPL filename as per the config's desire ?Or in fact is "which binary file to use to make the Combined SPL+U-BOOT mega image" ?
Ok, the commit message explains it pretty well, but the Kconfig help is totally different... hence the confusion sorry.
So we need to either make a choice submenu in this Kconfig : either this or that; or, do exactly what the Kconfig says: rename the output binary into the value of this Kconfig.
Does this make sense ?
Quoted 30 lines
Eugen
Quoted 27 lines
config
BUILD_TARGET
string "Build target special images"
default "u-boot-with-spl.sfp" ifTARGET_SOCFPGA_ARRIA10Kconfig +0
-0@@ -232,6 +241,7 @@ config BUILD_TARGETdefault "u-boot-elf.srec" if
RCAR_GEN3
default "u-boot.itb" ifSPL_LOAD_FIT&&ARCH_SUNXIdefault "u-boot.kwb" if KIRKWOOD
+ default "u-boot-with-spl.bin" ifARCH_AT91&&SPL_NAND_SUPPORThelp
Some SoCs need special image types (e.g. U-Boot binary with a special header) as build targets. By definingMakefile +0
-0@@ -1225,9 +1225,11 @@ else
SPL_PAYLOAD:= u-boot.bin
endifMakefile +2
-0+SPL_IMAGE := $(CONFIG_SPL_IMAGE:"%"=%) +OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
--pad-to=$(CONFIG_SPL_PAD_TO)Makefile +1
-1-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)
PATCH v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
Quoted 62 lines · Eugen.Hristev at microchip.com
Quoted 52 lines · Eugen Hristev
Quoted 35 lines · Stefan Roese
This patch adds the
CONFIG_SPL_IMAGEoption 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_IMAGEto "spl/boot.bin" for AT91 targets which use SPL NAND support (boot from NAND). For these build targets the combined image "u-boot-with-spl.bin" is now automatically generated and can be programmed into NAND as one single image (vs. SPL image and U-Boot as 2 separate images).Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested on the taurus board:
Tested-by Heiko Schocher <[email protected]>---
v3:
- No changev2:
- No changeKconfig | 10 ++++++++++ Makefile | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-)Kconfig +0
-0@@ -224,6 +224,15 @@ config BUILD_ROM which are not shipped in the U-Boot source tree.Kconfig config BUILD_ROM · line 234
Quoted 10 lines
Kconfig +9
-0Please, 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. +Hi Stefan,
Quoted 6 lines
If I try to just use menuconfig and change this value to something else, build fails. The purpose of this
Kconfigis to name the SPL filename as per the config's desire ?Or in fact is "which binary file to use to make the Combined SPL+U-BOOT mega image" ?
Quoted 7 lines
Ok, the commit message explains it pretty well, but the
Kconfighelp is totally different... hence the confusion sorry.
So we need to either make a choice submenu in thisKconfig: either this or that; or, do exactly what theKconfigsays: rename the output binary into the value of thisKconfig.Does this make sense ?
You are suggesting to add this SPL_IMAGE as choice instead of its current implementation? That might be better, yes. Let me look into this...
Thanks,
Stefan
PATCH v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
Hi Eugen,
On 03.04.19 13:21, Stefan Roese wrote:
<snip>
Quoted 13 lines
Quoted 13 lines
Quoted 6 lines
If I try to just use menuconfig and change this value to something else, build fails. The purpose of this
Kconfigis to name the SPL filename as per the config's desire ?Or in fact is "which binary file to use to make the Combined SPL+U-BOOT mega image" ?
Ok, the commit message explains it pretty well, but the
Kconfighelp is totally different... hence the confusion sorry.
So we need to either make a choice submenu in thisKconfig: either this or that; or, do exactly what theKconfigsays: rename the output binary into the value of thisKconfig.
Quoted 5 lines
Quoted 1 line
Does this make sense ?
You are suggesting to add this
SPL_IMAGEas choice instead of its current implementation? That might be better, yes. Let me look into this...
I did look into this and I would prefer to stay with the original implementation of the defaults. Changing this into a Kconfig choice makes this a bit more complex in the Kconfig. Additionally and even more important (for my personal feeling), the original implementation is more in line with the BUILD_TARGET implemenation directly below this new implementation.
So if you don't object, I would like to send a new version with the original implementation but with a "better" (more correct) description in Kconfig.
What do you think?
Thanks,
Stefan
PATCH v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
Quoted 36 lines · Stefan Roese
External E-Mail
Hi Eugen,
On 03.04.19 13:21, Stefan Roese wrote:
<snip>
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
If I try to just use menuconfig and change this value to something else,
build fails. The purpose of thisKconfigis to name the SPL filename as per the config's desire ?Or in fact is "which binary file to use to make the Combined SPL+U-BOOT mega image" ?
Ok, the commit message explains it pretty well, but the
Kconfighelp is totally different... hence the confusion sorry.
So we need to either make a choice submenu in thisKconfig: either this or that; or, do exactly what theKconfigsays: rename the output binary into the value of thisKconfig.Quoted 5 lines
Quoted 1 line
Does this make sense ?
You are suggesting to add this
SPL_IMAGEas choice instead of its current implementation? That might be better, yes. Let me look into this...I did look into this and I would prefer to stay with the original implementation of the defaults. Changing this into a
Kconfigchoice makes this a bit more complex in theKconfig. Additionally and even more important (for my personal feeling), the original implementation is more in line with theBUILD_TARGETimplemenation directly below this new implementation.
Quoted 5 lines
So if you don't object, I would like to send a new version with the original implementation but with a "better" (more correct) description in
Kconfig.What do you think?
This would imply that your new description has to state that if an incorrect binary name is configured here, the build will fail (?)
Quoted 3 lines
Thanks,
Stefan
PATCH v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
Quoted 39 lines · Eugen.Hristev at microchip.com
Quoted 36 lines · Stefan Roese
External E-Mail
Hi Eugen,
On 03.04.19 13:21, Stefan Roese wrote:
<snip>
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
If I try to just use menuconfig and change this value to something else,
build fails. The purpose of thisKconfigis to name the SPL filename as per the config's desire ?Or in fact is "which binary file to use to make the Combined SPL+U-BOOT mega image" ?
Ok, the commit message explains it pretty well, but the
Kconfighelp is totally different... hence the confusion sorry.
So we need to either make a choice submenu in thisKconfig: either this or that; or, do exactly what theKconfigsays: rename the output binary into the value of thisKconfig.Quoted 5 lines
Quoted 1 line
Does this make sense ?
You are suggesting to add this
SPL_IMAGEas choice instead of its current implementation? That might be better, yes. Let me look into this...I did look into this and I would prefer to stay with the original implementation of the defaults. Changing this into a
Kconfigchoice makes this a bit more complex in theKconfig. Additionally and even more important (for my personal feeling), the original implementation is more in line with theBUILD_TARGETimplemenation directly below this new implementation.
Quoted 8 lines
Quoted 5 lines
So if you don't object, I would like to send a new version with the original implementation but with a "better" (more correct) description in
Kconfig.What do you think?
This would imply that your new description has to state that if an incorrect binary name is configured here, the build will fail (?)
No. My main reasoning here is, that this is also not included in the description of "BUILD_TARGET" below. Here you can also change the selected value (via Kconfig help, no user input needed) to a new value that is not supported, which also results in a build error.
I would like to not make this overly complex here. If a user wants to do something stupid by defining this (or some other Kconfig option) to an unsupported value, we can't really stop him.
If you really think this is necessary, I will add a sentence to the Kconfig text, to only select "supported" values here. But again, I would prefer to not do this.
Thanks,
Stefan
PATCH v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
Quoted 66 lines · Stefan Roese
External E-Mail
Quoted 44 lines · Eugen.Hristev at microchip.com
Quoted 41 lines · Stefan Roese
External E-Mail
Hi Eugen,
On 03.04.19 13:21, Stefan Roese wrote:
<snip>
Quoted 19 lines
Quoted 19 lines
Quoted 9 lines
If I try to just use menuconfig and change this value to something else,
build fails. The purpose of thisKconfigis to name the SPL filename as
per the config's desire ?Or in fact is "which binary file to use to make the Combined SPL+U-BOOT
mega image" ?Ok, the commit message explains it pretty well, but the
Kconfighelp is
totally different... hence the confusion sorry.
So we need to either make a choice submenu in thisKconfig: either this
or that; or, do exactly what theKconfigsays: rename the output binary
into the value of thisKconfig.Quoted 5 lines
Quoted 1 line
Does this make sense ?
You are suggesting to add this
SPL_IMAGEas choice instead of its current implementation? That might be better, yes. Let me look into this...I did look into this and I would prefer to stay with the original implementation of the defaults. Changing this into a
Kconfigchoice makes this a bit more complex in theKconfig. Additionally and even more important (for my personal feeling), the original implementation is more in line with theBUILD_TARGETimplemenation directly below this new implementation.Quoted 8 lines
Quoted 5 lines
So if you don't object, I would like to send a new version with the original implementation but with a "better" (more correct) description in
Kconfig.What do you think?
This would imply that your new description has to state that if an incorrect binary name is configured here, the build will fail (?)
No. My main reasoning here is, that this is also not included in the description of "
BUILD_TARGET" below. Here you can also change the selected value (viaKconfighelp, no user input needed) to a new value that is not supported, which also results in a build error.I would like to not make this overly complex here. If a user wants to do something stupid by defining this (or some other
Kconfigoption) to an unsupported value, we can't really stop him.
Quoted 6 lines
If you really think this is necessary, I will add a sentence to the
Kconfigtext, to only select "supported" values here. But again, I would prefer to not do this.Thanks,
Stefan
Allright, but we have to make sure that everyone understands what this option does when they try to change it.
So, a bit of rework of the help text is needed.
PATCH v3 10/13 Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary
In reply to Eugen.Hristev at microchip.comQuoted 53 lines · Eugen.Hristev at microchip.com
Quoted 36 lines · Stefan Roese
This patch adds the
CONFIG_SPL_IMAGEoption 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_IMAGEto "spl/boot.bin" for AT91 targets which use SPL NAND support (boot from NAND). For these build targets the combined image "u-boot-with-spl.bin" is now automatically generated and can be programmed into NAND as one single image (vs. SPL image and U-Boot as 2 separate images).Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Andreas Bießmann <[email protected]>Cc Eugen Hristev <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested on the taurus board:
Tested-by Heiko Schocher <[email protected]>---
v3:
- No changev2:
- No changeKconfig | 10 ++++++++++ Makefile | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-)Kconfig +0
-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.Kconfig config BUILD_ROM · line 235
Quoted 10 lines
Kconfig +9
-0+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. +Hi Stefan,
Quoted 6 lines
If I try to just use menuconfig and change this value to something else, build fails. The purpose of this
Kconfigis to name the SPL filename as per the config's desire ?Or in fact is "which binary file to use to make the Combined SPL+U-BOOT mega image" ?
Its not meant to change the SPL image filename to an arbitrary name. Its meant to select one of the already supported values of the build system. I should probably re-phrase the Kconfig text to better reflect this.
Thanks,
Stefan
PATCH v3 11/13 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).
Tested on the taurus board:
---
v3:
- No change
v2:
- No change
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
@@ -173,4 +173,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 v3 12/13 arm: at91: at91sam9x5.dtsi: Add watchdog handle
In reply to Stefan RoeseThis makes it possible to reference the watchdog DT node via "&watchdog" from board dts files.
---
v3:
- No change
v2:
- New patch
arch/arm/dts/at91sam9x5.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/at91sam9x5.dtsi +1 -1
@@ -1180,7 +1180,7 @@ }; }; - watchdog at fffffe40 { + watchdog: watchdog at fffffe40 { compatible = "atmel,at91sam9260-wdt"; reg = <0xfffffe40 0x10>; interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
Signature · 1 line
2.21.0
PATCH v3 13/13 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.
---
v3:
- Add "timeout-sec" DT property
v2:
- Add dtb build target in dts Makefile
- Add gardena-smart-gateway-at91sam-u-boot.dtsi file with U-Boot specific DT properties
- at91sam9x5ek.dtsi is not included in the dts file any more as this did enable too much unused devices
arch/arm/dts/Makefile | 3 + ...1sam9g25-gardena-smart-gateway-u-boot.dtsi | 5 + .../dts/at91sam9g25-gardena-smart-gateway.dts | 120 ++++++++++++++++ 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 | 83 +++++++++++ .../configs/gardena-smart-gateway-at91sam.h | 88 ++++++++++++ 11 files changed, 527 insertions(+) create mode 100644 arch/arm/dts/at91sam9g25-gardena-smart-gateway-u-boot.dtsi create mode 100644 arch/arm/dts/at91sam9g25-gardena-smart-gateway.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/Makefile +3 -0
@@ -607,6 +607,9 @@ dtb-$(CONFIG_TARGET_AT91SAM9X5EK) += \ dtb-$(CONFIG_TARGET_AT91SAM9N12EK) += at91sam9n12ek.dtb +dtb-$(CONFIG_TARGET_GARDENA_SMART_GATEWAY_AT91SAM) += \ + at91sam9g25-gardena-smart-gateway.dtb + dtb-$(CONFIG_TARGET_ETHERNUT5) += ethernut5.dtb dtb-$(CONFIG_TARGET_USB_A9263) += usb_a9263.dtb
arch/arm/dts/at91sam9g25-gardena-smart-gateway-u-boot.dtsi new file +5 -0
@@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0+ + +&dbgu { + u-boot,dm-pre-reloc; +};
arch/arm/dts/at91sam9g25-gardena-smart-gateway.dts new file +120 -0
120 lines not on this page · raw message
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_GATEWAY_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_GATEWAY_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 +83 -0
83 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