* [U-Boot] [PATCH 0/6] km/spi: port SPI flash of KM Kirkwood boards to driver model
@ 2019-06-18 6:40 Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 1/6] km: modify Kconfig file organization for KM boards Pascal Linder
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Pascal Linder @ 2019-06-18 6:40 UTC (permalink / raw)
To: u-boot
This series of patches contains the portation of the SPI flash
interface for KM Kirkwood boards to the driver model. Apart from the
board specific code, some changes were necessary in the kirkwood_spi
driver that, however, only affect KM boards.
Furthermore, the Kconfig architecture in the Keymile folder has changed in
order to prepare the upcoming transferring of configurations to Kconfig.
Pascal Linder (6):
km: modify Kconfig file organization for KM boards
km/spi: add weak functions to kirkwood_spi driver (DM part)
km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards
km/spi: add SPI configuration to KM Kirkwood device tree
km/spi: activate driver model for SPI flash on KM Kirkwood boards
km/spi: remove deprecated SPI flash driver code for KM Kirkwood boards
arch/arm/dts/kirkwood-km_kirkwood.dts | 22 ++++++++++++
arch/arm/include/asm/arch-mvebu/spi.h | 11 ------
arch/arm/mach-kirkwood/Kconfig | 9 ++---
arch/powerpc/cpu/mpc83xx/Kconfig | 12 +++----
arch/powerpc/cpu/mpc85xx/Kconfig | 8 ++---
board/keymile/Kconfig | 16 +++++++++
board/keymile/km83xx/Kconfig | 16 +++++++++
board/keymile/km_arm/Kconfig | 10 ++++++
board/keymile/km_arm/km_arm.c | 23 ++++++++++--
board/keymile/kmp204x/Kconfig | 8 +++++
configs/portl2_defconfig | 3 +-
drivers/spi/kirkwood_spi.c | 52 +++++++++------------------
include/configs/km/km_arm.h | 5 ---
scripts/config_whitelist.txt | 1 -
14 files changed, 120 insertions(+), 76 deletions(-)
create mode 100644 board/keymile/Kconfig
--
2.21.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/6] km: modify Kconfig file organization for KM boards
2019-06-18 6:40 [U-Boot] [PATCH 0/6] km/spi: port SPI flash of KM Kirkwood boards to driver model Pascal Linder
@ 2019-06-18 6:41 ` Pascal Linder
2019-06-18 9:47 ` Stefan Roese
2019-06-18 6:41 ` [U-Boot] [PATCH 2/6] km/spi: add weak functions to kirkwood_spi driver (DM part) Pascal Linder
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Pascal Linder @ 2019-06-18 6:41 UTC (permalink / raw)
To: u-boot
As preparation for the upcoming transferring of configurations from header
files to Kconfig, a common Kconfig file for all KM boards was created. For
the moment, it only sources the other three, more specific, Kconfig files.
Therefore, the architecture Kconfig files now include the common Kconfig
file. Also, the configuration selection for KM boards was moved from the
architecture Kconfig files to the board specific Kconfig files.
Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
---
arch/arm/mach-kirkwood/Kconfig | 9 +++------
arch/powerpc/cpu/mpc83xx/Kconfig | 12 ++++--------
arch/powerpc/cpu/mpc85xx/Kconfig | 8 ++------
board/keymile/Kconfig | 16 ++++++++++++++++
board/keymile/km83xx/Kconfig | 16 ++++++++++++++++
board/keymile/km_arm/Kconfig | 7 +++++++
board/keymile/kmp204x/Kconfig | 8 ++++++++
7 files changed, 56 insertions(+), 20 deletions(-)
create mode 100644 board/keymile/Kconfig
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 3b860c4f55..8495aabc97 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -32,11 +32,8 @@ config TARGET_ICONNECT
bool "iconnect Board"
config TARGET_KM_KIRKWOOD
- bool "KM_KIRKWOOD Board"
- select BOARD_LATE_INIT
- imply CMD_CRAMFS
- imply CMD_DIAG
- imply FS_CRAMFS
+ bool "KM Kirkwood Board"
+ select VENDOR_KM
config TARGET_NET2BIG_V2
bool "LaCie 2Big Network v2 NAS Board"
@@ -79,7 +76,7 @@ source "board/buffalo/lsxl/Kconfig"
source "board/cloudengines/pogo_e02/Kconfig"
source "board/d-link/dns325/Kconfig"
source "board/iomega/iconnect/Kconfig"
-source "board/keymile/km_arm/Kconfig"
+source "board/keymile/Kconfig"
source "board/LaCie/net2big_v2/Kconfig"
source "board/LaCie/netspace_v2/Kconfig"
source "board/raidsonic/ib62x0/Kconfig"
diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 571cf8fc2e..9c96b8afc9 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -68,19 +68,15 @@ config TARGET_IDS8313
config TARGET_KM8360
bool "Support km8360"
- imply CMD_CRAMFS
- imply CMD_DIAG
- imply FS_CRAMFS
+ select VENDOR_KM
config TARGET_SUVD3
bool "Support suvd3"
- imply CMD_CRAMFS
- imply FS_CRAMFS
+ select VENDOR_KM
config TARGET_TUXX1
bool "Support tuxx1"
- imply CMD_CRAMFS
- imply FS_CRAMFS
+ select VENDOR_KM
config TARGET_TQM834X
bool "Support TQM834x"
@@ -107,7 +103,7 @@ source "board/freescale/mpc8349itx/Kconfig"
source "board/freescale/mpc837xemds/Kconfig"
source "board/freescale/mpc837xerdb/Kconfig"
source "board/ids/ids8313/Kconfig"
-source "board/keymile/km83xx/Kconfig"
+source "board/keymile/Kconfig"
source "board/mpc8308_p1m/Kconfig"
source "board/sbc8349/Kconfig"
source "board/tqc/tqm834x/Kconfig"
diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig
index 0057f195b3..d2b64328a2 100644
--- a/arch/powerpc/cpu/mpc85xx/Kconfig
+++ b/arch/powerpc/cpu/mpc85xx/Kconfig
@@ -412,11 +412,7 @@ config TARGET_CONTROLCENTERD
config TARGET_KMP204X
bool "Support kmp204x"
- select ARCH_P2041
- select PHYS_64BIT
- select FSL_DDR_INTERACTIVE
- imply CMD_CRAMFS
- imply FS_CRAMFS
+ select VENDOR_KM
config TARGET_XPEDITE520X
bool "Support xpedite520x"
@@ -1593,7 +1589,7 @@ source "board/freescale/t208xrdb/Kconfig"
source "board/freescale/t4qds/Kconfig"
source "board/freescale/t4rdb/Kconfig"
source "board/gdsys/p1022/Kconfig"
-source "board/keymile/kmp204x/Kconfig"
+source "board/keymile/Kconfig"
source "board/sbc8548/Kconfig"
source "board/socrates/Kconfig"
source "board/varisys/cyrus/Kconfig"
diff --git a/board/keymile/Kconfig b/board/keymile/Kconfig
new file mode 100644
index 0000000000..e30d64818c
--- /dev/null
+++ b/board/keymile/Kconfig
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019, Pascal Linder <pascal.linder@edu.hefr.ch>
+
+config VENDOR_KM
+ bool
+ help
+ Selected by any KM board to have additional configurations.
+
+if VENDOR_KM
+
+source "board/keymile/km83xx/Kconfig"
+source "board/keymile/kmp204x/Kconfig"
+source "board/keymile/km_arm/Kconfig"
+
+endif
diff --git a/board/keymile/km83xx/Kconfig b/board/keymile/km83xx/Kconfig
index d6c594c96a..9bb1a74ddd 100644
--- a/board/keymile/km83xx/Kconfig
+++ b/board/keymile/km83xx/Kconfig
@@ -9,6 +9,12 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "km8360"
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ imply CMD_CRAMFS
+ imply CMD_DIAG
+ imply FS_CRAMFS
+
endif
if TARGET_SUVD3
@@ -22,6 +28,11 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "suvd3"
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ imply CMD_CRAMFS
+ imply FS_CRAMFS
+
endif
if TARGET_TUXX1
@@ -35,4 +46,9 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "tuxx1"
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ imply CMD_CRAMFS
+ imply FS_CRAMFS
+
endif
diff --git a/board/keymile/km_arm/Kconfig b/board/keymile/km_arm/Kconfig
index 3476780847..2542f1ea8f 100644
--- a/board/keymile/km_arm/Kconfig
+++ b/board/keymile/km_arm/Kconfig
@@ -9,4 +9,11 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "km_kirkwood"
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ select BOARD_LATE_INIT
+ imply CMD_CRAMFS
+ imply CMD_DIAG
+ imply FS_CRAMFS
+
endif
diff --git a/board/keymile/kmp204x/Kconfig b/board/keymile/kmp204x/Kconfig
index 7b45a13cfb..f74d4295c7 100644
--- a/board/keymile/kmp204x/Kconfig
+++ b/board/keymile/kmp204x/Kconfig
@@ -9,4 +9,12 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "kmp204x"
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ select ARCH_P2041
+ select FSL_DDR_INTERACTIVE
+ select PHYS_64BIT
+ imply CMD_CRAMFS
+ imply FS_CRAMFS
+
endif
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/6] km/spi: add weak functions to kirkwood_spi driver (DM part)
2019-06-18 6:40 [U-Boot] [PATCH 0/6] km/spi: port SPI flash of KM Kirkwood boards to driver model Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 1/6] km: modify Kconfig file organization for KM boards Pascal Linder
@ 2019-06-18 6:41 ` Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 3/6] km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 4/6] km/spi: add SPI configuration to KM Kirkwood device tree Pascal Linder
3 siblings, 0 replies; 6+ messages in thread
From: Pascal Linder @ 2019-06-18 6:41 UTC (permalink / raw)
To: u-boot
The weak functions, known from the legacy code, are added to the DM part
as well. For this purpose, the release operation first needs to be
implemented. KM Kirkwood boards will overwrite those weak functions to
change the MPP configuration when claiming/releasing the bus, because the
hardware pins are shared between the SPI NOR and NAND devices.
Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
---
drivers/spi/kirkwood_spi.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index 5dd1ad67cf..881a775003 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -338,6 +338,11 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,
return _spi_xfer(plat->spireg, bitlen, dout, din, flags);
}
+__attribute__((weak)) int mvebu_board_spi_claim_bus(struct udevice *dev)
+{
+ return 0;
+}
+
static int mvebu_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
@@ -348,9 +353,19 @@ static int mvebu_spi_claim_bus(struct udevice *dev)
KWSPI_CS_MASK << KWSPI_CS_SHIFT,
spi_chip_select(dev) << KWSPI_CS_SHIFT);
+ return mvebu_board_spi_claim_bus(dev);
+}
+
+__attribute__((weak)) int mvebu_board_spi_release_bus(struct udevice *dev)
+{
return 0;
}
+static int mvebu_spi_release_bus(struct udevice *dev)
+{
+ return mvebu_board_spi_release_bus(dev);
+}
+
static int mvebu_spi_probe(struct udevice *bus)
{
struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
@@ -377,6 +392,7 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
static const struct dm_spi_ops mvebu_spi_ops = {
.claim_bus = mvebu_spi_claim_bus,
+ .release_bus = mvebu_spi_release_bus,
.xfer = mvebu_spi_xfer,
.set_speed = mvebu_spi_set_speed,
.set_mode = mvebu_spi_set_mode,
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 3/6] km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards
2019-06-18 6:40 [U-Boot] [PATCH 0/6] km/spi: port SPI flash of KM Kirkwood boards to driver model Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 1/6] km: modify Kconfig file organization for KM boards Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 2/6] km/spi: add weak functions to kirkwood_spi driver (DM part) Pascal Linder
@ 2019-06-18 6:41 ` Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 4/6] km/spi: add SPI configuration to KM Kirkwood device tree Pascal Linder
3 siblings, 0 replies; 6+ messages in thread
From: Pascal Linder @ 2019-06-18 6:41 UTC (permalink / raw)
To: u-boot
As the SPI NOR and NAND devices share the same hardware pins, the MPP
configuration has to be changed when claiming/releasing the bus. The
current configuration is saved when claiming and restored when releasing.
Furthermore, a general-purpose output is used to switch the chip-select
signal. This is now also implemented for the DM part of the kirkwood_spi
driver.
Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
---
board/keymile/km_arm/km_arm.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index ea03be9eb3..7087cc520f 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -322,6 +322,37 @@ void board_spi_release_bus(struct spi_slave *slave)
kw_gpio_set_value(KM_FLASH_GPIO_PIN, 1);
}
+static const u32 spi_mpp_config[] = {
+ MPP1_SPI_MOSI,
+ MPP2_SPI_SCK,
+ MPP3_SPI_MISO,
+ 0
+};
+
+static u32 spi_mpp_backup[4];
+
+int mvebu_board_spi_claim_bus(struct udevice *dev)
+{
+ spi_mpp_backup[3] = 0;
+
+ /* set new spi mpp config and save current one */
+ kirkwood_mpp_conf(spi_mpp_config, spi_mpp_backup);
+
+ kw_gpio_set_value(KM_FLASH_GPIO_PIN, 0);
+
+ return 0;
+}
+
+int mvebu_board_spi_release_bus(struct udevice *dev)
+{
+ /* restore saved mpp config */
+ kirkwood_mpp_conf(spi_mpp_backup, NULL);
+
+ kw_gpio_set_value(KM_FLASH_GPIO_PIN, 1);
+
+ return 0;
+}
+
#if (defined(CONFIG_KM_PIGGY4_88E6061))
#define PHY_LED_SEL_REG 0x18
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 4/6] km/spi: add SPI configuration to KM Kirkwood device tree
2019-06-18 6:40 [U-Boot] [PATCH 0/6] km/spi: port SPI flash of KM Kirkwood boards to driver model Pascal Linder
` (2 preceding siblings ...)
2019-06-18 6:41 ` [U-Boot] [PATCH 3/6] km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards Pascal Linder
@ 2019-06-18 6:41 ` Pascal Linder
3 siblings, 0 replies; 6+ messages in thread
From: Pascal Linder @ 2019-06-18 6:41 UTC (permalink / raw)
To: u-boot
In order to migrate the SPI flash interface to the driver model, the SPI
configuration needs to be added in the KM Kirkwood device tree file.
Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
---
arch/arm/dts/kirkwood-km_kirkwood.dts | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/arch/arm/dts/kirkwood-km_kirkwood.dts b/arch/arm/dts/kirkwood-km_kirkwood.dts
index f035eff1c1..b2c0209f5d 100644
--- a/arch/arm/dts/kirkwood-km_kirkwood.dts
+++ b/arch/arm/dts/kirkwood-km_kirkwood.dts
@@ -13,6 +13,10 @@
device_type = "memory";
reg = <0x00000000 0x08000000>;
};
+
+ aliases {
+ spi0 = &spi0;
+ };
};
&mdio {
@@ -29,3 +33,21 @@
phy-handle = <ðphy0>;
};
};
+
+&spi0 {
+ status = "okay";
+
+ flash at 0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "st,m25p80", "jedec,spi-nor", "spi-flash";
+ reg = <0>;
+ spi-max-frequency = <33000000>;
+ mode = <3>;
+
+ partition at uboot {
+ reg = <0x000000 0x0c0000>;
+ label = "uboot";
+ };
+ };
+};
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/6] km: modify Kconfig file organization for KM boards
2019-06-18 6:41 ` [U-Boot] [PATCH 1/6] km: modify Kconfig file organization for KM boards Pascal Linder
@ 2019-06-18 9:47 ` Stefan Roese
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Roese @ 2019-06-18 9:47 UTC (permalink / raw)
To: u-boot
On 18.06.19 08:41, Pascal Linder wrote:
> As preparation for the upcoming transferring of configurations from header
> files to Kconfig, a common Kconfig file for all KM boards was created. For
> the moment, it only sources the other three, more specific, Kconfig files.
> Therefore, the architecture Kconfig files now include the common Kconfig
> file. Also, the configuration selection for KM boards was moved from the
> architecture Kconfig files to the board specific Kconfig files.
>
> Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
> Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
> Cc: Mario Six <mario.six@gdsys.cc>
> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> ---
> arch/arm/mach-kirkwood/Kconfig | 9 +++------
> arch/powerpc/cpu/mpc83xx/Kconfig | 12 ++++--------
> arch/powerpc/cpu/mpc85xx/Kconfig | 8 ++------
> board/keymile/Kconfig | 16 ++++++++++++++++
> board/keymile/km83xx/Kconfig | 16 ++++++++++++++++
> board/keymile/km_arm/Kconfig | 7 +++++++
> board/keymile/kmp204x/Kconfig | 8 ++++++++
> 7 files changed, 56 insertions(+), 20 deletions(-)
> create mode 100644 board/keymile/Kconfig
This does not apply on top of current mainline. Please rebase and
resubmit.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-18 9:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 6:40 [U-Boot] [PATCH 0/6] km/spi: port SPI flash of KM Kirkwood boards to driver model Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 1/6] km: modify Kconfig file organization for KM boards Pascal Linder
2019-06-18 9:47 ` Stefan Roese
2019-06-18 6:41 ` [U-Boot] [PATCH 2/6] km/spi: add weak functions to kirkwood_spi driver (DM part) Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 3/6] km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards Pascal Linder
2019-06-18 6:41 ` [U-Boot] [PATCH 4/6] km/spi: add SPI configuration to KM Kirkwood device tree Pascal Linder
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.