arm: mvebu: Add SPI driver model support
authorStefan Roese <sr@denx.de>
Fri, 20 Nov 2015 12:51:57 +0000 (13:51 +0100)
committerStefan Roese <sr@denx.de>
Thu, 14 Jan 2016 13:08:59 +0000 (14:08 +0100)
This patch enables the DM support for the SPI driver and the
SPI NOR flash chips. Some MVEBU boards boot from SPI NOR, so
adding the aliases and enabling CONFIG_DM_SEQ_ALIAS is needed
here.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Cc: Dirk Eibach <dirk.eibach@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
arch/arm/Kconfig
arch/arm/dts/armada-388-gp.dts
arch/arm/dts/armada-38x.dtsi
arch/arm/dts/armada-xp-gp.dts
arch/arm/dts/armada-xp.dtsi
arch/arm/mach-mvebu/include/mach/config.h
arch/arm/mach-mvebu/include/mach/soc.h
include/configs/db-88f6820-gp.h

index b886d014011c6fa8a3796a43934f3daa31a867e6..68ae6b6d06d2255d2ce62fc114e4d736793fd2d7 100644 (file)
@@ -118,8 +118,11 @@ config ARCH_MVEBU
        select OF_SEPARATE
        select DM
        select DM_SERIAL
+       select DM_SPI
+       select DM_SPI_FLASH
        select SPL_DM
        select SPL_OF_CONTROL
+       select SPL_SIMPLE_BUS
 
 config TARGET_DEVKIT3250
        bool "Support devkit3250"
index f576e938265a5c8c59f5963a49d99b00db5ac128..f3bcbc6320344413d31319c45a65ea6c7624607b 100644 (file)
                stdout-path = "serial0:115200n8";
        };
 
+       aliases {
+               spi0 = &spi0;
+       };
+
        memory {
                device_type = "memory";
                reg = <0x00000000 0x80000000>; /* 2 GB */
                                pinctrl-names = "default";
                                pinctrl-0 = <&spi0_pins>;
                                status = "okay";
+                               u-boot,dm-pre-reloc;
 
                                spi-flash@0 {
+                                       u-boot,dm-pre-reloc;
                                        #address-cells = <1>;
                                        #size-cells = <1>;
                                        compatible = "st,m25p128", "jedec,spi-nor";
index 04ecfe6e2bc6e3c47210a9f5af18516b2e0b61d4..dc8a1a66c1fb627d710176fa0cfdb391d6f8d180 100644 (file)
@@ -70,6 +70,7 @@
 
        soc {
                compatible = "marvell,armada380-mbus", "simple-bus";
+               u-boot,dm-pre-reloc;
                #address-cells = <2>;
                #size-cells = <1>;
                controller = <&mbusc>;
 
                internal-regs {
                        compatible = "simple-bus";
+                       u-boot,dm-pre-reloc;
                        #address-cells = <1>;
                        #size-cells = <1>;
                        ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;
index ca5f8bb21010ecfb9c1bcaf22f0a297570403ab0..27799d1254eadc1f9056a17184195449c5cd8624 100644 (file)
                stdout-path = "serial0:115200n8";
        };
 
+       aliases {
+               spi0 = &spi0;
+       };
+
        memory {
                device_type = "memory";
                /*
 
                        spi0: spi@10600 {
                                status = "okay";
+                               u-boot,dm-pre-reloc;
 
                                spi-flash@0 {
+                                       u-boot,dm-pre-reloc;
                                        #address-cells = <1>;
                                        #size-cells = <1>;
                                        compatible = "n25q128a13", "jedec,spi-nor";
index 3de9b761cc1ab0fe7a8d3f0ea9caa7ca72e2a989..3fac39e41d789199947a3927bf7c4630ea14c275 100644 (file)
@@ -63,6 +63,7 @@
 
        soc {
                compatible = "marvell,armadaxp-mbus", "simple-bus";
+               u-boot,dm-pre-reloc;
 
                bootrom {
                        compatible = "marvell,bootrom";
index 3d18827573322f77faaf0f636e54f99546a2e403..74a1ff6ad7b5b8c1baefc5ea33e49885bee23e64 100644 (file)
@@ -47,8 +47,7 @@
  * SPI Flash configuration
  */
 #ifdef CONFIG_CMD_SF
-#define CONFIG_HARD_SPI                        1
-#define CONFIG_KIRKWOOD_SPI            1
+#define CONFIG_KIRKWOOD_SPI
 #ifndef CONFIG_ENV_SPI_BUS
 # define CONFIG_ENV_SPI_BUS            0
 #endif
@@ -60,6 +59,9 @@
 #endif
 #endif
 
+/* Needed for SPI NOR booting in SPL */
+#define CONFIG_DM_SEQ_ALIAS            1
+
 /*
  * Ethernet Driver configuration
  */
index 800f5d55a2504f062abd879a9dedc0e0d56ed752..3cdb1f24d77b912e7bca3ec853aa9e84ac442408 100644 (file)
@@ -47,7 +47,6 @@
 #define MVEBU_SDRAM_SCRATCH    (MVEBU_REGISTER(0x01504))
 #define MVEBU_L2_CACHE_BASE    (MVEBU_REGISTER(0x08000))
 #define CONFIG_SYS_PL310_BASE  MVEBU_L2_CACHE_BASE
-#define MVEBU_SPI_BASE         (MVEBU_REGISTER(0x10600))
 #define MVEBU_TWSI_BASE                (MVEBU_REGISTER(0x11000))
 #define MVEBU_MPP_BASE         (MVEBU_REGISTER(0x18000))
 #define MVEBU_GPIO0_BASE       (MVEBU_REGISTER(0x18100))
index dfc243d146d8d843ca2dc63059369993b924dc77..55ba7d30a62f9ba0cd46955ccef07c2f016961fa 100644 (file)
 #define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SPL_SPI_BUS             0
 #define CONFIG_SPL_SPI_CS              0
-#define CONFIG_SYS_SPI_U_BOOT_OFFS     0x20000
+#define CONFIG_SYS_SPI_U_BOOT_OFFS     0x24000
 #define CONFIG_SYS_U_BOOT_OFFS         CONFIG_SYS_SPI_U_BOOT_OFFS
 #endif