]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: at91sam9263ek: Use SPI-flash-based AT45xxx DataFlash
authorWenyou.Yang@microchip.com <Wenyou.Yang@microchip.com>
Fri, 21 Jul 2017 05:40:09 +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/at91sam9263.dtsi
arch/arm/dts/at91sam9263ek.dts
board/atmel/at91sam9263ek/at91sam9263ek.c
configs/at91sam9263ek_dataflash_cs0_defconfig
configs/at91sam9263ek_dataflash_defconfig
configs/at91sam9263ek_nandflash_defconfig
configs/at91sam9263ek_norflash_boot_defconfig
configs/at91sam9263ek_norflash_defconfig
include/configs/at91sam9263ek.h

index e899fd3f6a76f063c465b92c6f30e11867d08bb0..0b594be221214210882fe2da83711c17ec6ac4f3 100644 (file)
@@ -32,6 +32,7 @@
                ssc0 = &ssc0;
                ssc1 = &ssc1;
                pwm0 = &pwm0;
+               spi0 = &spi0;
        };
 
        cpus {
index 8cd7fada4f7d7b279124419748364e1fb14fdf25..35799b8a5e765d4c7184953352b78f3b12286009 100644 (file)
@@ -87,7 +87,7 @@
                                cs-gpios = <&pioA 5 0>, <0>, <0>, <0>;
                                mtd_dataflash@0 {
                                        compatible = "atmel,at45", "atmel,dataflash";
-                                       spi-max-frequency = <50000000>;
+                                       spi-max-frequency = <15000000>;
                                        reg = <0>;
                                };
                        };
index 9fa689399fe5eba2b813ad20ec6ff272a6e392da..bb06e5667a55494b255d4ba7b0a0ba104c32bf8c 100644 (file)
@@ -205,10 +205,6 @@ int board_init(void)
 #ifdef CONFIG_CMD_NAND
        at91sam9263ek_nand_hw_init();
 #endif
-#ifdef CONFIG_HAS_DATAFLASH
-       at91_set_pio_output(AT91_PIO_PORTE, 20, 1);     /* select spi0 clock */
-       at91_spi0_hw_init(1 << 0);
-#endif
 #ifdef CONFIG_USB_OHCI_NEW
        at91_uhp_hw_init();
 #endif
index be7f980158020a5f3f0d3dc9b7e823eccb0e9fb6..09157955e0882bdea88c0fd7f02573e8e4b227c9 100644 (file)
@@ -5,7 +5,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="at91sam9263ek"
 CONFIG_DEBUG_UART=y
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9263,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_USB=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE 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_DM_ETH=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
@@ -45,6 +50,8 @@ 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_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
index be7f980158020a5f3f0d3dc9b7e823eccb0e9fb6..09157955e0882bdea88c0fd7f02573e8e4b227c9 100644 (file)
@@ -5,7 +5,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="at91sam9263ek"
 CONFIG_DEBUG_UART=y
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9263,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_USB=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE 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_DM_ETH=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
@@ -45,6 +50,8 @@ 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_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
index d6a14c3c7a6ad0c492d302172a217f588a45168a..abe14b36f730273aa648cf127bf76c023eb7fac2 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_USB=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE 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_DM_ETH=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
@@ -45,6 +50,8 @@ 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_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
index 6d8a5de36af66bbf0ce500a84c59878e00bbbc98..94796019cdd196242c4ff6f294e4469435ef585b 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_USB=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE is not set
@@ -35,6 +36,10 @@ CONFIG_AT91_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_MTD_NOR_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_SPI_FLASH_DATAFLASH=y
 CONFIG_DM_ETH=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
@@ -46,6 +51,8 @@ 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_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
index 11a9a91203ca195925ae22cef5876228c32e3c30..3a94c6301dbd53192139d6a0571fe729314bc7a2 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_USB=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SOURCE is not set
@@ -35,6 +36,10 @@ CONFIG_AT91_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_MTD_NOR_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_SPI_FLASH_DATAFLASH=y
 CONFIG_DM_ETH=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
@@ -46,6 +51,8 @@ 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_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
index 27001e7007a90127ed60dd1dfaee5989aefa4a3d..e0abaa75a925b85d1f2ead7be04cf85974ce1a37 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR \
        (ATMEL_BASE_SRAM1 + 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)
-
 /* NOR flash, if populated */
 #ifdef CONFIG_SYS_USE_NORFLASH
 #define CONFIG_SYS_FLASH_CFI                   1
 #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) "\