diff mbox

[U-Boot,2/3] arm : at91sam9x5 : enable serial flash boot

Message ID 1345092267-16077-3-git-send-email-voice.shen@atmel.com
State Changes Requested, archived
Delegated to: Andreas Bießmann
Headers show

Commit Message

Bo Shen Aug. 16, 2012, 4:44 a.m. UTC
enable at91sam9x5 boot from serial flash

  Use at91sam9x5_dataflash to configure the u-boot

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
 arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |    4 ++--
 boards.cfg                                       |    1 +
 include/configs/at91sam9x5ek.h                   |   18 ++++++++++++++----
 3 files changed, 17 insertions(+), 6 deletions(-)

Comments

Andreas Bießmann Aug. 16, 2012, 7:36 a.m. UTC | #1
Dear Bo Shen,

On 16.08.2012 06:44, Bo Shen wrote:
> enable at91sam9x5 boot from serial flash
> 
>   Use at91sam9x5_dataflash to configure the u-boot
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
>  arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |    4 ++--
>  boards.cfg                                       |    1 +
>  include/configs/at91sam9x5ek.h                   |   18 ++++++++++++++----
>  3 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> index 7558ca2..6d77219 100644
> --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> @@ -121,7 +121,7 @@ void at91_serial2_hw_init(void)
>  #ifdef CONFIG_ATMEL_SPI
>  void at91_spi0_hw_init(unsigned long cs_mask)
>  {
> -	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
> +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
>  
>  	at91_set_a_periph(AT91_PIO_PORTA, 11, 0);	/* SPI0_MISO */
>  	at91_set_a_periph(AT91_PIO_PORTA, 12, 0);	/* SPI0_MOSI */
> @@ -150,7 +150,7 @@ void at91_spi0_hw_init(unsigned long cs_mask)
>  
>  void at91_spi1_hw_init(unsigned long cs_mask)
>  {
> -	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
> +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
>  
>  	at91_set_b_periph(AT91_PIO_PORTA, 21, 0);	/* SPI1_MISO */
>  	at91_set_b_periph(AT91_PIO_PORTA, 22, 0);	/* SPI1_MOSI */

I would like to see these two fixes in a separate patch 'fix spi access'
or something else.

rest of this patch looks sane to me.

Best regards

Andreas Bießmann
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
index 7558ca2..6d77219 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
@@ -121,7 +121,7 @@  void at91_serial2_hw_init(void)
 #ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTA, 11, 0);	/* SPI0_MISO */
 	at91_set_a_periph(AT91_PIO_PORTA, 12, 0);	/* SPI0_MOSI */
@@ -150,7 +150,7 @@  void at91_spi0_hw_init(unsigned long cs_mask)
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_b_periph(AT91_PIO_PORTA, 21, 0);	/* SPI1_MISO */
 	at91_set_b_periph(AT91_PIO_PORTA, 22, 0);	/* SPI1_MOSI */
diff --git a/boards.cfg b/boards.cfg
index edd750c..945ef09 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -91,6 +91,7 @@  at91sam9m10g45ek_nandflash   arm         arm926ejs   at91sam9m10g45ek    atmel
 at91sam9rlek_dataflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH
 at91sam9rlek_nandflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH
 at91sam9x5ek_nandflash       arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_NANDFLASH
+at91sam9x5ek_dataflash       arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_DATAFLASH
 at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
 at91sam9xeek_dataflash_cs1   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
 at91sam9xeek_nandflash       arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 82f6b48..21ef862 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -86,6 +86,7 @@ 
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_NAND
+#define CONFIG_CMD_SF
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS		1
@@ -96,12 +97,10 @@ 
 	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
 
 /* DataFlash */
-#ifdef CONFIG_ATMEL_SPI
-#define CONFIG_CMD_SF
-#define CONFIG_CMD_SPI
+#ifdef CONFIG_CMD_SF
+#define CONFIG_ATMEL_SPI
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_ATMEL
-#define CONFIG_SYS_MAX_DATAFLASH_BANKS
 #endif
 
 /* no NOR flash */
@@ -149,6 +148,17 @@ 
 #define CONFIG_BOOTCOMMAND	"nand read " \
 				"0x22000000 0x200000 0x300000; " \
 				"bootm 0x22000000"
+#else
+#ifdef CONFIG_SYS_USE_DATAFLASH
+/* bootstrap + u-boot + env + linux in data flash */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET	0x5000
+#define CONFIG_ENV_SIZE		0x3000
+#define CONFIG_ENV_SECT_SIZE	0x1000
+#define CONFIG_BOOTCOMMAND	"sf probe 0; " \
+				"sf read 0x22000000 0x100000 0x300000; " \
+				"bootm 0x22000000"
+#endif
 #endif
 
 #define CONFIG_BOOTARGS		"mem=128M console=ttyS0,115200 " \