* [PATCH 0/9] spi: dm-convert and cleanups
@ 2020-05-26 8:04 Jagan Teki
2020-05-26 8:04 ` [PATCH 1/9] spi Drop spi_init() Jagan Teki
` (8 more replies)
0 siblings, 9 replies; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
We still have few drivers left over,
drivers/spi/fsl_espi.c
drivers/spi/fsl_dspi.c
drivers/spi/kirkwood_spi.c
drivers/spi/mxc_spi.c
drivers/spi/omap3_spi.c
drivers/spi/sh_qspi.c
Yes, most of them have SPL foot-print issues but will figure
out the proper solutions and do necessary cleanup in coming
days.
Travis-CI:
https://travis-ci.org/github/openedev/u-boot-amarula/builds/691159310
Note:
- fsl_espi.c will completely removed along with SPI config
items on their boards, since there is no response on
dm-conversion over years even though we made couple of
zap patches.
- We are planning to push this soon.
Any inputs?
Jagan.
Jagan Teki (9):
spi Drop spi_init()
spi: Kconfig: Drop redundant CF_SPI definition
spi: Kconfig: Move MSCC_BB_SPI, FSL_QSPI into DM_SPI
ks2_evm: Switch to DM_SPL, SPL_OF_CONTROL
spi: davinci: Drop non-dm code
spi: mxs: Drop nondm code
spi: mxs: Code cleanup
spi: Zap SOFT_SPI (non-dm)
doc: driver-model: Update SPI migration status
configs/k2e_evm_defconfig | 2 +
configs/k2g_evm_defconfig | 2 +
configs/k2hk_evm_defconfig | 2 +
configs/k2l_evm_defconfig | 2 +
doc/driver-model/migration.rst | 5 -
drivers/spi/Kconfig | 73 ++++++------
drivers/spi/Makefile | 1 -
drivers/spi/cf_spi.c | 4 -
drivers/spi/davinci_spi.c | 157 -------------------------
drivers/spi/kirkwood_spi.c | 4 -
drivers/spi/mxs_spi.c | 158 +++----------------------
drivers/spi/soft_spi_legacy.c | 168 ---------------------------
include/configs/ti_armv7_keystone2.h | 17 ---
13 files changed, 58 insertions(+), 537 deletions(-)
delete mode 100644 drivers/spi/soft_spi_legacy.c
--
2.25.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/9] spi Drop spi_init()
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-05-27 18:21 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 2/9] spi: Kconfig: Drop redundant CF_SPI definition Jagan Teki
` (7 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
spi_init doesn't exist anywhere in the code.
Drop it.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/cf_spi.c | 4 ----
drivers/spi/kirkwood_spi.c | 4 ----
2 files changed, 8 deletions(-)
diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index dd9c77281f..dec92df69b 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -383,10 +383,6 @@ static int coldfire_spi_probe(struct udevice *bus)
return 0;
}
-void spi_init(void)
-{
-}
-
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int coldfire_dspi_ofdata_to_platdata(struct udevice *bus)
{
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index 01fcf6bef5..3986b06b25 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -183,10 +183,6 @@ int spi_cs_is_valid(unsigned int bus, unsigned int cs)
}
#endif
-void spi_init(void)
-{
-}
-
void spi_cs_activate(struct spi_slave *slave)
{
_spi_cs_activate(spireg);
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/9] spi: Kconfig: Drop redundant CF_SPI definition
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
2020-05-26 8:04 ` [PATCH 1/9] spi Drop spi_init() Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-05-27 18:22 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 3/9] spi: Kconfig: Move MSCC_BB_SPI, FSL_QSPI into DM_SPI Jagan Teki
` (6 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
CF_SPI kconfig option defined twice with DM_SPI
and non DM_SPI.
Drop the non DM_SPI side kconfig definition.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/Kconfig | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index fc759e71e2..658a48e57a 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -384,12 +384,6 @@ config MSCC_BB_SPI
Enable MSCC bitbang SPI driver. This driver can be used on
MSCC SOCs.
-config CF_SPI
- bool "ColdFire SPI driver"
- help
- Enable the ColdFire SPI driver. This driver can be used on
- some m68k SoCs.
-
config FSL_ESPI
bool "Freescale eSPI driver"
imply SPI_FLASH_BAR
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/9] spi: Kconfig: Move MSCC_BB_SPI, FSL_QSPI into DM_SPI
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
2020-05-26 8:04 ` [PATCH 1/9] spi Drop spi_init() Jagan Teki
2020-05-26 8:04 ` [PATCH 2/9] spi: Kconfig: Drop redundant CF_SPI definition Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-05-27 18:22 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 4/9] ks2_evm: Switch to DM_SPL, SPL_OF_CONTROL Jagan Teki
` (5 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
- MSCC_BB_SPI
- FSL_QSPI
Both are fully dm-driven, let's move them into DM_SPI
side definition.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/Kconfig | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 658a48e57a..59415209ee 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -141,6 +141,14 @@ config FSL_DSPI
this Freescale DSPI IP core. LS102xA and Colibri VF50/VF61 platforms
use this driver.
+config FSL_QSPI
+ bool "Freescale QSPI driver"
+ imply SPI_FLASH_BAR
+ help
+ Enable the Freescale Quad-SPI (QSPI) driver. This driver can be
+ used to access the SPI NOR flash on platforms embedding this
+ Freescale IP core.
+
config ICH_SPI
bool "Intel ICH SPI driver"
help
@@ -167,6 +175,13 @@ config MPC8XXX_SPI
help
Enable support for SPI on the MPC8XXX PowerPC SoCs.
+config MSCC_BB_SPI
+ bool "MSCC bitbang SPI driver"
+ depends on SOC_VCOREIII
+ help
+ Enable MSCC bitbang SPI driver. This driver can be used on
+ MSCC SOCs.
+
config MT7621_SPI
bool "MediaTek MT7621 SPI driver"
depends on SOC_MT7628
@@ -377,13 +392,6 @@ config SOFT_SPI
Enable Soft SPI driver. This driver is to use GPIO simulate
the SPI protocol.
-config MSCC_BB_SPI
- bool "MSCC bitbang SPI driver"
- depends on SOC_VCOREIII
- help
- Enable MSCC bitbang SPI driver. This driver can be used on
- MSCC SOCs.
-
config FSL_ESPI
bool "Freescale eSPI driver"
imply SPI_FLASH_BAR
@@ -392,14 +400,6 @@ config FSL_ESPI
access the SPI interface and SPI NOR flash on platforms embedding
this Freescale eSPI IP core.
-config FSL_QSPI
- bool "Freescale QSPI driver"
- imply SPI_FLASH_BAR
- help
- Enable the Freescale Quad-SPI (QSPI) driver. This driver can be
- used to access the SPI NOR flash on platforms embedding this
- Freescale IP core.
-
config DAVINCI_SPI
bool "Davinci & Keystone SPI driver"
depends on ARCH_DAVINCI || ARCH_KEYSTONE
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 4/9] ks2_evm: Switch to DM_SPL, SPL_OF_CONTROL
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
` (2 preceding siblings ...)
2020-05-26 8:04 ` [PATCH 3/9] spi: Kconfig: Move MSCC_BB_SPI, FSL_QSPI into DM_SPI Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-06-11 8:46 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 5/9] spi: davinci: Drop non-dm code Jagan Teki
` (4 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
This would make SPL build to DM_SPL, SPL_OF_CONTROL.
Build fine with but not tested.
Cc: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
configs/k2e_evm_defconfig | 2 ++
configs/k2g_evm_defconfig | 2 ++
configs/k2hk_evm_defconfig | 2 ++
configs/k2l_evm_defconfig | 2 ++
include/configs/ti_armv7_keystone2.h | 8 --------
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/configs/k2e_evm_defconfig b/configs/k2e_evm_defconfig
index 644b6e5464..9f91fb9598 100644
--- a/configs/k2e_evm_defconfig
+++ b/configs/k2e_evm_defconfig
@@ -36,11 +36,13 @@ CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
CONFIG_CMD_UBI=y
CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="keystone-k2e-evm"
CONFIG_ENV_IS_IN_NAND=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_DM=y
+CONFIG_SPL_DM=y
CONFIG_SYS_I2C_DAVINCI=y
CONFIG_TI_AEMIF=y
CONFIG_MISC=y
diff --git a/configs/k2g_evm_defconfig b/configs/k2g_evm_defconfig
index 5bc7f7f865..fb8fb250da 100644
--- a/configs/k2g_evm_defconfig
+++ b/configs/k2g_evm_defconfig
@@ -34,6 +34,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
CONFIG_CMD_UBI=y
CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="keystone-k2g-evm"
CONFIG_OF_LIST="keystone-k2g-generic keystone-k2g-evm keystone-k2g-ice"
CONFIG_DTB_RESELECT=y
@@ -41,6 +42,7 @@ CONFIG_MULTI_DTB_FIT=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DM=y
+CONFIG_SPL_DM=y
CONFIG_DFU_MMC=y
CONFIG_SYS_I2C_DAVINCI=y
CONFIG_MISC=y
diff --git a/configs/k2hk_evm_defconfig b/configs/k2hk_evm_defconfig
index eb5916c2c6..1cd7331653 100644
--- a/configs/k2hk_evm_defconfig
+++ b/configs/k2hk_evm_defconfig
@@ -36,11 +36,13 @@ CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
CONFIG_CMD_UBI=y
CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="keystone-k2hk-evm"
CONFIG_ENV_IS_IN_NAND=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_DM=y
+CONFIG_SPL_DM=y
CONFIG_SYS_I2C_DAVINCI=y
CONFIG_TI_AEMIF=y
CONFIG_MISC=y
diff --git a/configs/k2l_evm_defconfig b/configs/k2l_evm_defconfig
index 71a35e3496..ae4b26b7a9 100644
--- a/configs/k2l_evm_defconfig
+++ b/configs/k2l_evm_defconfig
@@ -36,11 +36,13 @@ CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
CONFIG_CMD_UBI=y
CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="keystone-k2l-evm"
CONFIG_ENV_IS_IN_NAND=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_DM=y
+CONFIG_SPL_DM=y
CONFIG_SYS_I2C_DAVINCI=y
CONFIG_TI_AEMIF=y
CONFIG_MISC=y
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h
index 1b014c1022..37210b2605 100644
--- a/include/configs/ti_armv7_keystone2.h
+++ b/include/configs/ti_armv7_keystone2.h
@@ -53,10 +53,6 @@
/* UART Configuration */
#define CONFIG_SYS_NS16550_MEM32
-#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL)
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE -4
-#endif
#define CONFIG_SYS_NS16550_COM1 KS2_UART0_BASE
#define CONFIG_SYS_NS16550_COM2 KS2_UART1_BASE
@@ -77,10 +73,6 @@
#define CONFIG_SYS_SPI2
#define CONFIG_SYS_SPI2_BASE KS2_SPI2_BASE
#define CONFIG_SYS_SPI2_NUM_CS 4
-#ifdef CONFIG_SPL_BUILD
-#undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
-#endif
/* Network Configuration */
#define CONFIG_BOOTP_DEFAULT
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 5/9] spi: davinci: Drop non-dm code
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
` (3 preceding siblings ...)
2020-05-26 8:04 ` [PATCH 4/9] ks2_evm: Switch to DM_SPL, SPL_OF_CONTROL Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-05-28 0:30 ` Adam Ford
2020-06-11 8:47 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 6/9] spi: mxs: Drop nondm code Jagan Teki
` (3 subsequent siblings)
8 siblings, 2 replies; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
Now all boards which are using davinci SPI driver
have moved to SPL_DM so drop the unneeded non-dm code.
Cc: Adam Ford <aford173@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/Kconfig | 12 +-
drivers/spi/davinci_spi.c | 157 ---------------------------
include/configs/ti_armv7_keystone2.h | 9 --
3 files changed, 6 insertions(+), 172 deletions(-)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 59415209ee..1a1f195232 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -119,6 +119,12 @@ config CF_SPI
Enable the ColdFire SPI driver. This driver can be used on
some m68k SoCs.
+config DAVINCI_SPI
+ bool "Davinci & Keystone SPI driver"
+ depends on ARCH_DAVINCI || ARCH_KEYSTONE
+ help
+ Enable the Davinci SPI driver
+
config DESIGNWARE_SPI
bool "Designware SPI driver"
help
@@ -400,12 +406,6 @@ config FSL_ESPI
access the SPI interface and SPI NOR flash on platforms embedding
this Freescale eSPI IP core.
-config DAVINCI_SPI
- bool "Davinci & Keystone SPI driver"
- depends on ARCH_DAVINCI || ARCH_KEYSTONE
- help
- Enable the Davinci SPI driver
-
config SH_QSPI
bool "Renesas Quad SPI driver"
help
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index 97ac97b1a5..e1e9b45cc9 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -55,41 +55,6 @@
/* SPIDEF */
#define SPIDEF_CSDEF0_MASK BIT(0)
-#ifndef CONFIG_DM_SPI
-#define SPI0_BUS 0
-#define SPI0_BASE CONFIG_SYS_SPI_BASE
-/*
- * Define default SPI0_NUM_CS as 1 for existing platforms that uses this
- * driver. Platform can configure number of CS using CONFIG_SYS_SPI0_NUM_CS
- * if more than one CS is supported and by defining CONFIG_SYS_SPI0.
- */
-#ifndef CONFIG_SYS_SPI0
-#define SPI0_NUM_CS 1
-#else
-#define SPI0_NUM_CS CONFIG_SYS_SPI0_NUM_CS
-#endif
-
-/*
- * define CONFIG_SYS_SPI1 when platform has spi-1 device (bus #1) and
- * CONFIG_SYS_SPI1_NUM_CS defines number of CS on this bus
- */
-#ifdef CONFIG_SYS_SPI1
-#define SPI1_BUS 1
-#define SPI1_NUM_CS CONFIG_SYS_SPI1_NUM_CS
-#define SPI1_BASE CONFIG_SYS_SPI1_BASE
-#endif
-
-/*
- * define CONFIG_SYS_SPI2 when platform has spi-2 device (bus #2) and
- * CONFIG_SYS_SPI2_NUM_CS defines number of CS on this bus
- */
-#ifdef CONFIG_SYS_SPI2
-#define SPI2_BUS 2
-#define SPI2_NUM_CS CONFIG_SYS_SPI2_NUM_CS
-#define SPI2_BASE CONFIG_SYS_SPI2_BASE
-#endif
-#endif
-
DECLARE_GLOBAL_DATA_PTR;
/* davinci spi register set */
@@ -122,9 +87,6 @@ struct davinci_spi_regs {
/* davinci spi slave */
struct davinci_spi_slave {
-#ifndef CONFIG_DM_SPI
- struct spi_slave slave;
-#endif
struct davinci_spi_regs *regs;
unsigned int freq; /* current SPI bus frequency */
unsigned int mode; /* current SPI mode used */
@@ -346,124 +308,6 @@ out:
return 0;
}
-#ifndef CONFIG_DM_SPI
-
-static inline struct davinci_spi_slave *to_davinci_spi(struct spi_slave *slave)
-{
- return container_of(slave, struct davinci_spi_slave, slave);
-}
-
-int spi_cs_is_valid(unsigned int bus, unsigned int cs)
-{
- int ret = 0;
-
- switch (bus) {
- case SPI0_BUS:
- if (cs < SPI0_NUM_CS)
- ret = 1;
- break;
-#ifdef CONFIG_SYS_SPI1
- case SPI1_BUS:
- if (cs < SPI1_NUM_CS)
- ret = 1;
- break;
-#endif
-#ifdef CONFIG_SYS_SPI2
- case SPI2_BUS:
- if (cs < SPI2_NUM_CS)
- ret = 1;
- break;
-#endif
- default:
- /* Invalid bus number. Do nothing */
- break;
- }
- return ret;
-}
-
-void spi_cs_activate(struct spi_slave *slave)
-{
- /* do nothing */
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
- /* do nothing */
-}
-
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
- unsigned int max_hz, unsigned int mode)
-{
- struct davinci_spi_slave *ds;
-
- if (!spi_cs_is_valid(bus, cs))
- return NULL;
-
- ds = spi_alloc_slave(struct davinci_spi_slave, bus, cs);
- if (!ds)
- return NULL;
-
- switch (bus) {
- case SPI0_BUS:
- ds->regs = (struct davinci_spi_regs *)SPI0_BASE;
- break;
-#ifdef CONFIG_SYS_SPI1
- case SPI1_BUS:
- ds->regs = (struct davinci_spi_regs *)SPI1_BASE;
- break;
-#endif
-#ifdef CONFIG_SYS_SPI2
- case SPI2_BUS:
- ds->regs = (struct davinci_spi_regs *)SPI2_BASE;
- break;
-#endif
- default: /* Invalid bus number */
- return NULL;
- }
-
- ds->freq = max_hz;
- ds->mode = mode;
-
- return &ds->slave;
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
- struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
- free(ds);
-}
-
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
- const void *dout, void *din, unsigned long flags)
-{
- struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
- ds->cur_cs = slave->cs;
-
- return __davinci_spi_xfer(ds, bitlen, dout, din, flags);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
- struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
-#ifdef CONFIG_SPI_HALF_DUPLEX
- ds->half_duplex = true;
-#else
- ds->half_duplex = false;
-#endif
- return __davinci_spi_claim_bus(ds, ds->slave.cs);
-}
-
-void spi_release_bus(struct spi_slave *slave)
-{
- struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
- __davinci_spi_release_bus(ds);
-}
-
-#else
static int davinci_spi_set_speed(struct udevice *bus, uint max_hz)
{
struct davinci_spi_slave *ds = dev_get_priv(bus);
@@ -582,4 +426,3 @@ U_BOOT_DRIVER(davinci_spi) = {
.ops = &davinci_spi_ops,
.priv_auto_alloc_size = sizeof(struct davinci_spi_slave),
};
-#endif
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h
index 37210b2605..b632ae010d 100644
--- a/include/configs/ti_armv7_keystone2.h
+++ b/include/configs/ti_armv7_keystone2.h
@@ -64,15 +64,6 @@
/* SPI Configuration */
#define CONFIG_SYS_SPI_CLK ks_clk_get_rate(KS2_CLK1_6)
-#define CONFIG_SYS_SPI0
-#define CONFIG_SYS_SPI_BASE KS2_SPI0_BASE
-#define CONFIG_SYS_SPI0_NUM_CS 4
-#define CONFIG_SYS_SPI1
-#define CONFIG_SYS_SPI1_BASE KS2_SPI1_BASE
-#define CONFIG_SYS_SPI1_NUM_CS 4
-#define CONFIG_SYS_SPI2
-#define CONFIG_SYS_SPI2_BASE KS2_SPI2_BASE
-#define CONFIG_SYS_SPI2_NUM_CS 4
/* Network Configuration */
#define CONFIG_BOOTP_DEFAULT
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 6/9] spi: mxs: Drop nondm code
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
` (4 preceding siblings ...)
2020-05-26 8:04 ` [PATCH 5/9] spi: davinci: Drop non-dm code Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-06-11 8:38 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 7/9] spi: mxs: Code cleanup Jagan Teki
` (2 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
Deadline for DM migration already passed by months
and no response on full dm conversation hence removed
the nondm code.
Note: Look like there is no user for nondm code
for this driver.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/Kconfig | 12 ++---
drivers/spi/mxs_spi.c | 123 ------------------------------------------
2 files changed, 6 insertions(+), 129 deletions(-)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 1a1f195232..46a7b9e9d3 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -213,6 +213,12 @@ config MVEBU_A3700_SPI
used to access the SPI NOR flash on platforms embedding this
Marvell IP core.
+config MXS_SPI
+ bool "MXS SPI Driver"
+ help
+ Enable the MXS SPI controller driver. This driver can be used
+ on the i.MX23 and i.MX28 SoCs.
+
config NXP_FSPI
bool "NXP FlexSPI driver"
depends on SPI_MEM
@@ -424,12 +430,6 @@ config MXC_SPI
Enable the MXC SPI controller driver. This driver can be used
on various i.MX SoCs such as i.MX31/35/51/6/7.
-config MXS_SPI
- bool "MXS SPI Driver"
- help
- Enable the MXS SPI controller driver. This driver can be used
- on the i.MX23 and i.MX28 SoCs.
-
config OMAP3_SPI
bool "McSPI driver for OMAP"
help
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index 0da4a80d71..a21419a15a 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -46,19 +46,6 @@ static void mxs_spi_end_xfer(struct mxs_ssp_regs *ssp_regs)
writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_set);
}
-#if !CONFIG_IS_ENABLED(DM_SPI)
-struct mxs_spi_slave {
- struct spi_slave slave;
- uint32_t max_khz;
- uint32_t mode;
- struct mxs_ssp_regs *regs;
-};
-
-static inline struct mxs_spi_slave *to_mxs_slave(struct spi_slave *slave)
-{
- return container_of(slave, struct mxs_spi_slave, slave);
-}
-#else
#include <dm.h>
#include <errno.h>
#include <dt-structs.h>
@@ -87,20 +74,12 @@ struct mxs_spi_priv {
unsigned int clk_id;
unsigned int mode;
};
-#endif
-#if !CONFIG_IS_ENABLED(DM_SPI)
-static int mxs_spi_xfer_pio(struct mxs_spi_slave *slave,
- char *data, int length, int write, unsigned long flags)
-{
- struct mxs_ssp_regs *ssp_regs = slave->regs;
-#else
static int mxs_spi_xfer_pio(struct mxs_spi_priv *priv,
char *data, int length, int write,
unsigned long flags)
{
struct mxs_ssp_regs *ssp_regs = priv->regs;
-#endif
if (flags & SPI_XFER_BEGIN)
mxs_spi_start_xfer(ssp_regs);
@@ -156,17 +135,10 @@ static int mxs_spi_xfer_pio(struct mxs_spi_priv *priv,
return 0;
}
-#if !CONFIG_IS_ENABLED(DM_SPI)
-static int mxs_spi_xfer_dma(struct mxs_spi_slave *slave,
- char *data, int length, int write, unsigned long flags)
-{
- struct mxs_ssp_regs *ssp_regs = slave->regs;
-#else
static int mxs_spi_xfer_dma(struct mxs_spi_priv *priv,
char *data, int length, int write,
unsigned long flags)
{ struct mxs_ssp_regs *ssp_regs = priv->regs;
-#endif
const int xfer_max_sz = 0xff00;
const int desc_count = DIV_ROUND_UP(length, xfer_max_sz) + 1;
struct mxs_dma_desc *dp;
@@ -207,11 +179,7 @@ static int mxs_spi_xfer_dma(struct mxs_spi_priv *priv,
/* Invalidate the area, so no writeback into the RAM races with DMA */
invalidate_dcache_range(dstart, dstart + cache_data_count);
-#if !CONFIG_IS_ENABLED(DM_SPI)
- dmach = MXS_DMA_CHANNEL_AHB_APBH_SSP0 + slave->slave.bus;
-#else
dmach = priv->dma_channel;
-#endif
dp = desc;
while (length) {
@@ -288,20 +256,12 @@ static int mxs_spi_xfer_dma(struct mxs_spi_priv *priv,
return ret;
}
-#if !CONFIG_IS_ENABLED(DM_SPI)
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
- const void *dout, void *din, unsigned long flags)
-{
- struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave);
- struct mxs_ssp_regs *ssp_regs = mxs_slave->regs;
-#else
int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev_get_parent(dev);
struct mxs_spi_priv *priv = dev_get_priv(bus);
struct mxs_ssp_regs *ssp_regs = priv->regs;
-#endif
int len = bitlen / 8;
char dummy;
int write = 0;
@@ -345,95 +305,13 @@ int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen,
if (!dma || (len < MXSSSP_SMALL_TRANSFER)) {
writel(SSP_CTRL1_DMA_ENABLE, &ssp_regs->hw_ssp_ctrl1_clr);
-#if !CONFIG_IS_ENABLED(DM_SPI)
- return mxs_spi_xfer_pio(mxs_slave, data, len, write, flags);
-#else
return mxs_spi_xfer_pio(priv, data, len, write, flags);
-#endif
} else {
writel(SSP_CTRL1_DMA_ENABLE, &ssp_regs->hw_ssp_ctrl1_set);
-#if !CONFIG_IS_ENABLED(DM_SPI)
- return mxs_spi_xfer_dma(mxs_slave, data, len, write, flags);
-#else
return mxs_spi_xfer_dma(priv, data, len, write, flags);
-#endif
- }
-}
-
-#if !CONFIG_IS_ENABLED(DM_SPI)
-int spi_cs_is_valid(unsigned int bus, unsigned int cs)
-{
- /* MXS SPI: 4 ports and 3 chip selects maximum */
- if (!mxs_ssp_bus_id_valid(bus) || cs > 2)
- return 0;
- else
- return 1;
-}
-
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
- unsigned int max_hz, unsigned int mode)
-{
- struct mxs_spi_slave *mxs_slave;
-
- if (!spi_cs_is_valid(bus, cs)) {
- printf("mxs_spi: invalid bus %d / chip select %d\n", bus, cs);
- return NULL;
}
-
- mxs_slave = spi_alloc_slave(struct mxs_spi_slave, bus, cs);
- if (!mxs_slave)
- return NULL;
-
- if (mxs_dma_init_channel(MXS_DMA_CHANNEL_AHB_APBH_SSP0 + bus))
- goto err_init;
-
- mxs_slave->max_khz = max_hz / 1000;
- mxs_slave->mode = mode;
- mxs_slave->regs = mxs_ssp_regs_by_bus(bus);
-
- return &mxs_slave->slave;
-
-err_init:
- free(mxs_slave);
- return NULL;
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
- struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave);
-
- free(mxs_slave);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
- struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave);
- struct mxs_ssp_regs *ssp_regs = mxs_slave->regs;
- u32 reg = 0;
-
- mxs_reset_block(&ssp_regs->hw_ssp_ctrl0_reg);
-
- writel((slave->cs << MXS_SSP_CHIPSELECT_SHIFT) |
- SSP_CTRL0_BUS_WIDTH_ONE_BIT,
- &ssp_regs->hw_ssp_ctrl0);
-
- reg = SSP_CTRL1_SSP_MODE_SPI | SSP_CTRL1_WORD_LENGTH_EIGHT_BITS;
- reg |= (mxs_slave->mode & SPI_CPOL) ? SSP_CTRL1_POLARITY : 0;
- reg |= (mxs_slave->mode & SPI_CPHA) ? SSP_CTRL1_PHASE : 0;
- writel(reg, &ssp_regs->hw_ssp_ctrl1);
-
- writel(0, &ssp_regs->hw_ssp_cmd0);
-
- mxs_set_ssp_busclock(slave->bus, mxs_slave->max_khz);
-
- return 0;
}
-void spi_release_bus(struct spi_slave *slave)
-{
-}
-
-#else /* CONFIG_DM_SPI */
/* Base numbers of i.MX2[38] clk for ssp0 IP block */
#define MXS_SSP_IMX23_CLKID_SSP0 33
#define MXS_SSP_IMX28_CLKID_SSP0 46
@@ -625,4 +503,3 @@ U_BOOT_DRIVER(mxs_spi) = {
.priv_auto_alloc_size = sizeof(struct mxs_spi_priv),
.probe = mxs_spi_probe,
};
-#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 7/9] spi: mxs: Code cleanup
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
` (5 preceding siblings ...)
2020-05-26 8:04 ` [PATCH 6/9] spi: mxs: Drop nondm code Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-06-11 8:39 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 8/9] spi: Zap SOFT_SPI (non-dm) Jagan Teki
2020-05-26 8:04 ` [PATCH 9/9] doc: driver-model: Update SPI migration status Jagan Teki
8 siblings, 1 reply; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
Order the macros, private structures and simple functions
in a proper way to have more code readability.
No functionality changed.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/mxs_spi.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index a21419a15a..e231e96e58 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -13,7 +13,10 @@
*/
#include <common.h>
+#include <dm.h>
+#include <dt-structs.h>
#include <cpu_func.h>
+#include <errno.h>
#include <log.h>
#include <malloc.h>
#include <memalign.h>
@@ -34,21 +37,9 @@
#define MXSSSP_SMALL_TRANSFER 512
-static void mxs_spi_start_xfer(struct mxs_ssp_regs *ssp_regs)
-{
- writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_set);
- writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_clr);
-}
-
-static void mxs_spi_end_xfer(struct mxs_ssp_regs *ssp_regs)
-{
- writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_clr);
- writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_set);
-}
-
-#include <dm.h>
-#include <errno.h>
-#include <dt-structs.h>
+/* Base numbers of i.MX2[38] clk for ssp0 IP block */
+#define MXS_SSP_IMX23_CLKID_SSP0 33
+#define MXS_SSP_IMX28_CLKID_SSP0 46
#ifdef CONFIG_MX28
#define dtd_fsl_imx_spi dtd_fsl_imx28_spi
@@ -75,6 +66,18 @@ struct mxs_spi_priv {
unsigned int mode;
};
+static void mxs_spi_start_xfer(struct mxs_ssp_regs *ssp_regs)
+{
+ writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_set);
+ writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_clr);
+}
+
+static void mxs_spi_end_xfer(struct mxs_ssp_regs *ssp_regs)
+{
+ writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_clr);
+ writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_set);
+}
+
static int mxs_spi_xfer_pio(struct mxs_spi_priv *priv,
char *data, int length, int write,
unsigned long flags)
@@ -312,10 +315,6 @@ int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen,
}
}
-/* Base numbers of i.MX2[38] clk for ssp0 IP block */
-#define MXS_SSP_IMX23_CLKID_SSP0 33
-#define MXS_SSP_IMX28_CLKID_SSP0 46
-
static int mxs_spi_probe(struct udevice *bus)
{
struct mxs_spi_platdata *plat = dev_get_platdata(bus);
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 8/9] spi: Zap SOFT_SPI (non-dm)
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
` (6 preceding siblings ...)
2020-05-26 8:04 ` [PATCH 7/9] spi: mxs: Code cleanup Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-05-31 14:07 ` Simon Glass
2020-06-11 8:40 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 9/9] doc: driver-model: Update SPI migration status Jagan Teki
8 siblings, 2 replies; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
- Deadline for DM migration already passed by months.
- Sent couple of zap patches and
- No response on dm conversation
hence removed the driver.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/Kconfig | 13 ++-
drivers/spi/Makefile | 1 -
drivers/spi/soft_spi_legacy.c | 168 ----------------------------------
3 files changed, 6 insertions(+), 176 deletions(-)
delete mode 100644 drivers/spi/soft_spi_legacy.c
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 46a7b9e9d3..09b9cb17d8 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -292,6 +292,12 @@ config SPI_SIFIVE
The SiFive SPI controller driver is found on various SiFive SoCs.
+config SOFT_SPI
+ bool "Soft SPI driver"
+ help
+ Enable Soft SPI driver. This driver is to use GPIO simulate
+ the SPI protocol.
+
config SPI_SUNXI
bool "Allwinner SoC SPI controllers"
default ARCH_SUNXI
@@ -397,13 +403,6 @@ config ZYNQMP_GQSPI
endif # if DM_SPI
-config SOFT_SPI
- bool "Soft SPI driver"
- depends on DM_SPI || (DEPRECATED && !DM_SPI)
- help
- Enable Soft SPI driver. This driver is to use GPIO simulate
- the SPI protocol.
-
config FSL_ESPI
bool "Freescale eSPI driver"
imply SPI_FLASH_BAR
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 342776404a..54881a7412 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_TI_QSPI) += ti_qspi.o
else
obj-y += spi.o
obj-$(CONFIG_SPI_MEM) += spi-mem-nodm.o
-obj-$(CONFIG_SOFT_SPI) += soft_spi_legacy.o
endif
obj-$(CONFIG_ALTERA_SPI) += altera_spi.o
diff --git a/drivers/spi/soft_spi_legacy.c b/drivers/spi/soft_spi_legacy.c
deleted file mode 100644
index cc5ab5f991..0000000000
--- a/drivers/spi/soft_spi_legacy.c
+++ /dev/null
@@ -1,168 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2002
- * Gerald Van Baren, Custom IDEAS, vanbaren at cideas.com.
- *
- * Influenced by code from:
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- */
-
-#include <common.h>
-#include <spi.h>
-
-#include <malloc.h>
-
-/*-----------------------------------------------------------------------
- * Definitions
- */
-
-#ifdef DEBUG_SPI
-#define PRINTD(fmt,args...) printf (fmt ,##args)
-#else
-#define PRINTD(fmt,args...)
-#endif
-
-struct soft_spi_slave {
- struct spi_slave slave;
- unsigned int mode;
-};
-
-static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave)
-{
- return container_of(slave, struct soft_spi_slave, slave);
-}
-
-/*=====================================================================*/
-/* Public Functions */
-/*=====================================================================*/
-
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
- unsigned int max_hz, unsigned int mode)
-{
- struct soft_spi_slave *ss;
-
- if (!spi_cs_is_valid(bus, cs))
- return NULL;
-
- ss = spi_alloc_slave(struct soft_spi_slave, bus, cs);
- if (!ss)
- return NULL;
-
- ss->mode = mode;
-
- /* TODO: Use max_hz to limit the SCK rate */
-
- return &ss->slave;
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
- struct soft_spi_slave *ss = to_soft_spi(slave);
-
- free(ss);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
-#ifdef CONFIG_SYS_IMMR
- volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
-#endif
- struct soft_spi_slave *ss = to_soft_spi(slave);
-
- /*
- * Make sure the SPI clock is in idle state as defined for
- * this slave.
- */
- if (ss->mode & SPI_CPOL)
- SPI_SCL(1);
- else
- SPI_SCL(0);
-
- return 0;
-}
-
-void spi_release_bus(struct spi_slave *slave)
-{
- /* Nothing to do */
-}
-
-/*-----------------------------------------------------------------------
- * SPI transfer
- *
- * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks
- * "bitlen" bits in the SPI MISO port. That's just the way SPI works.
- *
- * The source of the outgoing bits is the "dout" parameter and the
- * destination of the input bits is the "din" parameter. Note that "dout"
- * and "din" can point to the same memory location, in which case the
- * input data overwrites the output data (since both are buffered by
- * temporary variables, this is OK).
- */
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
- const void *dout, void *din, unsigned long flags)
-{
-#ifdef CONFIG_SYS_IMMR
- volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
-#endif
- struct soft_spi_slave *ss = to_soft_spi(slave);
- uchar tmpdin = 0;
- uchar tmpdout = 0;
- const u8 *txd = dout;
- u8 *rxd = din;
- int cpol = ss->mode & SPI_CPOL;
- int cpha = ss->mode & SPI_CPHA;
- unsigned int j;
-
- PRINTD("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
- slave->bus, slave->cs, *(uint *)txd, *(uint *)rxd, bitlen);
-
- if (flags & SPI_XFER_BEGIN)
- spi_cs_activate(slave);
-
- for(j = 0; j < bitlen; j++) {
- /*
- * Check if it is time to work on a new byte.
- */
- if ((j % 8) == 0) {
- if (txd)
- tmpdout = *txd++;
- else
- tmpdout = 0;
- if(j != 0) {
- if (rxd)
- *rxd++ = tmpdin;
- }
- tmpdin = 0;
- }
-
- if (!cpha)
- SPI_SCL(!cpol);
- SPI_SDA(tmpdout & 0x80);
- SPI_DELAY;
- if (cpha)
- SPI_SCL(!cpol);
- else
- SPI_SCL(cpol);
- tmpdin <<= 1;
- tmpdin |= SPI_READ;
- tmpdout <<= 1;
- SPI_DELAY;
- if (cpha)
- SPI_SCL(cpol);
- }
- /*
- * If the number of bits isn't a multiple of 8, shift the last
- * bits over to left-justify them. Then store the last byte
- * read in.
- */
- if (rxd) {
- if ((bitlen % 8) != 0)
- tmpdin <<= 8 - (bitlen % 8);
- *rxd++ = tmpdin;
- }
-
- if (flags & SPI_XFER_END)
- spi_cs_deactivate(slave);
-
- return(0);
-}
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 9/9] doc: driver-model: Update SPI migration status
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
` (7 preceding siblings ...)
2020-05-26 8:04 ` [PATCH 8/9] spi: Zap SOFT_SPI (non-dm) Jagan Teki
@ 2020-05-26 8:04 ` Jagan Teki
2020-05-31 14:07 ` Simon Glass
8 siblings, 1 reply; 21+ messages in thread
From: Jagan Teki @ 2020-05-26 8:04 UTC (permalink / raw)
To: u-boot
Update SPI drivers, driver model conversion status
as per latest conversion and dropping nondm code.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
doc/driver-model/migration.rst | 5 -----
1 file changed, 5 deletions(-)
diff --git a/doc/driver-model/migration.rst b/doc/driver-model/migration.rst
index d1fc0e6a78..2c0e2c7f06 100644
--- a/doc/driver-model/migration.rst
+++ b/doc/driver-model/migration.rst
@@ -69,20 +69,15 @@ to move the migration with in the deadline.
No dm conversion yet::
drivers/spi/fsl_espi.c
- drivers/spi/lpc32xx_ssp.c
- drivers/spi/sh_spi.c
- drivers/spi/soft_spi_legacy.c
* Status: In progress
* Deadline: 2019.04
Partially converted::
- drivers/spi/davinci_spi.c
drivers/spi/fsl_dspi.c
drivers/spi/kirkwood_spi.c
drivers/spi/mxc_spi.c
- drivers/spi/mxs_spi.c
drivers/spi/omap3_spi.c
drivers/spi/sh_qspi.c
--
2.25.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 1/9] spi Drop spi_init()
2020-05-26 8:04 ` [PATCH 1/9] spi Drop spi_init() Jagan Teki
@ 2020-05-27 18:21 ` Jagan Teki
0 siblings, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-05-27 18:21 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> spi_init doesn't exist anywhere in the code.
>
> Drop it.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/9] spi: Kconfig: Drop redundant CF_SPI definition
2020-05-26 8:04 ` [PATCH 2/9] spi: Kconfig: Drop redundant CF_SPI definition Jagan Teki
@ 2020-05-27 18:22 ` Jagan Teki
0 siblings, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-05-27 18:22 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> CF_SPI kconfig option defined twice with DM_SPI
> and non DM_SPI.
>
> Drop the non DM_SPI side kconfig definition.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 3/9] spi: Kconfig: Move MSCC_BB_SPI, FSL_QSPI into DM_SPI
2020-05-26 8:04 ` [PATCH 3/9] spi: Kconfig: Move MSCC_BB_SPI, FSL_QSPI into DM_SPI Jagan Teki
@ 2020-05-27 18:22 ` Jagan Teki
0 siblings, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-05-27 18:22 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> - MSCC_BB_SPI
> - FSL_QSPI
>
> Both are fully dm-driven, let's move them into DM_SPI
> side definition.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 5/9] spi: davinci: Drop non-dm code
2020-05-26 8:04 ` [PATCH 5/9] spi: davinci: Drop non-dm code Jagan Teki
@ 2020-05-28 0:30 ` Adam Ford
2020-06-11 8:47 ` Jagan Teki
1 sibling, 0 replies; 21+ messages in thread
From: Adam Ford @ 2020-05-28 0:30 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 3:04 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Now all boards which are using davinci SPI driver
> have moved to SPL_DM so drop the unneeded non-dm code.
Thanks for doing that.
>
> Cc: Adam Ford <aford173@gmail.com>
Tested-by: Adam Ford <aford173@gmail.com> #da850-evm
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> drivers/spi/Kconfig | 12 +-
> drivers/spi/davinci_spi.c | 157 ---------------------------
> include/configs/ti_armv7_keystone2.h | 9 --
> 3 files changed, 6 insertions(+), 172 deletions(-)
>
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index 59415209ee..1a1f195232 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -119,6 +119,12 @@ config CF_SPI
> Enable the ColdFire SPI driver. This driver can be used on
> some m68k SoCs.
>
> +config DAVINCI_SPI
> + bool "Davinci & Keystone SPI driver"
> + depends on ARCH_DAVINCI || ARCH_KEYSTONE
> + help
> + Enable the Davinci SPI driver
> +
> config DESIGNWARE_SPI
> bool "Designware SPI driver"
> help
> @@ -400,12 +406,6 @@ config FSL_ESPI
> access the SPI interface and SPI NOR flash on platforms embedding
> this Freescale eSPI IP core.
>
> -config DAVINCI_SPI
> - bool "Davinci & Keystone SPI driver"
> - depends on ARCH_DAVINCI || ARCH_KEYSTONE
> - help
> - Enable the Davinci SPI driver
> -
> config SH_QSPI
> bool "Renesas Quad SPI driver"
> help
> diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
> index 97ac97b1a5..e1e9b45cc9 100644
> --- a/drivers/spi/davinci_spi.c
> +++ b/drivers/spi/davinci_spi.c
> @@ -55,41 +55,6 @@
> /* SPIDEF */
> #define SPIDEF_CSDEF0_MASK BIT(0)
>
> -#ifndef CONFIG_DM_SPI
> -#define SPI0_BUS 0
> -#define SPI0_BASE CONFIG_SYS_SPI_BASE
> -/*
> - * Define default SPI0_NUM_CS as 1 for existing platforms that uses this
> - * driver. Platform can configure number of CS using CONFIG_SYS_SPI0_NUM_CS
> - * if more than one CS is supported and by defining CONFIG_SYS_SPI0.
> - */
> -#ifndef CONFIG_SYS_SPI0
> -#define SPI0_NUM_CS 1
> -#else
> -#define SPI0_NUM_CS CONFIG_SYS_SPI0_NUM_CS
> -#endif
> -
> -/*
> - * define CONFIG_SYS_SPI1 when platform has spi-1 device (bus #1) and
> - * CONFIG_SYS_SPI1_NUM_CS defines number of CS on this bus
> - */
> -#ifdef CONFIG_SYS_SPI1
> -#define SPI1_BUS 1
> -#define SPI1_NUM_CS CONFIG_SYS_SPI1_NUM_CS
> -#define SPI1_BASE CONFIG_SYS_SPI1_BASE
> -#endif
> -
> -/*
> - * define CONFIG_SYS_SPI2 when platform has spi-2 device (bus #2) and
> - * CONFIG_SYS_SPI2_NUM_CS defines number of CS on this bus
> - */
> -#ifdef CONFIG_SYS_SPI2
> -#define SPI2_BUS 2
> -#define SPI2_NUM_CS CONFIG_SYS_SPI2_NUM_CS
> -#define SPI2_BASE CONFIG_SYS_SPI2_BASE
> -#endif
> -#endif
> -
> DECLARE_GLOBAL_DATA_PTR;
>
> /* davinci spi register set */
> @@ -122,9 +87,6 @@ struct davinci_spi_regs {
>
> /* davinci spi slave */
> struct davinci_spi_slave {
> -#ifndef CONFIG_DM_SPI
> - struct spi_slave slave;
> -#endif
> struct davinci_spi_regs *regs;
> unsigned int freq; /* current SPI bus frequency */
> unsigned int mode; /* current SPI mode used */
> @@ -346,124 +308,6 @@ out:
> return 0;
> }
>
> -#ifndef CONFIG_DM_SPI
> -
> -static inline struct davinci_spi_slave *to_davinci_spi(struct spi_slave *slave)
> -{
> - return container_of(slave, struct davinci_spi_slave, slave);
> -}
> -
> -int spi_cs_is_valid(unsigned int bus, unsigned int cs)
> -{
> - int ret = 0;
> -
> - switch (bus) {
> - case SPI0_BUS:
> - if (cs < SPI0_NUM_CS)
> - ret = 1;
> - break;
> -#ifdef CONFIG_SYS_SPI1
> - case SPI1_BUS:
> - if (cs < SPI1_NUM_CS)
> - ret = 1;
> - break;
> -#endif
> -#ifdef CONFIG_SYS_SPI2
> - case SPI2_BUS:
> - if (cs < SPI2_NUM_CS)
> - ret = 1;
> - break;
> -#endif
> - default:
> - /* Invalid bus number. Do nothing */
> - break;
> - }
> - return ret;
> -}
> -
> -void spi_cs_activate(struct spi_slave *slave)
> -{
> - /* do nothing */
> -}
> -
> -void spi_cs_deactivate(struct spi_slave *slave)
> -{
> - /* do nothing */
> -}
> -
> -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
> - unsigned int max_hz, unsigned int mode)
> -{
> - struct davinci_spi_slave *ds;
> -
> - if (!spi_cs_is_valid(bus, cs))
> - return NULL;
> -
> - ds = spi_alloc_slave(struct davinci_spi_slave, bus, cs);
> - if (!ds)
> - return NULL;
> -
> - switch (bus) {
> - case SPI0_BUS:
> - ds->regs = (struct davinci_spi_regs *)SPI0_BASE;
> - break;
> -#ifdef CONFIG_SYS_SPI1
> - case SPI1_BUS:
> - ds->regs = (struct davinci_spi_regs *)SPI1_BASE;
> - break;
> -#endif
> -#ifdef CONFIG_SYS_SPI2
> - case SPI2_BUS:
> - ds->regs = (struct davinci_spi_regs *)SPI2_BASE;
> - break;
> -#endif
> - default: /* Invalid bus number */
> - return NULL;
> - }
> -
> - ds->freq = max_hz;
> - ds->mode = mode;
> -
> - return &ds->slave;
> -}
> -
> -void spi_free_slave(struct spi_slave *slave)
> -{
> - struct davinci_spi_slave *ds = to_davinci_spi(slave);
> -
> - free(ds);
> -}
> -
> -int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
> - const void *dout, void *din, unsigned long flags)
> -{
> - struct davinci_spi_slave *ds = to_davinci_spi(slave);
> -
> - ds->cur_cs = slave->cs;
> -
> - return __davinci_spi_xfer(ds, bitlen, dout, din, flags);
> -}
> -
> -int spi_claim_bus(struct spi_slave *slave)
> -{
> - struct davinci_spi_slave *ds = to_davinci_spi(slave);
> -
> -#ifdef CONFIG_SPI_HALF_DUPLEX
> - ds->half_duplex = true;
> -#else
> - ds->half_duplex = false;
> -#endif
> - return __davinci_spi_claim_bus(ds, ds->slave.cs);
> -}
> -
> -void spi_release_bus(struct spi_slave *slave)
> -{
> - struct davinci_spi_slave *ds = to_davinci_spi(slave);
> -
> - __davinci_spi_release_bus(ds);
> -}
> -
> -#else
> static int davinci_spi_set_speed(struct udevice *bus, uint max_hz)
> {
> struct davinci_spi_slave *ds = dev_get_priv(bus);
> @@ -582,4 +426,3 @@ U_BOOT_DRIVER(davinci_spi) = {
> .ops = &davinci_spi_ops,
> .priv_auto_alloc_size = sizeof(struct davinci_spi_slave),
> };
> -#endif
> diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h
> index 37210b2605..b632ae010d 100644
> --- a/include/configs/ti_armv7_keystone2.h
> +++ b/include/configs/ti_armv7_keystone2.h
> @@ -64,15 +64,6 @@
>
> /* SPI Configuration */
> #define CONFIG_SYS_SPI_CLK ks_clk_get_rate(KS2_CLK1_6)
> -#define CONFIG_SYS_SPI0
> -#define CONFIG_SYS_SPI_BASE KS2_SPI0_BASE
> -#define CONFIG_SYS_SPI0_NUM_CS 4
> -#define CONFIG_SYS_SPI1
> -#define CONFIG_SYS_SPI1_BASE KS2_SPI1_BASE
> -#define CONFIG_SYS_SPI1_NUM_CS 4
> -#define CONFIG_SYS_SPI2
> -#define CONFIG_SYS_SPI2_BASE KS2_SPI2_BASE
> -#define CONFIG_SYS_SPI2_NUM_CS 4
>
> /* Network Configuration */
> #define CONFIG_BOOTP_DEFAULT
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 8/9] spi: Zap SOFT_SPI (non-dm)
2020-05-26 8:04 ` [PATCH 8/9] spi: Zap SOFT_SPI (non-dm) Jagan Teki
@ 2020-05-31 14:07 ` Simon Glass
2020-06-11 8:40 ` Jagan Teki
1 sibling, 0 replies; 21+ messages in thread
From: Simon Glass @ 2020-05-31 14:07 UTC (permalink / raw)
To: u-boot
On Tue, 26 May 2020 at 02:05, Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> - Deadline for DM migration already passed by months.
> - Sent couple of zap patches and
> - No response on dm conversation
> hence removed the driver.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> drivers/spi/Kconfig | 13 ++-
> drivers/spi/Makefile | 1 -
> drivers/spi/soft_spi_legacy.c | 168 ----------------------------------
> 3 files changed, 6 insertions(+), 176 deletions(-)
> delete mode 100644 drivers/spi/soft_spi_legacy.c
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 9/9] doc: driver-model: Update SPI migration status
2020-05-26 8:04 ` [PATCH 9/9] doc: driver-model: Update SPI migration status Jagan Teki
@ 2020-05-31 14:07 ` Simon Glass
0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2020-05-31 14:07 UTC (permalink / raw)
To: u-boot
On Tue, 26 May 2020 at 02:05, Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Update SPI drivers, driver model conversion status
> as per latest conversion and dropping nondm code.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> doc/driver-model/migration.rst | 5 -----
> 1 file changed, 5 deletions(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 6/9] spi: mxs: Drop nondm code
2020-05-26 8:04 ` [PATCH 6/9] spi: mxs: Drop nondm code Jagan Teki
@ 2020-06-11 8:38 ` Jagan Teki
0 siblings, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-06-11 8:38 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Deadline for DM migration already passed by months
> and no response on full dm conversation hence removed
> the nondm code.
>
> Note: Look like there is no user for nondm code
> for this driver.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 7/9] spi: mxs: Code cleanup
2020-05-26 8:04 ` [PATCH 7/9] spi: mxs: Code cleanup Jagan Teki
@ 2020-06-11 8:39 ` Jagan Teki
0 siblings, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-06-11 8:39 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Order the macros, private structures and simple functions
> in a proper way to have more code readability.
>
> No functionality changed.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 8/9] spi: Zap SOFT_SPI (non-dm)
2020-05-26 8:04 ` [PATCH 8/9] spi: Zap SOFT_SPI (non-dm) Jagan Teki
2020-05-31 14:07 ` Simon Glass
@ 2020-06-11 8:40 ` Jagan Teki
1 sibling, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-06-11 8:40 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:35 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> - Deadline for DM migration already passed by months.
> - Sent couple of zap patches and
> - No response on dm conversation
> hence removed the driver.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 4/9] ks2_evm: Switch to DM_SPL, SPL_OF_CONTROL
2020-05-26 8:04 ` [PATCH 4/9] ks2_evm: Switch to DM_SPL, SPL_OF_CONTROL Jagan Teki
@ 2020-06-11 8:46 ` Jagan Teki
0 siblings, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-06-11 8:46 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> This would make SPL build to DM_SPL, SPL_OF_CONTROL.
>
> Build fine with but not tested.
>
> Cc: Vitaly Andrianov <vitalya@ti.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 5/9] spi: davinci: Drop non-dm code
2020-05-26 8:04 ` [PATCH 5/9] spi: davinci: Drop non-dm code Jagan Teki
2020-05-28 0:30 ` Adam Ford
@ 2020-06-11 8:47 ` Jagan Teki
1 sibling, 0 replies; 21+ messages in thread
From: Jagan Teki @ 2020-06-11 8:47 UTC (permalink / raw)
To: u-boot
On Tue, May 26, 2020 at 1:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Now all boards which are using davinci SPI driver
> have moved to SPL_DM so drop the unneeded non-dm code.
>
> Cc: Adam Ford <aford173@gmail.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2020-06-11 8:47 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 8:04 [PATCH 0/9] spi: dm-convert and cleanups Jagan Teki
2020-05-26 8:04 ` [PATCH 1/9] spi Drop spi_init() Jagan Teki
2020-05-27 18:21 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 2/9] spi: Kconfig: Drop redundant CF_SPI definition Jagan Teki
2020-05-27 18:22 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 3/9] spi: Kconfig: Move MSCC_BB_SPI, FSL_QSPI into DM_SPI Jagan Teki
2020-05-27 18:22 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 4/9] ks2_evm: Switch to DM_SPL, SPL_OF_CONTROL Jagan Teki
2020-06-11 8:46 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 5/9] spi: davinci: Drop non-dm code Jagan Teki
2020-05-28 0:30 ` Adam Ford
2020-06-11 8:47 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 6/9] spi: mxs: Drop nondm code Jagan Teki
2020-06-11 8:38 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 7/9] spi: mxs: Code cleanup Jagan Teki
2020-06-11 8:39 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 8/9] spi: Zap SOFT_SPI (non-dm) Jagan Teki
2020-05-31 14:07 ` Simon Glass
2020-06-11 8:40 ` Jagan Teki
2020-05-26 8:04 ` [PATCH 9/9] doc: driver-model: Update SPI migration status Jagan Teki
2020-05-31 14:07 ` Simon Glass
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.