arm: atmel: clean up for at91sam9x5ek board
Subsystems (2)
cover arm: atmel: clean up for at91sam9x5ek board
This patch series do a clean up for at91sam9x5ek board.
Bo Shen (3):
arm: atmel: at91sam9x5: cleanup cs configure for spi
arm: atmel: at91sam9x5: cleanup unneeded undef
arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - include/configs/at91sam9x5ek.h | 13 +++------- 3 files changed, 9 insertions(+), 33 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 arm: atmel: at91sam9x5: cleanup cs configure for spi
As the cs for spi is worked in gpio mode, so no need to configure it as peripheral and then configure to gpio.
---
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - 2 files changed, 6 insertions(+), 23 deletions(-)
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +6 -22
@@ -130,20 +130,12 @@ void at91_spi0_hw_init(unsigned long cs_mask)writel (1 <<ATMEL_ID_SPI0 , &pmc->pcer);if (cs_mask & (1 <<0 )) -at91_set_a_periph (AT91_PIO_PORTA ,14 ,0 ); -if (cs_mask & (1 <<1 )) -at91_set_b_periph (AT91_PIO_PORTA ,7 ,0 ); -if (cs_mask & (1 <<2 )) -at91_set_b_periph (AT91_PIO_PORTA ,1 ,0 ); -if (cs_mask & (1 <<3 )) -at91_set_b_periph (AT91_PIO_PORTB ,3 ,0 ); -if (cs_mask & (1 <<4 ))at91_set_pio_output (AT91_PIO_PORTA ,14 ,0 ); -if (cs_mask & (1 <<5 )) +if (cs_mask & (1 <<1 ))at91_set_pio_output (AT91_PIO_PORTA ,7 ,0 ); -if (cs_mask & (1 <<6 )) +if (cs_mask & (1 <<2 ))at91_set_pio_output (AT91_PIO_PORTA ,1 ,0 ); -if (cs_mask & (1 <<7 )) +if (cs_mask & (1 <<3 ))at91_set_pio_output (AT91_PIO_PORTB ,3 ,0 ); }
@@ -159,20 +151,12 @@ void at91_spi1_hw_init(unsigned long cs_mask)writel (1 <<ATMEL_ID_SPI1 , &pmc->pcer);if (cs_mask & (1 <<0 )) -at91_set_b_periph (AT91_PIO_PORTA ,8 ,0 ); -if (cs_mask & (1 <<1 )) -at91_set_b_periph (AT91_PIO_PORTA ,0 ,0 ); -if (cs_mask & (1 <<2 )) -at91_set_b_periph (AT91_PIO_PORTA ,31 ,0 ); -if (cs_mask & (1 <<3 )) -at91_set_b_periph (AT91_PIO_PORTA ,30 ,0 ); -if (cs_mask & (1 <<4 ))at91_set_pio_output (AT91_PIO_PORTA ,8 ,0 ); -if (cs_mask & (1 <<5 )) +if (cs_mask & (1 <<1 ))at91_set_pio_output (AT91_PIO_PORTA ,0 ,0 ); -if (cs_mask & (1 <<6 )) +if (cs_mask & (1 <<2 ))at91_set_pio_output (AT91_PIO_PORTA ,31 ,0 ); -if (cs_mask & (1 <<7 )) +if (cs_mask & (1 <<3 )) at91_set_pio_output(AT91_PIO_PORTA, 30, 0); }#endif
board/atmel/at91sam9x5ek/at91sam9x5ek.c +0 -1
@@ -272,7 +272,6 @@ int board_init(void)#ifdef CONFIG_ATMEL_SPI at91_spi0_hw_init (1 <<0 ); -at91_spi0_hw_init (1 <<4 );#endif #ifdef CONFIG_MACB
Signature · 1 line
1.7.9.5
PATCH 1/3 arm: atmel: at91sam9x5: cleanup cs configure for spi
Hi Bo,
Quoted 2 lines · Bo Shen
As the cs for spi is worked in gpio mode, so no need to configure it as peripheral and then configure to gpio.
That statement may be correct.
Quoted 49 lines
Signed-off-by Bo Shen <[email protected]>---
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - 2 files changed, 6 insertions(+), 23 deletions(-)arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +3
-19@@ -130,20 +130,12 @@ void at91_spi0_hw_init(unsigned long cs_mask)writel (1 <<ATMEL_ID_SPI0 , &pmc->pcer);if (cs_mask & (1 <<0 )) -at91_set_a_periph (AT91_PIO_PORTA ,14 ,0 ); -if (cs_mask & (1 <<1 )) -at91_set_b_periph (AT91_PIO_PORTA ,7 ,0 ); -if (cs_mask & (1 <<2 )) -at91_set_b_periph (AT91_PIO_PORTA ,1 ,0 ); -if (cs_mask & (1 <<3 )) -at91_set_b_periph (AT91_PIO_PORTB ,3 ,0 ); -if (cs_mask & (1 <<4 ))at91_set_pio_output (AT91_PIO_PORTA ,14 ,0 ); -if (cs_mask & (1 <<5 )) +if (cs_mask & (1 <<1 ))at91_set_pio_output (AT91_PIO_PORTA ,7 ,0 ); -if (cs_mask & (1 <<6 )) +if (cs_mask & (1 <<2 ))at91_set_pio_output (AT91_PIO_PORTA ,1 ,0 ); -if (cs_mask & (1 <<7 )) +if (cs_mask & (1 <<3 ))at91_set_pio_output (AT91_PIO_PORTB ,3 ,0 ); }@@ -159,20 +151,12 @@ void at91_spi1_hw_init(unsigned long cs_mask)writel (1 <<ATMEL_ID_SPI1 , &pmc->pcer);if (cs_mask & (1 <<0 )) -at91_set_b_periph (AT91_PIO_PORTA ,8 ,0 ); -if (cs_mask & (1 <<1 )) -at91_set_b_periph (AT91_PIO_PORTA ,0 ,0 ); -if (cs_mask & (1 <<2 )) -at91_set_b_periph (AT91_PIO_PORTA ,31 ,0 ); -if (cs_mask & (1 <<3 )) -at91_set_b_periph (AT91_PIO_PORTA ,30 ,0 ); -if (cs_mask & (1 <<4 ))at91_set_pio_output (AT91_PIO_PORTA ,8 ,0 );
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c void at91_spi1_hw_init(unsigned long cs_mask) · line 161
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +3
-3-if (cs_mask & (1 <<5 )) +if (cs_mask & (1 <<1 ))at91_set_pio_output (AT91_PIO_PORTA ,0 ,0 ); -if (cs_mask & (1 <<6 )) +if (cs_mask & (1 <<2 ))at91_set_pio_output (AT91_PIO_PORTA ,31 ,0 ); -if (cs_mask & (1 <<7 )) +if (cs_mask & (1 <<3 ))at91_set_pio_output (AT91_PIO_PORTA ,30 ,0 ); }
But these changes to at91_spiX_hw_init() are wrong!
The point is that we want to set the spi CS line to GPIO or peripheral mode by the function. Maybe the interface is bad but all of these functions behave like this. The assumption is that we always have 4 SPI CS per port, to setup the first one as peripheral we need to give 0x01 as mask, to setup the same CS as GPIO we need to apply offset of 4 bits -> 0x10 mask.
board/atmel/at91sam9x5ek/at91sam9x5ek.c int board_init(void) · line 275
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +0
-0#endif board/atmel/at91sam9x5ek/at91sam9x5ek.c +0
-1@@ -272,7 +272,6 @@ int board_init(void)#ifdef CONFIG_ATMEL_SPI at91_spi0_hw_init (1 <<0 ); -at91_spi0_hw_init (1 <<4 );
So the correct change would be to remove the first line and leave the at91_spiX_hw_init() untouched.
board/atmel/at91sam9x5ek/at91sam9x5ek.c int board_init(void) · line 277
Quoted 4 lines
board/atmel/at91sam9x5ek/at91sam9x5ek.c +0
-0#endif #ifdef CONFIG_MACB
@jagannadh.teki: I grabbed that patch delegated to you @ patchwork.
Best regards
Andreas Bie?mann
PATCH v2 1/3 arm: atmel: at91sam9x5: cleanup cs configure for spi
In reply to Bo ShenAs the cs for spi is worked in gpio mode, so no need to configure it as peripheral and then configure to gpio. Configure it to gpio directly.
---
Change in v2:
- only move line to configure it to peripheral
--- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - 1 file changed, 1 deletion(-)
board/atmel/at91sam9x5ek/at91sam9x5ek.c +0 -1
@@ -271,7 +271,6 @@ int board_init(void)#endif #ifdef CONFIG_ATMEL_SPI -at91_spi0_hw_init (1 <<0 );at91_spi0_hw_init (1 <<4 );#endif
Signature · 1 line
1.7.9.5
PATCH v2 1/3 arm: atmel: at91sam9x5: cleanup cs configure for spi
Dear Bo Shen,
Quoted 4 lines · Bo Shen
As the cs for spi is worked in gpio mode, so no need to configure it as peripheral and then configure to gpio. Configure it to gpio directly.
Quoted 8 lines
Signed-off-by Bo Shen <[email protected]>---
Change in v2:
- only move line to configure it to peripheral
---board/atmel/at91sam9x5ek/at91sam9x5ek.c| 1 -1 file changed, 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH 2/3 arm: atmel: at91sam9x5: cleanup unneeded undef
In reply to Bo Shenremove unneeded #undef for at91sam9x5ek board.
---
include/configs/at91sam9x5ek.h | 5 ----- 1 file changed, 5 deletions(-)
include/configs/at91sam9x5ek.h +0 -5
@@ -44,7 +44,6 @@#define LCD_BPP LCD_COLOR16#define LCD_OUTPUT_BPP 24#define CONFIG_LCD_LOGO -#undef LCD_TEST_PATTERN#define CONFIG_LCD_INFO #define CONFIG_LCD_INFO_BELOW_LOGO #define CONFIG_SYS_WHITE_ON_BLACK
@@ -244,8 +243,4 @@*/ #define CONFIG_SYS_MALLOC_LEN (512 * 1024 + 0x1000) -#ifdef CONFIG_USE_IRQ -#error CONFIG_USE_IRQ not supported -#endif -#endif
Signature · 1 line
1.7.9.5
PATCH 2/3 arm: atmel: at91sam9x5: cleanup unneeded undef
Dear Bo Shen,
Quoted 7 lines · Bo Shen
remove unneeded #undef for at91sam9x5ek board.
Signed-off-by Bo Shen <[email protected]>---
include/configs/at91sam9x5ek.h| 5 -----1 file changed, 5 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH 3/3 arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position
In reply to Bo ShenIn config_cmd_default.h, it will use CONFIG_SYS_NO_FLASH to decide whether include CONFIG_CMD_FLASH and CONFIG_CMD_IMLS. So, move the CONFIG_SYS_NO_FLASH to proper position, then we don't need to undef these two commands.
---
include/configs/at91sam9x5ek.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
include/configs/at91sam9x5ek.h +3 -5
@@ -61,14 +61,15 @@#define CONFIG_BOOTP_GATEWAY #define CONFIG_BOOTP_HOSTNAME +/* no NOR flash */ +#define CONFIG_SYS_NO_FLASH +/* * Command line configuration. */ #include <config_cmd_default.h> #undef CONFIG_CMD_FPGA#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_IMLS -#undef CONFIG_CMD_LOADS#define CONFIG_CMD_PING #define CONFIG_CMD_DHCP
@@ -100,9 +101,6 @@#define CONFIG_SF_DEFAULT_SPEED 30000000#endif -/* no NOR flash */ -#define CONFIG_SYS_NO_FLASH -/* NAND flash */ #ifdef CONFIG_CMD_NAND #define CONFIG_NAND_ATMEL
Signature · 1 line
1.7.9.5
PATCH 3/3 arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position
Dear Bo Shen,
Quoted 10 lines · Bo Shen
In
config_cmd_default.h, it will useCONFIG_SYS_NO_FLASHto decide whether includeCONFIG_CMD_FLASHandCONFIG_CMD_IMLS. So, move theCONFIG_SYS_NO_FLASHto proper position, then we don't need to undef these two commands.Signed-off-by Bo Shen <[email protected]>---
include/configs/at91sam9x5ek.h| 8 +++-----1 file changed, 3 insertions(+), 5 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
cover arm: atmel: clean up for at91sam9x5ek board
In reply to Bo ShenHi Bo,
Quoted 1 line · Bo Shen
This patch series do a clean up for at91sam9x5ek board.
I think this series is to fixup broken things, therefore could be applied for upcomming release. Can you please provide v1 for 1/3?
Quoted 11 lines
Bo Shen (3):
arm: atmel: at91sam9x5: cleanup cs configure for spi
arm: atmel: at91sam9x5: cleanup unneeded undef
arm: atmel: at91sam9x5: moveCONFIG_SYS_NO_FLASHto proper positionarch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - include/configs/at91sam9x5ek.h | 13 +++------- 3 files changed, 9 insertions(+), 33 deletions(-)
Best regards
Andreas Bie?mann
cover arm: atmel: clean up for at91sam9x5ek board
Hi Andreas,
Quoted 7 lines · Andreas Bie?mann
Hi Bo,
Quoted 1 line · Bo Shen
This patch series do a clean up for at91sam9x5ek board.
I think this series is to fixup broken things, therefore could be applied for upcomming release. Can you please provide v1 for 1/3?
I have sent v2 for 1/3 of this series.
Quoted 12 lines
Quoted 11 lines
Bo Shen (3):
arm: atmel: at91sam9x5: cleanup cs configure for spi
arm: atmel: at91sam9x5: cleanup unneeded undef
arm: atmel: at91sam9x5: moveCONFIG_SYS_NO_FLASHto proper positionarch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - include/configs/at91sam9x5ek.h | 13 +++------- 3 files changed, 9 insertions(+), 33 deletions(-)
Quoted 4 lines
Best regards
Andreas Bie?mann
Best Regards,
Bo Shen
cover arm: atmel: clean up for at91sam9x5ek board
In reply to Andreas BießmannHi Andreas,
Quoted 7 lines · Andreas Bie?mann
Hi Bo,
Quoted 1 line · Bo Shen
This patch series do a clean up for at91sam9x5ek board.
I think this series is to fixup broken things, therefore could be applied for upcomming release. Can you please provide v1 for 1/3?
I have sent v2 for 1/3 of this series.
Quoted 12 lines
Quoted 11 lines
Bo Shen (3):
arm: atmel: at91sam9x5: cleanup cs configure for spi
arm: atmel: at91sam9x5: cleanup unneeded undef
arm: atmel: at91sam9x5: moveCONFIG_SYS_NO_FLASHto proper positionarch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - include/configs/at91sam9x5ek.h | 13 +++------- 3 files changed, 9 insertions(+), 33 deletions(-)
Quoted 4 lines
Best regards
Andreas Bie?mann
Best Regards,
Bo Shen