km/spi: port SPI flash of KM Kirkwood boards to driver model
Subsystems (4)
cover km/spi: port SPI flash of KM Kirkwood boards to driver model
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
Signature · 1 line
2.21.0
PATCH 1/6 km: modify Kconfig file organization for KM boards
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.
--- 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
arch/arm/mach-kirkwood/Kconfig +3 -6
@@ -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"
arch/powerpc/cpu/mpc83xx/Kconfig +4 -8
@@ -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"
arch/powerpc/cpu/mpc85xx/Kconfig +2 -6
@@ -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"
board/keymile/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2019, Pascal Linder <[email protected]> + +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
board/keymile/km83xx/Kconfig +16 -0
@@ -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
board/keymile/km_arm/Kconfig +7 -0
@@ -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
board/keymile/kmp204x/Kconfig +8 -0
@@ -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
Signature · 1 line
2.21.0
PATCH 1/6 km: modify Kconfig file organization for KM boards
Quoted 20 lines · Pascal Linder
As preparation for the upcoming transferring of configurations from header files to
Kconfig, a commonKconfigfile for all KM boards was created. For the moment, it only sources the other three, more specific,Kconfigfiles. Therefore, the architectureKconfigfiles now include the commonKconfigfile. Also, the configuration selection for KM boards was moved from the architectureKconfigfiles to the board specificKconfigfiles.Signed-off-by Pascal Linder <[email protected]>Signed-off-by Holger Brunck <[email protected]>Cc Mario Six <[email protected]>Cc Prabhakar Kushwaha <[email protected]>--- 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(-)
Quoted 1 line
create mode 100644 board/keymile/Kconfig
This does not apply on top of current mainline. Please rebase and resubmit.
Thanks,
Stefan
PATCH 2/6 km/spi: add weak functions to kirkwood_spi driver (DM part)
In reply to Pascal LinderThe 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.
--- drivers/spi/kirkwood_spi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/spi/kirkwood_spi.c +16 -0
@@ -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,
Signature · 1 line
2.21.0
PATCH 3/6 km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards
In reply to Pascal LinderAs 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.
--- board/keymile/km_arm/km_arm.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
board/keymile/km_arm/km_arm.c +31 -0
@@ -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
Signature · 1 line
2.21.0
PATCH 4/6 km/spi: add SPI configuration to KM Kirkwood device tree
In reply to Pascal LinderIn 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.
--- arch/arm/dts/kirkwood-km_kirkwood.dts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm/dts/kirkwood-km_kirkwood.dts +22 -0
@@ -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"; + }; + }; +};
Signature · 1 line
2.21.0