]> git.sur5r.net Git - u-boot/commitdiff
board: at91sam9rlek: Use SPI-flash-based AT45xxx DataFlash
authorWenyou.Yang@microchip.com <Wenyou.Yang@microchip.com>
Fri, 21 Jul 2017 05:40:10 +0000 (13:40 +0800)
committerTom Rini <trini@konsulko.com>
Sat, 5 Aug 2017 00:38:35 +0000 (20:38 -0400)
To support driver model and device tree, use the SPI-flash-based
AT45xxx DataFlash driver, DataFlash is a kind of SPI flash.
Instead of ATMEL_DATAFLASH_SPI DataFlash older driver that will
be removed in the future.

Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/dts/at91sam9rl.dtsi
board/atmel/at91sam9rlek/at91sam9rlek.c
configs/at91sam9rlek_dataflash_defconfig
configs/at91sam9rlek_mmc_defconfig
configs/at91sam9rlek_nandflash_defconfig
include/configs/at91sam9rlek.h

index 8249994878d747bfb53c7473d09f3752c9617739..4602cd21e17eb9bf2b9a45632fc5987185ada61b 100644 (file)
@@ -34,6 +34,7 @@
                ssc0 = &ssc0;
                ssc1 = &ssc1;
                pwm0 = &pwm0;
+               spi0 = &spi0;
        };
 
        cpus {
index 672b3768dcbc0b5c3d5b3a1ba1c4a1ad9f577f34..6b13bdf59540cdbec0b7bc3f90e881dc924caaf1 100644 (file)
@@ -184,9 +184,6 @@ int board_init(void)
 #ifdef CONFIG_CMD_NAND
        at91sam9rlek_nand_hw_init();
 #endif
-#ifdef CONFIG_HAS_DATAFLASH
-       at91_spi0_hw_init(1 << 0);
-#endif
 #ifdef CONFIG_LCD
        at91sam9rlek_lcd_hw_init();
 #endif
index 7c6f4834f48f26e19b17ddfd1dd0d530839798d2..fecddb153d039e5d3097f36066c22700a43a5644 100644 (file)
@@ -5,7 +5,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="at91sam9rlek"
 CONFIG_DEBUG_UART=y
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9RL,SYS_USE_DATAFLASH"
-CONFIG_ENV_IS_IN_DATAFLASH=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTDELAY=3
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
@@ -19,6 +19,7 @@ CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_SF=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -34,6 +35,10 @@ CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_SPI_FLASH_DATAFLASH=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
 CONFIG_DM_SERIAL=y
@@ -43,4 +48,6 @@ CONFIG_DEBUG_UART_CLOCK=100000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_SPI=y
 CONFIG_LCD=y
index 741a1ff56c415385e941cc90e90e1ac6da08358a..29ede1c71079a40b1e333bd4c3db04fa043ff2c3 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_SF=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -34,6 +35,10 @@ CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_SPI_FLASH_DATAFLASH=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
 CONFIG_DM_SERIAL=y
@@ -43,4 +48,6 @@ CONFIG_DEBUG_UART_CLOCK=100000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_SPI=y
 CONFIG_LCD=y
index 50ee486b32ac620a9c0e0ac9daf5778d0cc39065..089856010189a9a4e5a9671bfa1ca21bd76c9b5b 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_SF=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -34,6 +35,10 @@ CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_SPI_FLASH_DATAFLASH=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
 CONFIG_DM_SERIAL=y
@@ -43,4 +48,6 @@ CONFIG_DEBUG_UART_CLOCK=100000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_SPI=y
 CONFIG_LCD=y
index 683322a6fa3c8e18ed5225fb56df0f0a0303c7f5..d34b4abbdea448c8e7db928fd3b27fac7e16b80b 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR \
        (ATMEL_BASE_SRAM + 16 * 1024 - GENERATED_GBL_DATA_SIZE)
 
-/* DataFlash */
-#define CONFIG_ATMEL_DATAFLASH_SPI
-#define CONFIG_HAS_DATAFLASH                   1
-#define CONFIG_SYS_MAX_DATAFLASH_BANKS         1
-#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0    0xC0000000      /* CS0 */
-#define AT91_SPI_CLK                           15000000
-#define DATAFLASH_TCSS                         (0x1a << 16)
-#define DATAFLASH_TCHS                         (0x1 << 24)
-
 /* NAND flash */
 #ifdef CONFIG_CMD_NAND
 #define CONFIG_NAND_ATMEL
 #ifdef CONFIG_SYS_USE_DATAFLASH
 
 /* bootstrap + u-boot + env + linux in dataflash on CS0 */
-#define CONFIG_SYS_MONITOR_BASE        (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
-#define CONFIG_ENV_OFFSET              0x4200
-#define CONFIG_ENV_ADDR                (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
+#define CONFIG_ENV_OFFSET      0x4200
 #define CONFIG_ENV_SIZE                0x4200
-#define CONFIG_BOOTCOMMAND     "cp.b 0xC0084000 0x22000000 0x210000; bootm"
+#define CONFIG_ENV_SECT_SIZE   0x210
+#define CONFIG_ENV_SPI_MAX_HZ  15000000
+#define CONFIG_BOOTCOMMAND     "sf probe 0; " \
+                               "sf read 0x22000000 0x84000 0x294000; " \
+                               "bootm 0x22000000"
 #define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
                                "root=/dev/mtdblock0 " \
                                "mtdparts=atmel_nand:-(root) "\