[U-Boot] [PATCH 0/3] 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(-)

As the cs for spi is worked in gpio mode, so no need to configure it as peripheral and then configure to gpio.
Signed-off-by: Bo Shen voice.shen@atmel.com ---
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - 2 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c index 6d94572..745dce6 100644 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c @@ -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 diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c index 6f67c34..fb74a30 100644 --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c @@ -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

Hi Bo,
On 12/10/2013 09:14 AM, Bo Shen wrote:
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.
Signed-off-by: Bo Shen voice.shen@atmel.com
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 28 +++++----------------- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - 2 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c index 6d94572..745dce6 100644 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c @@ -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);
}
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.
#endif diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c index 6f67c34..fb74a30 100644 --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c @@ -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.
#endif
#ifdef CONFIG_MACB
@jagannadh.teki: I grabbed that patch delegated to you @ patchwork.
Best regards
Andreas Bießmann

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.
Signed-off-by: Bo Shen voice.shen@atmel.com --- Change in v2: - only move line to configure it to peripheral --- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c index 6f67c34..17a2a40 100644 --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c @@ -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

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
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.
Signed-off-by: Bo Shen voice.shen@atmel.com
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

remove unneeded #undef for at91sam9x5ek board.
Signed-off-by: Bo Shen voice.shen@atmel.com ---
include/configs/at91sam9x5ek.h | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index ea9a50e..4eeaf3b 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include/configs/at91sam9x5ek.h @@ -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

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
remove unneeded #undef for at91sam9x5ek board.
Signed-off-by: Bo Shen voice.shen@atmel.com
include/configs/at91sam9x5ek.h | 5 ----- 1 file changed, 5 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

In 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.
Signed-off-by: Bo Shen voice.shen@atmel.com
---
include/configs/at91sam9x5ek.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 4eeaf3b..f0a6757 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include/configs/at91sam9x5ek.h @@ -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

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
In 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.
Signed-off-by: Bo Shen voice.shen@atmel.com
include/configs/at91sam9x5ek.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Hi Bo,
On 12/10/2013 09:13 AM, Bo Shen wrote:
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?
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(-)
Best regards
Andreas Bießmann

Hi Andreas,
On 12/17/2013 05:07 PM, Andreas Bießmann wrote:
Hi Bo,
On 12/10/2013 09:13 AM, Bo Shen wrote:
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.
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(-)
Best regards
Andreas Bießmann
Best Regards, Bo Shen

Hi Andreas,
On 12/17/2013 05:07 PM, Andreas Bießmann wrote:
Hi Bo,
On 12/10/2013 09:13 AM, Bo Shen wrote:
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.
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(-)
Best regards
Andreas Bießmann
Best Regards, Bo Shen
participants (2)
-
Andreas Bießmann
-
Bo Shen