[U-Boot] [PATCH 1/3] arm: atmel: at91sam9x5: cleanup cs configure for spi

Bo Shen voice.shen at atmel.com
Tue Dec 10 09:14:00 CET 2013


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 at 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
-- 
1.7.9.5



More information about the U-Boot mailing list